Hans Johnson
2853b1cdac
COMP: Use C++11 override directly
...
The override support in C++11 is required so avoid aliasing
this feature. Compilers that do not support the override keyword
are no longer supported.
2019-01-14 16:14:12 -06:00
terrycz126
8b31c6f0fd
Fix redefined(_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES) warning
2019-01-14 16:13:21 -06:00
Brad King
056850c44b
reader: fix signed overflow when parsing negative value
...
Clang's ubsan (-fsanitize=undefined) reports:
runtime error: negation of -9223372036854775808 cannot be represented in
type 'Json::Value::LargestInt' (aka 'long'); cast to an unsigned type to
negate this value to itself
Follow its advice and update the code to remove the explicit negation.
2019-01-11 14:04:41 -06:00
Hans Johnson
5c8e539af4
ENH: MSVS 2013 snprintf compatible substitute
...
Simplify the backwards compatible snprintf configuration for pre
1900 version of MSVC. Otherwise prefer C++11 syntax using std::snprintf.
2018-12-30 15:29:22 -06:00
Radoslav Atanasov
ccd077ffce
Fix MSVC 15.9 (2017) warning C4866
...
by changing operator[] param type from JSONCPP_STRING to const JSONCPP_STRING& for CharReaderBuilder and StreamWriterBuilder (as it is already in Value).
https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/c4866?view=vs-2017
2018-12-30 15:28:09 -06:00
Hans Johnson
4abf4ec208
PERF: Replace explicit return calls of constructor
...
Replaces explicit calls to the constructor in a return with a braced
initializer list. This way the return type is not needlessly duplicated in the
function definition and the return statement.
SRCDIR=/Users/johnsonhj/src/jsoncpp #My local SRC
BLDDIR=/Users/johnsonhj/src/jsoncpp/cmake-build-debug/ #My local BLD
cd /Users/johnsonhj/src/jsoncpp/cmake-build-debug/
run-clang-tidy.py -extra-arg=-D__clang__ -checks=-*,modernize-return-braced-init-list -header-filter=.* -fix
2018-12-30 15:26:29 -06:00
Hans Johnson
f64244ed3f
COMP: Use nullptr instead of 0 or NULL
...
The check converts the usage of null pointer constants (eg. NULL, 0) to
use the new C++11 nullptr keyword.
SRCDIR=/Users/johnsonhj/src/jsoncpp #My local SRC
BLDDIR=/Users/johnsonhj/src/jsoncpp/cmake-build-debug/ #My local BLD
cd /Users/johnsonhj/src/jsoncpp/cmake-build-debug/
run-clang-tidy.py -extra-arg=-D__clang__ -checks=-*,modernize-use-nullptr -header-filter=.* -fix
2018-12-12 13:41:06 -06:00
Marian Klymov
a5d7c714b1
Fix typo in previous fix.
2018-06-02 21:52:45 +03:00
Marian Klymov
84ca7d6f0b
Apply the formatting specified in .clang-format file.
2018-06-02 20:27:31 +03:00
Marian Klymov
fc20134c92
Fix different names for parameters in declaration and definition
2018-06-02 20:15:26 +03:00
Marian Klymov
091e03979d
Reduce scope of variable.
2018-06-02 19:48:10 +03:00
Billy Donahue
b5e1fe89aa
Apply the formatting specified in .clang-format file.
...
$ clang-format --version
clang-format version 7.0.0 (tags/google/stable/2018-01-11)
$ clang-format -i --style=file $(find . -name '*.cpp' -o -name '*.h')
2018-05-20 18:38:42 -04:00
fo40225
cf73619e28
refactoring cross compiler macro
2018-05-09 02:06:19 -05: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
Christopher Dunn
c89f0282d1
Do not write to stderr
...
fixes #665
closes #666
2017-09-09 14:49:55 -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
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
pavel.pimenov
6ca374371e
Fix V815:Decreased performance
2017-04-07 15:41:07 +03: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
Kirill V. Lyadvinsky
86f085b810
Make it a bit more multithreading friendly
2016-11-03 22:45:36 +03:00
Gergely Nagy
f6d785fda8
Fix poss SEGV
...
for non-null terminated input.
2016-09-25 18:45:04 -05: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
ea4af18317
Fix int->char conv warn
...
resolves #473
2016-05-15 23:13:56 -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
Christopher Dawes
75570d7068
Fixing up for #define instead of typedef in secure allocators
2016-03-14 19:15:17 -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
Techwolf
7e46bf76e8
std::snprintf fix for Cygwin
2016-02-10 17:09:32 -08: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
d4513fcf45
Fix conversion warnings/errors
...
See #411 .
http://paste.debian.net/378673/
2016-02-06 09:25:20 -06: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
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
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
Gaurav
83ea25e5e2
Make OurFeatures ctor as default.
...
Please review suggested changes.
2015-09-23 09:42:26 +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
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
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
6416350438
fix ,/. problem in reader
...
fixes #293
2015-06-18 22:45:36 -05:00
Christopher Dunn
2250b3c29d
use Json::RuntimeError
2015-03-08 12:44:55 -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
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
c312dd5ef7
Builder::operator[] plus tests
2015-03-05 09:18:01 -06:00
Christopher Dunn
19c49a459d
fix Builders::validate()
...
(cherry picked from commit 626cfcdbb8
)
2015-03-04 21:14:53 -06:00
Christopher Dunn
2d653bd15d
fix security hole for string-key-lengths > 2^30
2015-03-03 00:14:54 -06:00
Christopher Dunn
0c66e698fb
allowSingleQuotes
...
issue #182
2015-02-24 15:49:45 -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
c58e93b014
fix failing object case
2015-02-19 11:34:35 -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
2474989f24
Old -> Our
2015-02-11 09:48:24 -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
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
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
1e3149ab75
rm trailing newlines for *all* comments
...
This will make it easier to fix newlines consistently.
2015-01-25 14:32:13 -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
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
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
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
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
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
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
Aaron Jacobs
445328ace6
Fixed some clang-format weirdness.
2014-07-01 09:15:11 +10:00
Aaron Jacobs
9fa4e849a1
Ran clang-format over all .h and .cpp files.
...
clang-format -i $(find . -name '*.h' -or -name '*.cpp')
2014-07-01 08:48:54 +10:00
Christopher Dunn
6764059395
fix stdexcept
...
https://sourceforge.net/p/jsoncpp/bugs/68/
2014-05-13 09:49:25 +00:00