Commit Graph

676 Commits

Author SHA1 Message Date
Alexander V. Brezgin
b4abc8241f Optimize value range check 2016-11-20 03:50:32 +03:00
Alexander V. Brezgin
12e9ef32f9 Remove repeated condition
isDouble() contains isIntegral()
2016-11-20 03:28:15 +03:00
Christopher Dunn
77632b2611 Merge pull request #549 from jia3ep/master
Added stack overflow test
2016-11-09 14:28:13 -06:00
Christopher Dunn
34fc0020c0 Merge pull request #552 from omki2005/noexcept
change throw() to noexcept to conform to c++11
2016-11-08 07:21:56 -06:00
Christopher Dunn
f880a9432d Merge pull request #551 from suttungdigital/detect_locale_support
Check for locale support in CMake
2016-11-08 07:19:51 -06:00
Magnus Bjerke Vik
5a82131033 Rename NO_LOCALE_SUPPORT to JSONCPP_NO_LOCALE_SUPPORT 2016-11-08 09:47:27 +01:00
Magnus Bjerke Vik
1839f2da34 Check for locale support in CMake 2016-11-08 09:47:27 +01:00
Omkar Wagh
91c1d23461 change throw() to noexcept to conform to c++11 2016-11-07 17:39:38 -05:00
Kirill V. Lyadvinsky
86f085b810 Make it a bit more multithreading friendly 2016-11-03 22:45:36 +03:00
Brendan Drew
89ab7eca7f Ensure that the fact that a float was provided on input is preserved when writing output; update tests to reflect this fact 2016-10-27 04:49:11 -07:00
Paweł Bylica
1572539bec Rename variable empty to emptyString
Rename variable empty to emptyString in Value constructor to avoid shadowing of Value::empty().

GCC 4.8 produces the warning about this:
lib_json/json_value.cpp: In constructor ‘Json::Value::Value(Json::ValueType)’:
lib_json/json_value.cpp:346:27: warning: declaration of ‘empty’ shadows a member of 'this' [-Wshadow]
2016-10-14 11:59:28 +02:00
Christopher Dunn
92259f7147 Bump SOVERSION, separate from MAJOR.MINOR.MICRO 2016-10-02 11:29:12 -05:00
Christopher Dunn
4893a8f667 Merge pull request #535 from kavika13/master
Add RPATH to dynamic library build on OSX

fixes #534 

But we will revert if there are any complaints.
2016-09-25 18:58:14 -05:00
Gergely Nagy
f6d785fda8 Fix poss SEGV
for non-null terminated input.
2016-09-25 18:45:04 -05:00
Merlyn Morgan-Graham
8d54e333ff Add RPATH to dynamic library build on OSX 2016-09-22 22:06:25 -07:00
Christopher Dunn
b063cf4ada Merge pull request #529 from chrox802/chrox802-patch-1
fix a bug about Json::Path
2016-09-07 21:57:56 -05:00
chason
2f97c0147b fix a bug about Json::Path 2016-09-07 19:56:19 +08:00
Alexander Gazarov
52cfe5ae88 Replaced the template-based solution for avoiding calls to localeconv() with a macro-based one (fixes #527) 2016-09-06 14:41:13 +03:00
Gida Pataki
894e78bff1 Workaround for missing lconv::decimal_point on android 2016-08-26 23:30:18 +02:00
Christopher Dunn
126bdc2b05 Reject extra chars if strictRoot
resolves #511
2016-08-21 20:32:16 -05:00
Christopher Dunn
094a7d8564 Fix locale for decimal points
resolves #514
2016-08-21 20:13:58 -05:00
Christopher Dunn
80a82ea269 Optional space after comma
resolves #513
2016-08-21 16:35:19 -05:00
Christopher Dunn
f78f685bab Remove needless if.
resolves #516
2016-08-21 16:31:14 -05:00
Christopher Dunn
7e0571b444 Avoid null for stringValue
fixes #517
2016-08-21 16:25:29 -05:00
Christopher Dunn
b299d3581f Allow dtor for nullSingleton
re #488 and #490
2016-07-20 11:31:41 -07:00
Christopher Dunn
0f288aecdd Use a Myers Singleton for null
Avoid some static initialization problems.

From @marklakata
See #488
2016-06-26 19:36:40 -05:00
Christopher Dunn
e0f9aab0bf Make internal func anon
fixes #489
2016-06-26 17:54:15 -05:00
Christopher Dunn
ea4af18317 Fix int->char conv warn
resolves #473
2016-05-15 23:13:56 -05:00
Christopher Dunn
b999616df8 fix warning 2016-05-15 23:13:47 -05:00
Cristóvão B da Cruz e Silva
c8a7b445ea Small fix for strict compilers (using the flag -Werror for instance) 2016-03-26 18:41:46 +00:00
Christopher Dunn
ef2ff8754a Fix a clang warning
Resolves #451.
2016-03-23 22:33:18 -05:00
Christopher Dunn
98e981dff9 Use macro for override
b/c MS VS2010 is supposed to be C++11 but does not fulfull
the entire standard.

Resolves #410.
Re: #430.
2016-03-21 21:00:24 -05:00
dawesc
ae564653c4 -DJSONCPP_USE_SECURE_MEMORY=1 for cmake
Add allocator.h to amalgamated header
Test JSONCPP_USE_SECURE_MEMORY in Travis
2016-03-19 19:21:15 -05:00
Gaurav
0b597b4b48 Added NORETURN for throw functions.
Fix in definition also.
2016-03-16 11:17:21 +05:30
Gaurav
fbe1cf3916 Supporting GCC 6.0
Fixes test with GCC-6.0
2016-03-15 18:33:34 +05:30
Gaurav
cf86c473a5 Supporting GCC 6.0
This patch is also needed to build success for GCC 6.0.
Refer issue - https://github.com/open-source-parsers/jsoncpp/issues/411
2016-03-15 18:31:44 +05:30
Christopher Dawes
75570d7068 Fixing up for #define instead of typedef in secure allocators 2016-03-14 19:15:17 -05:00
Christopher Dunn
5da29e2707 Another shot at #411 2016-03-14 18:35:53 -05:00
Christopher Dunn
b84e0c159d JSONCPP_ISTREAM 2016-03-06 11:56:39 -06:00
Christopher Dunn
1e990640a9 JSONCPP_ISTRINGSTREAM 2016-03-06 11:56:39 -06:00
Christopher Dunn
38bb491400 JSONCPP_OSTRINGSTREAM 2016-03-06 11:56:38 -06:00
Christopher Dunn
724ba29bd3 JSONCPP_OSTREAM 2016-03-06 11:56:38 -06:00
Christopher Dunn
de5b792168 JSONCPP_STRING 2016-03-06 11:56:38 -06:00
Gaurav
4878913143 Avoid passing Null to memcmp
As per discussion in - https://github.com/open-source-parsers/jsoncpp/issues/404
Null should not be pass to memcmp, it may show undesired behaviour, so avoid doing that using assertion.
Also, changed one direct "assert" to JSON_ASSERT - it will be decided if exceptions are used or not.
2016-03-01 14:13:28 +05:30
Tomasz Maciejewski
ccd70540e3 remove C-style casting 2016-02-28 12:56:04 +01:00
Techwolf
7e46bf76e8 std::snprintf fix for Cygwin 2016-02-10 17:09:32 -08:00
Christopher Dunn
02bc3d77de This *might* fix the last gcc-6 error.
See https://github.com/open-source-parsers/jsoncpp/issues/411#issuecomment-180974558

I was unable to produce a warning in Clang, so I am not certain. But based on a [SO answer](http://stackoverflow.com/questions/25480059/gcc-conversion-warning-when-assigning-to-a-bitfield), I think I've fixed the following:
```
/tmp/jsoncpp/src/lib_json/json_value.cpp: In copy constructor 'Json::Value::CZString::CZString(const Json::Value::CZString&)':
/tmp/jsoncpp/src/lib_json/json_value.cpp:235:18: error: conversion to 'unsigned char:2' from 'unsigned int' may alter its value [-Werror=conversion]
   storage_.policy_ = (other.cstr_
                      ~~~~~~~~~~~~
                  ? (static_cast<DuplicationPolicy>(other.storage_.policy_) == noDuplication
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                      ? noDuplication : duplicate)
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                  : static_cast<DuplicationPolicy>(other.storage_.policy_));
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
2016-02-07 11:28:50 -06:00
Christopher Dunn
2713f4f456 Fix a sign-compare 2016-02-07 11:17:28 -06:00
Christopher Dunn
95f120f68e For gcc>=6 JSON_USE_INT64_DOUBLE_CONVERSION 2016-02-07 11:09:41 -06:00
Christopher Dunn
2c872ec997 Merge pull request #406 from magnific0/master
std::snprintf not part of std for MinGW32 using c++11
2016-02-06 10:21:45 -06:00
Christopher Dunn
fef4b75796 More conversion fixes for gcc 2016-02-06 10:10:49 -06:00
Christopher Dunn
d4513fcf45 Fix conversion warnings/errors
See #411.
  http://paste.debian.net/378673/
2016-02-06 09:25:20 -06:00
Jacco
bc9b445fee std::snprintf fix for MinGW32 c++11 2016-01-25 11:39:36 +01:00
Jacco
2646ac5fa5 std::snprintf fix for MinGW32 c++11 2016-01-25 11:38:49 +01:00
Evince
6b10ce8c0d json_reader throwRuntimeError return error details instead of hard-coded message
Signed-off-by: Evince <baneyue@gmail.com>
2015-10-28 00:22:46 +08:00
Christopher Dunn
527965cbde Minor
adjustments, based on comments in PR.
2015-10-19 23:49:07 -05:00
Motti
2b00891a86 move ctors
* Add move constructor to Value::CZString
* Add unit test for Value move constructor
* Allow includer to specify in advance the value for
JSON_HAS_RVALUE_REFERENCES
2015-10-19 23:42:52 -05:00
Benjamin Knecht
9fd1ca8d68 Add test code for precision 2015-10-15 18:32:24 +02:00
Benjamin Knecht
38022157b2 making precision unsigned int
adding precision as settings value for StreamBuilder
2015-10-15 18:00:42 +02:00
Benjamin Knecht
039a6e3b61 Create format string with sprintf.
For now use hardcoded precision '17' for now
2015-10-15 17:28:56 +02:00
ycqiu
c8a8cfcd4b fix
In value.h, ValueConstIterator can convert to ValueIterator, I think that is a bug. the correct way is ValueIterator can convert to ValueConstIterator.
2015-10-10 17:17:20 -05:00
ycqiu
4994c77d09 add test code
does not compile
2015-10-10 16:22:14 -05:00
Christopher Dunn
beae99924f Merge pull request #373 from antonindrawan/QNX_support
Compiles jsoncpp with QNX 6.6
2015-10-04 14:54:09 -05:00
drgler
b96d90efbd Remove defaulted default constructor 2015-10-03 19:40:23 +02:00
Anton Indrawan
e375b8c89e Compiles jsoncpp with QNX 6.6 2015-10-03 11:48:19 +02:00
Ben Boeckel
8df11d518b json_writer: improve isfinite support on *nix
Based on a patches to CMake by:

Ådne Hovda <ahovda@openit.com>:

    commit 7b1cdb00279908cacabada92f8a53e4986465423

    jsoncpp: Provide 'isfinite' implementation on older AIX and HP-UX

    Newer AIX and HP-UX platforms provide 'isfinite' as a <math.h> macro.
    Older versions do not, so add the definition if it is not provided.

Michael Scott <michael.scott@gbgplc.com>:

    commit 9217b678b305d7df7471ba476a81bf28961fdfa3

    jsoncpp: Provide 'isfinite' impl on more HP-UX versions (#15576)

    Some versions of HP-UX do not define 'isfinite' or 'finite' in math.h
    for Itanium when preprocessing with C++, so we have to add the
    definition ourselves instead to map to the internal version.

Joerg Sonnenberger <joerg@bec.de>:

    commit 75644dafe54c21902f14cfe58cb8338b553b69d8

    jsoncpp: Fix compilation as C99 on Solaris

    In C99 mode, Solaris variants may already define isfinite, so check for
    the existence first.
2015-10-01 13:27:19 -04:00
drgler
7e4875a239 __cplusplus value should not be used to decide for std::unique_ptr #350:
In addition to the C++ language version define __cplusplus also check _CPPLIB_VER for better Dinkumware support.
2015-09-27 14:03:35 +02:00
Christopher Dunn
979cbec237 Fully init OurReader
See #363, similar to #364.
2015-09-23 09:44:58 -05:00
Christopher Dunn
2e625dd9af Merge pull request #364 from ya1gaurav/patch-28
Have default ctor for OurFeatures
2015-09-23 09:41:17 -05:00
Gaurav
83ea25e5e2 Make OurFeatures ctor as default.
Please review suggested changes.
2015-09-23 09:42:26 +05:30
Christopher Dunn
5721f1ca57 Merge pull request #366 from ya1gaurav/patch-30
parseCommandLine also throws
2015-09-22 05:09:33 -05:00
Gaurav
6c14548293 parseCommandLine also throws
Catching exceptions thrown by parseCommandLine (std::bad_alloc & std::length_error) also.
2015-09-22 13:53:19 +05:30
Gaurav
6ee0bff822 Remove conditional check for isMultiLine
At all 3 places isMultiLine is checked in for loop :
for (int index = 0; index < size && !isMultiLine; ++index) {
It means !isMultiLine is always true (otherwise do not enter loop), so || condition does not depend on isMultiLine, so removed that.
2015-09-22 09:48:54 +05:30
Gaurav
e3b35992f8 Add default value of stackLimit couple of places
stackLimit default value is missing at two places.Adding them.
2015-09-21 18:05:15 +05:30
Gaurav
aadd0b1b63 C++11: override keyword
Source : http://en.cppreference.com/w/cpp/language/override
2015-09-05 12:03:38 -05:00
drgler
68509e6161 Fix number reading in the presence of Infinity: Only check for infinity if we have a leading sign character. 2015-09-05 14:49:33 +02:00
drgler
4cea1f6f6c Adjust whitespace formatting 2015-09-05 14:48:29 +02:00
Billy Donahue
7f7bbeff76 don't need out field of TestData 2015-09-05 04:22:18 -04:00
Billy Donahue
bfffe8cec7 prettier test 2015-09-05 04:07:56 -04:00
Billy Donahue
73154fb546 expanded Infinity test 2015-09-05 03:48:38 -04:00
drgler
63c747218b Floating-point NaN or Infinity values should be allowed as a feature #209
Introduce 'allowSpecialFloats' for readers and 'useSpecialFloats' for writers, use consistent macro snprintf definition for writers and readers, provide new unit tests for #209
2015-09-03 22:50:03 +02:00
drgler
2084563efb Floating-point NaN or Infinity values should be allowed as a feature #209
Introduce 'allowSpecialFloats' for readers and 'useSpecialFloats' for writers, use consistent macro snprintf definition for writers and readers, provide new unit tests for #209
2015-09-03 22:19:22 +02:00
Dmitry Marakasov
7acfd599f0 Specify float constant as float
Otherwise, on some 32 bit platforms this may not fit into long and compilation will fail:

    src/test_lib_json/main.cpp:1260: error: integer constant is too large for 'long' type
2015-08-21 21:19:26 +03:00
Robert Dailey
63a961a752 Clean up cmake END* (again)
(I missed a couple. ~cd)
2015-08-14 14:47:46 -07:00
Robert Dailey
37aaaec70e Clean up cmake END*
* Clean up closing statements for if conditions, functions, macros,
  and other entities. Newer versions of CMake do not require you to
  redundantly respecify the parameters to the opening arguments.
2015-08-14 14:31:08 -07:00
Aaron Jacobs
cc2c15c3eb Remove undefined behavior from a left shift of a negative value.
Fixed by shifting a positive value, then negating the result.

(Credit: Richard Trieu)
2015-08-03 10:58:29 +10:00
Michael Shields
7f06e9dc28 Fix cases where the most negative signed integer was negated, causing
undefined behavior.
2015-07-27 16:35:19 -07:00
Christopher Dunn
949babd7b0 Exceptions declared in header
resolves #272
2015-07-23 00:26:13 -05:00
Christopher Dunn
6ed877c77c correction for #316 2015-07-23 00:26:13 -05:00
filipjs
770fdda28b Update json_tool.h
Fix a typo in comment.
2015-07-14 14:34:07 +02:00
Christopher Dunn
7f240623d3 fixed a bug found by -Wshadow 2015-07-12 14:28:55 -05:00
Christopher Dunn
784433ac72 fix some warnings 2015-07-12 14:28:37 -05:00
Christopher Dunn
2428889813 1.6.3 2015-07-11 13:41:13 -05:00
Stuart Eichert
702a539762 Fix #296: Explicitly cast size_t results to unsigned when needed
This is rebased from #297, where AppVeyor had been failing, and which
was not properly based on the master branch.
2015-07-11 11:00:18 -05:00
Martyn Gigg
717c791d4e Allow an optional suffix on the debug library name in CMake. 2015-06-29 19:20:08 +01:00
Christopher Dunn
6416350438 fix ,/. problem in reader
fixes #293
2015-06-18 22:45:36 -05:00
Péricles Lopes Machado
97e093a361 fix compile error on android 2015-05-18 14:31:05 -03:00
Christopher Dunn
6649009ffa another fix for BORLANDC 2015-04-28 04:57:49 +01:00
Christopher Dunn
a0a7c5f6de a little test for issue 252, but does not fail for me 2015-04-27 18:14:09 -07:00
Gaurav
43019088f0 Use standard CMake variables - static/shared lib.
Replaced JSONCPP_LIB_BUILD_SHARED => BUILD_SHARED_LIBS
Moved flag JSON_DLL to line no 8.
2015-04-23 07:32:18 -07:00
Gaurav
0c1c076b7c Use standard CMake variables - static/shared lib.
Replaced JSONCPP_LIB_BUILD_SHARED => BUILD_SHARED_LIBS
Moved definition DJSON_DLL to line 11.
2015-04-23 07:32:18 -07:00
Gaurav
11130997c3 Use standard CMake variables - static/shared lib.
Replace JSONCPP_LIB_BUILD_SHARED => BUILD_SHARED_LIBS
Replace JSONCPP_LIB_BUILD_STATIC => BUILD_STATIC_LIBS
Removed workaround  https://github.com/open-source-parsers/jsoncpp/issues/51
Removed OPTION for shared/static in this file.
2015-04-23 07:32:17 -07:00
Christopher Dunn
74143f39e7 fix leak in unit-tests 2015-04-22 19:33:41 -07:00
Christopher Dunn
50069d72da prefer std::string for setComment()
in case of embedded nulls
2015-04-11 14:49:28 -05:00
Christopher Dunn
e255ce31a4 support UTF-8 in old Writers
We had already fixed Value to hold UTF-8 properly, but only the newer
StreamWriter was writing UTF-8 properly.

Old FasterWriter etc. were using asCString() instead of asString() in
Value::writeValue().

Hopefully this change does not break any existing code. Seems unlikely.

issue #240
2015-04-11 14:41:30 -05:00
Christopher Dunn
240ddb6a1b use std::snprintf for C++11 2015-03-31 15:04:24 -05:00
Baruch Siach
9dd77dc0ef Revert "Use std namespace for snprintf."
This reverts commit 1c58876185.

std::snprintf() is only available in C++11, which is not provided by
all compilers. Since the C library snprintf() can easily be used as a
replacement on Linux systems, this patch changes jsoncpp to use the C
library snprintf() instead of C++11 std::snprintf(), fixing the build error
below:

    src/lib_json/json_writer.cpp:33:18: error: 'snprintf' is not a member of 'std'

See #231, #224, and #218.
2015-03-31 15:04:24 -05:00
Connor Manning
1c58876185 Use std namespace for snprintf. 2015-03-11 21:33:08 -05:00
Connor Manning
2f2034629e Constrain MSVC _isfinite to before 2013, remove duplicate includes. 2015-03-11 21:33:08 -05:00
Dani-Hub
7020451b44 Fix isfinite for MSVC. 2015-03-11 21:32:59 -05:00
Connor Manning
80497f102e Use C++ standard headers. 2015-03-10 18:48:45 -05:00
Dani-Hub
f9feb66be2 Change exception data member
from "reference to string" to "string" (Resolves the most serious part of issue #216)
2015-03-09 18:42:16 -05:00
Christopher Dunn
ed495edcc1 prefer ValueIterator::name() to ::memberName()
in case of embedded nulls
2015-03-08 14:35:00 -05:00
Christopher Dunn
2250b3c29d use Json::RuntimeError 2015-03-08 12:44:55 -05:00
Christopher Dunn
5383794cc9 Runtime/LogicError and throwers 2015-03-08 12:31:57 -05:00
Christopher Dunn
75279ccec2 base Json::Exception 2015-03-08 12:20:06 -05:00
Christopher Dunn
717b08695e clarify errors
* use macros for logic errors, not input errors
* throw on parsing failure in `operator>>()`, not assert
* throw on malloc, not assert
2015-03-08 12:06:22 -05:00
Christopher Dunn
ee4ea0ec3f delete debug code from test 2015-03-07 15:47:39 -06:00
Christopher Dunn
ce19001238 require length
Ugh! I meant to do this long ago. It would have caught my blunder.
2015-03-07 15:12:52 -06:00
Christopher Dunn
a63d82d78a drop unused CString ctor case
`Value::CZString::CZString(char const* str, unsigned length, DuplicationPolicy allocate)` with `allocate == duplicate` does not happen.
2015-03-07 14:43:37 -06:00
datadiode
ee83f8891c Trivial fixes in CZString constructors. 2015-03-07 14:43:07 -06:00
Christopher Dunn
5c448687e1 fix ValueTest/zeroes* 2015-03-07 14:41:15 -06:00
Christopher Dunn
401e98269e old-style enum namespacing 2015-03-06 16:11:55 -06:00
Christopher Dunn
62ad140d18 rejectDupKeys 2015-03-06 12:39:05 -06:00
Christopher Dunn
527332d5d5 add rejectDupKeys feature - not yet impld 2015-03-06 12:38:58 -06:00
Christopher Dunn
cada3b951f test for repeated key in strictMode
https://sourceforge.net/p/jsoncpp/bugs/22/
2015-03-06 12:38:00 -06:00
Christopher Dunn
3976f17ffd test assignment over-writes comments, but swapPayload() does not 2015-03-06 09:16:19 -06:00
Christopher Dunn
80ca11bb41 test commentBefore
for issue #203
2015-03-06 05:55:19 -06:00
Christopher Dunn
2a840c105c had trouble finding Python on Windows
With this change, `make jsoncpp_check` will still fail if Python
is missing, so our CI tests are unaffected.
2015-03-05 17:42:12 -06:00
Christopher Dunn
0fd2875a44 fix get() for embedded zeroes in key
This method had been overlooked.
2015-03-05 16:47:29 -06:00
Christopher Dunn
d31151d150 test get(key, default) 2015-03-05 16:44:50 -06:00
Christopher Dunn
13e063c336 copy .dll for unit-test
Fix 2nd problem in issue #200.
* http://stackoverflow.com/questions/10671916/how-to-copy-dll-files-into-the-same-folder-as-the-executable-using-cmake

Q: What about the Python tests?
A: They are not normally run in Visual Studio. If desired, one can set PATH.
2015-03-05 15:23:20 -06:00
Christopher Dunn
f57da48f48 maybe address warning
cmake -DCMAKE_BUILD_TYPE=debug -DJSONCPP_LIB_BUILD_STATIC=OFF
-DJSONCPP_LIB_BUILD_SHARED=ON -G "Visual Studio 10" ../..

`potentially uninitialized local variable 'dist' (line 2212 of
test_lib_json/main.cpp)`
2015-03-05 14:41:42 -06:00
Christopher Dunn
c312dd5ef7 Builder::operator[] plus tests 2015-03-05 09:18:01 -06:00
Christopher Dunn
42d7e59fe0 fix compiler-error and warnings for VS2013
fix issue #200
2015-03-05 09:15:10 -06:00
Christopher Dunn
7b22768c33 test Builders::validate() 2015-03-04 21:17:03 -06:00
Christopher Dunn
19c49a459d fix Builders::validate()
(cherry picked from commit 626cfcdbb8)
2015-03-04 21:14:53 -06:00
Christopher Dunn
24f544996f no struct init
The C struct initializer is not standard C++.
GCC and Clang handle this (at least in some versions) but some
compilers might not.
2015-03-03 10:15:09 -06:00
Christopher Dunn
493f6dcebe keep StaticString (!allocated_) for copy ctor 2015-03-03 09:36:22 -06:00
Christopher Dunn
eaa06355e1 test Json::Value::null 2015-03-03 08:45:52 -06:00
Christopher Dunn
effd732aa1 null -> nullRef 2015-03-03 01:25:33 -06:00
Christopher Dunn
2d653bd15d fix security hole for string-key-lengths > 2^30 2015-03-03 00:14:54 -06:00
Christopher Dunn
585b267595 tests for zeroes
* ValueTest/zeroes
* ValueTest/zeroesInKeys
2015-03-03 00:14:54 -06:00
Christopher Dunn
c28610fb5d fix StaticString test
* support zeroes in string_
* support zeroes in writer; provide getString(char**, unsigned*)
* valueToQuotedStringN(), isCC0(), etc
* allow zeroes for cpptl ConstString
* allocated => non-static
2015-03-03 00:14:54 -06:00
Christopher Dunn
a53283568f cp duplicateStringValue() 2015-03-03 00:14:53 -06:00
Christopher Dunn
25342bac13 support UTF-8 for const methods 2015-03-03 00:14:53 -06:00
Christopher Dunn
e6b46e4503 stop computing strlen() in CZString 2015-03-02 23:50:59 -06:00
Christopher Dunn
8a77037320 actually store length in CZString 2015-03-02 23:50:59 -06:00
Christopher Dunn
57ad051f67 allow length in CZString 2015-03-02 23:50:59 -06:00
Christopher Dunn
b383fdc61e use memcmp in CZString
This is a loss of efficiency, but it prepares for an increase when we
have stored lengths.
2015-03-02 23:50:59 -06:00
Christopher Dunn
0570f9eefb test StaticString 2015-03-02 17:06:09 -06:00
Mark Lakata
8051cf6ba7 changed length argument of duplicateStringValue from unsigned int to size_t, to avoid warnings in Visual Studio. 2015-03-02 11:57:17 -08:00
Christopher Dunn
9998094eee skip python jsontestrunner by default
To run these tests, in cmake build-dir:
    make jsoncpp_check

TravisCI is now set to run these always.

For now, the test_json_lib unit-tests will still run.

issue #187
2015-02-26 09:41:45 -06:00
Christopher Dunn
4788764844 drop JSON_VALUE_USE_INTERNAL_MAP, JSON_USE_SIMPLE_INTERNAL_ALLOCATOR
And remove some old headers.

These were not actually compiling anymore, and there were outstanding,
known bugs, e.g. https://sourceforge.net/p/jsoncpp/bugs/27
2015-02-25 10:04:13 -06:00
Christopher Dunn
0c66e698fb allowSingleQuotes
issue #182
2015-02-24 15:49:45 -06:00
Christopher Dunn
b9229b7400 failing test for allowSingleQuotes 2015-02-23 16:40:06 -06:00
Christopher Dunn
7b3683ccd1 apply fix to old Reader 2015-02-19 11:37:17 -06:00
Christopher Dunn
58499031a4 fix all cases from issue -- all pass! 2015-02-19 11:35:28 -06:00
Christopher Dunn
2c8c1ac0ec all 8 failing cases from issue 2015-02-19 11:35:20 -06:00
Christopher Dunn
c58e93b014 fix failing object case 2015-02-19 11:34:35 -06:00
Christopher Dunn
eed193e151 object cases; 1st passes, 2nd fails 2015-02-19 11:34:35 -06:00
Christopher Dunn
4382a7b585 cases 0,1,5,9,12 from issue -- passing 2015-02-19 11:32:42 -06:00
Christopher Dunn
f164288646 help rebasing 2015-02-15 03:01:26 -06:00
Christopher Dunn
bd55164089 reverse sense for CPPTL too 2015-02-15 02:38:31 -06:00
Christopher Dunn
8ba9875962 IteratorTest 2015-02-15 02:38:31 -06:00
Christopher Dunn
f4be815c86 failIfExtra
1. failing regression tests, from #164 and #107
2. implemented; tests pass
3. allow trailing comments
2015-02-13 09:39:08 -06:00
Christopher Dunn
3ebba5cea8 stop calling validate() in newReader/Writer()
By not calling validate(), we can add
non-invasive features which will be simply ignored when user-code
is compiled against an old version. That way, we can often
avoid a minor version-bump.

The user can call validate() himself if he prefers that behavior.
2015-02-11 11:15:32 -06:00
Christopher Dunn
56df206847 limit stackDepth for old (deprecated) Json::Reader too
This is an improper solution. If multiple Readers exist,
then the effect stackLimit is reduced because of side-effects.
But our options are limited. We need to address the security
hole without breaking binary-compatibility.

However, this is not likely to cause any practical problems because:

* Anyone using `operator>>(istream, Json::Value)` will be using the
new code already
* Multiple Readers are uncommon.
* The stackLimit is quite high.
* Deeply nested JSON probably would have hit the system limits anyway.
2015-02-11 10:20:53 -06:00
Christopher Dunn
4dca80da49 limit stackDepth 2015-02-11 10:20:47 -06:00
Christopher Dunn
249ad9f47f stackLimit 2015-02-11 10:01:58 -06:00
Christopher Dunn
99b8e856f6 stackLimit_ 2015-02-11 10:01:58 -06:00
Christopher Dunn
89b72e1653 test stackLimit 2015-02-11 10:01:58 -06:00
Christopher Dunn
2474989f24 Old -> Our 2015-02-11 09:48:24 -06:00
Christopher Dunn
315b8c9f2c 1st StreamWriterTest 2015-02-10 23:29:14 -06:00
Christopher Dunn
29501c4d9f clarify comments
And throw instead of return null for invalid settings.
2015-02-10 23:03:27 -06:00
Christopher Dunn
20d09676c2 drop experimental OldCompressingStreamWriterBuilder 2015-02-10 21:29:35 -06:00
Christopher Dunn
5a744708fc enableYAMLCompatibility and dropNullPlaceholders for StreamWriterBuilder 2015-02-10 21:28:13 -06:00
Christopher Dunn
07f0e9308d nullRef, since we had to add that kludge to 0.8.0 2015-02-10 21:28:13 -06:00
Christopher Dunn
052050df07 copy Features to OldFeatures 2015-02-10 17:01:08 -06:00
Christopher Dunn
435d2a2f8d passes 2015-02-10 17:01:08 -06:00
Christopher Dunn
6123bd1505 copy Reader impl to OldReader 2015-02-10 17:01:08 -06:00
Christopher Dunn
7477bcfa3a renames for OldReader 2015-02-10 17:01:08 -06:00
Christopher Dunn
5e3e68af2e OldReader copied from Reader 2015-02-10 17:01:08 -06:00
Christopher Dunn
db75cdf21e mv CommentStyle to .cpp 2015-02-09 18:54:58 -06:00
Christopher Dunn
c41609b9f9 set output stream in write(), not in builder 2015-02-09 18:44:53 -06:00
Christopher Dunn
b56381a636 <stdexcept> 2015-02-09 18:29:11 -06:00
Christopher Dunn
f757c18ca0 add all features 2015-02-09 18:24:56 -06:00
Christopher Dunn
3cf9175bde remark defaults via doxygen snippet 2015-02-09 18:16:24 -06:00
Christopher Dunn
a9e1ab302d Builder::settings_
We use Json::Value to configure the builders so we can maintain
binary-compatibility easily.
2015-02-09 17:30:11 -06:00
Christopher Dunn
694dbcb328 update docs, writeString() 2015-02-09 15:25:57 -06:00
Christopher Dunn
3a65581b20 drop an old impl 2015-02-09 09:54:26 -06:00
Christopher Dunn
66a8ba255f clarify Builders 2015-02-09 01:29:43 -06:00
Christopher Dunn
2c1197c2c8 CharReader/Builder
* CharReaderBuilder is similar to StreamWriterBuilder.
* use rdbuf(), since getline(string) is not required to handle EOF as delimiter
2015-02-08 13:22:09 -06:00
Christopher Dunn
dee4602b8f rm unique_ptr<>/shared_ptr<>, for pre-C++11 2015-02-08 11:54:49 -06:00
Christopher Dunn
636121485c fix JSONCPP_WITH_CMAKE_PACKAGE #155
mv JSONCPP_WITH_CMAKE_PACKAGE ahead of INSTALL def.
2015-02-07 11:39:16 -06:00
Christopher Dunn
fe855fb4dd drop nullptr
See issue #153.
2015-02-02 15:33:47 -06:00
Christopher Dunn
198cc350c5 drop scoped enum, for pre-C++11 compatibility 2015-01-29 13:49:21 -06:00
Peter Spiess-Knafl
5e8595c0e2 added cmake option to build static and shared libraries at once
See #147 and #149.
2015-01-27 18:22:43 -06:00
Christopher Dunn
7eca3b4e88 gcc-4.6 (Travis CI) does not support 2015-01-26 11:17:42 -06:00
Christopher Dunn
6065a1c142 make StreamWriterBuilder concrete 2015-01-26 11:01:15 -06:00
Christopher Dunn
28a20917b0 Move old FastWriter stuff out of new Builder 2015-01-26 10:47:42 -06:00
Christopher Dunn
177b7b8f22 OldCompressingStreamWriterBuilder 2015-01-26 10:44:20 -06:00
Christopher Dunn
c7b39c2e25 deprecate old Writers
also, use withers instead of setters, and update docs
2015-01-25 18:45:59 -06:00
Christopher Dunn
d78caa3851 implement strange setting from FastWriter 2015-01-25 18:15:54 -06:00
Christopher Dunn
c6e0688e5a implement CommentStyle::None/indentation_=="" 2015-01-25 17:32:36 -06:00
Christopher Dunn
1e21e63853 default \t indentation, All comments 2015-01-25 16:01:59 -06:00
Christopher Dunn
dea6f8d9a6 incorporate 'proper newlines for comments' into new StreamWriter 2015-01-25 15:55:18 -06:00
Christopher Dunn
fe3979cd8a drop StreamWriterBuilderFactory, for now 2015-01-25 15:54:40 -06:00
Christopher Dunn
94665eab72 copy fixes from StyledStreamWriter 2015-01-25 15:54:40 -06:00
Christopher Dunn
9243d602fe const stuff 2015-01-25 15:54:40 -06:00
Christopher Dunn
beb6f35c63 non-const write 2015-01-25 15:54:40 -06:00
Christopher Dunn
ceef7f5219 copied impl of StyledStreamWriter 2015-01-25 15:54:40 -06:00
Christopher Dunn
d49ab5aee1 use new BuiltStyledStreamWriter in operator<<() 2015-01-25 15:54:40 -06:00
Christopher Dunn
4d649402b0 setIndentation() 2015-01-25 15:54:40 -06:00
Christopher Dunn
489707ff60 StreamWriter::Builder 2015-01-25 15:54:39 -06:00
Christopher Dunn
5fbfe3cdb9 StreamWriter 2015-01-25 15:54:39 -06:00
Christopher Dunn
964affd333 add back space before trailing comment 2015-01-25 15:49:02 -06:00
Christopher Dunn
74c2d82e19 proper newlines for comments
The logic is still messy, but it seems to work.
2015-01-25 15:05:09 -06:00
Christopher Dunn
1e3149ab75 rm trailing newlines for *all* comments
This will make it easier to fix newlines consistently.
2015-01-25 14:32:13 -06:00
datadiode
2f046b584d Fix a border case which causes Value::CommentInfo::setComment() to crash
re: pull #140
2015-01-25 11:19:51 -06:00
Christopher Dunn
7d82b14726 fix issue #90
We are static-casting to U, so we really have no reason to use
references.

However, if this comes up again, try applying -ffloat-store to
the target executable, per
    https://github.com/open-source-parsers/jsoncpp/issues/90
2015-01-24 14:34:54 -06:00
Christopher Dunn
2bc6137ada fix gcc warnings 2015-01-24 13:42:37 -06:00
Christopher Dunn
216ecd3085 fix test_comment_00 for #103 2015-01-23 14:28:44 -06:00
Christopher Dunn
d383056fbb avoid extra newlines in StyledStreamWriter
Add indented_ as a bitfield. (Verified that sizeof(StyledStreamWriter)
remains 96 for binary compatibility. But the new symbol requires a minor
version-bump.)
2015-01-23 14:23:31 -06:00
Christopher Dunn
3efc587fba make StyledStreamWriter work more like StyledWriter
tests pass
2015-01-23 13:36:10 -06:00
Christopher Dunn
3682f60927 --json-writer arg 2015-01-23 13:36:10 -06:00
Christopher Dunn
58c31ac550 mv try-block 2015-01-23 12:35:12 -06:00
Christopher Dunn
08cfd02d8c fix minor bugs in test-runner 2015-01-23 12:35:12 -06:00
Christopher Dunn
79211e1aeb Options class for test 2015-01-23 12:35:12 -06:00
Christopher Dunn
632c9b5032 cleaner 2015-01-23 12:35:12 -06:00
Christopher Dunn
05810a7607 cleaner 2015-01-23 12:35:12 -06:00
Christopher Dunn
942e2c999a unindent test-code 2015-01-23 12:35:12 -06:00
Christopher Dunn
2160c9a042 switch from StyledWriter to StyledStream writer in tests 2015-01-23 09:02:44 -06:00
Christopher Dunn
76746b09fc deprecate old removeMember() 2015-01-22 19:25:44 -06:00
Connor Manning
00b8ce81db Build without warnings with -pedantic enabled. 2015-01-22 10:48:45 -06:00
Christopher Dunn
59167d8627 more changes per cr 2015-01-21 16:05:08 -06:00
Christopher Dunn
05c1b8344d drop this-> (team preference) 2015-01-21 15:43:48 -06:00
Christopher Dunn
e893625e88 test removeIndex/Member() 2015-01-20 17:04:03 -06:00
Christopher Dunn
e87e41cdb0 from Itzik S; see issue #28
with minor corrections
2015-01-20 17:03:58 -06:00
Christopher Dunn
9de2c2d84d partial 2015-01-20 17:02:48 -06:00
Christopher Dunn
46a925ba4a fix compiler warning for a test 2015-01-20 15:19:22 -06:00
Mark Zeren
e39fb0083c Normalize comment EOLs while reading instead of while writing
Tests are currently failing when git cloning on Windows with autocrlf = true. In
that setup multiline comments contain \r\n EOLs. The test code assumes that
comments contain \n EOLs and opens the .actual files (etc.) with "wt" which
converts \n to \r\n. Thus we end up with \r\r\n EOLs in the output, which
triggers a test failure.

Instead we should cannonicalize comments while reading so that they contain only
\n EOLs. This approach simplifies other parts of the reader and writer logic,
and requires no changes to the test. It is a breaking change, but probably the
Right Thing going forward.

This change also fixes dereferencing past the end of the comment string in
StyledWriter::writeCommentBeforeValue.

Tests should be added with appropriate .gitattributes for the input files to
ensure that we run tests for DOS, Mac, and Unix EOL files on all platforms. For
now this change is enough to unblock Windows builds.

issue #116
2015-01-20 13:45:44 -06:00
Christopher Dunn
836f0fb863 fix comments before several types
tests pass
2015-01-20 12:23:44 -06:00
Christopher Dunn
66eb72f121 use SwapPayload() to retain comments
All tests pass, but we might be missing coverage.

issue #47
2015-01-20 12:07:01 -06:00
datadiode
c07ef37904 https://github.com/open-source-parsers/jsoncpp/issues/47 2015-01-18 10:05:25 +01:00
datadiode
09d352ac13 Remove unused functions 2015-01-17 13:26:23 +01:00
datadiode
50753bb808 Simplify Reader::decodeNumber() 2015-01-17 13:21:42 +01:00
datadiode
c1441ef5e0 stricter float parsing
fixes `test/jsonchecker/fail31.json`
(issue #113)
2015-01-16 15:05:12 -06:00
Christopher Dunn
65cee6ea16 fix double->string->double round-trip (bump minor ver.)
See #98.
  http://stackoverflow.com/questions/747470/what-is-the-meaning-of-numeric-limitsdoubledigits10/16941784#16941784
2015-01-06 12:40:36 -06:00
Magnus Bjerke Vik
748328a0d1 Fix cmake_package install being broken because of wrong include path.
The TARGET_INCLUDE_DIRECTORIES from inside the
IF(JSONCPP_WITH_CMAKE_PACKAGE) block was removed, since it only needs to
be set once.

In addition the CMAKE_VERSION check was simplified.
2015-01-06 09:51:44 +01:00
dominicpezzuto
d2b6992f3e Fix build issues related to Solaris and older GCC
Fixed two build issues:
 - JsonCPP currently doesn’t compile for Solaris due to platform
differences with ‘isfinite’ function.  Fixed by adding proper include
and define for Solaris.
 - JsonCPP currently doesn’t compile for GCC version 4.1.2 and earlier
due to use of ‘-Werror=*’ compile flag, which was introduced in a later
version.  Fixed by adding version check to only add this flag on
supported versions of GCC.
2014-12-27 16:45:40 -05:00
dominicpezzuto
54764dd85b Fix build issues related to Solaris and older GCC
Fixed two build issues:
 - JsonCPP currently doesn’t compile for Solaris due to platform
differences with ‘isfinite’ function.  Fixed by adding proper include
and define for Solaris.
 - JsonCPP currently doesn’t compile for GCC version 4.1.2 and earlier
due to use of ‘-Werror=*’ compile flag, which was introduced in a later
version.  Fixed by adding version check to only add this flag on
supported versions of GCC.
2014-12-27 16:44:26 -05:00
Christopher Dunn
8dd32e1e2e Merge pull request #94 from Gachapen/cmake_target_include
CMake: Add include directory to jsoncpp_lib target

Well-researched. Passes Travis CI.
2014-12-24 01:30:13 -06:00
Magnus Bjerke Vik
3fd7f8b470 CMake: Only add include directory to jsoncpp_lib target if CMake version supports the command. 2014-12-16 08:58:52 +01:00
Magnus Bjerke Vik
e99e6d9cc6 CMake: Add include directory to jsoncpp_lib target so that it can be easier used with other projects. 2014-12-03 15:42:41 +01:00
Rémi Verschelde
27639ce578 Add support for BUILD_SHARED_LIBS argument
BUILD_SHARED_LIBS is a standard CMake argument that serves the purpose
of the custom JSONCPP_LIB_BUILD_SHARED. For now we force JSONCPP_LIB_BUILD_SHARED
to true if BUILD_SHARED_LIBS was defined.
Workaround for #51.
2014-12-01 23:47:21 +01:00
xiaoyur347
83683da13f fix gcc warning when CXXFLAGS contains '-Wextra'
json_value.cpp:179:26: warning: enumeral and non-enumeral type in conditional expression [enabled by default]

https://github.com/open-source-parsers/jsoncpp/pull/84
2014-11-19 23:59:34 -06:00
Gaurav
767713be2b Remove gcc compilation warning in json_reader.cpp
Submitting Patch for Issue : https://github.com/open-source-parsers/jsoncpp/issues/77
It will fix warnings in json_reader.cpp
2014-11-17 14:04:03 +05:30
Gaurav
abc1e07543 Prefer appending character constants over string literals - correct patch.
Submitting correct patch for https://github.com/open-source-parsers/jsoncpp/issues/61
2014-11-13 12:47:19 +05:30
Billy Donahue
8eb5d89db6 Remove initInt and initUInt until they are needed. 2014-11-10 01:35:42 -05:00
Yu Xiaolei
dc84d96a49 Add CMake package file generation support 2014-11-05 12:31:44 +08:00
Yu Xiaolei
1c3a20de50 Allow customization of component install dirs 2014-11-05 11:25:53 +08:00
Mara Kim
b84a39cae5 Add public semantic error reporting
Closes open-source-parsers/jsoncpp#57
2014-10-23 02:18:14 -05:00
Cory Quammen
fd06bfca79 Removed unneeded newlines from parsed comments
Newlines from comments separated by lines are retained when comments
are appended, so adding a newline between separate comments for a
node is not needed.
2014-10-09 16:33:29 -04:00
Cory Quammen
4d23492d11 Added printing of comments to *.actual test files
This enables testing of comment-handling code. Updated *.expected test
result files to account for printing of comments.
2014-10-09 16:33:29 -04:00
Chuck Atkins
9dc9026e0b Workaround for missing C99 functions in older versions of Visual Studio 2014-09-19 13:16:09 -04:00
Christopher Dunn
4002f8a4be Revert "Revert "Removed vim mode lines.""
This reverts commit af77b5b594.

See discussion at
  32009b17e4 (commitcomment-7827708)
2014-09-18 16:46:40 -07:00
Christopher Dunn
0375af2eb5 drop version qualifier
This should help keep version.h stable.

    x.y.z-dev
    => major, minor, patch, qual
    == x, y, z, -dev

But we do not need -dev anymore.
2014-09-18 16:43:07 -07:00
Aaron Jacobs
ba330893d7 Ran clang-format again, this time hitting .inl files too.
clang-format -i $(find . -name '*.h' -or -name '*.cpp' -or -name '*.inl')
2014-09-18 16:33:49 -07:00
Christopher Dunn
877dd17206 bump version; proper SOVERSION 2014-09-16 12:42:33 -07:00
Christopher Dunn
16709c6ee8 JSONCPP_VERSION, not JSON_CPP_VERSION 2014-09-16 12:42:33 -07:00
Christopher Dunn
9aa4681052 Revert "Merge branch 'no-version'"
This reverts commit d9ced92d40, reversing
changes made to d2fa664a12.

Conflicts:
	include/json/version.h (keep)
2014-09-16 12:42:32 -07:00
Christopher Dunn
af77b5b594 Revert "Removed vim mode lines."
This reverts commit 32009b17e4.
2014-09-16 12:42:32 -07:00
Aaron Jacobs
11086dd6a7 Enabled PointerBindsToType in clang-format options. 2014-09-15 10:15:29 +10:00
Aaron Jacobs
30b07c0275 Ran clang-format over all .h and .cpp files.
clang-format -i $(find . -name '*.h' -or -name '*.cpp')
2014-09-15 10:14:48 +10:00
Aaron Jacobs
32009b17e4 Removed vim mode lines.
Users can set their own preferences in their personal vimrc.
2014-09-15 08:23:41 +10:00
Christopher Dunn
8f730b8a60 stop using version.h.in for cmake 2014-09-11 10:09:48 -07:00
Billy Donahue
45cd9490cd Switch to copy-and-swap idiom for operator=.
This allows the compiler to elide a copy when rhs is a temporary.
2014-09-10 10:37:34 -07:00
Christopher Dunn
236db83742 ws 2014-09-10 10:35:01 -07:00
Christopher Dunn
9d694516a0 clarify return value 2014-09-03 13:54:49 -07:00
Christopher Dunn
d94caac1ea ws 2014-09-03 13:46:37 -07:00
mloy
8eb6f88a87 snprintf does return a signed integer
assert if returned value is neagtive
2014-09-03 13:37:17 -07:00
Matthias Loy
64d591b720 snprintf already calculated the length 2014-09-03 13:37:17 -07:00
Matthias Loy
fe2cd01e80 free does nothing if parameter equals NULL 2014-09-03 13:37:17 -07:00
Don Milham
5bf16105b5 added option to FastWriter which omits the trailing new line character 2014-09-02 17:09:07 -06:00
Matthias Loy
48d9a92a1b do intermediate step in order to omit "dereferencing type-punned pointer" error 2014-08-13 13:20:29 +02:00
Matthias Loy
f97723dbb7 provoke compile error:
"dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]"
2014-08-13 13:19:02 +02:00
David West
bc5dbc6d41 Patch for bug #53 on version 0.5.0
This is a patch that we have utilized at IDEXX Labs for the the bug described above.
We have tested and verified this on x86 32 and 64 bit linux and 32 bit arm.
2014-08-13 02:03:33 -07:00
Egor Tensin
81d16dfda1 Fixed deprecated target file path location 2014-08-13 02:02:53 -07:00
Chris Gilling
97c77b4a86 add tests to check that exceptions are thrown for wrong types
* Add JSONTEST_ASSERT_THROWS macro to test if an expression
  throws an exceptions.
* add JSONTEST_FIXTURE(ValueTest, typeChecksThrowExceptions)
2014-08-13 02:00:41 -07:00
pffang
27e3263894 WinCE Compatibility Fix
Note: str.imbue and std::locale::classic() are not supported on WINCE
2014-07-10 20:27:52 -07:00
Christopher Dunn
8582876c5c vim modelines 2014-07-10 20:24:23 -07:00
Christopher Dunn
496c655523 fix numeric locale
In some locales (e.g. de_DE) floats have commas instead of
dots, but JSON requires dots.
See:
  https://github.com/open-source-parsers/jsoncpp/pull/9
  https://github.com/open-source-parsers/jsoncpp/pull/3
2014-07-10 20:24:23 -07:00
Christopher Dunn
49c732607b Revert "Merge pull request #7 from steffen-kiess/fix-locale"
This reverts commit 0db9d6ea01, reversing
changes made to 06dcb1fc89.

For discussion, see
  https://github.com/open-source-parsers/jsoncpp/pull/9
  https://github.com/open-source-parsers/jsoncpp/pull/3
2014-07-10 19:59:26 -07:00
Steffen Kieß
b8aaa03367 Use std::stringstream instead of snprintf() for double->string conversion
`snprintf()` will use the current `LC_NUMERIC` locale
for converting a double to a string,
which will use a `,` instead of a `.` in some locales (e.g. de_DE).
`std::stringstream` allows setting the locale to `"C"` to always get a `.`.
This occurs only for that `stringstream` instance; no global is
altered.
2014-07-09 11:46:00 -07:00
renu555
41b79398a3 Always true condition.
for (int index = 0; index < size && !isMultiLine; ++index) 
In addition to dead code, in the above if condition checking to !isMultiLine is of no use as it will be always true and hence "for" depends only on condition [index < size.]
The mentioned test case works fine in this case also.
2014-07-05 19:05:41 -07:00
renu555
66b77384d8 Fix dead code scenario.
Changes explained
2014-07-05 19:05:41 -07:00
renu555
17c244e644 Fixing unreachable condition.
if (!isMultiLine) at line 563 suggests that isMultiline is 0 when if takes true branch. So the condition && at line 571 will always be false.
Also at line 568 !isMultiline in loop conditional check suggests that it depends only on one condition i.e. index <size because !isMultiline is always true. 
Hence , it seems logical mistake at line 571 of using && instead of ||
2014-07-05 19:05:41 -07:00
Christopher Dunn
28836b8acc fix bug for static init
Ugh! Static initialization of instance variables is a very bad idea.

This fix is taken from the Chromium code-base. It includes their
double-fix for ARM.

* https://codereview.chromium.org/24984004
* https://src.chromium.org/viewvc/chrome?revision=226099&view=revision
* https://code.google.com/p/webrtc/issues/detail?id=1777
2014-07-05 17:36:20 -07:00
Aaron Jacobs
3a0c4fcc82 Ran clang-format again. 2014-07-01 09:20:48 +10:00