* 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>
* 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>
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
* 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.
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.
* 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/64Fixes#1187
* semicolon (rookie mistake!)
* Windows tab escape testing with custom locale (#1190)
Co-authored-by: Nikolay Baklicharov <thestorm.nik@gmail.com>
* 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/64Fixes#1187
* semicolon (rookie mistake!)
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
* [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>
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.
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.
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.
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.
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.