1386 Commits

Author SHA1 Message Date
Tero Kinnunen
2d55c7445f
Parse large floats as infinity (#1349) (#1353)
Return 1.9.1 functionality where values too large to fit in
double are converted to positive or negative infinity.

Commit 645cd04 changed functionality so that large floats cause
parse error, while version 1.9.1 accepted them as infinite.
This is problematic because writer outputs infinity values
as `1e+9999`, which could no longer be parsed back.

Fixed also legacy Reader even though it did not parse large values
even before breaking change, due to problematic output/parse asymmetry.

`>>` operator sets value to numeric_limits::max/lowest value if
representation is too large to fit to double. [1][2] In macos
value appears to be parsed to infinity.

> | value in *val*           | description |
> |--------------------------|-------------|
> | numeric_limits::max()    | The sequence represents a value too large for the type of val |
> | numeric_limits::lowest() | The sequence represents a value too large negative for the type of val |

[1] https://www.cplusplus.com/reference/istream/istream/operator%3E%3E/
[2] https://www.cplusplus.com/reference/locale/num_get/get/

Signed-off-by: Tero Kinnunen <tero.kinnunen@vaisala.com>

Co-authored-by: Tero Kinnunen <tero.kinnunen@vaisala.com>
2021-12-14 18:00:28 -08:00
Christopher Dunn
5defb4ed1a
Merge pull request #1351 from open-source-parsers/drop-deprecation-warnings
Drop compile-time deprecation warning
1.9.5
2021-11-03 12:53:28 -05:00
Christopher Dunn
c4904b2c0d Bump micro version 2021-11-03 11:39:54 -05:00
Christopher Dunn
54a5432c01 Drop compile-time deprecation warning 2021-11-03 11:35:15 -05:00
Christopher Dunn
b22302e560
Merge pull request #1347 from fjtrujy/position_independent_code
Fix POSITION_INDEPENDENT_CODE
2021-11-03 10:41:12 -05:00
Francisco Javier Trujillo Mata
29f9853455 Fix cmake config for POSITION_INDEPENDENT_CODE enabling it just when BUILD_SHARED_LIBS is ON 2021-10-29 10:41:41 +02:00
Christopher Dunn
fa747b1ae3 clang-format is not available by default 2021-10-28 13:38:53 -05:00
Alex Beregszaszi
94a6220f7c
Document skipBom in CharReaderBuilder (#1332) 2021-09-21 01:55:25 -04:00
Jack Ullery
c39fbdac0f
minor fix for code examples (#1317) 2021-08-12 17:08:46 -04:00
Frank Dana
65bb1b1c1d
CMake: Remove ancient version checks (#1299)
The minimum version for the project is CMake 3.8.0, so there's
no point in keeping legacy code for pre-3.0 or pre-2.8 CMake.
2021-06-23 11:03:44 -07:00
Mariusz Glebocki
375a1119f8
Add support for Bazel build system (#1275)
Co-authored-by: Christopher Dunn <cdunn2001@gmail.com>
2021-05-05 21:03:02 -05:00
SpaceIm
5fabc5e6d2
conversion errors only if warnings as errors enabled (#1284) 2021-05-05 20:55:25 -05:00
Christopher Dunn
ed1ab7ac45 Avoid getline(s, EOF)
Fixes #1288
2021-05-05 01:21:22 -05:00
Christopher Dunn
bb34617267 Merge branch 'cmake-config-improvements' #1271
(creating merge-commit late, after accidental "rebase-and-merge")
2021-05-04 23:49:10 -05:00
Sergey Rachev
993e4e2828 - isolated namespace targets into separate file 2021-05-04 23:34:28 -05:00
Sergey Rachev
2af4a4c6c8 - workaround for CMake < 3.18 ALIAS target limitation to not point to non-GLOBAL IMPORTED target 2021-05-04 23:34:28 -05:00
Sergey Rachev
a3914b792f - narrowed lines to be aligned with overall file line width 2021-05-04 23:34:28 -05:00
Sergey Rachev
cee42e0bd7 - empty line at end of file 2021-05-04 23:34:28 -05:00
Sergey Rachev
62f3e03475 - declare namespaced export target to simplify the library usage
When the static libary is available use it as exported alias, otherwise use shared library. Cmake takes care about import library when Windows platform DLL is used
2021-05-04 23:34:28 -05:00
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