forked from bblanchon/ArduinoJson
Set ARDUINOJSON_ENABLE_NAN and ARDUINOJSON_ENABLE_INFINITY to 0
This commit is contained in:
27
CHANGELOG.md
27
CHANGELOG.md
@ -7,10 +7,31 @@ HEAD
|
|||||||
* Fixed `deserializeJson()` silently accepting a `Stream*` (issue #978)
|
* Fixed `deserializeJson()` silently accepting a `Stream*` (issue #978)
|
||||||
* Fixed invalid result from `operator|` (issue #981)
|
* Fixed invalid result from `operator|` (issue #981)
|
||||||
* Made `deserializeJson()` more picky about trailing characters (issue #980)
|
* Made `deserializeJson()` more picky about trailing characters (issue #980)
|
||||||
* Added `ARDUINOJSON_ENABLE_NAN` to enable NaN in JSON (issue #973)
|
* Added `ARDUINOJSON_ENABLE_NAN` (default=0) to enable NaN in JSON (issue #973)
|
||||||
* Added `ARDUINOJSON_ENABLE_INFINITY` to enable Infinity in JSON
|
* Added `ARDUINOJSON_ENABLE_INFINITY` (default=0) to enable Infinity in JSON
|
||||||
|
|
||||||
> ### BREAKING CHANGE
|
> ### BREAKING CHANGES
|
||||||
|
>
|
||||||
|
> #### NaN and Infinity
|
||||||
|
>
|
||||||
|
> The JSON specification allows neither NaN not Infinity, but previous
|
||||||
|
> versions of ArduinoJson supported it. Now, ArduinoJson behaves like most
|
||||||
|
> other libraries: a NaN or and Infinity in the `JsonDocument`, becomes
|
||||||
|
> a `null` in the output JSON. Also, `deserializeJson()` returns
|
||||||
|
> `InvalidInput` if the JSON document contains NaN or Infinity.
|
||||||
|
>
|
||||||
|
> This version still supports NaN and Infinity in JSON documents, but
|
||||||
|
> it's disabled by default to be compatible with other JSON parsers.
|
||||||
|
> If you need the old behavior back, define `ARDUINOJSON_ENABLE_NAN` and
|
||||||
|
> `ARDUINOJSON_ENABLE_INFINITY` to `1`;:
|
||||||
|
>
|
||||||
|
> ```c++
|
||||||
|
> #define ARDUINOJSON_ENABLE_NAN 1
|
||||||
|
> #define ARDUINOJSON_ENABLE_INFINITY 1
|
||||||
|
> #include <ArduinoJson.h>
|
||||||
|
> ```
|
||||||
|
>
|
||||||
|
> #### The "or" operator
|
||||||
>
|
>
|
||||||
> This version slightly changes the behavior of the | operator when the
|
> This version slightly changes the behavior of the | operator when the
|
||||||
> variant contains a float and the user requests an integer.
|
> variant contains a float and the user requests an integer.
|
||||||
|
@ -137,12 +137,12 @@
|
|||||||
|
|
||||||
// Support NaN in JSON
|
// Support NaN in JSON
|
||||||
#ifndef ARDUINOJSON_ENABLE_NAN
|
#ifndef ARDUINOJSON_ENABLE_NAN
|
||||||
#define ARDUINOJSON_ENABLE_NAN 1
|
#define ARDUINOJSON_ENABLE_NAN 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Support Infinity in JSON
|
// Support Infinity in JSON
|
||||||
#ifndef ARDUINOJSON_ENABLE_INFINITY
|
#ifndef ARDUINOJSON_ENABLE_INFINITY
|
||||||
#define ARDUINOJSON_ENABLE_INFINITY 1
|
#define ARDUINOJSON_ENABLE_INFINITY 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Control the exponentiation threshold for big numbers
|
// Control the exponentiation threshold for big numbers
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
// MIT License
|
// MIT License
|
||||||
|
|
||||||
#define ARDUINOJSON_USE_LONG_LONG 0
|
#define ARDUINOJSON_USE_LONG_LONG 0
|
||||||
|
#define ARDUINOJSON_ENABLE_NAN 1
|
||||||
|
#define ARDUINOJSON_ENABLE_INFINITY 1
|
||||||
|
|
||||||
#include <ArduinoJson.h>
|
#include <ArduinoJson.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
// MIT License
|
// MIT License
|
||||||
|
|
||||||
#define ARDUINOJSON_USE_DOUBLE 0
|
#define ARDUINOJSON_USE_DOUBLE 0
|
||||||
|
#define ARDUINOJSON_ENABLE_NAN 1
|
||||||
|
#define ARDUINOJSON_ENABLE_INFINITY 1
|
||||||
|
|
||||||
#include <ArduinoJson/Numbers/parseFloat.hpp>
|
#include <ArduinoJson/Numbers/parseFloat.hpp>
|
||||||
#include <catch.hpp>
|
#include <catch.hpp>
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
#include <limits>
|
#include <limits>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#define ARDUINOJSON_ENABLE_NAN 1
|
||||||
|
#define ARDUINOJSON_ENABLE_INFINITY 1
|
||||||
#include <ArduinoJson/Json/TextFormatter.hpp>
|
#include <ArduinoJson/Json/TextFormatter.hpp>
|
||||||
#include <ArduinoJson/Serialization/DynamicStringWriter.hpp>
|
#include <ArduinoJson/Serialization/DynamicStringWriter.hpp>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user