forked from bblanchon/ArduinoJson
Fixed comparison of JsonVariant
with mixed strings (closes #1051)
This commit is contained in:
@ -16,15 +16,18 @@ namespace ARDUINOJSON_NAMESPACE {
|
||||
enum {
|
||||
VALUE_MASK = 0x7F,
|
||||
|
||||
OWNERSHIP_BIT = 0x01,
|
||||
VALUE_IS_NULL = 0,
|
||||
VALUE_IS_LINKED_RAW = 0x01,
|
||||
VALUE_IS_OWNED_RAW = 0x02,
|
||||
VALUE_IS_LINKED_STRING = 0x03,
|
||||
VALUE_IS_OWNED_STRING = 0x04,
|
||||
VALUE_IS_BOOLEAN = 0x05,
|
||||
VALUE_IS_POSITIVE_INTEGER = 0x06,
|
||||
VALUE_IS_NEGATIVE_INTEGER = 0x07,
|
||||
VALUE_IS_FLOAT = 0x08,
|
||||
VALUE_IS_LINKED_RAW = 0x02,
|
||||
VALUE_IS_OWNED_RAW = 0x03,
|
||||
VALUE_IS_LINKED_STRING = 0x04,
|
||||
VALUE_IS_OWNED_STRING = 0x05,
|
||||
|
||||
// CAUTION: no OWNERSHIP_BIT below
|
||||
VALUE_IS_BOOLEAN = 0x06,
|
||||
VALUE_IS_POSITIVE_INTEGER = 0x08,
|
||||
VALUE_IS_NEGATIVE_INTEGER = 0x0A,
|
||||
VALUE_IS_FLOAT = 0x0C,
|
||||
|
||||
COLLECTION_MASK = 0x60,
|
||||
VALUE_IS_OBJECT = 0x20,
|
||||
|
@ -101,7 +101,9 @@ class VariantData {
|
||||
}
|
||||
|
||||
bool equals(const VariantData &other) const {
|
||||
if (type() != other.type()) return false;
|
||||
// Check that variant have the same type, but ignore string ownership
|
||||
if ((type() | OWNERSHIP_BIT) != (other.type() | OWNERSHIP_BIT))
|
||||
return false;
|
||||
|
||||
switch (type()) {
|
||||
case VALUE_IS_LINKED_STRING:
|
||||
|
Reference in New Issue
Block a user