1367 Commits

Author SHA1 Message Date
Sergey Rachev
b640795571 - exported targets go to separate generated file and package config file generated from template to use automatic package resolving and resolution logic
CMake  provides helpers to generate config file. Generated config file has usefull macro check_required_components() to set necessary variables like PackageName_FOUND if requirements has been satisfied. An absence of dedicated config file confuses user project as necessary variables are not set.
2021-05-04 23:34:28 -05:00
Billy Donahue
94cda30dbd
Rearrange Comments::set (#1278)
* slightly optimize Comments::set

Avoid allocation if the set is going to be rejected anyway.

Prototype suggestion from #1277 review thread
2021-03-18 05:22:35 -04:00
PinkD
1ee39a6752 add comment for emitUTF8 in header 2021-03-06 01:33:15 -06:00
Billy Donahue
b1bd848241
fix sign-conversion warning (#1268)
Use ArrayIndex instead of int.  Fixes #1266
2021-02-20 16:07:34 -05:00
Sven Köhler
09c5ecd84f only append _static suffix for microsoft toolchains 2021-02-20 13:40:52 -06:00
Billy Donahue
fda274ddd2
Fix Value::resize to fill all array elements (#1265)
* Fix Value::resize to fill all array elements

Fixes #1264
2021-02-09 23:50:37 -05:00
Yixing Lao
da9e17d257 allow selection of Windows MSVC runtime 2021-02-03 14:29:20 -06:00
Derick Vigne
ac2870298e Fixed pkg-config Version 2021-02-03 13:40:56 -06:00
GermanAizek
c9a976238b minor fixes for 64 bits and refactor code 2021-01-15 11:49:10 -05:00
Riccardo Corsi
eab8ebe644 Disable also Visual Studio warning C4275 (std::exception used as base class in dll-interface class) when building as DLL and JSONCPP_DISABLE_DLL_INTERFACE_WARNING is defined. 2021-01-10 00:50:48 -06:00
Billy Donahue
fe9663e7ed Json::ValueIterator operators * and -> need to be const
Fixes #1249.
2021-01-10 00:40:21 -06:00
Christopher Dunn
5c4219b8ae Update version in dox
We should automate this, but for now we can at least update:

    make -f dev.makefile update-version
    make -f dev.makefile dox
    # Then, go to jsoncpp-doc repo, add, and push.

* https://github.com/open-source-parsers/jsoncpp-docs/issues/2
2021-01-10 00:18:59 -06:00
Christopher Dunn
be4a512887
Remove trailing space characters (#1256)
Also add two newlines

(rebased from `aaronfranke/formatting`)

resolves #1220

Co-authored-by: Aaron Franke <arnfranke@yahoo.com>
2021-01-09 22:39:07 -06:00
Lei
940982438d
Fix a precision bug of valueToString, prevent to give an error result… (#1246)
* Fix a precision bug of valueToString, prevent to give an error result on input of wanted precision 0 and a double value which end of zero before decimal point ,such as 1230.01,12300.1;
Add test cases for double valueToString with precision 0;

* Delete a test case with platform differences in the previous commit

* Fix clang-format.

* Fix clang-format!

Co-authored-by: lilei <dlilei@126.com>
2020-12-15 11:08:05 -08:00
Hans Johnson
8954092f0a
ENH: Prevent cmake in source builds (#1091)
* ENH: Prevent cmake in source builds

Building directly inside the root of the source tree
can cause problems where the build intermediate files
overwrite or conflict with the intended source code
files.

This modification identifies this problem and
issues failure messages and suggestions to over
come the problem with more robust build suggestion.

Co-authored-by: Jordan Bayles <jophba@chromium.org>
2020-11-06 13:35:51 -08:00
Marcel Opprecht
ceae0e3867
Fix clang-tidy warnings (#1231)
* Fix clang-tidy warnings

Signed-off-by: Marcel Opprecht <marcel.opprecht@scandit.com>

* Fixup/clang-format

Co-authored-by: Marcel Opprecht <marcel.opprecht@scandit.com>
Co-authored-by: Jordan Bayles <jophba@chromium.org>
2020-11-06 13:22:26 -08:00
Christian Ledergerber
30170d651c Fix c++20 compilation problem for clang10 and fix potential bug due to compiler optimization 2020-11-02 10:51:39 -05:00
Christopher Dunn
5f4e10462f
Merge pull request #1229 from open-source-parsers/pypi
Try meson/ninja from pypi
2020-10-10 11:30:19 -05:00
Christopher Dunn
bb9db78fe2 Do not allow failures on osx 2020-10-10 11:20:19 -05:00
Christopher Dunn
1664b6bbf8 Try meson/ninja from pypi
This lets us simplify linux a little.

However, we still want to test cmake, so there is only so much we
can simplify.

For OSX, we still need `clang-format` from homebrew.

* Add PYTHONUSERBASE/bin to PATH for linux
2020-10-10 11:19:28 -05:00
Christopher Dunn
5d1cb30e40 clang-format 2020-10-10 11:10:09 -05:00
Ben Boeckel
c60ebf787a test: ensure the version numbers agree 2020-10-03 23:09:25 -05:00
Ben Boeckel
72db276986 version.h: fix the version number in the header
Fixes: #1224
2020-10-03 23:09:25 -05:00
Jordan Bayles
9059f5cad0
Roll version numbers for 1.9.4 release (#1223) 1.9.4 2020-09-25 19:19:16 -07:00
Daniel Engberg
45733df96c meson: Don't specifically look for python3
Not all distributions provide Python as python3 and as Meson already depends on 3.5+ just use what Meson uses.
References: https://mesonbuild.com/Getting-meson.html
https://mesonbuild.com/Python-module.html#find_installation

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
2020-09-01 23:02:57 -05:00
Ben Wolsieffer
5be07bdc5e
Fix generation of pkg-config file with absolute includedir/libdir. (#1199) 2020-07-20 20:36:30 +08:00
Chen
bf0cfa5b46
hot fix for building static lib (#1203)
Fix #1197
2020-07-14 16:37:22 +08:00
Chen
cfc1ad72ad
Enhance cmake script (#1197)
* BUILD_TYPE corresponds to Release/Debug
   but LIB_TYPE corresponds to shared/static.

* Add support to build shared, static and object lib at the same time.
2020-07-13 20:33:58 +08:00
nathanruiz
c8453d39d1
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.
2020-06-23 14:52:28 -07:00
Billy Donahue
632044ad95
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>
2020-06-11 18:14:03 -04:00
Billy Donahue
b3189a0800
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!)
2020-06-11 17:43:44 -04:00
Jordan Bayles
9be5895985
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
2020-05-30 20:20:20 -07:00
kabeer27
6aba23f4a8
Fixes Oss-Fuzz issue: 21916 (#1180)
* Fix heap-buffer-overflow in json_reader
1.9.3
2020-05-29 21:50:26 +08:00
Billy Donahue
c161f4ac69
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.
2020-05-21 11:30:59 -04:00
Billy Donahue
75b360af4a
spot fix #1171: isprint argument must be representable as unsigned char (#1173) 2020-05-13 18:37:02 -04:00
Rosen Penev
e36cff19f0
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>
2020-05-12 19:19:36 -04:00
Edward Brey
b8cb8889aa
Added current dir specifier for PowerShell (#1169)
The `./` is needed before `vcpkg install jsoncpp` when installing with PowerShell.
2020-05-08 09:00:12 +08:00
Chen
d2d4c74a03
Update README.md and add dota17 to AUTHORS list. (#1168)
* update README

* add dota17 to AUTHORS list
2020-04-30 18:05:17 +08:00
Chen
8b7ea09b80
Bump soversion to 24 (#1167) 2020-04-30 17:58:07 +08:00
xkszltl
a4fb5db543
Put ".exe" and ".dll" together to make test usable in build dir. (#1166) 2020-04-30 10:31:54 +08:00
Christopher Dunn
d517d598a7
Merge pull request #1165 from mrjoel/mrjoel/cmake-updates
Improve CMake correctness and handling
2020-04-29 08:27:43 -05:00
Joel Johnson
e9b0b96be6 Remove redundant cmake_minimum_required from example
This is already covered by the toplevel CMake, which also serves to
provide a consistent minimum version.
2020-04-28 15:21:16 -06:00
Joel Johnson
3f0d63b5a9 Use internal CMake compiler version directly 2020-04-28 15:21:16 -06:00
Joel Johnson
524234e479 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.
2020-04-28 15:21:16 -06:00
Joel Johnson
9abf11935c 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.
2020-04-28 15:21:16 -06:00
Joel Johnson
8a5e792f20 Add Clang support, be explicit about MSVC flags 2020-04-28 15:21:16 -06:00
Joel Johnson
30eb5ce128 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.
2020-04-28 15:21:16 -06:00
Joel Johnson
12ceb01485 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.
2020-04-28 15:21:16 -06:00
Joel Johnson
edc6239f39 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.
2020-04-28 15:21:16 -06:00
Joel Johnson
5a0152ae1b Only set CMAKE_BUILD_TYPE for single config generators 2020-04-28 15:21:16 -06:00