From e900f5b91249fdce24493fe731c2f6d15dbed4b5 Mon Sep 17 00:00:00 2001 From: Christopher Dunn Date: Wed, 3 Sep 2014 14:11:33 -0700 Subject: [PATCH] fix README; ws --- README.md | 2 +- src/lib_json/json_writer.cpp | 18 +++++------------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 6af343fa0..e981c2777 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ Alternatively, from the command-line on Unix in the source directory: mkdir -p ../build/debug cd ../build/debug - cmake -DCMAKE_BUILD_TYPE=debug -DJSONCPP_LIB_BUILD_SHARED=OFF -G "Unix Makefiles" ../../jsoncpp/src + cmake -DCMAKE_BUILD_TYPE=debug -DJSONCPP_LIB_BUILD_SHARED=OFF -G "Unix Makefiles" ../../jsoncpp make Running `cmake -`" will display the list of available generators (passed using diff --git a/src/lib_json/json_writer.cpp b/src/lib_json/json_writer.cpp index e52fe4a6b..3a9994eea 100644 --- a/src/lib_json/json_writer.cpp +++ b/src/lib_json/json_writer.cpp @@ -81,23 +81,15 @@ std::string valueToString(double value) { len = sprintf_s(buffer, sizeof(buffer), "%.16g", value); #endif #else - if ( isfinite( value )) - { + if (isfinite( value )) { len = snprintf(buffer, sizeof(buffer), "%.16g", value); - } - else - { + } else { // IEEE standard states that NaN values will not compare to themselves - if ( value != value) - { + if ( value != value) { len = snprintf(buffer, sizeof(buffer), "null"); - } - else if ( value < 0) - { + } else if ( value < 0) { len = snprintf(buffer, sizeof(buffer), "-1e+9999"); - } - else - { + } else { len = snprintf(buffer, sizeof(buffer), "1e+9999"); } // For those, we do not need to call fixNumLoc, but it is fast.