mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-03-03 04:38:39 +01:00
Merge pull request #413 from cdunn2001/debian-patches
Debian patches - 0.y.z branch See #411. http://anonscm.debian.org/cgit/collab-maint/libjsoncpp.git/tree/debian/patches
This commit is contained in:
commit
26159b96f1
@ -12,6 +12,8 @@ OPTION(JSONCPP_WITH_CMAKE_PACKAGE "Generate and install cmake package files" OFF
|
|||||||
OPTION(BUILD_SHARED_LIBS "Build jsoncpp_lib as a shared library." OFF)
|
OPTION(BUILD_SHARED_LIBS "Build jsoncpp_lib as a shared library." OFF)
|
||||||
OPTION(BUILD_STATIC_LIBS "Build jsoncpp_lib static library." ON)
|
OPTION(BUILD_STATIC_LIBS "Build jsoncpp_lib static library." ON)
|
||||||
|
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
# Ensures that CMAKE_BUILD_TYPE is visible in cmake-gui on Unix
|
# Ensures that CMAKE_BUILD_TYPE is visible in cmake-gui on Unix
|
||||||
IF(NOT WIN32)
|
IF(NOT WIN32)
|
||||||
IF(NOT CMAKE_BUILD_TYPE)
|
IF(NOT CMAKE_BUILD_TYPE)
|
||||||
@ -30,7 +32,7 @@ SET(ARCHIVE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}
|
|||||||
CACHE PATH "Install dir for static libraries")
|
CACHE PATH "Install dir for static libraries")
|
||||||
SET(LIBRARY_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}
|
SET(LIBRARY_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}
|
||||||
CACHE PATH "Install dir for shared libraries")
|
CACHE PATH "Install dir for shared libraries")
|
||||||
SET(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include
|
SET(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/jsoncpp
|
||||||
CACHE PATH "Install dir for headers")
|
CACHE PATH "Install dir for headers")
|
||||||
SET(PACKAGE_INSTALL_DIR lib${LIB_SUFFIX}/cmake
|
SET(PACKAGE_INSTALL_DIR lib${LIB_SUFFIX}/cmake
|
||||||
CACHE PATH "Install dir for cmake package config files")
|
CACHE PATH "Install dir for cmake package config files")
|
||||||
@ -114,7 +116,7 @@ IF(JSONCPP_WITH_PKGCONFIG_SUPPORT)
|
|||||||
"pkg-config/jsoncpp.pc"
|
"pkg-config/jsoncpp.pc"
|
||||||
@ONLY)
|
@ONLY)
|
||||||
INSTALL(FILES "${CMAKE_BINARY_DIR}/pkg-config/jsoncpp.pc"
|
INSTALL(FILES "${CMAKE_BINARY_DIR}/pkg-config/jsoncpp.pc"
|
||||||
DESTINATION "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/pkgconfig")
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF(JSONCPP_WITH_CMAKE_PACKAGE)
|
IF(JSONCPP_WITH_CMAKE_PACKAGE)
|
||||||
|
@ -48,8 +48,8 @@ IF(BUILD_SHARED_LIBS)
|
|||||||
|
|
||||||
INSTALL( TARGETS jsoncpp_lib ${INSTALL_EXPORT}
|
INSTALL( TARGETS jsoncpp_lib ${INSTALL_EXPORT}
|
||||||
RUNTIME DESTINATION ${RUNTIME_INSTALL_DIR}
|
RUNTIME DESTINATION ${RUNTIME_INSTALL_DIR}
|
||||||
LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR}
|
LIBRARY DESTINATION "${LIBRARY_INSTALL_DIR}/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||||
ARCHIVE DESTINATION ${ARCHIVE_INSTALL_DIR})
|
ARCHIVE DESTINATION "${ARCHIVE_INSTALL_DIR}/${CMAKE_LIBRARY_ARCHITECTURE}")
|
||||||
|
|
||||||
IF(NOT CMAKE_VERSION VERSION_LESS 2.8.11)
|
IF(NOT CMAKE_VERSION VERSION_LESS 2.8.11)
|
||||||
TARGET_INCLUDE_DIRECTORIES( jsoncpp_lib PUBLIC
|
TARGET_INCLUDE_DIRECTORIES( jsoncpp_lib PUBLIC
|
||||||
@ -67,8 +67,8 @@ IF(BUILD_STATIC_LIBS)
|
|||||||
|
|
||||||
INSTALL( TARGETS jsoncpp_lib_static ${INSTALL_EXPORT}
|
INSTALL( TARGETS jsoncpp_lib_static ${INSTALL_EXPORT}
|
||||||
RUNTIME DESTINATION ${RUNTIME_INSTALL_DIR}
|
RUNTIME DESTINATION ${RUNTIME_INSTALL_DIR}
|
||||||
LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR}
|
LIBRARY DESTINATION "${LIBRARY_INSTALL_DIR}/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||||
ARCHIVE DESTINATION ${ARCHIVE_INSTALL_DIR})
|
ARCHIVE DESTINATION "${ARCHIVE_INSTALL_DIR}/${CMAKE_LIBRARY_ARCHITECTURE}")
|
||||||
|
|
||||||
IF(NOT CMAKE_VERSION VERSION_LESS 2.8.11)
|
IF(NOT CMAKE_VERSION VERSION_LESS 2.8.11)
|
||||||
TARGET_INCLUDE_DIRECTORIES( jsoncpp_lib_static PUBLIC
|
TARGET_INCLUDE_DIRECTORIES( jsoncpp_lib_static PUBLIC
|
||||||
|
@ -43,7 +43,11 @@ static int stackDepth_g = 0; // see readValue()
|
|||||||
|
|
||||||
namespace Json {
|
namespace Json {
|
||||||
|
|
||||||
typedef std::auto_ptr<CharReader> CharReaderPtr;
|
#if __GNUC__ >= 6
|
||||||
|
typedef std::scoped_ptr<CharReader> const CharReaderPtr;
|
||||||
|
#else
|
||||||
|
typedef std::auto_ptr<CharReader> CharReaderPtr;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Implementation of class Features
|
// Implementation of class Features
|
||||||
// ////////////////////////////////
|
// ////////////////////////////////
|
||||||
@ -1477,33 +1481,9 @@ bool OurReader::decodeDouble(Token& token) {
|
|||||||
|
|
||||||
bool OurReader::decodeDouble(Token& token, Value& decoded) {
|
bool OurReader::decodeDouble(Token& token, Value& decoded) {
|
||||||
double value = 0;
|
double value = 0;
|
||||||
const int bufferSize = 32;
|
std::string buffer( token.start_, token.end_ );
|
||||||
int count;
|
std::istringstream is(buffer);
|
||||||
int length = int(token.end_ - token.start_);
|
if (!(is >> value))
|
||||||
|
|
||||||
// Sanity check to avoid buffer overflow exploits.
|
|
||||||
if (length < 0) {
|
|
||||||
return addError("Unable to parse token length", token);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Avoid using a string constant for the format control string given to
|
|
||||||
// sscanf, as this can cause hard to debug crashes on OS X. See here for more
|
|
||||||
// info:
|
|
||||||
//
|
|
||||||
// http://developer.apple.com/library/mac/#DOCUMENTATION/DeveloperTools/gcc-4.0.1/gcc/Incompatibilities.html
|
|
||||||
char format[] = "%lf";
|
|
||||||
|
|
||||||
if (length <= bufferSize) {
|
|
||||||
Char buffer[bufferSize + 1];
|
|
||||||
memcpy(buffer, token.start_, length);
|
|
||||||
buffer[length] = 0;
|
|
||||||
count = sscanf(buffer, format, &value);
|
|
||||||
} else {
|
|
||||||
std::string buffer(token.start_, token.end_);
|
|
||||||
count = sscanf(buffer.c_str(), format, &value);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (count != 1)
|
|
||||||
return addError("'" + std::string(token.start_, token.end_) +
|
return addError("'" + std::string(token.start_, token.end_) +
|
||||||
"' is not a number.",
|
"' is not a number.",
|
||||||
token);
|
token);
|
||||||
|
@ -54,7 +54,11 @@
|
|||||||
|
|
||||||
namespace Json {
|
namespace Json {
|
||||||
|
|
||||||
typedef std::auto_ptr<StreamWriter> StreamWriterPtr;
|
#if __GNUC__ >= 6
|
||||||
|
typedef std::scoped_ptr<StreamWriter> const StreamWriterPtr;
|
||||||
|
#else
|
||||||
|
typedef std::auto_ptr<StreamWriter> StreamWriterPtr;
|
||||||
|
#endif
|
||||||
|
|
||||||
static bool containsControlCharacter(const char* str) {
|
static bool containsControlCharacter(const char* str) {
|
||||||
while (*str) {
|
while (*str) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user