fo40225
6e5e9be736
corss compiler isnan
2018-05-08 12:35:08 +08:00
fo40225
4050143288
fix ValueTest/integers, CharReaderAllowSpecialFloatsTest/issue209 test failure when fp:fast on msvc
2018-05-05 15:05:22 +08:00
fo40225
3f0d91f08a
fix ValueTest/specialFloats test failure when fp:fast on msvc
2018-05-05 14:38:53 +08:00
Mike R
a07fc53287
Add setting precision for json writers and also add decimal places precision type. ( #752 )
...
* Added setting precision for writers.
* Added special case for precise precision and global precision.
* Added good setting of type of precision and also added this type to BuiltStreamWriter and for its settings.
* Added some tests.
2018-03-13 15:35:31 -05:00
Christopher Dunn
3e2b8ea9cc
Minor changes for static analysis ( #749 )
...
re: #747
2018-03-03 12:51:17 -06:00
Thomas Jandecka
592d942b3b
fix: byte shift when interpreting 32-bit utf-8 codepoints
2018-02-14 14:23:58 +01:00
luzpaz
5b45aa55ca
Misc-typos ( #741 )
...
Found in downstream CMake repo via `codespell -q 3`
2018-02-08 19:05:50 -06:00
Maxim Ky
1ec85c76a4
Value::removeMember arg "removed" is optional now (could be nullptr)
2018-01-29 16:59:24 +03:00
Maxim Ky
c27936e0aa
Value::removeMember moves the existing value to "removed" now
2018-01-29 16:58:45 +03:00
Andrey Okoshkin
9b569c8ce3
Make Value copy constructor simplier
...
Helper private methods Value::dupPayload() and Value::dupMeta() are added.
Value copy constructor doesn't attempt to delete its data first.
* Value::dupPayload() duplicates a payload.
* Value::dupMeta() duplicates comments and an offset position with a limit.
2018-01-12 15:59:20 +03:00
Andrey Okoshkin
392e3a5b49
Add basic test for Value::copy() ( #704 )
2018-01-12 14:36:01 +03:00
Andrey Okoshkin
c69148c946
Fix Value::copyPayload() and Value::copy() ( #704 )
...
Value copy constructor shares the same code with Value::copy() and Value::copyPayload().
New Value::releasePayload() is used to free payload memory.
Fixes : #704
2018-01-12 14:33:47 +03:00
Christopher Dunn
63ab03ca28
replace code point in range(0xD800, 0xDFFF) to replacement mark ( #714 )
...
closes #712
2017-12-20 14:43:55 -06:00
Wolfram Rösler
9079422ac1
Allow Json::Value to be used in a boolean context ( #695 )
...
Must bump soversion too.
2017-12-05 11:18:55 -06:00
Remy Jette
42ca02b833
Fix sign mismatch in valueToString
...
`valueToString` takes an argument `unsigned int precision`, but it is used with `%d` rather than `%u` in the `snprintf` format string. Make the format string look for an unsigned value instead.
2017-12-04 17:49:36 -08:00
Josh Soref
e6a588a246
Spelling ( #703 )
2017-12-03 10:54:29 -06:00
Sascha Zelzer
7c979e8661
Suppress implicit-fallthrough warnings from GCC 7 ( #697 )
...
GCC 7, when compiling with -Wimplicit-fallthrough=1 or higher, issues a warning which can be suppressed using a comment that matches certain regular expressions. The comment change does just that: signal to GCC that the fall through is intentional.
Fixes #676
2017-11-16 13:13:55 -06:00
Marcel Raad
240c85a10c
MSVC warning fixes in tests
...
- only use "#pragma GCC" on GCC-compatible compilers
- suppress deprecation warnings also on MSVC
2017-11-10 11:00:40 +01:00
Christopher Dunn
d61cddedac
rm unused func
2017-10-29 23:45:01 -05:00
Wolfram Rösler
a06b390187
Un-deprecate removeMember overloads, return void ( #693 )
...
* Un-deprecate removeMember overloads, return void
Sometimes we just want to remove something we don't need anymore. Having
to supply a return buffer for the removeMember function to return something
we don't care about is a nuisance. There are removeMember overloads that
don't need a return buffer but they are deprecated. This commit un-deprecates
these overloads and modifies them to return nothing (void) instead of the
object that was removed.
Further discussion: https://github.com/open-source-parsers/jsoncpp/pull/689
WARNING: Changes the return type of the formerly deprecated removeMember
overloads from Value to void. May break existing client code.
* Minor stylistic fixes
Don't explicitly return a void value from a void function. Also, convert
size_t to unsigned in the CZString ctor to avoid a compiler warning.
2017-10-18 00:19:27 -05:00
Paweł Kierski
42a161fc80
Serialize UTF-8 string with Unicode escapes ( #687 )
...
Squashed and merged.
2017-10-03 18:19:20 -07:00
Christopher Dunn
a3a4059367
Use non-deprecated removeMember()
...
closes #683
2017-09-30 00:46:15 -05:00
Christopher Dunn
17c14e73a9
Use move ctor in append()
2017-09-15 18:55:50 -05:00
Christopher Dunn
c89f0282d1
Do not write to stderr
...
fixes #665
closes #666
2017-09-09 14:49:55 -05:00
Christopher Dunn
d830c0ab94
Fix writeCommentBeforeValue() iter deref
...
fixes #649
2017-08-28 08:43:05 -05:00
Christopher Dunn
90591c70cd
Suppress GCC deprecated-declarations warning for tests
2017-08-28 08:42:43 -05:00
Christopher Dunn
6d31cec7cf
Drop scons support
2017-08-27 15:02:01 -05:00
Christopher Dunn
004270db37
Avoid memory error
...
But simply use `.assign()` instead of the extra copy. (See comment from
@BillyDonhue at #580.)
fixes #578
closes #580
2017-08-27 14:16:01 -05:00
Gaurav
9006194139
Fix uninitialized value detected by valgrind
...
Fix issue reported in https://github.com/open-source-parsers/jsoncpp/issues/578
For std::string variable, length() is more readable than size().
2017-08-27 14:16:01 -05:00
damiram
ef16a35328
Fixing warnings. Added JSONCPP_DEPRECATED definition for clang. Also updating .gitignore to ignore .DS_Store files (Mac OS Finder generated)
2017-08-02 22:44:42 -07:00
Александр Малинин
6a15ca6442
Fix non-rvalue Json::Value assignment operator (should copy, not move)
2017-07-31 15:29:02 +03:00
Devin Jeanpierre
59e4d35339
Restore BL's authorship attribution, and add "The Jsoncpp Authors" where it was missing.
...
Requested/noticed in https://github.com/open-source-parsers/jsoncpp/pull/610 , and a
followup to https://github.com/open-source-parsers/jsoncpp/pull/607 .
2017-07-21 03:44:36 -07:00
Christopher Dunn
f26edb05e5
Merge pull request #630 from jschueller/appveyor
...
Fix shared/static lib build conflict
resolves #631
2017-07-16 17:18:24 -05:00
pavel.pimenov
ea9f0cec30
strstr -> strchr
...
https://www.viva64.com/en/w/V817/print/
2017-07-13 14:21:53 +03:00
Julien Schueller
ffdcc9355d
Avoid import/static libs name clash
2017-07-13 09:03:35 +02:00
Dhruv Paranjape
0ba8bd73f5
add move assignment operator for CZString and change copy assignment to const reference.
2017-07-08 17:47:13 +05:30
Dhruv Paranjape
23c44d9f9e
overload append function for R value references.
2017-07-08 17:30:47 +05:30
Dhruv Paranjape
8996c377aa
add move assignment operator for Json::Value class.
2017-07-08 17:27:07 +05:30
Bernhard Hartleb
4a9d77bcf7
Fix issue #567 in writing real values in different locales
...
The output of snprintf might produce ',' separators for decimal places if
certain locales are set. This commit moves the converversion from ',' to '.'
to correct place. Otherwise an additional ".0" might be appended.
2017-06-22 22:46:16 +02:00
Sylvestre Ledru
7f9cc2705c
Allocate the proper memory for formatString. Fix a warning with gcc 7.1
...
/root/firefox-gcc-last/toolkit/components/jsoncpp/src/lib_json/json_writer.cpp:139:16: note: using the range [-2147483648, 2147483647] for directive argument
/root/firefox-gcc-last/toolkit/components/jsoncpp/src/lib_json/json_writer.cpp:146:10: note: 'sprintf' output between 5 and 15 bytes into a destination of size 6
sprintf(formatString, "%%.%dg", precision);
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2017-06-09 22:41:48 +02:00
Anton Indrawan
2e319850d1
Fix QNX build: QNX defines sprintf under the std namespace. Use snprintf instead
2017-05-01 23:14:23 +02:00
pavel.pimenov
6ca374371e
Fix V815:Decreased performance
2017-04-07 15:41:07 +03:00
Alexander V. Brezgin
c442fd96e6
Optimize Value::isIntegral() method
...
Worst case called modf() twice
2017-03-29 06:37:37 +05:00
Gaurav
f251f15e6a
Fix crash issue due to NULL value.
...
Null value in Value constructor will crash strlen(). Avoid crash with JSON_ASSERT_MESSAGE
2017-01-17 17:28:43 +05:30
Christopher Dunn
11836ae9aa
std::min<unsigned>, for VS2015
...
fixes #565
2016-12-21 11:09:57 -06:00
David Seifert
f3a4941590
Replace current install variables with GNUInstallDirs
...
* The GNUInstallDirs module is more idiomatic and supported by
Kitware upstream, whereas the current directories are not
standardised across CMake-using packages. Using CMake native
mechanisms is better than reinventing the wheel, as it makes
using the build system more uniform across the ecosystem
* Use CMAKE_CXX_STANDARD to force C++11
* Require CMake 3.1.0 at a minimum
* Fixed lower/UPPERcase format for function/macro calls
* Fixed indents by replacing tabs with 4 spaces
2016-12-14 17:53:10 +01:00
Christopher Dunn
0d25d9aebf
Merge pull request #556 from Infotecs/nnkur-rec-fix
...
Removed a static variable used to contain the current recursion depth in json_reader.cpp
2016-12-09 10:47:17 -06:00
nnkur
5021e799dc
Renamed JSONCPP_STACK_LIMIT to JSONCPP_DEPRECATED_STACK_LIMIT
...
Renamed JSONCPP_STACK_LIMIT to JSONCPP_DEPRECATED_STACK_LIMIT to stress that usage of this macros assumes old interface.
2016-12-07 15:47:08 +03:00
nnkur
2ecd2a59de
Add files via upload
...
Removed a static variable used to contain the current recursion depth of Reader::readValue(). The number of elements in an internal container Reader::nodes_ is used instead. It is correct because any recursive call of Reader::readValue() is executed with adjacent nodes_.push() and nodes_.pop() calls.
Added the option to change the allowed recursion depth at compile time by defining a macro JSONCPP_STACK_LIMIT as the required integer value.
2016-11-30 18:30:12 +03:00
Alexander V. Brezgin
ee7935986e
Optimize value check
2016-11-20 03:55:08 +03:00
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