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 1c58876185d2a4ed87dac4a54b82f607e74f55fd.
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 626cfcdbb83bdc93243d7b64144e88f08c510085)
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