Commit Graph

1363 Commits

Author SHA1 Message Date
Hans Johnson
b082693b9e 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.
2019-10-17 10:52:13 -07:00
nicolaswilson
a955529e47 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.
2019-10-17 10:47:51 -07:00
dota17
f59ac2a1d7 add coveralls to test coverage (#1060) 2019-10-17 10:46:41 -07:00
Jordan Bayles
a07b37e4ec
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
2019-10-17 10:43:25 -07:00
Hans Johnson
aebc7faa4f 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
2019-10-17 11:11:34 -05:00
dota17
bdacfd7bc0
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
2019-10-16 14:33:53 +08:00
dota17
c5f66ab816 Test Framework Modify : Remove JSONTEST_REGISTER_FIXTURE (#1050)
* add JSONTEST_FIXTURE_V2 to automatically register

* fix clang-format

* revert singleton
2019-10-15 15:48:50 -07:00
Rosen Penev
bcad4e4de2 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>
2019-10-15 15:27:23 +08:00
dota17
7329223f58
fix clang-format (#1049)
fix clang-format for #1039
2019-10-14 09:42:47 +08:00
Jordan Bayles
2e33c218cb
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
2019-10-11 15:08:42 -07:00
dota17
ddc0748c4f 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+%
2019-10-11 14:39:09 -07:00
es1x
2ee3b1dbb1 Re-add JSONCPP_NORETURN (#1041)
Fixes Visual Studio 2013 compatibility.
2019-10-11 11:33:36 -07:00
Jordan Bayles
f34bf24bbd
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 b27c83f691.
2019-10-11 11:19:00 -07:00
Jacob Bundgaard
c4bc6da87d Fix dead link in CONTRIBUTING.md (#1044) 2019-10-10 10:22:25 +08:00
dota17
736409f1b5 fix clang-format error for ci (#1036)
* fix clang-format error for ci

* update
2019-10-01 12:54:07 -07:00
Griffin Downs
7e97345e26 Add vcpkg installation instructions (#1037) 2019-10-01 12:53:42 -07:00
Vincent
227c7cdfa5 Supplement the testcase for comparing object (#1032)
* supplement the testcase for comparing object

* update testcase

* add a new test scenarios in compareObject
2019-09-25 14:07:34 -07:00
Vincent
00c2c9f6e4 Supplement the testcase for comparing the Array and Null (#1031)
* supplement the testcase for comparing the Array and Null

* update testcase
2019-09-25 14:07:08 -07:00
Jordan Bayles
d448610770
Fixup Json::Value append methods, run clang format. (#1022) 2019-09-25 14:05:45 -07:00
Jordan Bayles
00b979f086
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.
2019-09-25 14:04:53 -07:00
Rosen Penev
ae4dc9aa62 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>
2019-09-25 14:03:30 -07:00
dota17
e9ccbe0145 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
2019-09-17 13:30:00 -07:00
Rosen Penev
21e3d21243 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.
2019-09-17 12:46:55 -07:00
Vincent
c97bd59ff2 add a testcase in ValueTest:CopyObject (#1028) 2019-09-17 12:46:29 -07:00
Jordan Bayles
81ae1d55f7
Just run clang format (#1025) 2019-09-16 12:37:14 -07:00
Jordan Bayles
18f790fbe7
Issue 1021: Fix clang 10 compilation (#1023)
This patch fixes an implicit long to double conversion, fixing
compilation on the as-of-yet unreleased clang v10.
2019-09-16 12:27:59 -07:00
m-gupta
3013ed48b3 jsoncpp: Define JSON_USE_INT64_DOUBLE_CONVERSION for clang as well. (#1002)
The current check to define JSON_USE_INT64_DOUBLE_CONVERSION
works for GCC but not clang.

Clang does define __GNUC__ but with a value 4 which misses
the check for >= 6.

This avoids the -Wimplicit-int-float-conversion warning
when jsoncpp is built with a recent version of clang.

Signed-off-by: Manoj Gupta <manojgupta@google.com>
2019-09-16 12:24:13 -07:00
dota17
2cb9a5803e reinforce readToken function and add simple tests (#1012) 2019-09-16 11:25:22 -07:00
Frank Richter
c5cb313ca0 Do not allow tokenError tokens after input if failIfExtra is set. (#1014)
Currently when failIfExtra is set and strictRoot is not set,
OurReader::parse() will accept trailing non-whitespace after the JSON value
as long as the first token is not a valid JSON token. This commit changes
this to disallow any non-whitespace after the JSON value.

This commit also suppresses the "Extra non-whitespace after JSON value."
error message if parsing was aborted after another error.
2019-09-16 10:41:50 -07:00
dota17
abcd3f7b1f Modify code comments in write.h (#987)
* modify code comments in write.h

* update
2019-09-16 10:40:35 -07:00
dota17
d622250c3e Check the comments array boundry. (#993)
* check the comments array boundry

* remove empty line
2019-09-16 10:40:09 -07:00
dota17
db61dba885 Improving Code Readability (#1004) 2019-09-16 10:35:48 -07:00
dota17
7ef0f9fa5b [Language Conformance] Use constexpr restriction in jsoncpp (#1005)
* use constexpr restriction in jsoncpp

* remove TODO comment
2019-09-16 10:33:47 -07:00
dota17
3550a0a939 add some testcases: WriteTest, StreamWriterTest (#1015) 2019-09-16 10:32:46 -07:00
Google AutoFuzz Team
21ab82916b Add dictionary for fuzzing (#1020) 2019-09-16 10:30:59 -07:00
dota17
fd940255ce change the returned value (#1003) 2019-08-26 12:47:54 -07:00
aliha
472adb60ee Fix a coupe of typos (#1007) 2019-08-26 12:37:05 -07:00
dota17
c92c87b47d Add some test cases in ValueTest (#1010)
* add some test cases in ValueTest

* add some test cases in ValueTest
2019-08-26 12:36:51 -07:00
Frank Richter
b941149a37 tests: Improve CharReaderFailIfExtraTest (#1011)
* There was a nonsensical change of 'failIfExtra' before calling strictMode():
  the latter resets the former.
  Dealt with by having one test with pure strictMode and one with strictMode
  but failIfExtra=false.
* The JSONTEST_ASSERT_STRING_EQUAL tests for the error strings swapped
  the 'expected' and 'actual' values.
2019-08-26 12:36:27 -07:00
dota17
2cf939e8c3 change Value::null to Value::nullSingleton() (#1000) 2019-08-13 22:42:10 -07:00
Jordan Bayles
7b28698c5c
Cleanup versioning strategy relanding (#989) (#997)
* Cleanup versioning strategy

Currently, versioning is a mess. CMake and Meson have seperate build
version number storage locations, with no way of knowing you need to
have both. Plus, due to recent revisions the amalgamate script is broken
unless you build first, and may still be broken afterwards.

This PR fixes some issues with versioning, and adds comments clarifying
what has to be done when doing a release.

* Run clang format

* Update SOVERSION....
2019-08-13 22:41:43 -07:00
Jordan Bayles
0d27381acf
Revert "Cleanup versioning strategy (#989)" (#996)
This reverts commit 12325b814f.
2019-07-31 11:26:48 -07:00
Jordan Bayles
12325b814f
Cleanup versioning strategy (#989)
* Cleanup versioning strategy

Currently, versioning is a mess. CMake and Meson have seperate build
version number storage locations, with no way of knowing you need to
have both. Plus, due to recent revisions the amalgamate script is broken
unless you build first, and may still be broken afterwards.

This PR fixes some issues with versioning, and adds comments clarifying
what has to be done when doing a release.

* Run clang format

* Update SOVERSION....
2019-07-22 15:25:23 -07:00
dota17
b27c83f691 Delete JSONCPP_DEPRECATED, use [[deprecated]] instead. (#978)
* delete JSONCPP_DEPRECATED, use [[deprecated]]

* add pragma warning(disable:4996)

* add error C2416

* update

* update

* update
2019-07-17 13:35:33 -07:00
Billy Donahue
483eba84a7 Improve code comment formatting (Issue #985) 2019-07-17 13:04:53 -07:00
Jordan Bayles
b3507948e2 Fix definition check for GNUC 2019-07-17 13:03:23 -07:00
Jordan Bayles
645250b669 \#979 Fix parseFromStream definition
This patch fixes issue #979, where the parseFromStream definition in
the header is different from the implementation.
2019-07-11 14:38:06 -07:00
Jordan Bayles
25c57812e2 Add new JSON_USE_NULLREF flag
This patch adds a new flag, JSON_USE_NULLREF, which removes
the legacy singletons null, nullRef for consumers that require not
having static initialized globals, like Chromium.
2019-07-11 14:34:51 -07:00
Jordan Bayles
9ef812a097 \#964 Delete JSONCPP_NORETURN for [[noreturn]]
This patch removes the custom JSONCPP_NORETURN macro in favor of the
C++11 standard [[noreturn]] attribute.
2019-07-10 18:57:47 -07:00
lilinchao
60ba071aac pop the root node after readValue() 2019-07-09 16:16:00 -07:00