ArduinoJson @ 7.4.3

This commit is contained in:
proddy
2026-03-30 23:15:00 +02:00
parent 7f9fd44a02
commit b72b368d3c

View File

@@ -1,5 +1,5 @@
// ArduinoJson - https://arduinojson.org // ArduinoJson - https://arduinojson.org
// Copyright © 2014-2025, Benoit BLANCHON // Copyright © 2014-2026, Benoit BLANCHON
// MIT License // MIT License
#pragma once #pragma once
@@ -239,11 +239,11 @@
#define ARDUINOJSON_BIN2ALPHA_1111() P #define ARDUINOJSON_BIN2ALPHA_1111() P
#define ARDUINOJSON_BIN2ALPHA_(A, B, C, D) ARDUINOJSON_BIN2ALPHA_##A##B##C##D() #define ARDUINOJSON_BIN2ALPHA_(A, B, C, D) ARDUINOJSON_BIN2ALPHA_##A##B##C##D()
#define ARDUINOJSON_BIN2ALPHA(A, B, C, D) ARDUINOJSON_BIN2ALPHA_(A, B, C, D) #define ARDUINOJSON_BIN2ALPHA(A, B, C, D) ARDUINOJSON_BIN2ALPHA_(A, B, C, D)
#define ARDUINOJSON_VERSION "7.4.2" #define ARDUINOJSON_VERSION "7.4.3"
#define ARDUINOJSON_VERSION_MAJOR 7 #define ARDUINOJSON_VERSION_MAJOR 7
#define ARDUINOJSON_VERSION_MINOR 4 #define ARDUINOJSON_VERSION_MINOR 4
#define ARDUINOJSON_VERSION_REVISION 2 #define ARDUINOJSON_VERSION_REVISION 3
#define ARDUINOJSON_VERSION_MACRO V742 #define ARDUINOJSON_VERSION_MACRO V743
#ifndef ARDUINOJSON_VERSION_NAMESPACE #ifndef ARDUINOJSON_VERSION_NAMESPACE
#define ARDUINOJSON_VERSION_NAMESPACE \ #define ARDUINOJSON_VERSION_NAMESPACE \
ARDUINOJSON_CONCAT5(ARDUINOJSON_VERSION_MACRO, \ ARDUINOJSON_CONCAT5(ARDUINOJSON_VERSION_MACRO, \
@@ -1541,6 +1541,7 @@ struct FloatTraits<T, 8 /*64bits*/> {
static const mantissa_type mantissa_max = (mantissa_type(1) << mantissa_bits) - 1; static const mantissa_type mantissa_max = (mantissa_type(1) << mantissa_bits) - 1;
using exponent_type = int16_t; using exponent_type = int16_t;
static const exponent_type exponent_max = 308; static const exponent_type exponent_max = 308;
static const size_t binaryPowersOfTen = 9;
static pgm_ptr<T> positiveBinaryPowersOfTen() { static pgm_ptr<T> positiveBinaryPowersOfTen() {
ARDUINOJSON_DEFINE_PROGMEM_ARRAY( // ARDUINOJSON_DEFINE_PROGMEM_ARRAY( //
uint64_t, uint64_t,
@@ -1606,6 +1607,7 @@ struct FloatTraits<T, 4 /*32bits*/> {
static const mantissa_type mantissa_max = (mantissa_type(1) << mantissa_bits) - 1; static const mantissa_type mantissa_max = (mantissa_type(1) << mantissa_bits) - 1;
using exponent_type = int8_t; using exponent_type = int8_t;
static const exponent_type exponent_max = 38; static const exponent_type exponent_max = 38;
static const size_t binaryPowersOfTen = 6;
static pgm_ptr<T> positiveBinaryPowersOfTen() { static pgm_ptr<T> positiveBinaryPowersOfTen() {
ARDUINOJSON_DEFINE_PROGMEM_ARRAY(uint32_t, ARDUINOJSON_DEFINE_PROGMEM_ARRAY(uint32_t,
factors, factors,
@@ -1668,9 +1670,12 @@ template <typename TFloat, typename TExponent>
inline TFloat make_float(TFloat m, TExponent e) { inline TFloat make_float(TFloat m, TExponent e) {
using traits = FloatTraits<TFloat>; using traits = FloatTraits<TFloat>;
auto powersOfTen = e > 0 ? traits::positiveBinaryPowersOfTen() : traits::negativeBinaryPowersOfTen(); auto powersOfTen = e > 0 ? traits::positiveBinaryPowersOfTen() : traits::negativeBinaryPowersOfTen();
auto count = traits::binaryPowersOfTen;
if (e <= 0) if (e <= 0)
e = TExponent(-e); e = TExponent(-e);
for (uint8_t index = 0; e != 0; index++) { for (uint8_t index = 0; e != 0; index++) {
if (index >= count)
return traits::nan();
if (e & 1) if (e & 1)
m *= powersOfTen[index]; m *= powersOfTen[index];
e >>= 1; e >>= 1;
@@ -2422,7 +2427,7 @@ class VariantData {
return; return;
var->removeMember(key, resources); var->removeMember(key, resources);
} }
void reset() { void reset() { // TODO: remove
type_ = VariantType::Null; type_ = VariantType::Null;
} }
void setBoolean(bool value) { void setBoolean(bool value) {
@@ -4214,7 +4219,7 @@ template <typename T, typename Enable = void>
struct Comparer; struct Comparer;
template <typename T> template <typename T>
struct Comparer<T, enable_if_t<IsString<T>::value>> : ComparerBase { struct Comparer<T, enable_if_t<IsString<T>::value>> : ComparerBase {
T rhs; T rhs; // TODO: store adapted string?
explicit Comparer(T value) explicit Comparer(T value)
: rhs(value) { : rhs(value) {
} }
@@ -5298,7 +5303,7 @@ class StringBuilder {
append(*s++); append(*s++);
} }
void append(const char * s, size_t n) { void append(const char * s, size_t n) {
while (n-- > 0) while (n-- > 0) // TODO: memcpy
append(*s++); append(*s++);
} }
void append(char c) { void append(char c) {