mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-16 22:04:36 +00:00
Bug 1375957 - Bump the version of jsoncpp r=kip
MozReview-Commit-ID: IwdWn9R4GRz --HG-- extra : rebase_source : fb3d0ee7bf5cf7aee5b1c871ea35192a55232513
This commit is contained in:
parent
4e9cf83ee8
commit
90de18de8a
@ -1 +1,111 @@
|
||||
Baptiste Lepilleur <blep@users.sourceforge.net>
|
||||
|
||||
Aaron Jacobs <aaronjjacobs@gmail.com>
|
||||
Aaron Jacobs <jacobsa@google.com>
|
||||
Adam Boseley <ABoseley@agjunction.com>
|
||||
Adam Boseley <adam.boseley@gmail.com>
|
||||
Aleksandr Derbenev <13alexac@gmail.com>
|
||||
Alexander Gazarov <DrMetallius@users.noreply.github.com>
|
||||
Alexander V. Brezgin <abrezgin@appliedtech.ru>
|
||||
Alexandr Brezgin <albrezgin@mail.ru>
|
||||
Alexey Kruchinin <alexey@mopals.com>
|
||||
Anton Indrawan <anton.indrawan@gmail.com>
|
||||
Baptiste Jonglez <git@bitsofnetworks.org>
|
||||
Baptiste Lepilleur <baptiste.lepilleur@gmail.com>
|
||||
Baruch Siach <baruch@tkos.co.il>
|
||||
Ben Boeckel <mathstuf@gmail.com>
|
||||
Benjamin Knecht <bknecht@logitech.com>
|
||||
Bernd Kuhls <bernd.kuhls@t-online.de>
|
||||
Billy Donahue <billydonahue@google.com>
|
||||
Braden McDorman <bmcdorman@gmail.com>
|
||||
Brandon Myers <bmyers1788@gmail.com>
|
||||
Brendan Drew <brendan.drew@daqri.com>
|
||||
chason <cxchao802@gmail.com>
|
||||
Chris Gilling <cgilling@iparadigms.com>
|
||||
Christopher Dawes <christopher.dawes.1981@googlemail.com>
|
||||
Christopher Dunn <cdunn2001@gmail.com>
|
||||
Chuck Atkins <chuck.atkins@kitware.com>
|
||||
Cody P Schafer <dev@codyps.com>
|
||||
Connor Manning <connor@hobu.co>
|
||||
Cory Quammen <cory.quammen@kitware.com>
|
||||
Cristóvão B da Cruz e Silva <CrisXed@gmail.com>
|
||||
Daniel Krügler <daniel.kruegler@gmail.com>
|
||||
Dani-Hub <daniel.kruegler@googlemail.com>
|
||||
Dan Liu <gzliudan>
|
||||
datadiode <datadiode@users.noreply.github.com>
|
||||
datadiode <jochen.neubeck@vodafone.de>
|
||||
David Seifert <soap@gentoo.org>
|
||||
David West <david-west@idexx.com>
|
||||
dawesc <chris.dawes@eftlab.co.uk>
|
||||
Dmitry Marakasov <amdmi3@amdmi3.ru>
|
||||
dominicpezzuto <dom@dompezzuto.com>
|
||||
Don Milham <dmilham@gmail.com>
|
||||
drgler <daniel.kruegler@gmail.com>
|
||||
ds283 <D.Seery@sussex.ac.uk>
|
||||
Egor Tensin <Egor.Tensin@gmail.com>
|
||||
eightnoteight <mr.eightnoteight@gmail.com>
|
||||
Evince <baneyue@gmail.com>
|
||||
filipjs <filipjs@users.noreply.github.com>
|
||||
findblar <ft@finbarr.ca>
|
||||
Florian Meier <florian.meier@koalo.de>
|
||||
Gaëtan Lehmann <gaetan.lehmann@gmail.com>
|
||||
Gaurav <g.gupta@samsung.com>
|
||||
Gergely Nagy <ngg@ngg.hu>
|
||||
Gida Pataki <gida.pataki@prezi.com>
|
||||
I3ck <buckmartin@buckmartin.de>
|
||||
Iñaki Baz Castillo <ibc@aliax.net>
|
||||
Jacco <jacco@geul.net>
|
||||
Jean-Christophe Fillion-Robin <jchris.fillionr@kitware.com>
|
||||
Jonas Platte <mail@jonasplatte.de>
|
||||
Jörg Krause <joerg.krause@embedded.rocks>
|
||||
Keith Lea <keith@whamcitylights.com>
|
||||
Kevin Grant <kbradleygrant@gmail.com>
|
||||
Kirill V. Lyadvinsky <jia3ep@gmail.com>
|
||||
Kirill V. Lyadvinsky <mail@codeatcpp.com>
|
||||
Kobi Gurkan <kobigurk@gmail.com>
|
||||
Magnus Bjerke Vik <mbvett@gmail.com>
|
||||
Malay Shah <malays@users.sourceforge.net>
|
||||
Mara Kim <hacker.root@gmail.com>
|
||||
Marek Kotewicz <marek.kotewicz@gmail.com>
|
||||
Mark Lakata <mark@lakata.org>
|
||||
Mark Zeren <mzeren@vmware.com>
|
||||
Martin Buck <buckmartin@buckmartin.de>
|
||||
Martyn Gigg <martyn.gigg@gmail.com>
|
||||
Mattes D <github@xoft.cz>
|
||||
Matthias Loy <matthias.loy@hbm.com>
|
||||
Merlyn Morgan-Graham <kavika@gmail.com>
|
||||
Michael Shields <mshields@google.com>
|
||||
Michał Górny <mgorny@gentoo.org>
|
||||
Mike Naberezny <mike@naberezny.com>
|
||||
mloy <matthias.loy@googlemail.com>
|
||||
Motti <lanzkron@gmail.com>
|
||||
nnkur <nnkur@mail.ru>
|
||||
Omkar Wagh <owagh@owaghlinux.ny.tower-research.com>
|
||||
paulo <paulobrizolara@users.noreply.github.com>
|
||||
pavel.pimenov <pavel.pimenov@gmail.com>
|
||||
Paweł Bylica <chfast@gmail.com>
|
||||
Péricles Lopes Machado <pericles.raskolnikoff@gmail.com>
|
||||
Peter Spiess-Knafl <psk@autistici.org>
|
||||
pffang <pffang@vip.qq.com>
|
||||
Rémi Verschelde <remi@verschelde.fr>
|
||||
renu555 <renu.tyagi@samsung.com>
|
||||
Robert Dailey <rcdailey@gmail.com>
|
||||
Sam Clegg <sbc@chromium.org>
|
||||
selaselah <selah@outlook.com>
|
||||
Sergiy80 <sil2004@gmail.com>
|
||||
sergzub <sergzub@gmail.com>
|
||||
Stefan Schweter <stefan@schweter.it>
|
||||
Steffen Kieß <Steffen.Kiess@ipvs.uni-stuttgart.de>
|
||||
Steven Hahn <hahnse@ornl.gov>
|
||||
Stuart Eichert <stuart@fivemicro.com>
|
||||
SuperManitu <supermanitu@gmail.com>
|
||||
Techwolf <dring@g33kworld.net>
|
||||
Tengiz Sharafiev <btolfa+github@gmail.com>
|
||||
Tomasz Maciejewski <tmaciejewsk@gmail.com>
|
||||
Vicente Olivert Riera <Vincent.Riera@imgtec.com>
|
||||
xiaoyur347 <xiaoyur347@gmail.com>
|
||||
ycqiu <429148848@qq.com>
|
||||
yiqiju <fred_ju@selinc.com>
|
||||
Yu Xiaolei <dreifachstein@gmail.com>
|
||||
|
||||
Google Inc.
|
||||
|
@ -1 +1,2 @@
|
||||
a304d61a7b3ee2700b52abc0b28412aabee782e5
|
||||
56efb6ba83f7c8d63d81e25b42b0367c48aa5f3c
|
||||
|
||||
|
@ -2,12 +2,12 @@ The JsonCpp library's source code, including accompanying documentation,
|
||||
tests and demonstration applications, are licensed under the following
|
||||
conditions...
|
||||
|
||||
The author (Baptiste Lepilleur) explicitly disclaims copyright in all
|
||||
The JsonCpp Authors explicitly disclaim copyright in all
|
||||
jurisdictions which recognize such a disclaimer. In such jurisdictions,
|
||||
this software is released into the Public Domain.
|
||||
|
||||
In jurisdictions which do not recognize Public Domain property (e.g. Germany as of
|
||||
2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur, and is
|
||||
2010), this software is Copyright (c) 2007-2010 by The JsonCpp Authors, and is
|
||||
released under the terms of the MIT License (see below).
|
||||
|
||||
In jurisdictions which recognize Public Domain property, the user of this
|
||||
@ -23,7 +23,7 @@ described in clear, concise terms at:
|
||||
The full text of the MIT License follows:
|
||||
|
||||
========================================================================
|
||||
Copyright (c) 2007-2010 Baptiste Lepilleur
|
||||
Copyright (c) 2007-2010 The JsonCpp Authors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
|
@ -1,5 +1,6 @@
|
||||
Introduction
|
||||
------------
|
||||
# JsonCpp
|
||||
|
||||
[![badge](https://img.shields.io/badge/conan.io-jsoncpp%2F1.8.0-green.svg?logo=data:image/png;base64%2CiVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAMAAAAolt3jAAAA1VBMVEUAAABhlctjlstkl8tlmMtlmMxlmcxmmcxnmsxpnMxpnM1qnc1sn85voM91oM11oc1xotB2oc56pNF6pNJ2ptJ8ptJ8ptN9ptN8p9N5qNJ9p9N9p9R8qtOBqdSAqtOAqtR%2BrNSCrNJ/rdWDrNWCsNWCsNaJs9eLs9iRvNuVvdyVv9yXwd2Zwt6axN6dxt%2Bfx%2BChyeGiyuGjyuCjyuGly%2BGlzOKmzOGozuKoz%2BKqz%2BOq0OOv1OWw1OWw1eWx1eWy1uay1%2Baz1%2Baz1%2Bez2Oe02Oe12ee22ujUGwH3AAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfgBQkREyOxFIh/AAAAiklEQVQI12NgAAMbOwY4sLZ2NtQ1coVKWNvoc/Eq8XDr2wB5Ig62ekza9vaOqpK2TpoMzOxaFtwqZua2Bm4makIM7OzMAjoaCqYuxooSUqJALjs7o4yVpbowvzSUy87KqSwmxQfnsrPISyFzWeWAXCkpMaBVIC4bmCsOdgiUKwh3JojLgAQ4ZCE0AMm2D29tZwe6AAAAAElFTkSuQmCC)](http://www.conan.io/source/jsoncpp/1.8.0/theirix/ci)
|
||||
|
||||
[JSON][json-org] is a lightweight data-interchange format. It can represent
|
||||
numbers, strings, ordered sequences of values, and collections of name/value
|
||||
@ -7,37 +8,45 @@ pairs.
|
||||
|
||||
[json-org]: http://json.org/
|
||||
|
||||
[JsonCpp][] is a C++ library that allows manipulating JSON values, including
|
||||
JsonCpp is a C++ library that allows manipulating JSON values, including
|
||||
serialization and deserialization to and from strings. It can also preserve
|
||||
existing comment in unserialization/serialization steps, making it a convenient
|
||||
format to store user input files.
|
||||
|
||||
[JsonCpp]: http://open-source-parsers.github.io/jsoncpp-docs/doxygen/index.html
|
||||
|
||||
## Documentation
|
||||
|
||||
[JsonCpp documentation][JsonCpp-documentation] is generated using [Doxygen][].
|
||||
|
||||
[JsonCpp-documentation]: http://open-source-parsers.github.io/jsoncpp-docs/doxygen/index.html
|
||||
[Doxygen]: http://www.doxygen.org
|
||||
|
||||
|
||||
## A note on backward-compatibility
|
||||
|
||||
* `1.y.z` is built with C++11.
|
||||
* `0.y.z` can be used with older compilers.
|
||||
* Major versions maintain binary-compatibility.
|
||||
|
||||
# Using JsonCpp in your project
|
||||
-----------------------------
|
||||
|
||||
## Using JsonCpp in your project
|
||||
|
||||
The recommended approach to integrating JsonCpp in your project is to include
|
||||
the [amalgamated source](#generating-amalgamated-source-and-header) (a single
|
||||
`.cpp` file and two `.h` files) in your project, and compile and build as you
|
||||
the [amalgamated source](#generating-amalgamated-source-and-header) (a single
|
||||
`.cpp` file and two `.h` files) in your project, and compile and build as you
|
||||
would any other source file. This ensures consistency of compilation flags and
|
||||
ABI compatibility, issues which arise when building shared or static
|
||||
ABI compatibility, issues which arise when building shared or static
|
||||
libraries. See the next section for instructions.
|
||||
|
||||
The `include/` should be added to your compiler include path. Jsoncpp headers
|
||||
|
||||
The `include/` should be added to your compiler include path. JsonCpp headers
|
||||
should be included as follow:
|
||||
|
||||
#include <json/json.h>
|
||||
|
||||
If JsonCpp was built as a dynamic library on Windows, then your project needs to
|
||||
define the macro `JSON_DLL`.
|
||||
If JsonCpp was built as a dynamic library on Windows, then your project needs to define the macro `JSON_DLL`.
|
||||
|
||||
### Generating amalgamated source and header
|
||||
|
||||
Generating amalgamated source and header
|
||||
----------------------------------------
|
||||
JsonCpp is provided with a script to generate a single header and a single
|
||||
source file to ease inclusion into an existing project. The amalgamated source
|
||||
can be generated at any time by running the following command from the
|
||||
@ -48,6 +57,7 @@ top-directory (this requires Python 2.6):
|
||||
It is possible to specify header name. See the `-h` option for detail.
|
||||
|
||||
By default, the following files are generated:
|
||||
|
||||
* `dist/jsoncpp.cpp`: source file that needs to be added to your project.
|
||||
* `dist/json/json.h`: corresponding header file for use in your project. It is
|
||||
equivalent to including `json/json.h` in non-amalgamated source. This header
|
||||
@ -56,15 +66,51 @@ By default, the following files are generated:
|
||||
JsonCpp types.
|
||||
|
||||
The amalgamated sources are generated by concatenating JsonCpp source in the
|
||||
correct order and defining the macro `JSON_IS_AMALGAMATION` to prevent inclusion
|
||||
of other headers.
|
||||
correct order and defining the macro `JSON_IS_AMALGAMATION` to prevent inclusion of other headers.
|
||||
|
||||
# Contributing to JsonCpp
|
||||
|
||||
Building and testing with CMake
|
||||
-------------------------------
|
||||
[CMake][] is a C++ Makefiles/Solution generator. It is usually available on most
|
||||
Linux system as package. On Ubuntu:
|
||||
## Contributing to JsonCpp
|
||||
|
||||
### Building and testing with Conan
|
||||
|
||||
[Conan](https://www.conan.io/#/) is an open source package manager intended for C/C++ projects.
|
||||
It is cross platform and build system agnostic.
|
||||
|
||||
Conan requires Python for running, and can be installed using pip:
|
||||
|
||||
pip install conan
|
||||
|
||||
Detailed instructions can be found on [conan docs](http://docs.conan.io/en/latest/).
|
||||
|
||||
For build jsoncpp with conan, you need to create a [conanfile.txt](http://docs.conan.io/en/latest/reference/conanfile_txt.html) or a [conanfile.py](http://docs.conan.io/en/latest/reference/conanfile.html). The first is simpler, but the second is more flexible.
|
||||
|
||||
This is a sample conanfile.txt:
|
||||
|
||||
```
|
||||
[requires]
|
||||
jsoncpp/1.8.0@theirix/ci
|
||||
|
||||
[generators]
|
||||
cmake
|
||||
```
|
||||
|
||||
**Note**: cmake is not required, you can use other [integrations](http://docs.conan.io/en/latest/integrations.html). Or you can set the appropriate environment variables, using [virtualenv generators](http://docs.conan.io/en/latest/mastering/virtualenv.html).
|
||||
|
||||
Then run the following command from the conanfile directory:
|
||||
|
||||
conan install --build missing
|
||||
|
||||
This will try to download the appropriate package for your settings (OS, compiler, architecture) from the [recipe packages](https://www.conan.io/source/jsoncpp/1.8.0/theirix/ci). If it is not found, the package will be built.
|
||||
|
||||
**Note**: you do not need to install cmake to build jsoncpp using conan, because the recipe will download it automatically.
|
||||
|
||||
If you need, you can customize the jsoncpp recipe. Just clone/fork [it from github](https://github.com/theirix/conan-jsoncpp/).
|
||||
|
||||
See [integrations instructions](http://docs.conan.io/en/latest/integrations.html) for how to use your build system with conan.
|
||||
|
||||
### Building and testing with CMake
|
||||
|
||||
[CMake][] is a C++ Makefiles/Solution generator. It is usually available on most Linux system as package. On Ubuntu:
|
||||
|
||||
sudo apt-get install cmake
|
||||
|
||||
@ -75,10 +121,10 @@ missing, the build will skip running those tests.
|
||||
|
||||
When running CMake, a few parameters are required:
|
||||
|
||||
* a build directory where the makefiles/solution are generated. It is also used
|
||||
* A build directory where the makefiles/solution are generated. It is also used
|
||||
to store objects, libraries and executables files.
|
||||
* the generator to use: makefiles or Visual Studio solution? What version or
|
||||
Visual Studio, 32 or 64 bits solution?
|
||||
* The generator to use: makefiles or Visual Studio solution? What version or
|
||||
Visual Studio, 32 or 64 bits solution?
|
||||
|
||||
Steps for generating solution/makefiles using `cmake-gui`:
|
||||
|
||||
@ -97,16 +143,20 @@ Alternatively, from the command-line on Unix in the source directory:
|
||||
cmake -DCMAKE_BUILD_TYPE=debug -DBUILD_STATIC_LIBS=ON -DBUILD_SHARED_LIBS=OFF -DARCHIVE_INSTALL_DIR=. -G "Unix Makefiles" ../..
|
||||
make
|
||||
|
||||
For a good pkg-config file, add:
|
||||
|
||||
-DCMAKE_INSTALL_INCLUDEDIR=include/jsoncpp
|
||||
|
||||
Running `cmake -h` will display the list of available generators (passed using
|
||||
the `-G` option).
|
||||
|
||||
By default CMake hides compilation commands. This can be modified by specifying
|
||||
`-DCMAKE_VERBOSE_MAKEFILE=true` when generating makefiles.
|
||||
|
||||
Building and testing with SCons
|
||||
-------------------------------
|
||||
**Note:** The SCons-based build system is deprecated. Please use CMake; see the
|
||||
section above.
|
||||
### Building and testing with SCons
|
||||
|
||||
**Note:** The SCons-based build system is deprecated. Please use CMake (see the
|
||||
section above).
|
||||
|
||||
JsonCpp can use [Scons][] as a build system. Note that SCons requires Python to
|
||||
be installed.
|
||||
@ -133,7 +183,8 @@ If you are building with Microsoft Visual Studio 2008, you need to set up the
|
||||
environment by running `vcvars32.bat` (e.g. MSVC 2008 command prompt) before
|
||||
running SCons.
|
||||
|
||||
## Running the tests manually
|
||||
### Running the tests manually
|
||||
|
||||
You need to run tests manually only if you are troubleshooting an issue.
|
||||
|
||||
In the instructions below, replace `path/to/jsontest` with the path of the
|
||||
@ -142,35 +193,36 @@ In the instructions below, replace `path/to/jsontest` with the path of the
|
||||
cd test
|
||||
# This will run the Reader/Writer tests
|
||||
python runjsontests.py path/to/jsontest
|
||||
|
||||
|
||||
# This will run the Reader/Writer tests, using JSONChecker test suite
|
||||
# (http://www.json.org/JSON_checker/).
|
||||
# Notes: not all tests pass: JsonCpp is too lenient (for example,
|
||||
# it allows an integer to start with '0'). The goal is to improve
|
||||
# strict mode parsing to get all tests to pass.
|
||||
python runjsontests.py --with-json-checker path/to/jsontest
|
||||
|
||||
|
||||
# This will run the unit tests (mostly Value)
|
||||
python rununittests.py path/to/test_lib_json
|
||||
|
||||
|
||||
# You can run the tests using valgrind:
|
||||
python rununittests.py --valgrind path/to/test_lib_json
|
||||
|
||||
## Running the tests using scons
|
||||
### Running the tests using SCons
|
||||
|
||||
Note that tests can be run using SCons using the `check` target:
|
||||
|
||||
scons platform=$PLATFORM check
|
||||
|
||||
Building the documentation
|
||||
--------------------------
|
||||
### Building the documentation
|
||||
|
||||
Run the Python script `doxybuild.py` from the top directory:
|
||||
|
||||
python doxybuild.py --doxygen=$(which doxygen) --open --with-dot
|
||||
|
||||
See `doxybuild.py --help` for options.
|
||||
|
||||
Adding a reader/writer test
|
||||
---------------------------
|
||||
### Adding a reader/writer test
|
||||
|
||||
To add a test, you need to create two files in test/data:
|
||||
|
||||
* a `TESTNAME.json` file, that contains the input document in JSON format.
|
||||
@ -179,21 +231,19 @@ To add a test, you need to create two files in test/data:
|
||||
|
||||
The `TESTNAME.expected` file format is as follows:
|
||||
|
||||
* each line represents a JSON element of the element tree represented by the
|
||||
* Each line represents a JSON element of the element tree represented by the
|
||||
input document.
|
||||
* each line has two parts: the path to access the element separated from the
|
||||
* Each line has two parts: the path to access the element separated from the
|
||||
element value by `=`. Array and object values are always empty (i.e.
|
||||
represented by either `[]` or `{}`).
|
||||
* element path: `.` represents the root element, and is used to separate object
|
||||
* Element path `.` represents the root element, and is used to separate object
|
||||
members. `[N]` is used to specify the value of an array element at index `N`.
|
||||
|
||||
See the examples `test_complex_01.json` and `test_complex_01.expected` to better
|
||||
understand element paths.
|
||||
See the examples `test_complex_01.json` and `test_complex_01.expected` to better understand element paths.
|
||||
|
||||
Understanding reader/writer test output
|
||||
---------------------------------------
|
||||
When a test is run, output files are generated beside the input test files.
|
||||
Below is a short description of the content of each file:
|
||||
### Understanding reader/writer test output
|
||||
|
||||
When a test is run, output files are generated beside the input test files. Below is a short description of the content of each file:
|
||||
|
||||
* `test_complex_01.json`: input JSON document.
|
||||
* `test_complex_01.expected`: flattened JSON element tree used to check if
|
||||
@ -208,7 +258,7 @@ Below is a short description of the content of each file:
|
||||
* `test_complex_01.process-output`: `jsontest` output, typically useful for
|
||||
understanding parsing errors.
|
||||
|
||||
License
|
||||
-------
|
||||
## License
|
||||
|
||||
See the `LICENSE` file for details. In summary, JsonCpp is licensed under the
|
||||
MIT license, or public domain if desired and recognized in your jurisdiction.
|
||||
|
@ -9,6 +9,8 @@
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
|
||||
#pragma pack(push, 8)
|
||||
|
||||
namespace Json {
|
||||
template<typename T>
|
||||
class SecureAllocator {
|
||||
@ -91,4 +93,6 @@ bool operator!=(const SecureAllocator<T>&, const SecureAllocator<U>&) {
|
||||
|
||||
} //namespace Json
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#endif // CPPTL_JSON_ALLOCATOR_H_INCLUDED
|
||||
|
@ -83,10 +83,16 @@
|
||||
// managable and fixes a set of common hard-to-find bugs.
|
||||
#if __cplusplus >= 201103L
|
||||
# define JSONCPP_OVERRIDE override
|
||||
#elif defined(_MSC_VER) && _MSC_VER > 1600
|
||||
# define JSONCPP_NOEXCEPT noexcept
|
||||
#elif defined(_MSC_VER) && _MSC_VER > 1600 && _MSC_VER < 1900
|
||||
# define JSONCPP_OVERRIDE override
|
||||
# define JSONCPP_NOEXCEPT throw()
|
||||
#elif defined(_MSC_VER) && _MSC_VER >= 1900
|
||||
# define JSONCPP_OVERRIDE override
|
||||
# define JSONCPP_NOEXCEPT noexcept
|
||||
#else
|
||||
# define JSONCPP_OVERRIDE
|
||||
# define JSONCPP_NOEXCEPT throw()
|
||||
#endif
|
||||
|
||||
#ifndef JSON_HAS_RVALUE_REFERENCES
|
||||
|
@ -10,6 +10,8 @@
|
||||
#include "forwards.h"
|
||||
#endif // if !defined(JSON_IS_AMALGAMATION)
|
||||
|
||||
#pragma pack(push, 8)
|
||||
|
||||
namespace Json {
|
||||
|
||||
/** \brief Configuration passed to reader and writer.
|
||||
@ -54,4 +56,6 @@ public:
|
||||
|
||||
} // namespace Json
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#endif // CPPTL_JSON_FEATURES_H_INCLUDED
|
||||
|
@ -23,6 +23,8 @@
|
||||
#pragma warning(disable : 4251)
|
||||
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
||||
|
||||
#pragma pack(push, 8)
|
||||
|
||||
namespace Json {
|
||||
|
||||
/** \brief Unserialize a <a HREF="http://www.json.org">JSON</a> document into a
|
||||
@ -397,6 +399,8 @@ JSON_API JSONCPP_ISTREAM& operator>>(JSONCPP_ISTREAM&, Value&);
|
||||
|
||||
} // namespace Json
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
||||
#pragma warning(pop)
|
||||
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
||||
|
@ -42,6 +42,8 @@
|
||||
#pragma warning(disable : 4251)
|
||||
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
||||
|
||||
#pragma pack(push, 8)
|
||||
|
||||
/** \brief JSON (JavaScript Object Notation).
|
||||
*/
|
||||
namespace Json {
|
||||
@ -53,8 +55,8 @@ namespace Json {
|
||||
class JSON_API Exception : public std::exception {
|
||||
public:
|
||||
Exception(JSONCPP_STRING const& msg);
|
||||
~Exception() throw() JSONCPP_OVERRIDE;
|
||||
char const* what() const throw() JSONCPP_OVERRIDE;
|
||||
~Exception() JSONCPP_NOEXCEPT JSONCPP_OVERRIDE;
|
||||
char const* what() const JSONCPP_NOEXCEPT JSONCPP_OVERRIDE;
|
||||
protected:
|
||||
JSONCPP_STRING msg_;
|
||||
};
|
||||
@ -859,6 +861,7 @@ template<>
|
||||
inline void swap(Json::Value& a, Json::Value& b) { a.swap(b); }
|
||||
}
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
||||
#pragma warning(pop)
|
||||
|
@ -3,10 +3,10 @@
|
||||
#ifndef JSON_VERSION_H_INCLUDED
|
||||
# define JSON_VERSION_H_INCLUDED
|
||||
|
||||
# define JSONCPP_VERSION_STRING "1.7.7"
|
||||
# define JSONCPP_VERSION_STRING "1.8.0"
|
||||
# define JSONCPP_VERSION_MAJOR 1
|
||||
# define JSONCPP_VERSION_MINOR 7
|
||||
# define JSONCPP_VERSION_PATCH 7
|
||||
# define JSONCPP_VERSION_MINOR 8
|
||||
# define JSONCPP_VERSION_PATCH 0
|
||||
# define JSONCPP_VERSION_QUALIFIER
|
||||
# define JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8))
|
||||
|
||||
|
@ -20,6 +20,8 @@
|
||||
#pragma warning(disable : 4251)
|
||||
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
||||
|
||||
#pragma pack(push, 8)
|
||||
|
||||
namespace Json {
|
||||
|
||||
class Value;
|
||||
@ -324,6 +326,8 @@ JSON_API JSONCPP_OSTREAM& operator<<(JSONCPP_OSTREAM&, const Value& root);
|
||||
|
||||
} // namespace Json
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
||||
#pragma warning(pop)
|
||||
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
||||
|
@ -1,4 +1,5 @@
|
||||
// Copyright 2007-2011 Baptiste Lepilleur
|
||||
// Copyright (C) 2016 InfoTeCS JSC. All rights reserved.
|
||||
// Distributed under MIT license, or public domain if desired and
|
||||
// recognized in your jurisdiction.
|
||||
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||
@ -44,8 +45,12 @@
|
||||
#pragma warning(disable : 4996)
|
||||
#endif
|
||||
|
||||
static int const stackLimit_g = 1000;
|
||||
static int stackDepth_g = 0; // see readValue()
|
||||
// Define JSONCPP_DEPRECATED_STACK_LIMIT as an appropriate integer at compile time to change the stack limit
|
||||
#if !defined(JSONCPP_DEPRECATED_STACK_LIMIT)
|
||||
#define JSONCPP_DEPRECATED_STACK_LIMIT 1000
|
||||
#endif
|
||||
|
||||
static size_t const stackLimit_g = JSONCPP_DEPRECATED_STACK_LIMIT; // see readValue()
|
||||
|
||||
namespace Json {
|
||||
|
||||
@ -132,13 +137,12 @@ bool Reader::parse(const char* beginDoc,
|
||||
current_ = begin_;
|
||||
lastValueEnd_ = 0;
|
||||
lastValue_ = 0;
|
||||
commentsBefore_ = "";
|
||||
commentsBefore_.clear();
|
||||
errors_.clear();
|
||||
while (!nodes_.empty())
|
||||
nodes_.pop();
|
||||
nodes_.push(&root);
|
||||
|
||||
stackDepth_g = 0; // Yes, this is bad coding, but options are limited.
|
||||
bool successful = readValue();
|
||||
Token token;
|
||||
skipCommentTokens(token);
|
||||
@ -161,12 +165,10 @@ bool Reader::parse(const char* beginDoc,
|
||||
}
|
||||
|
||||
bool Reader::readValue() {
|
||||
// This is a non-reentrant way to support a stackLimit. Terrible!
|
||||
// But this deprecated class has a security problem: Bad input can
|
||||
// cause a seg-fault. This seems like a fair, binary-compatible way
|
||||
// to prevent the problem.
|
||||
if (stackDepth_g >= stackLimit_g) throwRuntimeError("Exceeded stackLimit in readValue().");
|
||||
++stackDepth_g;
|
||||
// readValue() may call itself only if it calls readObject() or ReadArray().
|
||||
// These methods execute nodes_.push() just before and nodes_.pop)() just after calling readValue().
|
||||
// parse() executes one nodes_.push(), so > instead of >=.
|
||||
if (nodes_.size() > stackLimit_g) throwRuntimeError("Exceeded stackLimit in readValue().");
|
||||
|
||||
Token token;
|
||||
skipCommentTokens(token);
|
||||
@ -174,7 +176,7 @@ bool Reader::readValue() {
|
||||
|
||||
if (collectComments_ && !commentsBefore_.empty()) {
|
||||
currentValue().setComment(commentsBefore_, commentBefore);
|
||||
commentsBefore_ = "";
|
||||
commentsBefore_.clear();
|
||||
}
|
||||
|
||||
switch (token.type_) {
|
||||
@ -240,7 +242,6 @@ bool Reader::readValue() {
|
||||
lastValue_ = ¤tValue();
|
||||
}
|
||||
|
||||
--stackDepth_g;
|
||||
return successful;
|
||||
}
|
||||
|
||||
@ -473,7 +474,7 @@ bool Reader::readObject(Token& tokenStart) {
|
||||
break;
|
||||
if (tokenName.type_ == tokenObjectEnd && name.empty()) // empty object
|
||||
return true;
|
||||
name = "";
|
||||
name.clear();
|
||||
if (tokenName.type_ == tokenString) {
|
||||
if (!decodeString(tokenName, name))
|
||||
return recoverFromError(tokenObjectEnd);
|
||||
@ -1028,7 +1029,6 @@ private:
|
||||
Location lastValueEnd_;
|
||||
Value* lastValue_;
|
||||
JSONCPP_STRING commentsBefore_;
|
||||
int stackDepth_;
|
||||
|
||||
OurFeatures const features_;
|
||||
bool collectComments_;
|
||||
@ -1039,7 +1039,6 @@ private:
|
||||
OurReader::OurReader(OurFeatures const& features)
|
||||
: errors_(), document_(), begin_(), end_(), current_(), lastValueEnd_(),
|
||||
lastValue_(), commentsBefore_(),
|
||||
stackDepth_(0),
|
||||
features_(features), collectComments_() {
|
||||
}
|
||||
|
||||
@ -1057,13 +1056,12 @@ bool OurReader::parse(const char* beginDoc,
|
||||
current_ = begin_;
|
||||
lastValueEnd_ = 0;
|
||||
lastValue_ = 0;
|
||||
commentsBefore_ = "";
|
||||
commentsBefore_.clear();
|
||||
errors_.clear();
|
||||
while (!nodes_.empty())
|
||||
nodes_.pop();
|
||||
nodes_.push(&root);
|
||||
|
||||
stackDepth_ = 0;
|
||||
bool successful = readValue();
|
||||
Token token;
|
||||
skipCommentTokens(token);
|
||||
@ -1092,15 +1090,15 @@ bool OurReader::parse(const char* beginDoc,
|
||||
}
|
||||
|
||||
bool OurReader::readValue() {
|
||||
if (stackDepth_ >= features_.stackLimit_) throwRuntimeError("Exceeded stackLimit in readValue().");
|
||||
++stackDepth_;
|
||||
// To preserve the old behaviour we cast size_t to int.
|
||||
if (static_cast<int>(nodes_.size()) > features_.stackLimit_) throwRuntimeError("Exceeded stackLimit in readValue().");
|
||||
Token token;
|
||||
skipCommentTokens(token);
|
||||
bool successful = true;
|
||||
|
||||
if (collectComments_ && !commentsBefore_.empty()) {
|
||||
currentValue().setComment(commentsBefore_, commentBefore);
|
||||
commentsBefore_ = "";
|
||||
commentsBefore_.clear();
|
||||
}
|
||||
|
||||
switch (token.type_) {
|
||||
@ -1190,7 +1188,6 @@ bool OurReader::readValue() {
|
||||
lastValue_ = ¤tValue();
|
||||
}
|
||||
|
||||
--stackDepth_;
|
||||
return successful;
|
||||
}
|
||||
|
||||
@ -1450,7 +1447,7 @@ bool OurReader::readObject(Token& tokenStart) {
|
||||
break;
|
||||
if (tokenName.type_ == tokenObjectEnd && name.empty()) // empty object
|
||||
return true;
|
||||
name = "";
|
||||
name.clear();
|
||||
if (tokenName.type_ == tokenString) {
|
||||
if (!decodeString(tokenName, name))
|
||||
return recoverFromError(tokenObjectEnd);
|
||||
|
@ -6,7 +6,13 @@
|
||||
#ifndef LIB_JSONCPP_JSON_TOOL_H_INCLUDED
|
||||
#define LIB_JSONCPP_JSON_TOOL_H_INCLUDED
|
||||
|
||||
#ifndef NO_LOCALE_SUPPORT
|
||||
|
||||
// Also support old flag NO_LOCALE_SUPPORT
|
||||
#ifdef NO_LOCALE_SUPPORT
|
||||
#define JSONCPP_NO_LOCALE_SUPPORT
|
||||
#endif
|
||||
|
||||
#ifndef JSONCPP_NO_LOCALE_SUPPORT
|
||||
#include <clocale>
|
||||
#endif
|
||||
|
||||
@ -18,7 +24,7 @@
|
||||
|
||||
namespace Json {
|
||||
static char getDecimalPoint() {
|
||||
#ifdef NO_LOCALE_SUPPORT
|
||||
#ifdef JSONCPP_NO_LOCALE_SUPPORT
|
||||
return '\0';
|
||||
#else
|
||||
struct lconv* lc = localeconv();
|
||||
|
@ -193,9 +193,9 @@ namespace Json {
|
||||
Exception::Exception(JSONCPP_STRING const& msg)
|
||||
: msg_(msg)
|
||||
{}
|
||||
Exception::~Exception() throw()
|
||||
Exception::~Exception() JSONCPP_NOEXCEPT
|
||||
{}
|
||||
char const* Exception::what() const throw()
|
||||
char const* Exception::what() const JSONCPP_NOEXCEPT
|
||||
{
|
||||
return msg_.c_str();
|
||||
}
|
||||
@ -303,7 +303,7 @@ bool Value::CZString::operator<(const CZString& other) const {
|
||||
// Assume both are strings.
|
||||
unsigned this_len = this->storage_.length_;
|
||||
unsigned other_len = other.storage_.length_;
|
||||
unsigned min_len = std::min(this_len, other_len);
|
||||
unsigned min_len = std::min<unsigned>(this_len, other_len);
|
||||
JSON_ASSERT(this->cstr_ && other.cstr_);
|
||||
int comp = memcmp(this->cstr_, other.cstr_, min_len);
|
||||
if (comp < 0) return true;
|
||||
@ -343,7 +343,7 @@ bool Value::CZString::isStaticString() const { return storage_.policy_ == noDupl
|
||||
* This optimization is used in ValueInternalMap fast allocator.
|
||||
*/
|
||||
Value::Value(ValueType vtype) {
|
||||
static char const empty[] = "";
|
||||
static char const emptyString[] = "";
|
||||
initBasic(vtype);
|
||||
switch (vtype) {
|
||||
case nullValue:
|
||||
@ -357,7 +357,7 @@ Value::Value(ValueType vtype) {
|
||||
break;
|
||||
case stringValue:
|
||||
// allocated_ == false, so this is safe.
|
||||
value_.string_ = const_cast<char*>(static_cast<char const*>(empty));
|
||||
value_.string_ = const_cast<char*>(static_cast<char const*>(emptyString));
|
||||
break;
|
||||
case arrayValue:
|
||||
case objectValue:
|
||||
@ -398,6 +398,7 @@ Value::Value(double value) {
|
||||
|
||||
Value::Value(const char* value) {
|
||||
initBasic(stringValue, true);
|
||||
JSON_ASSERT_MESSAGE(value != NULL, "Null Value Passed to Value Constructor");
|
||||
value_.string_ = duplicateAndPrefixStringValue(value, static_cast<unsigned>(strlen(value)));
|
||||
}
|
||||
|
||||
@ -566,7 +567,7 @@ bool Value::operator<(const Value& other) const {
|
||||
char const* other_str;
|
||||
decodePrefixedString(this->allocated_, this->value_.string_, &this_len, &this_str);
|
||||
decodePrefixedString(other.allocated_, other.value_.string_, &other_len, &other_str);
|
||||
unsigned min_len = std::min(this_len, other_len);
|
||||
unsigned min_len = std::min<unsigned>(this_len, other_len);
|
||||
JSON_ASSERT(this_str && other_str);
|
||||
int comp = memcmp(this_str, other_str, min_len);
|
||||
if (comp < 0) return true;
|
||||
@ -879,7 +880,7 @@ bool Value::isConvertibleTo(ValueType other) const {
|
||||
case nullValue:
|
||||
return (isNumeric() && asDouble() == 0.0) ||
|
||||
(type_ == booleanValue && value_.bool_ == false) ||
|
||||
(type_ == stringValue && asString() == "") ||
|
||||
(type_ == stringValue && asString().empty()) ||
|
||||
(type_ == arrayValue && value_.map_->size() == 0) ||
|
||||
(type_ == objectValue && value_.map_->size() == 0) ||
|
||||
type_ == nullValue;
|
||||
@ -1279,7 +1280,11 @@ bool Value::isBool() const { return type_ == booleanValue; }
|
||||
bool Value::isInt() const {
|
||||
switch (type_) {
|
||||
case intValue:
|
||||
#if defined(JSON_HAS_INT64)
|
||||
return value_.int_ >= minInt && value_.int_ <= maxInt;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
case uintValue:
|
||||
return value_.uint_ <= UInt(maxInt);
|
||||
case realValue:
|
||||
@ -1294,9 +1299,17 @@ bool Value::isInt() const {
|
||||
bool Value::isUInt() const {
|
||||
switch (type_) {
|
||||
case intValue:
|
||||
#if defined(JSON_HAS_INT64)
|
||||
return value_.int_ >= 0 && LargestUInt(value_.int_) <= LargestUInt(maxUInt);
|
||||
#else
|
||||
return value_.int_ >= 0;
|
||||
#endif
|
||||
case uintValue:
|
||||
#if defined(JSON_HAS_INT64)
|
||||
return value_.uint_ <= maxUInt;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
case realValue:
|
||||
return value_.real_ >= 0 && value_.real_ <= maxUInt &&
|
||||
IsIntegral(value_.real_);
|
||||
@ -1347,16 +1360,28 @@ bool Value::isUInt64() const {
|
||||
}
|
||||
|
||||
bool Value::isIntegral() const {
|
||||
switch (type_) {
|
||||
case intValue:
|
||||
case uintValue:
|
||||
return true;
|
||||
case realValue:
|
||||
#if defined(JSON_HAS_INT64)
|
||||
return isInt64() || isUInt64();
|
||||
// Note that maxUInt64 (= 2^64 - 1) is not exactly representable as a
|
||||
// double, so double(maxUInt64) will be rounded up to 2^64. Therefore we
|
||||
// require the value to be strictly less than the limit.
|
||||
return value_.real_ >= double(minInt64) && value_.real_ < maxUInt64AsDouble && IsIntegral(value_.real_);
|
||||
#else
|
||||
return isInt() || isUInt();
|
||||
#endif
|
||||
return value_.real_ >= minInt && value_.real_ <= maxUInt && IsIntegral(value_.real_);
|
||||
#endif // JSON_HAS_INT64
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Value::isDouble() const { return type_ == realValue || isIntegral(); }
|
||||
bool Value::isDouble() const { return type_ == intValue || type_ == uintValue || type_ == realValue; }
|
||||
|
||||
bool Value::isNumeric() const { return isIntegral() || isDouble(); }
|
||||
bool Value::isNumeric() const { return isDouble(); }
|
||||
|
||||
bool Value::isString() const { return type_ == stringValue; }
|
||||
|
||||
@ -1481,6 +1506,7 @@ Path::Path(const JSONCPP_STRING& path,
|
||||
const PathArgument& a4,
|
||||
const PathArgument& a5) {
|
||||
InArgs in;
|
||||
in.reserve(5);
|
||||
in.push_back(&a1);
|
||||
in.push_back(&a2);
|
||||
in.push_back(&a3);
|
||||
|
@ -139,17 +139,23 @@ namespace {
|
||||
JSONCPP_STRING valueToString(double value, bool useSpecialFloats, unsigned int precision) {
|
||||
// Allocate a buffer that is more than large enough to store the 16 digits of
|
||||
// precision requested below.
|
||||
char buffer[32];
|
||||
char buffer[36];
|
||||
int len = -1;
|
||||
|
||||
char formatString[6];
|
||||
sprintf(formatString, "%%.%dg", precision);
|
||||
char formatString[15];
|
||||
snprintf(formatString, sizeof(formatString), "%%.%dg", precision);
|
||||
|
||||
// Print into the buffer. We need not request the alternative representation
|
||||
// that always has a decimal point because JSON doesn't distingish the
|
||||
// concepts of reals and integers.
|
||||
if (isfinite(value)) {
|
||||
len = snprintf(buffer, sizeof(buffer), formatString, value);
|
||||
|
||||
// try to ensure we preserve the fact that this was given to us as a double on input
|
||||
if (!strstr(buffer, ".") && !strstr(buffer, "e")) {
|
||||
strcat(buffer, ".0");
|
||||
}
|
||||
|
||||
} else {
|
||||
// IEEE standard states that NaN values will not compare to themselves
|
||||
if (value != value) {
|
||||
@ -329,7 +335,7 @@ void FastWriter::dropNullPlaceholders() { dropNullPlaceholders_ = true; }
|
||||
void FastWriter::omitEndingLineFeed() { omitEndingLineFeed_ = true; }
|
||||
|
||||
JSONCPP_STRING FastWriter::write(const Value& root) {
|
||||
document_ = "";
|
||||
document_.clear();
|
||||
writeValue(root);
|
||||
if (!omitEndingLineFeed_)
|
||||
document_ += "\n";
|
||||
@ -397,9 +403,9 @@ StyledWriter::StyledWriter()
|
||||
: rightMargin_(74), indentSize_(3), addChildValues_() {}
|
||||
|
||||
JSONCPP_STRING StyledWriter::write(const Value& root) {
|
||||
document_ = "";
|
||||
document_.clear();
|
||||
addChildValues_ = false;
|
||||
indentString_ = "";
|
||||
indentString_.clear();
|
||||
writeCommentBeforeValue(root);
|
||||
writeValue(root);
|
||||
writeCommentAfterValueOnSameLine(root);
|
||||
@ -613,7 +619,7 @@ StyledStreamWriter::StyledStreamWriter(JSONCPP_STRING indentation)
|
||||
void StyledStreamWriter::write(JSONCPP_OSTREAM& out, const Value& root) {
|
||||
document_ = &out;
|
||||
addChildValues_ = false;
|
||||
indentString_ = "";
|
||||
indentString_.clear();
|
||||
indented_ = true;
|
||||
writeCommentBeforeValue(root);
|
||||
if (!indented_) writeIndent();
|
||||
@ -895,7 +901,7 @@ int BuiltStyledStreamWriter::write(Value const& root, JSONCPP_OSTREAM* sout)
|
||||
sout_ = sout;
|
||||
addChildValues_ = false;
|
||||
indented_ = true;
|
||||
indentString_ = "";
|
||||
indentString_.clear();
|
||||
writeCommentBeforeValue(root);
|
||||
if (!indented_) writeIndent();
|
||||
indented_ = true;
|
||||
@ -1149,10 +1155,10 @@ StreamWriter* StreamWriterBuilder::newStreamWriter() const
|
||||
}
|
||||
JSONCPP_STRING nullSymbol = "null";
|
||||
if (dnp) {
|
||||
nullSymbol = "";
|
||||
nullSymbol.clear();
|
||||
}
|
||||
if (pre > 17) pre = 17;
|
||||
JSONCPP_STRING endingLineFeedSymbol = "";
|
||||
JSONCPP_STRING endingLineFeedSymbol;
|
||||
return new BuiltStyledStreamWriter(
|
||||
indentation, cs,
|
||||
colonSymbol, nullSymbol, endingLineFeedSymbol, usf, pre);
|
||||
|
Loading…
x
Reference in New Issue
Block a user