mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2024-12-12 10:03:51 +01:00
Fix typo in JSONCPP_USE_SECURE_MEMORY vs JSONCPP_USING_SECURE_MEMORY (#1567)
This commit is contained in:
parent
07e3d1b076
commit
8214f717e7
@ -127,7 +127,7 @@ using LargestUInt = UInt64;
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
using Allocator =
|
using Allocator =
|
||||||
typename std::conditional<JSONCPP_USING_SECURE_MEMORY, SecureAllocator<T>,
|
typename std::conditional<JSONCPP_USE_SECURE_MEMORY, SecureAllocator<T>,
|
||||||
std::allocator<T>>::type;
|
std::allocator<T>>::type;
|
||||||
using String = std::basic_string<char, std::char_traits<char>, Allocator<char>>;
|
using String = std::basic_string<char, std::char_traits<char>, Allocator<char>>;
|
||||||
using IStringStream =
|
using IStringStream =
|
||||||
|
@ -375,7 +375,7 @@ public:
|
|||||||
int compare(const Value& other) const;
|
int compare(const Value& other) const;
|
||||||
|
|
||||||
const char* asCString() const; ///< Embedded zeroes could cause you trouble!
|
const char* asCString() const; ///< Embedded zeroes could cause you trouble!
|
||||||
#if JSONCPP_USING_SECURE_MEMORY
|
#if JSONCPP_USE_SECURE_MEMORY
|
||||||
unsigned getCStringLength() const; // Allows you to understand the length of
|
unsigned getCStringLength() const; // Allows you to understand the length of
|
||||||
// the CString
|
// the CString
|
||||||
#endif
|
#endif
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
(JSONCPP_VERSION_PATCH << 8))
|
(JSONCPP_VERSION_PATCH << 8))
|
||||||
|
|
||||||
#if !defined(JSONCPP_USE_SECURE_MEMORY)
|
#if !defined(JSONCPP_USE_SECURE_MEMORY)
|
||||||
#define JSONCPP_USING_SECURE_MEMORY 0
|
#define JSONCPP_USE_SECURE_MEMORY 0
|
||||||
#endif
|
#endif
|
||||||
// If non-zero, the library zeroes any memory that it has allocated before
|
// If non-zero, the library zeroes any memory that it has allocated before
|
||||||
// it frees its memory.
|
// it frees its memory.
|
||||||
|
@ -165,7 +165,7 @@ inline static void decodePrefixedString(bool isPrefixed, char const* prefixed,
|
|||||||
/** Free the string duplicated by
|
/** Free the string duplicated by
|
||||||
* duplicateStringValue()/duplicateAndPrefixStringValue().
|
* duplicateStringValue()/duplicateAndPrefixStringValue().
|
||||||
*/
|
*/
|
||||||
#if JSONCPP_USING_SECURE_MEMORY
|
#if JSONCPP_USE_SECURE_MEMORY
|
||||||
static inline void releasePrefixedStringValue(char* value) {
|
static inline void releasePrefixedStringValue(char* value) {
|
||||||
unsigned length = 0;
|
unsigned length = 0;
|
||||||
char const* valueDecoded;
|
char const* valueDecoded;
|
||||||
@ -180,10 +180,10 @@ static inline void releaseStringValue(char* value, unsigned length) {
|
|||||||
memset(value, 0, size);
|
memset(value, 0, size);
|
||||||
free(value);
|
free(value);
|
||||||
}
|
}
|
||||||
#else // !JSONCPP_USING_SECURE_MEMORY
|
#else // !JSONCPP_USE_SECURE_MEMORY
|
||||||
static inline void releasePrefixedStringValue(char* value) { free(value); }
|
static inline void releasePrefixedStringValue(char* value) { free(value); }
|
||||||
static inline void releaseStringValue(char* value, unsigned) { free(value); }
|
static inline void releaseStringValue(char* value, unsigned) { free(value); }
|
||||||
#endif // JSONCPP_USING_SECURE_MEMORY
|
#endif // JSONCPP_USE_SECURE_MEMORY
|
||||||
|
|
||||||
} // namespace Json
|
} // namespace Json
|
||||||
|
|
||||||
@ -601,7 +601,7 @@ const char* Value::asCString() const {
|
|||||||
return this_str;
|
return this_str;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if JSONCPP_USING_SECURE_MEMORY
|
#if JSONCPP_USE_SECURE_MEMORY
|
||||||
unsigned Value::getCStringLength() const {
|
unsigned Value::getCStringLength() const {
|
||||||
JSON_ASSERT_MESSAGE(type() == stringValue,
|
JSON_ASSERT_MESSAGE(type() == stringValue,
|
||||||
"in Json::Value::asCString(): requires stringValue");
|
"in Json::Value::asCString(): requires stringValue");
|
||||||
|
@ -410,7 +410,7 @@ Json::String ToJsonString(const char* toConvert) {
|
|||||||
|
|
||||||
Json::String ToJsonString(Json::String in) { return in; }
|
Json::String ToJsonString(Json::String in) { return in; }
|
||||||
|
|
||||||
#if JSONCPP_USING_SECURE_MEMORY
|
#if JSONCPP_USE_SECURE_MEMORY
|
||||||
Json::String ToJsonString(std::string in) {
|
Json::String ToJsonString(std::string in) {
|
||||||
return Json::String(in.data(), in.data() + in.length());
|
return Json::String(in.data(), in.data() + in.length());
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ TestResult& checkEqual(TestResult& result, T expected, U actual,
|
|||||||
|
|
||||||
Json::String ToJsonString(const char* toConvert);
|
Json::String ToJsonString(const char* toConvert);
|
||||||
Json::String ToJsonString(Json::String in);
|
Json::String ToJsonString(Json::String in);
|
||||||
#if JSONCPP_USING_SECURE_MEMORY
|
#if JSONCPP_USE_SECURE_MEMORY
|
||||||
Json::String ToJsonString(std::string in);
|
Json::String ToJsonString(std::string in);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user