mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
6.20.1
This commit is contained in:
@@ -1,6 +1,13 @@
|
|||||||
ArduinoJson: change log
|
ArduinoJson: change log
|
||||||
=======================
|
=======================
|
||||||
|
|
||||||
|
v6.20.1 (2023-02-08)
|
||||||
|
-------
|
||||||
|
|
||||||
|
* Remove explicit exclusion of `as<char*>()` and `as<char>()` (issue #1860)
|
||||||
|
If you try to call them, you'll now get the same error message as any unsupported type.
|
||||||
|
You could also add a custom converter for `char*` and `char`.
|
||||||
|
|
||||||
v6.20.0 (2022-12-26)
|
v6.20.0 (2022-12-26)
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,18 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://arduinojson.org/"><img alt="ArduinoJson" src="logo.svg" /></a>
|
<a href="https://arduinojson.org/"><img alt="ArduinoJson" src="https://arduinojson.org/images/logo.svg" width="200" /></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
[](https://github.com/bblanchon/ArduinoJson/actions?query=workflow%3A%22Continuous+Integration%22+branch%3A6.x)
|
[](https://github.com/bblanchon/ArduinoJson/actions?query=workflow%3A%22Continuous+Integration%22+branch%3A6.x)
|
||||||
[](https://ci.appveyor.com/project/bblanchon/arduinojson/branch/6.x)
|
[](https://ci.appveyor.com/project/bblanchon/arduinojson/branch/6.x)
|
||||||
[](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:arduinojson)
|
[](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:arduinojson)
|
||||||
[](https://coveralls.io/github/bblanchon/ArduinoJson?branch=6.x)
|
[](https://coveralls.io/github/bblanchon/ArduinoJson?branch=6.x)
|
||||||
[](https://www.ardu-badge.com/ArduinoJson/6.20.0)
|
[](https://www.ardu-badge.com/ArduinoJson/6.20.1)
|
||||||
[](https://registry.platformio.org/packages/libraries/bblanchon/ArduinoJson?version=6.20.0)
|
[](https://registry.platformio.org/packages/libraries/bblanchon/ArduinoJson?version=6.20.1)
|
||||||
[](https://github.com/bblanchon/ArduinoJson/stargazers)
|
[](https://components.espressif.com/components/bblanchon/arduinojson)
|
||||||
[](https://github.com/sponsors/bblanchon)
|
[](https://github.com/bblanchon/ArduinoJson/stargazers)
|
||||||
|
[](https://github.com/sponsors/bblanchon)
|
||||||
|
|
||||||
ArduinoJson is a C++ JSON library for Arduino and IoT (Internet Of Things).
|
ArduinoJson is a C++ JSON library for Arduino and IoT (Internet Of Things).
|
||||||
|
|
||||||
@@ -99,7 +100,6 @@ ArduinoJson is a C++ JSON library for Arduino and IoT (Internet Of Things).
|
|||||||
* Most popular of all Arduino libraries on [GitHub](https://github.com/search?o=desc&q=arduino+library&s=stars&type=Repositories)
|
* Most popular of all Arduino libraries on [GitHub](https://github.com/search?o=desc&q=arduino+library&s=stars&type=Repositories)
|
||||||
* [Used in hundreds of projects](https://www.hackster.io/search?i=projects&q=arduinojson)
|
* [Used in hundreds of projects](https://www.hackster.io/search?i=projects&q=arduinojson)
|
||||||
* [Responsive support](https://github.com/bblanchon/ArduinoJson/issues?q=is%3Aissue+is%3Aclosed)
|
* [Responsive support](https://github.com/bblanchon/ArduinoJson/issues?q=is%3Aissue+is%3Aclosed)
|
||||||
* [Discord server](https://discord.gg/DzN6hHHD4h)
|
|
||||||
|
|
||||||
## Quickstart
|
## Quickstart
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
|
|
||||||
#include <ArduinoJson/Misc/SafeBoolIdiom.hpp>
|
#include <ArduinoJson/Misc/SafeBoolIdiom.hpp>
|
||||||
#include <ArduinoJson/Namespace.hpp>
|
#include <ArduinoJson/Namespace.hpp>
|
||||||
|
#include <ArduinoJson/Polyfills/pgmspace_generic.hpp>
|
||||||
#include <ArduinoJson/Polyfills/preprocessor.hpp>
|
#include <ArduinoJson/Polyfills/preprocessor.hpp>
|
||||||
#include <ArduinoJson/Polyfills/static_array.hpp>
|
|
||||||
|
|
||||||
#if ARDUINOJSON_ENABLE_STD_STREAM
|
#if ARDUINOJSON_ENABLE_STD_STREAM
|
||||||
# include <ostream>
|
# include <ostream>
|
||||||
@@ -74,16 +74,16 @@ class DeserializationError : public SafeBoolIdom<DeserializationError> {
|
|||||||
|
|
||||||
#if ARDUINOJSON_ENABLE_PROGMEM
|
#if ARDUINOJSON_ENABLE_PROGMEM
|
||||||
const __FlashStringHelper* f_str() const {
|
const __FlashStringHelper* f_str() const {
|
||||||
ARDUINOJSON_DEFINE_STATIC_ARRAY(char, s0, "Ok");
|
ARDUINOJSON_DEFINE_PROGMEM_ARRAY(char, s0, "Ok");
|
||||||
ARDUINOJSON_DEFINE_STATIC_ARRAY(char, s1, "EmptyInput");
|
ARDUINOJSON_DEFINE_PROGMEM_ARRAY(char, s1, "EmptyInput");
|
||||||
ARDUINOJSON_DEFINE_STATIC_ARRAY(char, s2, "IncompleteInput");
|
ARDUINOJSON_DEFINE_PROGMEM_ARRAY(char, s2, "IncompleteInput");
|
||||||
ARDUINOJSON_DEFINE_STATIC_ARRAY(char, s3, "InvalidInput");
|
ARDUINOJSON_DEFINE_PROGMEM_ARRAY(char, s3, "InvalidInput");
|
||||||
ARDUINOJSON_DEFINE_STATIC_ARRAY(char, s4, "NoMemory");
|
ARDUINOJSON_DEFINE_PROGMEM_ARRAY(char, s4, "NoMemory");
|
||||||
ARDUINOJSON_DEFINE_STATIC_ARRAY(char, s5, "TooDeep");
|
ARDUINOJSON_DEFINE_PROGMEM_ARRAY(char, s5, "TooDeep");
|
||||||
ARDUINOJSON_DEFINE_STATIC_ARRAY(
|
ARDUINOJSON_DEFINE_PROGMEM_ARRAY(
|
||||||
const char*, messages, ARDUINOJSON_EXPAND6({s0, s1, s2, s3, s4, s5}));
|
const char*, messages, ARDUINOJSON_EXPAND6({s0, s1, s2, s3, s4, s5}));
|
||||||
return ARDUINOJSON_READ_STATIC_ARRAY(const __FlashStringHelper*, messages,
|
return reinterpret_cast<const __FlashStringHelper*>(
|
||||||
_code);
|
pgm_read(messages + _code));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class MsgPackDeserializer {
|
|||||||
NestingLimit nestingLimit) {
|
NestingLimit nestingLimit) {
|
||||||
DeserializationError::Code err;
|
DeserializationError::Code err;
|
||||||
|
|
||||||
uint8_t code = 0;
|
uint8_t code = 0; // TODO: why do we need to initialize this variable?
|
||||||
err = readByte(code);
|
err = readByte(code);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
#include <ArduinoJson/Configuration.hpp>
|
#include <ArduinoJson/Configuration.hpp>
|
||||||
#include <ArduinoJson/Polyfills/alias_cast.hpp>
|
#include <ArduinoJson/Polyfills/alias_cast.hpp>
|
||||||
#include <ArduinoJson/Polyfills/math.hpp>
|
#include <ArduinoJson/Polyfills/math.hpp>
|
||||||
|
#include <ArduinoJson/Polyfills/pgmspace_generic.hpp>
|
||||||
#include <ArduinoJson/Polyfills/preprocessor.hpp>
|
#include <ArduinoJson/Polyfills/preprocessor.hpp>
|
||||||
#include <ArduinoJson/Polyfills/static_array.hpp>
|
|
||||||
#include <ArduinoJson/Polyfills/type_traits.hpp>
|
#include <ArduinoJson/Polyfills/type_traits.hpp>
|
||||||
|
|
||||||
namespace ARDUINOJSON_NAMESPACE {
|
namespace ARDUINOJSON_NAMESPACE {
|
||||||
@@ -49,7 +49,7 @@ struct FloatTraits<T, 8 /*64bits*/> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static T positiveBinaryPowerOfTen(int index) {
|
static T positiveBinaryPowerOfTen(int index) {
|
||||||
ARDUINOJSON_DEFINE_STATIC_ARRAY( //
|
ARDUINOJSON_DEFINE_PROGMEM_ARRAY( //
|
||||||
uint32_t, factors,
|
uint32_t, factors,
|
||||||
ARDUINOJSON_EXPAND18({
|
ARDUINOJSON_EXPAND18({
|
||||||
0x40240000, 0x00000000, // 1e1
|
0x40240000, 0x00000000, // 1e1
|
||||||
@@ -62,13 +62,12 @@ struct FloatTraits<T, 8 /*64bits*/> {
|
|||||||
0x5A827748, 0xF9301D32, // 1e128
|
0x5A827748, 0xF9301D32, // 1e128
|
||||||
0x75154FDD, 0x7F73BF3C // 1e256
|
0x75154FDD, 0x7F73BF3C // 1e256
|
||||||
}));
|
}));
|
||||||
return forge(
|
return forge(pgm_read(factors + 2 * index),
|
||||||
ARDUINOJSON_READ_STATIC_ARRAY(uint32_t, factors, 2 * index),
|
pgm_read(factors + 2 * index + 1));
|
||||||
ARDUINOJSON_READ_STATIC_ARRAY(uint32_t, factors, 2 * index + 1));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static T negativeBinaryPowerOfTen(int index) {
|
static T negativeBinaryPowerOfTen(int index) {
|
||||||
ARDUINOJSON_DEFINE_STATIC_ARRAY( //
|
ARDUINOJSON_DEFINE_PROGMEM_ARRAY( //
|
||||||
uint32_t, factors,
|
uint32_t, factors,
|
||||||
ARDUINOJSON_EXPAND18({
|
ARDUINOJSON_EXPAND18({
|
||||||
0x3FB99999, 0x9999999A, // 1e-1
|
0x3FB99999, 0x9999999A, // 1e-1
|
||||||
@@ -81,13 +80,12 @@ struct FloatTraits<T, 8 /*64bits*/> {
|
|||||||
0x255BBA08, 0xCF8C979D, // 1e-128
|
0x255BBA08, 0xCF8C979D, // 1e-128
|
||||||
0x0AC80628, 0x64AC6F43 // 1e-256
|
0x0AC80628, 0x64AC6F43 // 1e-256
|
||||||
}));
|
}));
|
||||||
return forge(
|
return forge(pgm_read(factors + 2 * index),
|
||||||
ARDUINOJSON_READ_STATIC_ARRAY(uint32_t, factors, 2 * index),
|
pgm_read(factors + 2 * index + 1));
|
||||||
ARDUINOJSON_READ_STATIC_ARRAY(uint32_t, factors, 2 * index + 1));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static T negativeBinaryPowerOfTenPlusOne(int index) {
|
static T negativeBinaryPowerOfTenPlusOne(int index) {
|
||||||
ARDUINOJSON_DEFINE_STATIC_ARRAY( //
|
ARDUINOJSON_DEFINE_PROGMEM_ARRAY( //
|
||||||
uint32_t, factors,
|
uint32_t, factors,
|
||||||
ARDUINOJSON_EXPAND18({
|
ARDUINOJSON_EXPAND18({
|
||||||
0x3FF00000, 0x00000000, // 1e0
|
0x3FF00000, 0x00000000, // 1e0
|
||||||
@@ -100,9 +98,8 @@ struct FloatTraits<T, 8 /*64bits*/> {
|
|||||||
0x25915445, 0x81B7DEC2, // 1e-127
|
0x25915445, 0x81B7DEC2, // 1e-127
|
||||||
0x0AFE07B2, 0x7DD78B14 // 1e-255
|
0x0AFE07B2, 0x7DD78B14 // 1e-255
|
||||||
}));
|
}));
|
||||||
return forge(
|
return forge(pgm_read(factors + 2 * index),
|
||||||
ARDUINOJSON_READ_STATIC_ARRAY(uint32_t, factors, 2 * index),
|
pgm_read(factors + 2 * index + 1));
|
||||||
ARDUINOJSON_READ_STATIC_ARRAY(uint32_t, factors, 2 * index + 1));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static T nan() {
|
static T nan() {
|
||||||
@@ -175,7 +172,7 @@ struct FloatTraits<T, 4 /*32bits*/> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static T positiveBinaryPowerOfTen(int index) {
|
static T positiveBinaryPowerOfTen(int index) {
|
||||||
ARDUINOJSON_DEFINE_STATIC_ARRAY(uint32_t, factors,
|
ARDUINOJSON_DEFINE_PROGMEM_ARRAY(uint32_t, factors,
|
||||||
ARDUINOJSON_EXPAND6({
|
ARDUINOJSON_EXPAND6({
|
||||||
0x41200000, // 1e1f
|
0x41200000, // 1e1f
|
||||||
0x42c80000, // 1e2f
|
0x42c80000, // 1e2f
|
||||||
@@ -184,11 +181,11 @@ struct FloatTraits<T, 4 /*32bits*/> {
|
|||||||
0x5a0e1bca, // 1e16f
|
0x5a0e1bca, // 1e16f
|
||||||
0x749dc5ae // 1e32f
|
0x749dc5ae // 1e32f
|
||||||
}));
|
}));
|
||||||
return forge(ARDUINOJSON_READ_STATIC_ARRAY(uint32_t, factors, index));
|
return forge(pgm_read(factors + index));
|
||||||
}
|
}
|
||||||
|
|
||||||
static T negativeBinaryPowerOfTen(int index) {
|
static T negativeBinaryPowerOfTen(int index) {
|
||||||
ARDUINOJSON_DEFINE_STATIC_ARRAY(uint32_t, factors,
|
ARDUINOJSON_DEFINE_PROGMEM_ARRAY(uint32_t, factors,
|
||||||
ARDUINOJSON_EXPAND6({
|
ARDUINOJSON_EXPAND6({
|
||||||
0x3dcccccd, // 1e-1f
|
0x3dcccccd, // 1e-1f
|
||||||
0x3c23d70a, // 1e-2f
|
0x3c23d70a, // 1e-2f
|
||||||
@@ -197,11 +194,11 @@ struct FloatTraits<T, 4 /*32bits*/> {
|
|||||||
0x24e69595, // 1e-16f
|
0x24e69595, // 1e-16f
|
||||||
0x0a4fb11f // 1e-32f
|
0x0a4fb11f // 1e-32f
|
||||||
}));
|
}));
|
||||||
return forge(ARDUINOJSON_READ_STATIC_ARRAY(uint32_t, factors, index));
|
return forge(pgm_read(factors + index));
|
||||||
}
|
}
|
||||||
|
|
||||||
static T negativeBinaryPowerOfTenPlusOne(int index) {
|
static T negativeBinaryPowerOfTenPlusOne(int index) {
|
||||||
ARDUINOJSON_DEFINE_STATIC_ARRAY(uint32_t, factors,
|
ARDUINOJSON_DEFINE_PROGMEM_ARRAY(uint32_t, factors,
|
||||||
ARDUINOJSON_EXPAND6({
|
ARDUINOJSON_EXPAND6({
|
||||||
0x3f800000, // 1e0f
|
0x3f800000, // 1e0f
|
||||||
0x3dcccccd, // 1e-1f
|
0x3dcccccd, // 1e-1f
|
||||||
@@ -210,7 +207,7 @@ struct FloatTraits<T, 4 /*32bits*/> {
|
|||||||
0x26901d7d, // 1e-15f
|
0x26901d7d, // 1e-15f
|
||||||
0x0c01ceb3 // 1e-31f
|
0x0c01ceb3 // 1e-31f
|
||||||
}));
|
}));
|
||||||
return forge(ARDUINOJSON_READ_STATIC_ARRAY(uint32_t, factors, index));
|
return forge(pgm_read(factors + index));
|
||||||
}
|
}
|
||||||
|
|
||||||
static T forge(uint32_t bits) {
|
static T forge(uint32_t bits) {
|
||||||
|
|||||||
@@ -5,20 +5,41 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ArduinoJson/Namespace.hpp>
|
#include <ArduinoJson/Namespace.hpp>
|
||||||
#include <ArduinoJson/Polyfills/pgmspace.hpp>
|
|
||||||
#include <ArduinoJson/Polyfills/type_traits.hpp>
|
#if ARDUINOJSON_ENABLE_PROGMEM
|
||||||
|
# include <ArduinoJson/Polyfills/pgmspace.hpp>
|
||||||
|
# include <ArduinoJson/Polyfills/type_traits.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace ARDUINOJSON_NAMESPACE {
|
namespace ARDUINOJSON_NAMESPACE {
|
||||||
|
|
||||||
template <typename T>
|
#if ARDUINOJSON_ENABLE_PROGMEM
|
||||||
typename enable_if<is_pointer<T>::value, T>::type pgm_read(const void* p) {
|
|
||||||
return reinterpret_cast<T>(pgm_read_ptr(p));
|
# ifndef ARDUINOJSON_DEFINE_PROGMEM_ARRAY
|
||||||
}
|
# define ARDUINOJSON_DEFINE_PROGMEM_ARRAY(type, name, value) \
|
||||||
|
static type const name[] PROGMEM = value;
|
||||||
|
# endif
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
typename enable_if<is_same<T, uint32_t>::value, T>::type pgm_read(
|
inline const T* pgm_read(const T* const* p) {
|
||||||
const void* p) {
|
return reinterpret_cast<const T*>(pgm_read_ptr(p));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline uint32_t pgm_read(const uint32_t* p) {
|
||||||
return pgm_read_dword(p);
|
return pgm_read_dword(p);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
|
||||||
|
# ifndef ARDUINOJSON_DEFINE_PROGMEM_ARRAY
|
||||||
|
# define ARDUINOJSON_DEFINE_PROGMEM_ARRAY(type, name, value) \
|
||||||
|
static type const name[] = value;
|
||||||
|
# endif
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
inline T pgm_read(const T* p) {
|
||||||
|
return *p;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
} // namespace ARDUINOJSON_NAMESPACE
|
} // namespace ARDUINOJSON_NAMESPACE
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
// ArduinoJson - https://arduinojson.org
|
|
||||||
// Copyright © 2014-2022, Benoit BLANCHON
|
|
||||||
// MIT License
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <ArduinoJson/Configuration.hpp>
|
|
||||||
|
|
||||||
#if ARDUINOJSON_ENABLE_PROGMEM
|
|
||||||
|
|
||||||
# include <ArduinoJson/Polyfills/pgmspace_generic.hpp>
|
|
||||||
|
|
||||||
# ifndef ARDUINOJSON_DEFINE_PROGMEM_ARRAY
|
|
||||||
# define ARDUINOJSON_DEFINE_PROGMEM_ARRAY(type, name, value) \
|
|
||||||
static type const name[] PROGMEM = value;
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# define ARDUINOJSON_DEFINE_STATIC_ARRAY ARDUINOJSON_DEFINE_PROGMEM_ARRAY
|
|
||||||
|
|
||||||
# define ARDUINOJSON_READ_STATIC_ARRAY(type, name, index) \
|
|
||||||
pgm_read<type>(name + index)
|
|
||||||
|
|
||||||
#else // i.e. ARDUINOJSON_ENABLE_PROGMEM == 0
|
|
||||||
|
|
||||||
# define ARDUINOJSON_DEFINE_STATIC_ARRAY(type, name, value) \
|
|
||||||
static type const name[] = value;
|
|
||||||
|
|
||||||
# define ARDUINOJSON_READ_STATIC_ARRAY(type, name, index) name[index]
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -22,7 +22,7 @@ struct Comparer;
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
struct Comparer<T, typename enable_if<IsString<T>::value>::type>
|
struct Comparer<T, typename enable_if<IsString<T>::value>::type>
|
||||||
: ComparerBase {
|
: ComparerBase {
|
||||||
T rhs;
|
T rhs; // TODO: store adapted string?
|
||||||
|
|
||||||
explicit Comparer(T value) : rhs(value) {}
|
explicit Comparer(T value) : rhs(value) {}
|
||||||
|
|
||||||
|
|||||||
@@ -46,10 +46,8 @@ class VariantRefBase : public VariantTag {
|
|||||||
// Casts the value to the specified type.
|
// Casts the value to the specified type.
|
||||||
// https://arduinojson.org/v6/api/jsonvariant/as/
|
// https://arduinojson.org/v6/api/jsonvariant/as/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
FORCE_INLINE typename enable_if<!is_same<T, char*>::value &&
|
FORCE_INLINE
|
||||||
!is_same<T, char>::value &&
|
typename enable_if<!ConverterNeedsWriteableRef<T>::value, T>::type
|
||||||
!ConverterNeedsWriteableRef<T>::value,
|
|
||||||
T>::type
|
|
||||||
as() const {
|
as() const {
|
||||||
return Converter<T>::fromJson(getVariantConst());
|
return Converter<T>::fromJson(getVariantConst());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define ARDUINOJSON_VERSION "6.20.0"
|
#define ARDUINOJSON_VERSION "6.20.1"
|
||||||
#define ARDUINOJSON_VERSION_MAJOR 6
|
#define ARDUINOJSON_VERSION_MAJOR 6
|
||||||
#define ARDUINOJSON_VERSION_MINOR 20
|
#define ARDUINOJSON_VERSION_MINOR 20
|
||||||
#define ARDUINOJSON_VERSION_REVISION 0
|
#define ARDUINOJSON_VERSION_REVISION 1
|
||||||
|
|||||||
Reference in New Issue
Block a user