#SET( JSONCPP_VERSION_MAJOR X )
#SET( JSONCPP_VERSION_MINOR Y )
#SET( JSONCPP_VERSION_PATCH Z )
-SET( JSONCPP_VERSION 1.7.4 )
+SET( JSONCPP_VERSION 1.7.5 )
jsoncpp_parse_version( ${JSONCPP_VERSION} JSONCPP_VERSION )
#IF(NOT JSONCPP_VERSION_FOUND)
# MESSAGE(FATAL_ERROR "Failed to parse version string properly. Expect X.Y.Z")
typedef __int64 Int64;
typedef unsigned __int64 UInt64;
#else // if defined(_MSC_VER) // Other platforms, use long long
-typedef long long int Int64;
-typedef unsigned long long int UInt64;
+typedef int64_t Int64;
+typedef uint64_t UInt64;
#endif // if defined(_MSC_VER)
typedef Int64 LargestInt;
typedef UInt64 LargestUInt;
#ifndef JSON_VERSION_H_INCLUDED
# define JSON_VERSION_H_INCLUDED
-# define JSONCPP_VERSION_STRING "1.7.4"
+# define JSONCPP_VERSION_STRING "1.7.5"
# define JSONCPP_VERSION_MAJOR 1
# define JSONCPP_VERSION_MINOR 7
-# define JSONCPP_VERSION_PATCH 4
+# define JSONCPP_VERSION_PATCH 5
# define JSONCPP_VERSION_QUALIFIER
# define JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8))
Token token;
skipCommentTokens(token);
if (features_.failIfExtra_) {
- if (token.type_ != tokenError && token.type_ != tokenEndOfStream) {
+ if ((features_.strictRoot_ || token.type_ != tokenError) && token.type_ != tokenEndOfStream) {
addError("Extra non-whitespace after JSON value.", token);
return false;
}
Char buffer[bufferSize + 1];
memcpy(buffer, token.start_, ulength);
buffer[length] = 0;
+ fixNumericLocaleInput(buffer, buffer + length);
count = sscanf(buffer, format, &value);
} else {
JSONCPP_STRING buffer(token.start_, token.end_);
#ifndef LIB_JSONCPP_JSON_TOOL_H_INCLUDED
#define LIB_JSONCPP_JSON_TOOL_H_INCLUDED
+#include <clocale>
/* This header provides common string manipulation support, such as UTF-8,
* portable conversion from/to string...
namespace Json {
+/// Fallback for decimal_point on android, where the lconv is an empty struct.
+template<typename Lconv, bool=(sizeof(Lconv) >= sizeof(char*))>
+struct Locale {
+ static char decimalPoint() {
+ return '\0';
+ }
+};
+
+/// Return decimal_point for the current locale.
+template<typename Lconv>
+struct Locale<Lconv, true> {
+ static char decimalPoint() {
+ Lconv* lc = localeconv();
+ if (lc == NULL) {
+ return '\0';
+ }
+ return *(lc->decimal_point);
+ }
+};
+
/// Converts a unicode code-point to UTF-8.
static inline JSONCPP_STRING codePointToUTF8(unsigned int cp) {
JSONCPP_STRING result;
}
}
+static inline void fixNumericLocaleInput(char* begin, char* end) {
+ char decimalPoint = Locale<struct lconv>::decimalPoint();
+ if (decimalPoint != '\0' && decimalPoint != '.') {
+ while (begin < end) {
+ if (*begin == '.') {
+ *begin = decimalPoint;
+ }
+ ++begin;
+ }
+ }
+}
+
} // namespace Json {
#endif // LIB_JSONCPP_JSON_TOOL_H_INCLUDED
// static
Value const& Value::nullSingleton()
{
- static Value const* nullStatic = new Value;
- return *nullStatic;
+ static Value const nullStatic;
+ return nullStatic;
}
// for backwards compatibility, we'll leave these global references around, but DO NOT
* This optimization is used in ValueInternalMap fast allocator.
*/
Value::Value(ValueType vtype) {
+ static char const empty[] = "";
initBasic(vtype);
switch (vtype) {
case nullValue:
value_.real_ = 0.0;
break;
case stringValue:
- value_.string_ = 0;
+ // allocated_ == false, so this is safe.
+ value_.string_ = const_cast<char*>(static_cast<char const*>(empty));
break;
case arrayValue:
case objectValue:
JSON_ASSERT_UNREACHABLE;
}
- if (comments_)
- delete[] comments_;
+ delete[] comments_;
value_.uint_ = 0;
}
break;
case stringValue:
{
- // Is NULL possible for value.string_?
+ // Is NULL possible for value.string_? No.
char const* str;
char const* end;
bool ok = value.getString(&str, &end);
break;
case stringValue:
{
- // Is NULL possible for value.string_?
+ // Is NULL possible for value.string_? No.
char const* str;
char const* end;
bool ok = value.getString(&str, &end);
break;
case stringValue:
{
- // Is NULL possible for value.string_?
+ // Is NULL possible for value.string_? No.
char const* str;
char const* end;
bool ok = value.getString(&str, &end);
break;
case stringValue:
{
- // Is NULL is possible for value.string_?
+ // Is NULL is possible for value.string_? No.
char const* str;
char const* end;
bool ok = value.getString(&str, &end);
if (!indentation_.empty()) *sout_ << " ";
for (unsigned index = 0; index < size; ++index) {
if (index > 0)
- *sout_ << ", ";
+ *sout_ << ((!indentation_.empty()) ? ", " : ",");
*sout_ << childValues_[index];
}
if (!indentation_.empty()) *sout_ << " ";