Imported Upstream version 1.7.6 upstream/1.7.6
authorDongHun Kwak <dh0128.kwak@samsung.com>
Wed, 26 Oct 2016 07:47:30 +0000 (16:47 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Wed, 26 Oct 2016 07:47:30 +0000 (16:47 +0900)
Change-Id: I0b18e3c86617b0260c14c0f1d1444ee610719317
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
CMakeLists.txt
include/json/version.h
src/lib_json/CMakeLists.txt
src/lib_json/json_reader.cpp
src/lib_json/json_tool.h
src/lib_json/json_value.cpp
version

index 1bb891e..fc14519 100644 (file)
@@ -22,6 +22,11 @@ IF(NOT WIN32)
     ENDIF()
 ENDIF()
 
+# Enable runtime search path support for dynamic libraries on OSX
+IF(APPLE)
+    SET(CMAKE_MACOSX_RPATH 1)
+ENDIF()
+
 SET(DEBUG_LIBNAME_SUFFIX "" CACHE STRING "Optional suffix to append to the library name for a debug build")
 SET(LIB_SUFFIX "" CACHE STRING "Optional arch-dependent suffix for the library installation directory")
 
@@ -64,7 +69,7 @@ ENDMACRO()
 #SET( JSONCPP_VERSION_MAJOR X )
 #SET( JSONCPP_VERSION_MINOR Y )
 #SET( JSONCPP_VERSION_PATCH Z )
-SET( JSONCPP_VERSION 1.7.5 )
+SET( JSONCPP_VERSION 1.7.6 )
 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")
index 74380bb..8da5fed 100644 (file)
@@ -3,10 +3,10 @@
 #ifndef JSON_VERSION_H_INCLUDED
 # define JSON_VERSION_H_INCLUDED
 
-# define JSONCPP_VERSION_STRING "1.7.5"
+# define JSONCPP_VERSION_STRING "1.7.6"
 # define JSONCPP_VERSION_MAJOR 1
 # define JSONCPP_VERSION_MINOR 7
-# define JSONCPP_VERSION_PATCH 5
+# define JSONCPP_VERSION_PATCH 6
 # define JSONCPP_VERSION_QUALIFIER
 # define JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8))
 
index 99ddc7f..b70c5a8 100644 (file)
@@ -46,6 +46,11 @@ IF(BUILD_SHARED_LIBS)
     SET_TARGET_PROPERTIES( jsoncpp_lib PROPERTIES OUTPUT_NAME jsoncpp
                            DEBUG_OUTPUT_NAME jsoncpp${DEBUG_LIBNAME_SUFFIX} )
 
+    # Set library's runtime search path on OSX
+    IF(APPLE)
+        SET_TARGET_PROPERTIES( jsoncpp_lib PROPERTIES INSTALL_RPATH "@loader_path/." )
+    ENDIF()
+
     INSTALL( TARGETS jsoncpp_lib ${INSTALL_EXPORT}
          RUNTIME DESTINATION ${RUNTIME_INSTALL_DIR}
          LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR}
index b354be3..5e04d74 100644 (file)
@@ -401,7 +401,7 @@ Reader::addComment(Location begin, Location end, CommentPlacement placement) {
 }
 
 bool Reader::readCStyleComment() {
-  while (current_ != end_) {
+  while ((current_ + 1) < end_) {
     Char c = getNextChar();
     if (c == '*' && *current_ == '/')
       break;
@@ -520,7 +520,7 @@ bool Reader::readArray(Token& tokenStart) {
   currentValue().swapPayload(init);
   currentValue().setOffsetStart(tokenStart.start_ - begin_);
   skipSpaces();
-  if (*current_ == ']') // empty array
+  if (current_ != end_ && *current_ == ']') // empty array
   {
     Token endArray;
     readToken(endArray);
@@ -1361,7 +1361,7 @@ OurReader::addComment(Location begin, Location end, CommentPlacement placement)
 }
 
 bool OurReader::readCStyleComment() {
-  while (current_ != end_) {
+  while ((current_ + 1) < end_) {
     Char c = getNextChar();
     if (c == '*' && *current_ == '/')
       break;
@@ -1503,7 +1503,7 @@ bool OurReader::readArray(Token& tokenStart) {
   currentValue().swapPayload(init);
   currentValue().setOffsetStart(tokenStart.start_ - begin_);
   skipSpaces();
-  if (*current_ == ']') // empty array
+  if (current_ != end_ && *current_ == ']') // empty array
   {
     Token endArray;
     readToken(endArray);
index 4a829b0..0e729e6 100644 (file)
@@ -5,7 +5,10 @@
 
 #ifndef LIB_JSONCPP_JSON_TOOL_H_INCLUDED
 #define LIB_JSONCPP_JSON_TOOL_H_INCLUDED
+
+#ifndef NO_LOCALE_SUPPORT
 #include <clocale>
+#endif
 
 /* 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);
-  }
-};
+static char getDecimalPoint() {
+#ifdef NO_LOCALE_SUPPORT
+  return '\0';
+#else
+  struct lconv* lc = localeconv();
+  return lc ? *(lc->decimal_point) : '\0';
+#endif
+}
 
 /// Converts a unicode code-point to UTF-8.
 static inline JSONCPP_STRING codePointToUTF8(unsigned int cp) {
@@ -104,7 +95,7 @@ static inline void fixNumericLocale(char* begin, char* end) {
 }
 
 static inline void fixNumericLocaleInput(char* begin, char* end) {
-  char decimalPoint = Locale<struct lconv>::decimalPoint();
+  char decimalPoint = getDecimalPoint();
   if (decimalPoint != '\0' && decimalPoint != '.') {
     while (begin < end) {
       if (*begin == '.') {
index 7b6c89a..88c630f 100644 (file)
@@ -1504,12 +1504,12 @@ void Path::makePath(const JSONCPP_STRING& path, const InArgs& in) {
           index = index * 10 + ArrayIndex(*current - '0');
         args_.push_back(index);
       }
-      if (current == end || *current++ != ']')
+      if (current == end || *++current != ']')
         invalidPath(path, int(current - path.c_str()));
     } else if (*current == '%') {
       addPathInArg(path, in, itInArg, PathArgument::kindKey);
       ++current;
-    } else if (*current == '.') {
+    } else if (*current == '.' || *current == ']') {
       ++current;
     } else {
       const char* beginName = current;
@@ -1529,7 +1529,7 @@ void Path::addPathInArg(const JSONCPP_STRING& /*path*/,
   } else if ((*itInArg)->kind_ != kind) {
     // Error: bad argument type
   } else {
-    args_.push_back(**itInArg);
+    args_.push_back(**itInArg++);
   }
 }
 
@@ -1544,16 +1544,19 @@ const Value& Path::resolve(const Value& root) const {
     if (arg.kind_ == PathArgument::kindIndex) {
       if (!node->isArray() || !node->isValidIndex(arg.index_)) {
         // Error: unable to resolve path (array value expected at position...
+        return Value::null;
       }
       node = &((*node)[arg.index_]);
     } else if (arg.kind_ == PathArgument::kindKey) {
       if (!node->isObject()) {
         // Error: unable to resolve path (object value expected at position...)
+        return Value::null;
       }
       node = &((*node)[arg.key_]);
       if (node == &Value::nullSingleton()) {
         // Error: unable to resolve path (object has no member named '' at
         // position...)
+        return Value::null;
       }
     }
   }
diff --git a/version b/version
index 6a126f4..de28578 100644 (file)
--- a/version
+++ b/version
@@ -1 +1 @@
-1.7.5
+1.7.6