summaryrefslogtreecommitdiff
path: root/core/io/marshalls.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/io/marshalls.cpp')
-rw-r--r--core/io/marshalls.cpp20
1 files changed, 6 insertions, 14 deletions
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp
index 1d9d2dd959..37320d7a77 100644
--- a/core/io/marshalls.cpp
+++ b/core/io/marshalls.cpp
@@ -324,7 +324,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
ERR_FAIL_COND_V(len < 12, ERR_INVALID_DATA);
Vector<StringName> names;
Vector<StringName> subnames;
- StringName prop;
uint32_t namecount = strlen &= 0x7FFFFFFF;
uint32_t subnamecount = decode_uint32(buf + 4);
@@ -333,9 +332,10 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
len -= 12;
buf += 12;
+ if (flags & 2) // Obsolete format with property seperate from subpath
+ subnamecount++;
+
uint32_t total = namecount + subnamecount;
- if (flags & 2)
- total++;
if (r_len)
(*r_len) += 12;
@@ -359,10 +359,8 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
if (i < namecount)
names.push_back(str);
- else if (i < namecount + subnamecount)
- subnames.push_back(str);
else
- prop = str;
+ subnames.push_back(str);
buf += strlen + pad;
len -= strlen + pad;
@@ -371,7 +369,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
(*r_len) += 4 + strlen + pad;
}
- r_variant = NodePath(names, subnames, flags & 1, prop);
+ r_variant = NodePath(names, subnames, flags & 1);
} else {
//old format, just a string
@@ -919,8 +917,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
uint32_t flags = 0;
if (np.is_absolute())
flags |= 1;
- if (np.get_property() != StringName())
- flags |= 2;
encode_uint32(flags, buf + 8);
@@ -930,8 +926,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
r_len += 12;
int total = np.get_name_count() + np.get_subname_count();
- if (np.get_property() != StringName())
- total++;
for (int i = 0; i < total; i++) {
@@ -939,10 +933,8 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
if (i < np.get_name_count())
str = np.get_name(i);
- else if (i < np.get_name_count() + np.get_subname_count())
- str = np.get_subname(i - np.get_subname_count());
else
- str = np.get_property();
+ str = np.get_subname(i - np.get_name_count());
CharString utf8 = str.utf8();