- jsoncpp: bump to version 1.9.5

Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
svenhoefer
2022-07-16 15:25:02 +02:00
committed by Thilo Graf
parent 1ffd91ebee
commit e2bb70c4f1
3 changed files with 45 additions and 28 deletions

View File

@@ -94,10 +94,10 @@ license you like.
// 3. /CMakeLists.txt // 3. /CMakeLists.txt
// IMPORTANT: also update the SOVERSION!! // IMPORTANT: also update the SOVERSION!!
#define JSONCPP_VERSION_STRING "1.9.4" #define JSONCPP_VERSION_STRING "1.9.5"
#define JSONCPP_VERSION_MAJOR 1 #define JSONCPP_VERSION_MAJOR 1
#define JSONCPP_VERSION_MINOR 9 #define JSONCPP_VERSION_MINOR 9
#define JSONCPP_VERSION_PATCH 4 #define JSONCPP_VERSION_PATCH 5
#define JSONCPP_VERSION_QUALIFIER #define JSONCPP_VERSION_QUALIFIER
#define JSONCPP_VERSION_HEXA \ #define JSONCPP_VERSION_HEXA \
((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | \ ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | \
@@ -136,7 +136,8 @@ license you like.
#include <cstring> #include <cstring>
#include <memory> #include <memory>
#pragma pack(push, 8) #pragma pack(push)
#pragma pack()
namespace Json { namespace Json {
template <typename T> class SecureAllocator { template <typename T> class SecureAllocator {

View File

@@ -93,10 +93,10 @@ license you like.
// 3. /CMakeLists.txt // 3. /CMakeLists.txt
// IMPORTANT: also update the SOVERSION!! // IMPORTANT: also update the SOVERSION!!
#define JSONCPP_VERSION_STRING "1.9.4" #define JSONCPP_VERSION_STRING "1.9.5"
#define JSONCPP_VERSION_MAJOR 1 #define JSONCPP_VERSION_MAJOR 1
#define JSONCPP_VERSION_MINOR 9 #define JSONCPP_VERSION_MINOR 9
#define JSONCPP_VERSION_PATCH 4 #define JSONCPP_VERSION_PATCH 5
#define JSONCPP_VERSION_QUALIFIER #define JSONCPP_VERSION_QUALIFIER
#define JSONCPP_VERSION_HEXA \ #define JSONCPP_VERSION_HEXA \
((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | \ ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | \
@@ -135,7 +135,8 @@ license you like.
#include <cstring> #include <cstring>
#include <memory> #include <memory>
#pragma pack(push, 8) #pragma pack(push)
#pragma pack()
namespace Json { namespace Json {
template <typename T> class SecureAllocator { template <typename T> class SecureAllocator {
@@ -459,7 +460,8 @@ class ValueConstIterator;
#include "forwards.h" #include "forwards.h"
#endif // if !defined(JSON_IS_AMALGAMATION) #endif // if !defined(JSON_IS_AMALGAMATION)
#pragma pack(push, 8) #pragma pack(push)
#pragma pack()
namespace Json { namespace Json {
@@ -577,7 +579,8 @@ public:
#pragma warning(disable : 4251 4275) #pragma warning(disable : 4251 4275)
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
#pragma pack(push, 8) #pragma pack(push)
#pragma pack()
/** \brief JSON (JavaScript Object Notation). /** \brief JSON (JavaScript Object Notation).
*/ */
@@ -960,7 +963,7 @@ public:
/// \post type() is arrayValue /// \post type() is arrayValue
void resize(ArrayIndex newSize); void resize(ArrayIndex newSize);
//@{ ///@{
/// Access an array element (zero based index). If the array contains less /// Access an array element (zero based index). If the array contains less
/// than index element, then null value are inserted in the array so that /// than index element, then null value are inserted in the array so that
/// its size is index+1. /// its size is index+1.
@@ -968,15 +971,15 @@ public:
/// this from the operator[] which takes a string.) /// this from the operator[] which takes a string.)
Value& operator[](ArrayIndex index); Value& operator[](ArrayIndex index);
Value& operator[](int index); Value& operator[](int index);
//@} ///@}
//@{ ///@{
/// Access an array element (zero based index). /// Access an array element (zero based index).
/// (You may need to say 'value[0u]' to get your compiler to distinguish /// (You may need to say 'value[0u]' to get your compiler to distinguish
/// this from the operator[] which takes a string.) /// this from the operator[] which takes a string.)
const Value& operator[](ArrayIndex index) const; const Value& operator[](ArrayIndex index) const;
const Value& operator[](int index) const; const Value& operator[](int index) const;
//@} ///@}
/// If the array contains at least index+1 elements, returns the element /// If the array contains at least index+1 elements, returns the element
/// value, otherwise returns defaultValue. /// value, otherwise returns defaultValue.
@@ -1496,7 +1499,8 @@ inline void swap(Value& a, Value& b) { a.swap(b); }
#pragma warning(disable : 4251) #pragma warning(disable : 4251)
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
#pragma pack(push, 8) #pragma pack(push)
#pragma pack()
namespace Json { namespace Json {
@@ -1506,8 +1510,7 @@ namespace Json {
* \deprecated Use CharReader and CharReaderBuilder. * \deprecated Use CharReader and CharReaderBuilder.
*/ */
class JSONCPP_DEPRECATED( class JSON_API Reader {
"Use CharReader and CharReaderBuilder instead.") JSON_API Reader {
public: public:
using Char = char; using Char = char;
using Location = const Char*; using Location = const Char*;
@@ -1524,13 +1527,13 @@ public:
}; };
/** \brief Constructs a Reader allowing all features for parsing. /** \brief Constructs a Reader allowing all features for parsing.
* \deprecated Use CharReader and CharReaderBuilder.
*/ */
JSONCPP_DEPRECATED("Use CharReader and CharReaderBuilder instead")
Reader(); Reader();
/** \brief Constructs a Reader allowing the specified feature set for parsing. /** \brief Constructs a Reader allowing the specified feature set for parsing.
* \deprecated Use CharReader and CharReaderBuilder.
*/ */
JSONCPP_DEPRECATED("Use CharReader and CharReaderBuilder instead")
Reader(const Features& features); Reader(const Features& features);
/** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a> /** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a>
@@ -1913,7 +1916,8 @@ JSON_API IStream& operator>>(IStream&, Value&);
#pragma warning(disable : 4251) #pragma warning(disable : 4251)
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
#pragma pack(push, 8) #pragma pack(push)
#pragma pack()
namespace Json { namespace Json {
@@ -2040,7 +2044,7 @@ public:
/** \brief Abstract class for writers. /** \brief Abstract class for writers.
* \deprecated Use StreamWriter. (And really, this is an implementation detail.) * \deprecated Use StreamWriter. (And really, this is an implementation detail.)
*/ */
class JSONCPP_DEPRECATED("Use StreamWriter instead") JSON_API Writer { class JSON_API Writer {
public: public:
virtual ~Writer(); virtual ~Writer();
@@ -2060,7 +2064,7 @@ public:
#pragma warning(push) #pragma warning(push)
#pragma warning(disable : 4996) // Deriving from deprecated class #pragma warning(disable : 4996) // Deriving from deprecated class
#endif #endif
class JSONCPP_DEPRECATED("Use StreamWriterBuilder instead") JSON_API FastWriter class JSON_API FastWriter
: public Writer { : public Writer {
public: public:
FastWriter(); FastWriter();
@@ -2110,7 +2114,7 @@ private:
* - otherwise, it the values do not fit on one line, or the array contains * - otherwise, it the values do not fit on one line, or the array contains
* object or non empty array, then print one value per line. * object or non empty array, then print one value per line.
* *
* If the Value have comments then they are outputed according to their * If the Value have comments then they are outputted according to their
*#CommentPlacement. *#CommentPlacement.
* *
* \sa Reader, Value, Value::setComment() * \sa Reader, Value, Value::setComment()
@@ -2120,7 +2124,7 @@ private:
#pragma warning(push) #pragma warning(push)
#pragma warning(disable : 4996) // Deriving from deprecated class #pragma warning(disable : 4996) // Deriving from deprecated class
#endif #endif
class JSONCPP_DEPRECATED("Use StreamWriterBuilder instead") JSON_API class JSON_API
StyledWriter : public Writer { StyledWriter : public Writer {
public: public:
StyledWriter(); StyledWriter();
@@ -2179,7 +2183,7 @@ private:
* - otherwise, it the values do not fit on one line, or the array contains * - otherwise, it the values do not fit on one line, or the array contains
* object or non empty array, then print one value per line. * object or non empty array, then print one value per line.
* *
* If the Value have comments then they are outputed according to their * If the Value have comments then they are outputted according to their
#CommentPlacement. #CommentPlacement.
* *
* \sa Reader, Value, Value::setComment() * \sa Reader, Value, Value::setComment()
@@ -2189,7 +2193,7 @@ private:
#pragma warning(push) #pragma warning(push)
#pragma warning(disable : 4996) // Deriving from deprecated class #pragma warning(disable : 4996) // Deriving from deprecated class
#endif #endif
class JSONCPP_DEPRECATED("Use StreamWriterBuilder instead") JSON_API class JSON_API
StyledStreamWriter { StyledStreamWriter {
public: public:
/** /**

View File

@@ -250,6 +250,7 @@ Iter fixZerosInTheEnd(Iter begin, Iter end, unsigned int precision) {
#endif // if !defined(JSON_IS_AMALGAMATION) #endif // if !defined(JSON_IS_AMALGAMATION)
#include <algorithm> #include <algorithm>
#include <cassert> #include <cassert>
#include <cmath>
#include <cstring> #include <cstring>
#include <iostream> #include <iostream>
#include <istream> #include <istream>
@@ -838,9 +839,15 @@ bool Reader::decodeDouble(Token& token, Value& decoded) {
double value = 0; double value = 0;
String buffer(token.start_, token.end_); String buffer(token.start_, token.end_);
IStringStream is(buffer); IStringStream is(buffer);
if (!(is >> value)) if (!(is >> value)) {
return addError( if (value == std::numeric_limits<double>::max())
value = std::numeric_limits<double>::infinity();
else if (value == std::numeric_limits<double>::lowest())
value = -std::numeric_limits<double>::infinity();
else if (!std::isinf(value))
return addError(
"'" + String(token.start_, token.end_) + "' is not a number.", token); "'" + String(token.start_, token.end_) + "' is not a number.", token);
}
decoded = value; decoded = value;
return true; return true;
} }
@@ -1845,7 +1852,7 @@ bool OurReader::decodeNumber(Token& token, Value& decoded) {
const auto digit(static_cast<Value::UInt>(c - '0')); const auto digit(static_cast<Value::UInt>(c - '0'));
if (value >= threshold) { if (value >= threshold) {
// We've hit or exceeded the max value divided by 10 (rounded down). If // We've hit or exceeded the max value divided by 10 (rounded down). If
// a) we've only just touched the limit, meaing value == threshold, // a) we've only just touched the limit, meaning value == threshold,
// b) this is the last digit, or // b) this is the last digit, or
// c) it's small enough to fit in that rounding delta, we're okay. // c) it's small enough to fit in that rounding delta, we're okay.
// Otherwise treat this number as a double to avoid overflow. // Otherwise treat this number as a double to avoid overflow.
@@ -1885,7 +1892,12 @@ bool OurReader::decodeDouble(Token& token, Value& decoded) {
const String buffer(token.start_, token.end_); const String buffer(token.start_, token.end_);
IStringStream is(buffer); IStringStream is(buffer);
if (!(is >> value)) { if (!(is >> value)) {
return addError( if (value == std::numeric_limits<double>::max())
value = std::numeric_limits<double>::infinity();
else if (value == std::numeric_limits<double>::lowest())
value = -std::numeric_limits<double>::infinity();
else if (!std::isinf(value))
return addError(
"'" + String(token.start_, token.end_) + "' is not a number.", token); "'" + String(token.start_, token.end_) + "' is not a number.", token);
} }
decoded = value; decoded = value;