mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-10-15 23:20:05 +02:00
Compare commits
16 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
6eaf150dc7 | ||
![]() |
8b489f891a | ||
![]() |
65cee6ea16 | ||
![]() |
dfc5f879c1 | ||
![]() |
1a4dc3a888 | ||
![]() |
0f6884f771 | ||
![]() |
748328a0d1 | ||
![]() |
f44278cd4e | ||
![]() |
d2b6992f3e | ||
![]() |
54764dd85b | ||
![]() |
8dd32e1e2e | ||
![]() |
3fd7f8b470 | ||
![]() |
e99e6d9cc6 | ||
![]() |
9ca1aaab14 | ||
![]() |
27639ce578 | ||
![]() |
f8a3a599ac |
@@ -17,15 +17,17 @@ IF(NOT WIN32)
|
||||
ENDIF(NOT CMAKE_BUILD_TYPE)
|
||||
ENDIF(NOT WIN32)
|
||||
|
||||
SET(LIB_SUFFIX "" CACHE STRING "Optional arch-dependent suffix for the library installation directory")
|
||||
|
||||
SET(RUNTIME_INSTALL_DIR bin
|
||||
CACHE PATH "Install dir for executables and dlls")
|
||||
SET(ARCHIVE_INSTALL_DIR lib
|
||||
SET(ARCHIVE_INSTALL_DIR lib${LIB_SUFFIX}
|
||||
CACHE PATH "Install dir for static libraries")
|
||||
SET(LIBRARY_INSTALL_DIR lib
|
||||
SET(LIBRARY_INSTALL_DIR lib${LIB_SUFFIX}
|
||||
CACHE PATH "Install dir for shared libraries")
|
||||
SET(INCLUDE_INSTALL_DIR include
|
||||
CACHE PATH "Install dir for headers")
|
||||
SET(PACKAGE_INSTALL_DIR lib/cmake
|
||||
SET(PACKAGE_INSTALL_DIR lib${LIB_SUFFIX}/cmake
|
||||
CACHE PATH "Install dir for cmake package config files")
|
||||
MARK_AS_ADVANCED( RUNTIME_INSTALL_DIR ARCHIVE_INSTALL_DIR INCLUDE_INSTALL_DIR PACKAGE_INSTALL_DIR )
|
||||
|
||||
@@ -101,7 +103,7 @@ IF(JSONCPP_WITH_PKGCONFIG_SUPPORT)
|
||||
"pkg-config/jsoncpp.pc"
|
||||
@ONLY)
|
||||
INSTALL(FILES "${CMAKE_BINARY_DIR}/pkg-config/jsoncpp.pc"
|
||||
DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig")
|
||||
DESTINATION "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/pkgconfig")
|
||||
ENDIF(JSONCPP_WITH_PKGCONFIG_SUPPORT)
|
||||
|
||||
IF(JSONCPP_WITH_CMAKE_PACKAGE)
|
||||
|
@@ -4,9 +4,9 @@
|
||||
#ifndef JSON_VERSION_H_INCLUDED
|
||||
# define JSON_VERSION_H_INCLUDED
|
||||
|
||||
# define JSONCPP_VERSION_STRING "1.0.0"
|
||||
# define JSONCPP_VERSION_STRING "1.1.0"
|
||||
# define JSONCPP_VERSION_MAJOR 1
|
||||
# define JSONCPP_VERSION_MINOR 0
|
||||
# define JSONCPP_VERSION_MINOR 1
|
||||
# define JSONCPP_VERSION_PATCH 0
|
||||
# define JSONCPP_VERSION_QUALIFIER
|
||||
# define JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8))
|
||||
|
@@ -1,6 +1,6 @@
|
||||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
exec_prefix=${prefix}
|
||||
libdir=${exec_prefix}/lib
|
||||
libdir=${exec_prefix}/@LIBRARY_INSTALL_DIR@
|
||||
includedir=${prefix}/@INCLUDE_INSTALL_DIR@
|
||||
|
||||
Name: jsoncpp
|
||||
|
@@ -1,4 +1,8 @@
|
||||
OPTION(JSONCPP_LIB_BUILD_SHARED "Build jsoncpp_lib as a shared library." OFF)
|
||||
IF(BUILD_SHARED_LIBS)
|
||||
SET(JSONCPP_LIB_BUILD_SHARED ON)
|
||||
ENDIF(BUILD_SHARED_LIBS)
|
||||
|
||||
IF(JSONCPP_LIB_BUILD_SHARED)
|
||||
SET(JSONCPP_LIB_TYPE SHARED)
|
||||
ADD_DEFINITIONS( -DJSON_DLL_BUILD )
|
||||
@@ -6,9 +10,15 @@ ELSE(JSONCPP_LIB_BUILD_SHARED)
|
||||
SET(JSONCPP_LIB_TYPE STATIC)
|
||||
ENDIF(JSONCPP_LIB_BUILD_SHARED)
|
||||
|
||||
|
||||
if( CMAKE_COMPILER_IS_GNUCXX )
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=strict-aliasing")
|
||||
#Get compiler version.
|
||||
execute_process( COMMAND ${CMAKE_CXX_COMPILER} -dumpversion
|
||||
OUTPUT_VARIABLE GNUCXX_VERSION )
|
||||
|
||||
#-Werror=* was introduced -after- GCC 4.1.2
|
||||
if( GNUCXX_VERSION VERSION_GREATER 4.1.2 )
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=strict-aliasing")
|
||||
endif()
|
||||
endif( CMAKE_COMPILER_IS_GNUCXX )
|
||||
|
||||
SET( JSONCPP_INCLUDE_DIR ../../include )
|
||||
@@ -39,12 +49,15 @@ ADD_LIBRARY( jsoncpp_lib ${JSONCPP_LIB_TYPE}
|
||||
SET_TARGET_PROPERTIES( jsoncpp_lib PROPERTIES OUTPUT_NAME jsoncpp )
|
||||
SET_TARGET_PROPERTIES( jsoncpp_lib PROPERTIES VERSION ${JSONCPP_VERSION} SOVERSION ${JSONCPP_VERSION_MAJOR} )
|
||||
|
||||
IF(NOT CMAKE_VERSION VERSION_LESS 2.8.11)
|
||||
TARGET_INCLUDE_DIRECTORIES( jsoncpp_lib PUBLIC
|
||||
$<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/${JSONCPP_INCLUDE_DIR}>
|
||||
)
|
||||
ENDIF(NOT CMAKE_VERSION VERSION_LESS 2.8.11)
|
||||
|
||||
# Install instructions for this target
|
||||
IF(JSONCPP_WITH_CMAKE_PACKAGE)
|
||||
TARGET_INCLUDE_DIRECTORIES( jsoncpp_lib
|
||||
PUBLIC $<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/${JSON_INCLUDE_DIR}>
|
||||
)
|
||||
SET(INSTALL_EXPORT EXPORT jsoncpp)
|
||||
ELSE(JSONCPP_WITH_CMAKE_PACKAGE)
|
||||
SET(INSTALL_EXPORT)
|
||||
|
@@ -26,6 +26,11 @@
|
||||
#pragma warning(disable : 4996)
|
||||
#endif
|
||||
|
||||
#if defined(__sun) && defined(__SVR4) //Solaris
|
||||
#include <ieeefp.h>
|
||||
#define isfinite finite
|
||||
#endif
|
||||
|
||||
namespace Json {
|
||||
|
||||
static bool containsControlCharacter(const char* str) {
|
||||
@@ -82,13 +87,13 @@ std::string valueToString(double value) {
|
||||
// visual studio 2005 to
|
||||
// avoid warning.
|
||||
#if defined(WINCE)
|
||||
len = _snprintf(buffer, sizeof(buffer), "%.16g", value);
|
||||
len = _snprintf(buffer, sizeof(buffer), "%.17g", value);
|
||||
#else
|
||||
len = sprintf_s(buffer, sizeof(buffer), "%.16g", value);
|
||||
len = sprintf_s(buffer, sizeof(buffer), "%.17g", value);
|
||||
#endif
|
||||
#else
|
||||
if (isfinite(value)) {
|
||||
len = snprintf(buffer, sizeof(buffer), "%.16g", value);
|
||||
len = snprintf(buffer, sizeof(buffer), "%.17g", value);
|
||||
} else {
|
||||
// IEEE standard states that NaN values will not compare to themselves
|
||||
if (value != value) {
|
||||
|
@@ -926,7 +926,7 @@ JSONTEST_FIXTURE(ValueTest, integers) {
|
||||
JSONTEST_ASSERT_EQUAL(float(uint64ToDouble(Json::UInt64(1) << 63)),
|
||||
val.asFloat());
|
||||
JSONTEST_ASSERT_EQUAL(true, val.asBool());
|
||||
JSONTEST_ASSERT_STRING_EQUAL("9.223372036854776e+18",
|
||||
JSONTEST_ASSERT_STRING_EQUAL("9.2233720368547758e+18",
|
||||
normalizeFloatingPointStr(val.asString()));
|
||||
|
||||
// int64 min
|
||||
@@ -974,7 +974,7 @@ JSONTEST_FIXTURE(ValueTest, integers) {
|
||||
JSONTEST_ASSERT_EQUAL(-9223372036854775808.0, val.asDouble());
|
||||
JSONTEST_ASSERT_EQUAL(-9223372036854775808.0, val.asFloat());
|
||||
JSONTEST_ASSERT_EQUAL(true, val.asBool());
|
||||
JSONTEST_ASSERT_STRING_EQUAL("-9.223372036854776e+18",
|
||||
JSONTEST_ASSERT_STRING_EQUAL("-9.2233720368547758e+18",
|
||||
normalizeFloatingPointStr(val.asString()));
|
||||
|
||||
// 10^19
|
||||
@@ -1065,7 +1065,7 @@ JSONTEST_FIXTURE(ValueTest, integers) {
|
||||
JSONTEST_ASSERT_EQUAL(18446744073709551616.0, val.asDouble());
|
||||
JSONTEST_ASSERT_EQUAL(18446744073709551616.0, val.asFloat());
|
||||
JSONTEST_ASSERT_EQUAL(true, val.asBool());
|
||||
JSONTEST_ASSERT_STRING_EQUAL("1.844674407370955e+19",
|
||||
JSONTEST_ASSERT_STRING_EQUAL("1.8446744073709552e+19",
|
||||
normalizeFloatingPointStr(val.asString()));
|
||||
#endif
|
||||
}
|
||||
@@ -1217,7 +1217,7 @@ JSONTEST_FIXTURE(ValueTest, nonIntegers) {
|
||||
normalizeFloatingPointStr(val.asString()));
|
||||
|
||||
val = Json::Value(1.2345678901234);
|
||||
JSONTEST_ASSERT_STRING_EQUAL("1.2345678901234",
|
||||
JSONTEST_ASSERT_STRING_EQUAL("1.2345678901234001",
|
||||
normalizeFloatingPointStr(val.asString()));
|
||||
|
||||
// A 16-digit floating point number.
|
||||
|
@@ -1,8 +1,8 @@
|
||||
from __future__ import print_function
|
||||
from glob import glob
|
||||
import sys
|
||||
import os
|
||||
import os.path
|
||||
from glob import glob
|
||||
import pipes
|
||||
import optparse
|
||||
|
||||
VALGRIND_CMD = 'valgrind --tool=memcheck --leak-check=yes --undef-value-errors=yes '
|
||||
@@ -56,7 +56,7 @@ def runAllTests( jsontest_executable_path, input_dir = None,
|
||||
options = is_json_checker_test and '--json-checker' or ''
|
||||
pipe = os.popen( "%s%s %s %s" % (
|
||||
valgrind_path, jsontest_executable_path, options,
|
||||
input_path) )
|
||||
pipes.quote(input_path)))
|
||||
process_output = pipe.read()
|
||||
status = pipe.close()
|
||||
if is_json_checker_test:
|
||||
|
Reference in New Issue
Block a user