Skip to content

Commit 26159b9

Browse files
committed
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
2 parents 9297822 + e105003 commit 26159b9

File tree

4 files changed

+21
-35
lines changed

4 files changed

+21
-35
lines changed

Diff for: CMakeLists.txt

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ OPTION(JSONCPP_WITH_CMAKE_PACKAGE "Generate and install cmake package files" OFF
1212
OPTION(BUILD_SHARED_LIBS "Build jsoncpp_lib as a shared library." OFF)
1313
OPTION(BUILD_STATIC_LIBS "Build jsoncpp_lib static library." ON)
1414

15+
include(GNUInstallDirs)
16+
1517
# Ensures that CMAKE_BUILD_TYPE is visible in cmake-gui on Unix
1618
IF(NOT WIN32)
1719
IF(NOT CMAKE_BUILD_TYPE)
@@ -30,7 +32,7 @@ SET(ARCHIVE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}
3032
CACHE PATH "Install dir for static libraries")
3133
SET(LIBRARY_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}
3234
CACHE PATH "Install dir for shared libraries")
33-
SET(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include
35+
SET(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/jsoncpp
3436
CACHE PATH "Install dir for headers")
3537
SET(PACKAGE_INSTALL_DIR lib${LIB_SUFFIX}/cmake
3638
CACHE PATH "Install dir for cmake package config files")
@@ -114,7 +116,7 @@ IF(JSONCPP_WITH_PKGCONFIG_SUPPORT)
114116
"pkg-config/jsoncpp.pc"
115117
@ONLY)
116118
INSTALL(FILES "${CMAKE_BINARY_DIR}/pkg-config/jsoncpp.pc"
117-
DESTINATION "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/pkgconfig")
119+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
118120
ENDIF()
119121

120122
IF(JSONCPP_WITH_CMAKE_PACKAGE)

Diff for: src/lib_json/CMakeLists.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ IF(BUILD_SHARED_LIBS)
4848

4949
INSTALL( TARGETS jsoncpp_lib ${INSTALL_EXPORT}
5050
RUNTIME DESTINATION ${RUNTIME_INSTALL_DIR}
51-
LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR}
52-
ARCHIVE DESTINATION ${ARCHIVE_INSTALL_DIR})
51+
LIBRARY DESTINATION "${LIBRARY_INSTALL_DIR}/${CMAKE_LIBRARY_ARCHITECTURE}"
52+
ARCHIVE DESTINATION "${ARCHIVE_INSTALL_DIR}/${CMAKE_LIBRARY_ARCHITECTURE}")
5353

5454
IF(NOT CMAKE_VERSION VERSION_LESS 2.8.11)
5555
TARGET_INCLUDE_DIRECTORIES( jsoncpp_lib PUBLIC
@@ -67,8 +67,8 @@ IF(BUILD_STATIC_LIBS)
6767

6868
INSTALL( TARGETS jsoncpp_lib_static ${INSTALL_EXPORT}
6969
RUNTIME DESTINATION ${RUNTIME_INSTALL_DIR}
70-
LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR}
71-
ARCHIVE DESTINATION ${ARCHIVE_INSTALL_DIR})
70+
LIBRARY DESTINATION "${LIBRARY_INSTALL_DIR}/${CMAKE_LIBRARY_ARCHITECTURE}"
71+
ARCHIVE DESTINATION "${ARCHIVE_INSTALL_DIR}/${CMAKE_LIBRARY_ARCHITECTURE}")
7272

7373
IF(NOT CMAKE_VERSION VERSION_LESS 2.8.11)
7474
TARGET_INCLUDE_DIRECTORIES( jsoncpp_lib_static PUBLIC

Diff for: src/lib_json/json_reader.cpp

+8-28
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ static int stackDepth_g = 0; // see readValue()
4343

4444
namespace Json {
4545

46-
typedef std::auto_ptr<CharReader> CharReaderPtr;
46+
#if __GNUC__ >= 6
47+
typedef std::scoped_ptr<CharReader> const CharReaderPtr;
48+
#else
49+
typedef std::auto_ptr<CharReader> CharReaderPtr;
50+
#endif
4751

4852
// Implementation of class Features
4953
// ////////////////////////////////
@@ -1477,33 +1481,9 @@ bool OurReader::decodeDouble(Token& token) {
14771481

14781482
bool OurReader::decodeDouble(Token& token, Value& decoded) {
14791483
double value = 0;
1480-
const int bufferSize = 32;
1481-
int count;
1482-
int length = int(token.end_ - token.start_);
1483-
1484-
// Sanity check to avoid buffer overflow exploits.
1485-
if (length < 0) {
1486-
return addError("Unable to parse token length", token);
1487-
}
1488-
1489-
// Avoid using a string constant for the format control string given to
1490-
// sscanf, as this can cause hard to debug crashes on OS X. See here for more
1491-
// info:
1492-
//
1493-
// http://developer.apple.com/library/mac/#DOCUMENTATION/DeveloperTools/gcc-4.0.1/gcc/Incompatibilities.html
1494-
char format[] = "%lf";
1495-
1496-
if (length <= bufferSize) {
1497-
Char buffer[bufferSize + 1];
1498-
memcpy(buffer, token.start_, length);
1499-
buffer[length] = 0;
1500-
count = sscanf(buffer, format, &value);
1501-
} else {
1502-
std::string buffer(token.start_, token.end_);
1503-
count = sscanf(buffer.c_str(), format, &value);
1504-
}
1505-
1506-
if (count != 1)
1484+
std::string buffer( token.start_, token.end_ );
1485+
std::istringstream is(buffer);
1486+
if (!(is >> value))
15071487
return addError("'" + std::string(token.start_, token.end_) +
15081488
"' is not a number.",
15091489
token);

Diff for: src/lib_json/json_writer.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@
5454

5555
namespace Json {
5656

57-
typedef std::auto_ptr<StreamWriter> StreamWriterPtr;
57+
#if __GNUC__ >= 6
58+
typedef std::scoped_ptr<StreamWriter> const StreamWriterPtr;
59+
#else
60+
typedef std::auto_ptr<StreamWriter> StreamWriterPtr;
61+
#endif
5862

5963
static bool containsControlCharacter(const char* str) {
6064
while (*str) {

0 commit comments

Comments
 (0)