mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-26 00:37:36 +02:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
3252013509 | |||
deab127a2f |
@ -1,6 +1,11 @@
|
||||
ArduinoJson: change log
|
||||
=======================
|
||||
|
||||
v7.4.1 (2025-04-11)
|
||||
------
|
||||
|
||||
* Fix crash with tiny Flash strings (issue #2170)
|
||||
|
||||
v7.4.0 (2025-04-09)
|
||||
------
|
||||
|
||||
|
@ -10,7 +10,7 @@ if(ESP_PLATFORM)
|
||||
return()
|
||||
endif()
|
||||
|
||||
project(ArduinoJson VERSION 7.4.0)
|
||||
project(ArduinoJson VERSION 7.4.1)
|
||||
|
||||
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
|
||||
include(CTest)
|
||||
|
@ -1,4 +1,4 @@
|
||||
version: 7.4.0.{build}
|
||||
version: 7.4.1.{build}
|
||||
environment:
|
||||
matrix:
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
|
||||
|
@ -87,6 +87,13 @@ TEST_CASE("JsonDocument::set()") {
|
||||
});
|
||||
}
|
||||
|
||||
SECTION("Flash tiny string") { // issue #2170
|
||||
doc.set(F("abc"));
|
||||
|
||||
REQUIRE(doc.as<const char*>() == "abc"_s);
|
||||
REQUIRE(spy.log() == AllocatorLog{});
|
||||
}
|
||||
|
||||
#ifdef HAS_VARIABLE_LENGTH_ARRAY
|
||||
SECTION("VLA") {
|
||||
size_t i = 16;
|
||||
|
@ -1,7 +1,7 @@
|
||||
version: "7.4.0"
|
||||
version: "7.4.1"
|
||||
description: >-
|
||||
A simple and efficient JSON library for embedded C++.
|
||||
★ 6896 stars on GitHub!
|
||||
★ 6898 stars on GitHub!
|
||||
Supports serialization, deserialization, MessagePack, streams, filtering, and more.
|
||||
Fully tested and documented.
|
||||
url: https://arduinojson.org/
|
||||
|
@ -1,13 +1,13 @@
|
||||
{
|
||||
"name": "ArduinoJson",
|
||||
"keywords": "json, rest, http, web",
|
||||
"description": "A simple and efficient JSON library for embedded C++. ⭐ 6896 stars on GitHub! Supports serialization, deserialization, MessagePack, streams, filtering, and more. Fully tested and documented.",
|
||||
"description": "A simple and efficient JSON library for embedded C++. ⭐ 6898 stars on GitHub! Supports serialization, deserialization, MessagePack, streams, filtering, and more. Fully tested and documented.",
|
||||
"homepage": "https://arduinojson.org/?utm_source=meta&utm_medium=library.json",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/bblanchon/ArduinoJson.git"
|
||||
},
|
||||
"version": "7.4.0",
|
||||
"version": "7.4.1",
|
||||
"authors": {
|
||||
"name": "Benoit Blanchon",
|
||||
"url": "https://blog.benoitblanchon.fr"
|
||||
|
@ -1,9 +1,9 @@
|
||||
name=ArduinoJson
|
||||
version=7.4.0
|
||||
version=7.4.1
|
||||
author=Benoit Blanchon <blog.benoitblanchon.fr>
|
||||
maintainer=Benoit Blanchon <blog.benoitblanchon.fr>
|
||||
sentence=A simple and efficient JSON library for embedded C++.
|
||||
paragraph=⭐ 6896 stars on GitHub! Supports serialization, deserialization, MessagePack, streams, filtering, and more. Fully tested and documented.
|
||||
paragraph=⭐ 6898 stars on GitHub! Supports serialization, deserialization, MessagePack, streams, filtering, and more. Fully tested and documented.
|
||||
category=Data Processing
|
||||
url=https://arduinojson.org/?utm_source=meta&utm_medium=library.properties
|
||||
architectures=*
|
||||
|
@ -41,7 +41,7 @@ class StringBuffer {
|
||||
ARDUINOJSON_ASSERT(node_ != nullptr);
|
||||
const char* s = node_->data;
|
||||
if (isTinyString(s, size_))
|
||||
data->setTinyString(s, static_cast<uint8_t>(size_));
|
||||
data->setTinyString(adaptString(s, size_));
|
||||
else
|
||||
data->setOwnedString(commitStringNode());
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ class StringBuilder {
|
||||
|
||||
char* p = node_->data;
|
||||
if (isTinyString(p, size_)) {
|
||||
variant->setTinyString(p, static_cast<uint8_t>(size_));
|
||||
variant->setTinyString(adaptString(p, size_));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -526,12 +526,20 @@ class VariantData {
|
||||
content_.asLinkedString = s;
|
||||
}
|
||||
|
||||
void setTinyString(const char* s, uint8_t n) {
|
||||
template <typename TAdaptedString>
|
||||
void setTinyString(const TAdaptedString& s) {
|
||||
ARDUINOJSON_ASSERT(type_ == VariantType::Null); // must call clear() first
|
||||
ARDUINOJSON_ASSERT(s);
|
||||
ARDUINOJSON_ASSERT(s.size() <= tinyStringMaxLength);
|
||||
|
||||
type_ = VariantType::TinyString;
|
||||
for (uint8_t i = 0; i < n; i++)
|
||||
content_.asTinyString[i] = s[i];
|
||||
|
||||
auto n = uint8_t(s.size());
|
||||
for (uint8_t i = 0; i < n; i++) {
|
||||
char c = s[i];
|
||||
ARDUINOJSON_ASSERT(c != 0); // no NUL in tiny string
|
||||
content_.asTinyString[i] = c;
|
||||
}
|
||||
|
||||
content_.asTinyString[n] = 0;
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ inline bool VariantData::setString(TAdaptedString value,
|
||||
}
|
||||
|
||||
if (isTinyString(value, value.size())) {
|
||||
setTinyString(value.data(), uint8_t(value.size()));
|
||||
setTinyString(value);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -4,8 +4,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#define ARDUINOJSON_VERSION "7.4.0"
|
||||
#define ARDUINOJSON_VERSION "7.4.1"
|
||||
#define ARDUINOJSON_VERSION_MAJOR 7
|
||||
#define ARDUINOJSON_VERSION_MINOR 4
|
||||
#define ARDUINOJSON_VERSION_REVISION 0
|
||||
#define ARDUINOJSON_VERSION_MACRO V740
|
||||
#define ARDUINOJSON_VERSION_REVISION 1
|
||||
#define ARDUINOJSON_VERSION_MACRO V741
|
||||
|
Reference in New Issue
Block a user