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")
#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")
#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))
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}
}
bool Reader::readCStyleComment() {
- while (current_ != end_) {
+ while ((current_ + 1) < end_) {
Char c = getNextChar();
if (c == '*' && *current_ == '/')
break;
currentValue().swapPayload(init);
currentValue().setOffsetStart(tokenStart.start_ - begin_);
skipSpaces();
- if (*current_ == ']') // empty array
+ if (current_ != end_ && *current_ == ']') // empty array
{
Token endArray;
readToken(endArray);
}
bool OurReader::readCStyleComment() {
- while (current_ != end_) {
+ while ((current_ + 1) < end_) {
Char c = getNextChar();
if (c == '*' && *current_ == '/')
break;
currentValue().swapPayload(init);
currentValue().setOffsetStart(tokenStart.start_ - begin_);
skipSpaces();
- if (*current_ == ']') // empty array
+ if (current_ != end_ && *current_ == ']') // empty array
{
Token endArray;
readToken(endArray);
#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) {
}
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 = 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;
} else if ((*itInArg)->kind_ != kind) {
// Error: bad argument type
} else {
- args_.push_back(**itInArg);
+ args_.push_back(**itInArg++);
}
}
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;
}
}
}