jsoncpp.git
2 weeks agoDelete nullptr Json::Value constructor (#1194) master
nathanruiz [Tue, 23 Jun 2020 21:52:28 +0000 (07:52 +1000)]
Delete nullptr Json::Value constructor (#1194)

This patch adds an explicit ctor with a std::nullptr_t argument, that is `delete`-d. This keeps Json::Value from exposing a coding error when automatically promoted to a const char* type.

4 weeks agoBilly donahue avoid isprint (#1191)
Billy Donahue [Thu, 11 Jun 2020 22:14:03 +0000 (18:14 -0400)]
Billy donahue avoid isprint (#1191)

* avoid isprint

`std::isprint` is locale-specific and the JSON-spec is not.
In particular, isprint('\t') is true in Windows CP1252.

Has bitten others, e.g. https://github.com/laurikari/tre/issues/64

Fixes #1187

* semicolon (rookie mistake!)

* Windows tab escape testing with custom locale (#1190)

Co-authored-by: Nikolay Baklicharov <thestorm.nik@gmail.com>
4 weeks agoavoid isprint, because it is locale specific (#1189)
Billy Donahue [Thu, 11 Jun 2020 21:43:44 +0000 (17:43 -0400)]
avoid isprint, because it is locale specific (#1189)

* avoid isprint

`std::isprint` is locale-specific and the JSON-spec is not.
In particular, isprint('\t') is true in Windows CP1252.

Has bitten others, e.g. https://github.com/laurikari/tre/issues/64

Fixes #1187

* semicolon (rookie mistake!)

6 weeks agoIssue 1182: Fix fuzzing bug (#1183)
Jordan Bayles [Sun, 31 May 2020 03:20:20 +0000 (20:20 -0700)]
Issue 1182: Fix fuzzing bug (#1183)

This patch fixes a fuzzing bug by resolving a bad fallthrough in the
setComment logic.

The result is that we get a proper error instead of an assert, making
the library friendlier to use and less likely to cause issue for
consumers.

See related Chromium project bug:
https://bugs.chromium.org/p/chromium/issues/detail?id=989851

Issue: 1182

6 weeks agoFixes Oss-Fuzz issue: 21916 (#1180) 1.9.3 v1.9.3
kabeer27 [Fri, 29 May 2020 13:50:26 +0000 (19:20 +0530)]
Fixes Oss-Fuzz issue: 21916 (#1180)

* Fix heap-buffer-overflow in json_reader

7 weeks agoEscape control chars even if emitting UTF8 (#1178)
Billy Donahue [Thu, 21 May 2020 15:30:59 +0000 (11:30 -0400)]
Escape control chars even if emitting UTF8 (#1178)

* Escape control chars even if emitting UTF8

See #1176
Fixes #1175

* review comments

* fix test by stopping early enough to punt on utf8-input.

8 weeks agospot fix #1171: isprint argument must be representable as unsigned char (#1173)
Billy Donahue [Wed, 13 May 2020 22:37:02 +0000 (18:37 -0400)]
spot fix #1171: isprint argument must be representable as unsigned char (#1173)

2 months agoclang-tidy + any_of usage (#1171)
Rosen Penev [Tue, 12 May 2020 23:19:36 +0000 (16:19 -0700)]
clang-tidy + any_of usage (#1171)

* [clang-tidy] change functions to static

Found with readability-convert-member-functions-to-static

Signed-off-by: Rosen Penev <rosenp@gmail.com>
* optimize JsonWriter::validate #1171

* do the same for json_reader

Signed-off-by: Rosen Penev <rosenp@gmail.com>
* use std::any_of

Also simplified two loops.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Co-authored-by: Billy Donahue <billy.donahue@gmail.com>
2 months agoAdded current dir specifier for PowerShell (#1169)
Edward Brey [Fri, 8 May 2020 01:00:12 +0000 (20:00 -0500)]
Added current dir specifier for PowerShell (#1169)

The `./` is needed before `vcpkg install jsoncpp` when installing with PowerShell.

2 months agoUpdate README.md and add dota17 to AUTHORS list. (#1168)
Chen [Thu, 30 Apr 2020 10:05:17 +0000 (18:05 +0800)]
Update README.md and add dota17 to AUTHORS list. (#1168)

* update README

* add dota17 to AUTHORS list

2 months agoBump soversion to 24 (#1167)
Chen [Thu, 30 Apr 2020 09:58:07 +0000 (17:58 +0800)]
Bump soversion to 24 (#1167)

2 months agoPut ".exe" and ".dll" together to make test usable in build dir. (#1166)
xkszltl [Thu, 30 Apr 2020 02:31:54 +0000 (10:31 +0800)]
Put ".exe" and ".dll" together to make test usable in build dir. (#1166)

2 months agoMerge pull request #1165 from mrjoel/mrjoel/cmake-updates
Christopher Dunn [Wed, 29 Apr 2020 13:27:43 +0000 (08:27 -0500)]
Merge pull request #1165 from mrjoel/mrjoel/cmake-updates

Improve CMake correctness and handling

2 months agoRemove redundant cmake_minimum_required from example 1165/head
Joel Johnson [Wed, 19 Feb 2020 16:14:08 +0000 (09:14 -0700)]
Remove redundant cmake_minimum_required from example

This is already covered by the toplevel CMake, which also serves to
provide a consistent minimum version.

2 months agoUse internal CMake compiler version directly
Joel Johnson [Tue, 18 Feb 2020 20:56:26 +0000 (13:56 -0700)]
Use internal CMake compiler version directly

2 months agoUse non-version checked add_compile_options
Joel Johnson [Mon, 20 Jan 2020 20:21:14 +0000 (13:21 -0700)]
Use non-version checked add_compile_options

Commit aebc7fa added version checks for CMake compatibility. In reality,
only the add_compile_definitions need the check - add_compile_options
itself has been supported since 3.0. Tested and confirmed built
successfully with CMake 3.8.0.

2 months agoRemove unused CMake variable
Joel Johnson [Tue, 18 Feb 2020 23:55:45 +0000 (16:55 -0700)]
Remove unused CMake variable

EXTRA_CXX_FLAGS is never defined, making this a noop. Further,
COMPILE_OPTIONS is invalid to set as a DIRECTORY property.

2 months agoAdd Clang support, be explicit about MSVC flags
Joel Johnson [Wed, 1 Jan 2020 03:38:39 +0000 (20:38 -0700)]
Add Clang support, be explicit about MSVC flags

2 months agoCheck compiler using CMAKE_CXX_COMPILER_ID
Joel Johnson [Wed, 1 Jan 2020 03:23:08 +0000 (20:23 -0700)]
Check compiler using CMAKE_CXX_COMPILER_ID

Since the introduction of CMAKE_COMPILER_IS_GNUCXX CMake has
suggested using CMAKE_CXX_COMPILER_ID for more general checks.

2 months agoAlways use consistent CXX_STANDARD
Joel Johnson [Tue, 31 Dec 2019 23:07:22 +0000 (16:07 -0700)]
Always use consistent CXX_STANDARD

Since CMake has subdirectory variable scope, unilaterally set the
CMAKE_CXX_STANDARD variable to use C++11. This covers cases with the
library being included externally, both in cases of only C++98 being
specified, as well as later versions being specified (since the
CXX_STANDARD itself isn't a library dependency, only the PUBLIC
target_compile_features on jsoncpp_lib). The previous direct check for
C++98 is handled by requiring C++11 on this library; should the
compiler being used not support C++11 then CMake will issue an error.

2 months agoNot needed to specify CMAKE_MACOSX_RPATH
Joel Johnson [Tue, 31 Dec 2019 23:03:32 +0000 (16:03 -0700)]
Not needed to specify CMAKE_MACOSX_RPATH

As of CMake 3.0 with CMP0042, MACOSX_RPATH is enabled by default.
Since the validated version used by jsoncpp is later than 3.0,
this is already covered.

2 months agoOnly set CMAKE_BUILD_TYPE for single config generators
Joel Johnson [Tue, 31 Dec 2019 22:42:19 +0000 (15:42 -0700)]
Only set CMAKE_BUILD_TYPE for single config generators

2 months agoConsolidate setting of jsoncpp target properties
Joel Johnson [Wed, 19 Feb 2020 01:04:59 +0000 (18:04 -0700)]
Consolidate setting of jsoncpp target properties

2 months agoDon't use unique variable for postfix
Joel Johnson [Wed, 19 Feb 2020 01:04:04 +0000 (18:04 -0700)]
Don't use unique variable for postfix

The more general CMake way to handle library suffixing is to set
CMAKE_<CONFIG>_POSTFIX, so setting the Debug output suffix name should
be more correctly done by the caller or CMake configurer by setting
the desired value in CMAKE_DEBUG_POSTFIX.

2 months agoallowBom -> skipBom (#1162)
Chen [Tue, 28 Apr 2020 09:30:08 +0000 (17:30 +0800)]
allowBom -> skipBom (#1162)

2 months agoIgnore byte order mark in the head of UTF-8 text. (#1149)
Chen [Tue, 28 Apr 2020 07:16:05 +0000 (15:16 +0800)]
Ignore byte order mark in the head of UTF-8 text. (#1149)

* Ignore bom at the beginning of the UTF-8 text

2 months agoMake throwRuntimeError/throwLogicError print msg when built with JSON_USE_EXCEPTION=0
bcsgh [Tue, 24 Mar 2020 00:34:46 +0000 (17:34 -0700)]
Make throwRuntimeError/throwLogicError print msg when built with JSON_USE_EXCEPTION=0

2 months agoMerge branch 'fixup-tests' into 'master' (#1102)
Christopher Dunn [Fri, 24 Apr 2020 18:06:44 +0000 (13:06 -0500)]
Merge branch 'fixup-tests' into 'master' (#1102)

2 months agoDo not run colliding tests at same time
Christopher Dunn [Fri, 24 Apr 2020 14:24:22 +0000 (09:24 -0500)]
Do not run colliding tests at same time

2 months agoCleanup test configurations
Jordan Bayles [Thu, 14 Nov 2019 18:52:13 +0000 (10:52 -0800)]
Cleanup test configurations

2 months agoIssue 1102: Fixup test suite, fix broken tests
Jordan Bayles [Thu, 14 Nov 2019 18:41:25 +0000 (10:41 -0800)]
Issue 1102: Fixup test suite, fix broken tests

A recent PR broken the JsonChecker tests by adding support for trailing
commas. This didn't end up breaking the build, because those tests
aren't run, except locally and only using CMake.

This patch fixes the tests by adding exclusions for trailing comma
tests, as well as updates Meson to run these tests as part of `ninja
test`.

See issue #1102.

2 months agoStop checking status; raise instead
Christopher Dunn [Fri, 24 Apr 2020 06:45:19 +0000 (01:45 -0500)]
Stop checking status; raise instead

2 months agoninja test
Christopher Dunn [Fri, 24 Apr 2020 05:58:35 +0000 (00:58 -0500)]
ninja test

2 months agoamalgamate: add version.h and allocator.h to the forwards header
Ben Boeckel [Mon, 30 Dec 2019 16:37:14 +0000 (11:37 -0500)]
amalgamate: add version.h and allocator.h to the forwards header

Required to get JSONCPP_USING_SECURE_MEMORY and the SecureAllocator
available for the definition of Allocator.

2 months agoadding myself to AUTHORS as per commits (#1109)
Stefano Fiorentino [Fri, 24 Apr 2020 03:52:56 +0000 (05:52 +0200)]
adding myself to AUTHORS as per commits (#1109)

commits:
ff923658c4d9f1492617557148369b34c71ba623
5907cef86ca699a842d0a8cad4c018b4da5d6e17

3 months agoclang-tidy fixes again (#1155)
Rosen Penev [Sun, 12 Apr 2020 05:26:04 +0000 (22:26 -0700)]
clang-tidy fixes again (#1155)

* [clang-tidy] remove redundant string initialization

Found with readability-redundant-string-init

Signed-off-by: Rosen Penev <rosenp@gmail.com>
* [clang-tidy] switch to raw strings

Easier to read.

Found with modernize-raw-string-literal

Signed-off-by: Rosen Penev <rosenp@gmail.com>
* [clang-tidy] fix performance issues

Found with performance*

Signed-off-by: Rosen Penev <rosenp@gmail.com>
* fix extra comma warnings

Found with clang's -Wextra-semi-stmt

Signed-off-by: Rosen Penev <rosenp@gmail.com>
* remove JSONCPP_OP_EXPLICIT

This codebase in C++11. No need for compatibility with C++98.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
* remove JSONCPP_NOEXCEPT

This codebase is C++11 now. No need for this macro.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 months agorevert trailing comma in old Reader (#1126)
Chen [Thu, 13 Feb 2020 21:25:08 +0000 (05:25 +0800)]
revert trailing comma in old Reader (#1126)

4 months agoRemove '=delete' from template methods for Xcode 8 (#1133)
David Gobbi [Thu, 13 Feb 2020 21:22:49 +0000 (14:22 -0700)]
Remove '=delete' from template methods for Xcode 8 (#1133)

For Apple clang-800.0.42.1, which was released with Xcode 8 in
September 2016, the '=delete' on the 'is' and 'as' methods causes
the following errors for value.h:

  inline declaration of 'as<bool>' follows non-inline definition
  inline declaration of 'is<bool>' follows non-inline definition

etcetera for the other specializations of 'is' and 'as'.  The same
problem also occurs for clang-3.8 but not clang-3.9 or later.

4 months agoUse ccache right (#1139)
Claus Klein [Thu, 13 Feb 2020 21:20:46 +0000 (22:20 +0100)]
Use ccache right (#1139)

* Prevent cmakelint warnings

Use 4 spaces for indent, no tabs

* Use ccache right

fix indents too at CMakeLists.txt

5 months agoclang-tidy fixes again (#1087)
Rosen Penev [Mon, 3 Feb 2020 04:03:45 +0000 (20:03 -0800)]
clang-tidy fixes again (#1087)

* [clang-tidy] Do not use else after return

Found with readability-else-after-return

Signed-off-by: Rosen Penev <rosenp@gmail.com>
* [clang-tidy] Convert several loops to be range based

Found with modernize-loop-convert

Signed-off-by: Rosen Penev <rosenp@gmail.com>
* [clang-tidy] Replace deprecated C headers

Found with modernize-deprecated-headers

Signed-off-by: Rosen Penev <rosenp@gmail.com>
* [clang-tidy] Use auto where applicable

Found with modernize-use-auto

Signed-off-by: Rosen Penev <rosenp@gmail.com>
* .clang-tidy: Add these checks

5 months agofix compile warnning using cmake (#1132)
Chen [Mon, 20 Jan 2020 09:12:35 +0000 (17:12 +0800)]
fix compile warnning using cmake (#1132)

6 months agoMeson updates (#1124)
David Seifert [Tue, 7 Jan 2020 01:23:50 +0000 (02:23 +0100)]
Meson updates (#1124)

* Modernize meson.build

* Make tests optional
* Use `files()` for quick sanity checks

* Bump version to 1.9.3

* Bump SOVERSION, as some functions were removed
  and structs were changed, as determined by
  libabigail.

6 months agojson_writer: fix inverted sense in isAnyCharRequiredQuoting (#1120)
Andrew Childs [Sat, 28 Dec 2019 07:04:24 +0000 (16:04 +0900)]
json_writer: fix inverted sense in isAnyCharRequiredQuoting (#1120)

This bug is only affects platforms where `char` is unsigned.

When char is a signed type, values >= 0x80 are also considered < 0,
and hence require escaping due to the < ' ' condition.

When char is an unsigned type, values >= 0x80 match none of the
conditions and are considered safe to emit without escaping.

This shows up as a test failure:

* Detail of EscapeSequenceTest/writeEscapeSequence test failure:
/build/source/src/test_lib_json/main.cpp(3370): expected == result
  Expected: '["\"","\\","\b","\f","\n","\r","\t","\u0278","\ud852\udf62"]
  '
  Actual  : '["\"","\\","\b","\f","\n","\r","\t","ɸ","𤭢"]
  '

6 months agoReplace Raw Unicode in Testcase (#1127)
Chen [Thu, 26 Dec 2019 08:08:17 +0000 (16:08 +0800)]
Replace Raw Unicode in Testcase (#1127)

* use unicode code point

* change values' order, because JSONTEST_ASSERT_EQUAL(expected, actual)

6 months agoAdd option JSONCPP_WITH_EXAMPLE (#1099)
theirix [Mon, 23 Dec 2019 03:04:44 +0000 (06:04 +0300)]
Add option JSONCPP_WITH_EXAMPLE (#1099)

* Add option JSONCPP_WITH_EXAMPLE

Allows to conditionally build examples as
it has been done for tests.  Useful for packaging.

* Do not build example by default

6 months agofix Reader bug and add testcase (#1122)
Chen [Mon, 23 Dec 2019 02:56:54 +0000 (10:56 +0800)]
fix Reader bug and add testcase (#1122)

7 months agotweak to avoid implicit narrowing warning. (#1114)
Billy Donahue [Wed, 11 Dec 2019 20:12:37 +0000 (15:12 -0500)]
tweak to avoid implicit narrowing warning. (#1114)

* tweak to avoid implicit narrowing warning.

change an int to size_t #1113

* Update main.cpp

7 months agoAdd test cases for Reader (#1108)
Chen [Wed, 4 Dec 2019 02:24:52 +0000 (10:24 +0800)]
Add test cases for Reader  (#1108)

* update testcase for reader

* add a helper function

* refactor structured error testing

7 months agoRun Clang-tidy with modernize-use-auto (#1077)
Chen [Wed, 4 Dec 2019 01:08:45 +0000 (09:08 +0800)]
Run Clang-tidy with modernize-use-auto (#1077)

* Run clang-tidy modify with modernize-use-auto
* Use using instead of typedef

7 months agoAdd an insert overload function (#1110)
Chen [Tue, 3 Dec 2019 01:13:42 +0000 (09:13 +0800)]
Add an insert overload function (#1110)

7 months agoeliminate some redundancy in test_lib_json/main.cpp (#1104)
Billy Donahue [Fri, 15 Nov 2019 14:18:32 +0000 (09:18 -0500)]
eliminate some redundancy in test_lib_json/main.cpp (#1104)

refactor test 'CharReaderAllowDropNullTest/issue178'

7 months agoAdd some testcases for charReader (#1095)
dota17 [Fri, 15 Nov 2019 06:51:43 +0000 (14:51 +0800)]
Add some testcases for charReader (#1095)

* update charReader test case

* remove C ++ compiler version switch for smart pointer

* remove comma test due to PR #1098

7 months agoMerge pull request #1101 from open-source-parsers/drop_cpptl_support
Christopher Dunn [Fri, 15 Nov 2019 06:31:06 +0000 (00:31 -0600)]
Merge pull request #1101 from open-source-parsers/drop_cpptl_support

Issue 1100: Drop CPPTL support

7 months agoReadd some overzealously removed code drop_cpptl_support 1101/head
Jordan Bayles [Thu, 14 Nov 2019 18:15:49 +0000 (10:15 -0800)]
Readd some overzealously removed code

7 months agoIssue 1100: Drop CPPTL support
Jordan Bayles [Thu, 14 Nov 2019 17:38:11 +0000 (09:38 -0800)]
Issue 1100: Drop CPPTL support

CPPTL support is no longer relevant to JsonCpp, and can be removed from
the library. This patch removes all mentions of CPPTL, by removing all
definitions and code sections conditionally compiled only when JsonCpp
is used with CPPTL. Include guards are also renamed to not refer to
CPPTL where appropriate.

7 months agoMerge pull request #1098 from cdunn2001/allow-trailing-commas
Christopher Dunn [Thu, 14 Nov 2019 06:21:18 +0000 (00:21 -0600)]
Merge pull request #1098 from cdunn2001/allow-trailing-commas

Allow trailing comma in objects and arrays

7 months agoRun clang-format 1098/head
Jacob Bundgaard [Mon, 4 Nov 2019 12:29:17 +0000 (13:29 +0100)]
Run clang-format

7 months agoAllow trailing comma in arrays if dropped null placeholders are not allowed
Jacob Bundgaard [Thu, 17 Oct 2019 14:03:31 +0000 (16:03 +0200)]
Allow trailing comma in arrays if dropped null placeholders are not allowed

7 months agoAllow trailing comma in objects
Jacob Bundgaard [Wed, 16 Oct 2019 15:07:41 +0000 (17:07 +0200)]
Allow trailing comma in objects

8 months agosome test coverage for Value::iterator (#1093) 1.9.2
Billy Donahue [Tue, 12 Nov 2019 07:16:54 +0000 (02:16 -0500)]
some test coverage for Value::iterator (#1093)

8 months agoIssue 1066 (#1080)
Billy Donahue [Tue, 12 Nov 2019 03:43:52 +0000 (22:43 -0500)]
Issue 1066 (#1080)

Implemented `as<T>()` and `is<T>()` with accompanying tests

8 months agoNumber fixes (#1053)
Jordan Bayles [Sat, 9 Nov 2019 03:49:16 +0000 (19:49 -0800)]
Number fixes (#1053)

* cleaning up the logic for parsing numbers

* Add Testcases for new Reader in jsontestrunner

8 months agoUpdate coverage badge (#1088)
dota17 [Thu, 7 Nov 2019 07:25:06 +0000 (15:25 +0800)]
Update coverage badge (#1088)

update coverage badge
change int to Json::ArrayIndex in for-loop

8 months agoadd testcase for json_value.cpp to improve coverage [90+%]
chenguoping [Sat, 26 Oct 2019 07:57:35 +0000 (15:57 +0800)]
add testcase for json_value.cpp to improve coverage [90+%]

8 months agoENH: Move to requiring python 3
Hans Johnson [Mon, 4 Nov 2019 13:46:51 +0000 (07:46 -0600)]
ENH: Move to requiring python 3

Resolves #1081

See for more details:
https://devguide.python.org/devcycle/#end-of-life-branches
https://pythonclock.org/

8 months agoCOMP: Remove shadow variable warning
Hans Johnson [Mon, 4 Nov 2019 13:37:19 +0000 (07:37 -0600)]
COMP: Remove shadow variable warning

jsoncpp/src/test_lib_json/main.cpp:2261:30: warning: declaration shadows a local variable [-Wshadow]
    Json::StyledStreamWriter writer;
                             ^
jsoncpp/src/test_lib_json/main.cpp:2237:28: note: previous declaration is here
  Json::StyledStreamWriter writer;
                           ^

8 months agoCOMP: Fix type mismatch ambiguity
Hans Johnson [Mon, 4 Nov 2019 13:35:52 +0000 (07:35 -0600)]
COMP: Fix type mismatch ambiguity

jsoncpp/src/test_lib_json/main.cpp:354:31: error:
  implicit conversion changes signedness: 'int' to
  'std::__1::vector<Json::Value *, std::__1::allocator<Json::Value *> >::size_type'
  aka 'unsigned long') [-Werror,-Wsign-conversion]
    JSONTEST_ASSERT_EQUAL(vec[i], &array[i]);
                          ~~~ ^

8 months agoRemove deprecated makerelease.py
Christopher Dunn [Mon, 4 Nov 2019 09:20:17 +0000 (01:20 -0800)]
Remove deprecated makerelease.py

re: #1081

8 months agoExplicitly specify hexfloat in TestResult operator<< (#1078)
Billy Donahue [Sun, 3 Nov 2019 20:27:39 +0000 (15:27 -0500)]
Explicitly specify hexfloat in TestResult operator<< (#1078)

8 months agoAvoid deprecated Meson feature
Christopher Dunn [Mon, 4 Nov 2019 09:13:59 +0000 (01:13 -0800)]
Avoid deprecated Meson feature

* https://mesonbuild.com/Python-3-module.html

> This module is deprecated and replaced by the python module.

8 months agoUpdate meson/python
Christopher Dunn [Mon, 4 Nov 2019 08:27:02 +0000 (00:27 -0800)]
Update meson/python

```
DEPRECATION: Project targetting '>= 0.41.1' but tried to use feature deprecated since '0.48.0': python3 module
Build targets in project: 3
WARNING: Deprecated features used:
 * 0.48.0: {'python3 module'}
```

8 months agoadd coverage badge in readme (#1072)
dota17 [Sat, 26 Oct 2019 09:03:05 +0000 (17:03 +0800)]
add coverage badge in readme (#1072)

8 months agomodify README.md: add some badges (#1070)
dota17 [Fri, 25 Oct 2019 09:12:11 +0000 (17:12 +0800)]
modify README.md: add some badges (#1070)

8 months agoremove pushError in CharReader (#1055)
dota17 [Wed, 23 Oct 2019 22:31:25 +0000 (06:31 +0800)]
remove pushError in CharReader (#1055)

8 months agoupdate testcases to improve coverage (#1061)
dota17 [Wed, 23 Oct 2019 22:30:34 +0000 (06:30 +0800)]
update testcases to improve coverage (#1061)

8 months agoFix link to Amalgamated wiki article (#1064)
Jacob Bundgaard [Fri, 18 Oct 2019 18:06:56 +0000 (20:06 +0200)]
Fix link to Amalgamated wiki article (#1064)

8 months agoCOMP: Improve const correctness for ValueIterators (#1056)
Hans Johnson [Thu, 17 Oct 2019 17:52:13 +0000 (12:52 -0500)]
COMP: Improve const correctness for ValueIterators (#1056)

The protected deref method had inconsistent interface
of being a const function that returned a non-const
reference.  Resolves #914.

8 months agoAdded emitUTF8 setting. (#1045)
nicolaswilson [Thu, 17 Oct 2019 17:47:51 +0000 (18:47 +0100)]
Added emitUTF8 setting. (#1045)

* Added emitUTF8 setting to emit UTF8 format JSON.

* Added a test for emitUTF8, with it in default, on and off states.

* Review comments addressed.

* Merged master into my branch & resolved conflicts.

* Fix clang-format errors.

* Fix clang-format errors.

* Fixed clang-format errors.

* Fixed clang-format errors.

8 months agoadd coveralls to test coverage (#1060)
dota17 [Thu, 17 Oct 2019 17:46:41 +0000 (01:46 +0800)]
add coveralls to test coverage (#1060)

8 months agoImprove performance for comment parsing (#1052)
Jordan Bayles [Thu, 17 Oct 2019 17:43:25 +0000 (10:43 -0700)]
Improve performance for comment parsing (#1052)

* Improve performance for comment parsing

* Fix weird main.cpp issue

* Readd newline

* remove carriage return feed char

* Remove unnecessary checks

8 months agoBUG: New CMake features used that break backward compatibility
Hans Johnson [Wed, 16 Oct 2019 14:38:05 +0000 (09:38 -0500)]
BUG: New CMake features used that break backward compatibility

We desire for jsoncpp to compile and be readily available
with older  versions of cmake.  The use of newer cmake
commands requires conditional statements so that older
strategies can be used with older versions of cmake.

Resolves: #1018

8 months agoadd a new method to insert a new value in an array at specific index. (#949)
dota17 [Wed, 16 Oct 2019 06:33:53 +0000 (14:33 +0800)]
add a new method to insert a new value in an array at specific index. (#949)

* add a new method to insert a new value in an array at specific index.

* update: index > length, return false;

* fix clang-format

8 months agoTest Framework Modify : Remove JSONTEST_REGISTER_FIXTURE (#1050)
dota17 [Tue, 15 Oct 2019 22:48:50 +0000 (06:48 +0800)]
Test Framework Modify : Remove JSONTEST_REGISTER_FIXTURE (#1050)

* add JSONTEST_FIXTURE_V2 to automatically register

* fix clang-format

* revert singleton

8 months agoclang-tidy cleanups 2 (#1048)
Rosen Penev [Tue, 15 Oct 2019 07:27:23 +0000 (00:27 -0700)]
clang-tidy cleanups 2 (#1048)

* [clang-tidy] Add explicit to single argument constructor

Found with hicpp-explicit-conversions

Signed-off-by: Rosen Penev <rosenp@gmail.com>
* [clang-tidy] Fix mismatching declaration

Found with readability-inconsistent-declaration-parameter-name

Signed-off-by: Rosen Penev <rosenp@gmail.com>
* [clang-tidy] Replace {} with = default

Found with modernize-use-equals-default

Signed-off-by: Rosen Penev <rosenp@gmail.com>
* [clang-tidy] Remove redundant .c_Str

Found with readability-redundant-string-cstr

Signed-off-by: Rosen Penev <rosenp@gmail.com>
* [clang-tidy] Simplify boolean expressions

Found with readability-simplify-boolean-expr

Signed-off-by: Rosen Penev <rosenp@gmail.com>
* [clang-tidy] Use std::move

Found with modernize-pass-by-value

Signed-off-by: Rosen Penev <rosenp@gmail.com>
* [clang-tidy] Uppercase literal suffixes

Found with hicpp-uppercase-literal-suffix

Signed-off-by: Rosen Penev <rosenp@gmail.com>
8 months agofix clang-format (#1049)
dota17 [Mon, 14 Oct 2019 01:42:47 +0000 (09:42 +0800)]
fix clang-format (#1049)

fix clang-format for #1039

9 months agoFix fuzzer off by one error (#1047)
Jordan Bayles [Fri, 11 Oct 2019 22:08:42 +0000 (15:08 -0700)]
Fix fuzzer off by one error (#1047)

* Fix fuzzer off by one error

Currently the fuzzer has an off by one error, as it passing a bad length
to the CharReader::parse method, resulting in a heap buffer overflow.

* Rebase master, rerun clang format

9 months agoadd testcases for writerTest [improve coverage] (#1039)
dota17 [Fri, 11 Oct 2019 21:39:09 +0000 (05:39 +0800)]
add testcases for writerTest [improve coverage] (#1039)

* add testcases for writerTest

* update StyledWriterTest, StyledStreamWriterTest and StreamWriterTest

* run clang-format

* add FastWriter Test

* Improve Coverage to 90+%

9 months agoRe-add JSONCPP_NORETURN (#1041)
es1x [Fri, 11 Oct 2019 18:33:36 +0000 (21:33 +0300)]
Re-add JSONCPP_NORETURN (#1041)

Fixes Visual Studio 2013 compatibility.

9 months agoIssue #958: Travis CI should enforce clang-format standards (#1026)
Jordan Bayles [Fri, 11 Oct 2019 18:19:00 +0000 (11:19 -0700)]
Issue #958: Travis CI should enforce clang-format standards (#1026)

* Issue #958: Travis CI should enfore clang-format standards

This patch adds clang format support to the travis bots.

* Update path

* Roll back to version 8 since 9 is in test

* Cleanup clang

* Revert "Delete JSONCPP_DEPRECATED, use [[deprecated]] instead. (#978)" (#1029)

This reverts commit b27c83f691a03f521a1b3b99eefa2973f8e2bfcd.

9 months agoFix dead link in CONTRIBUTING.md (#1044)
Jacob Bundgaard [Thu, 10 Oct 2019 02:22:25 +0000 (04:22 +0200)]
Fix dead link in CONTRIBUTING.md (#1044)

9 months agofix clang-format error for ci (#1036)
dota17 [Tue, 1 Oct 2019 19:54:07 +0000 (03:54 +0800)]
fix clang-format error for ci (#1036)

* fix clang-format error for ci

* update

9 months agoAdd vcpkg installation instructions (#1037)
Griffin Downs [Tue, 1 Oct 2019 19:53:42 +0000 (12:53 -0700)]
Add vcpkg installation instructions (#1037)

9 months agoSupplement the testcase for comparing object (#1032)
Vincent [Wed, 25 Sep 2019 21:07:34 +0000 (05:07 +0800)]
Supplement the testcase for comparing object (#1032)

* supplement the testcase for comparing object

* update testcase

* add a new test scenarios in compareObject

9 months agoSupplement the testcase for comparing the Array and Null (#1031)
Vincent [Wed, 25 Sep 2019 21:07:08 +0000 (05:07 +0800)]
Supplement the testcase for comparing the Array and Null (#1031)

* supplement the testcase for comparing the Array and Null

* update testcase

9 months agoFixup Json::Value append methods, run clang format. (#1022)
Jordan Bayles [Wed, 25 Sep 2019 21:05:45 +0000 (14:05 -0700)]
Fixup Json::Value append methods, run clang format. (#1022)

9 months agoIssue #970: Rename features.h to json_features.h (#1024)
Jordan Bayles [Wed, 25 Sep 2019 21:04:53 +0000 (14:04 -0700)]
Issue #970: Rename features.h to json_features.h (#1024)

This patch fixes a build issue on CMake, presumably due to the new glibc
having a features.h include file. This patch renames our features.h file
to avoid a name collision.

9 months agoclang-tidy fixes (#1033)
Rosen Penev [Wed, 25 Sep 2019 21:03:30 +0000 (14:03 -0700)]
clang-tidy fixes (#1033)

* [clang-tidy] Replace C typedef with C++ using

Found with modernize-use-using

Added to .clang-tidy file.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
* [clang-tidy] Remove redundant member init

Found with readability-redundant-member-init

Added to .clang-tidy

* [clang-tidy] Replace C casts with C++ ones

Found with google-readability-casting

Signed-off-by: Rosen Penev <rosenp@gmail.com>
* [clang-tidy] Use default member init

Found with modernize-use-default-member-init

Signed-off-by: Rosen Penev <rosenp@gmail.com>
9 months agoCreate an example directory and add some code examples. (#944)
dota17 [Tue, 17 Sep 2019 20:30:00 +0000 (04:30 +0800)]
Create an example directory and add some code examples. (#944)

* update example directory

* modify some compile error.

* update with clang-format

* update

* update

* add_definitions("../include/json")

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# Date:      Wed Jul 10 21:26:16 2019 +0800
#
# On branch code_example
# Your branch is up-to-date with 'origin/code_example'.
#
# Changes to be committed:
# modified:   example/CMakeLists.txt
#

* change CMakeLists.txt

* update streamWrite.cpp

* update

* Update readFromStream.cpp

* fix typo

9 months agopkgconfig: Fix for cross compilation (#1027)
Rosen Penev [Tue, 17 Sep 2019 19:46:55 +0000 (12:46 -0700)]
pkgconfig: Fix for cross compilation (#1027)

exec_ and prefix must be overridden  in such a case.

Makes the .pc file more consistent with other projects.

9 months agoadd a testcase in ValueTest:CopyObject (#1028)
Vincent [Tue, 17 Sep 2019 19:46:29 +0000 (03:46 +0800)]
add a testcase in ValueTest:CopyObject (#1028)