forked from bblanchon/ArduinoJson
@ -6,6 +6,7 @@ HEAD
|
|||||||
|
|
||||||
* Fix "no matching function" with `JsonObjectConst::operator[]` (issue #2019)
|
* Fix "no matching function" with `JsonObjectConst::operator[]` (issue #2019)
|
||||||
* Remove unused files in the PlatformIO package
|
* Remove unused files in the PlatformIO package
|
||||||
|
* Fix `volatile bool` serialized as `1` or `0` instead of `true` or `false` (issue #2029)
|
||||||
|
|
||||||
v7.0.0 (2024-01-03)
|
v7.0.0 (2024-01-03)
|
||||||
------
|
------
|
||||||
|
@ -140,6 +140,13 @@ TEST_CASE("volatile") {
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
JsonVariant variant = doc.to<JsonVariant>();
|
JsonVariant variant = doc.to<JsonVariant>();
|
||||||
|
|
||||||
|
SECTION("volatile bool") { // issue #2029
|
||||||
|
volatile bool f = true;
|
||||||
|
variant.set(f);
|
||||||
|
CHECK(variant.is<bool>() == true);
|
||||||
|
CHECK(variant.as<bool>() == true);
|
||||||
|
}
|
||||||
|
|
||||||
SECTION("volatile int") {
|
SECTION("volatile int") {
|
||||||
volatile int f = 42;
|
volatile int f = 42;
|
||||||
variant.set(f);
|
variant.set(f);
|
||||||
|
@ -132,7 +132,8 @@ VariantRefBase<TDerived>::operator[](const TString& key) const {
|
|||||||
template <typename TDerived>
|
template <typename TDerived>
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline bool VariantRefBase<TDerived>::set(const T& value) const {
|
inline bool VariantRefBase<TDerived>::set(const T& value) const {
|
||||||
Converter<T>::toJson(value, getOrCreateVariant());
|
Converter<typename detail::remove_cv<T>::type>::toJson(value,
|
||||||
|
getOrCreateVariant());
|
||||||
auto resources = getResourceManager();
|
auto resources = getResourceManager();
|
||||||
return resources && !resources->overflowed();
|
return resources && !resources->overflowed();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user