mirror of
https://github.com/eledio-devices/thirdparty-ArduinoJson.git
synced 2025-11-01 00:38:27 +01:00
Fixed "linked" strings incorrectly marked as "owned" (fixes #1318)
This commit is contained in:
@@ -4,12 +4,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h> // int8_t, int16_t
|
||||
|
||||
#include <ArduinoJson/Polyfills/gsl/not_null.hpp>
|
||||
#include <ArduinoJson/Polyfills/type_traits.hpp>
|
||||
#include <ArduinoJson/Strings/StoragePolicy.hpp>
|
||||
#include <ArduinoJson/Variant/VariantContent.hpp>
|
||||
|
||||
#include <stdint.h> // int8_t, int16_t
|
||||
|
||||
namespace ARDUINOJSON_NAMESPACE {
|
||||
|
||||
typedef conditional<sizeof(void*) <= 2, int8_t, int16_t>::type VariantSlotDiff;
|
||||
@@ -69,14 +70,16 @@ class VariantSlot {
|
||||
_next = VariantSlotDiff(slot - this);
|
||||
}
|
||||
|
||||
void setOwnedKey(not_null<const char*> k) {
|
||||
void setKey(const char* k, storage_policies::store_by_copy) {
|
||||
ARDUINOJSON_ASSERT(k != NULL);
|
||||
_flags |= KEY_IS_OWNED;
|
||||
_key = k.get();
|
||||
_key = k;
|
||||
}
|
||||
|
||||
void setLinkedKey(not_null<const char*> k) {
|
||||
void setKey(const char* k, storage_policies::store_by_address) {
|
||||
ARDUINOJSON_ASSERT(k != NULL);
|
||||
_flags &= VALUE_MASK;
|
||||
_key = k.get();
|
||||
_key = k;
|
||||
}
|
||||
|
||||
const char* key() const {
|
||||
|
||||
Reference in New Issue
Block a user