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.cpp114
1 files changed, 0 insertions, 114 deletions
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp
index abf27954b8..fc0b037b07 100644
--- a/core/io/marshalls.cpp
+++ b/core/io/marshalls.cpp
@@ -49,7 +49,6 @@ void EncodedObjectAsID::set_object_id(ObjectID p_id) {
}
ObjectID EncodedObjectAsID::get_object_id() const {
-
return id;
}
@@ -97,7 +96,6 @@ static Error _decode_string(const uint8_t *&buf, int &len, int *r_len, String &r
}
Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int *r_len, bool p_allow_objects) {
-
const uint8_t *buf = p_buffer;
int len = p_len;
@@ -113,13 +111,10 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
*r_len = 4;
switch (type & ENCODE_MASK) {
-
case Variant::NIL: {
-
r_variant = Variant();
} break;
case Variant::BOOL: {
-
ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA);
bool val = decode_uint32(buf);
r_variant = val;
@@ -127,7 +122,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
(*r_len) += 4;
} break;
case Variant::INT: {
-
if (type & ENCODE_FLAG_64) {
ERR_FAIL_COND_V(len < 8, ERR_INVALID_DATA);
int64_t val = decode_uint64(buf);
@@ -145,7 +139,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
} break;
case Variant::FLOAT: {
-
if (type & ENCODE_FLAG_64) {
ERR_FAIL_COND_V(len < 8, ERR_INVALID_DATA);
double val = decode_double(buf);
@@ -162,7 +155,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
} break;
case Variant::STRING: {
-
String str;
Error err = _decode_string(buf, len, r_len, str);
if (err)
@@ -173,7 +165,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
// math types
case Variant::VECTOR2: {
-
ERR_FAIL_COND_V(len < 4 * 2, ERR_INVALID_DATA);
Vector2 val;
val.x = decode_float(&buf[0]);
@@ -185,7 +176,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
} break;
case Variant::VECTOR2I: {
-
ERR_FAIL_COND_V(len < 4 * 2, ERR_INVALID_DATA);
Vector2i val;
val.x = decode_uint32(&buf[0]);
@@ -197,7 +187,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
} break;
case Variant::RECT2: {
-
ERR_FAIL_COND_V(len < 4 * 4, ERR_INVALID_DATA);
Rect2 val;
val.position.x = decode_float(&buf[0]);
@@ -211,7 +200,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
} break;
case Variant::RECT2I: {
-
ERR_FAIL_COND_V(len < 4 * 4, ERR_INVALID_DATA);
Rect2i val;
val.position.x = decode_uint32(&buf[0]);
@@ -225,7 +213,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
} break;
case Variant::VECTOR3: {
-
ERR_FAIL_COND_V(len < 4 * 3, ERR_INVALID_DATA);
Vector3 val;
val.x = decode_float(&buf[0]);
@@ -238,7 +225,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
} break;
case Variant::VECTOR3I: {
-
ERR_FAIL_COND_V(len < 4 * 3, ERR_INVALID_DATA);
Vector3i val;
val.x = decode_uint32(&buf[0]);
@@ -251,12 +237,10 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
} break;
case Variant::TRANSFORM2D: {
-
ERR_FAIL_COND_V(len < 4 * 6, ERR_INVALID_DATA);
Transform2D val;
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 2; j++) {
-
val.elements[i][j] = decode_float(&buf[(i * 2 + j) * 4]);
}
}
@@ -268,7 +252,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
} break;
case Variant::PLANE: {
-
ERR_FAIL_COND_V(len < 4 * 4, ERR_INVALID_DATA);
Plane val;
val.normal.x = decode_float(&buf[0]);
@@ -282,7 +265,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
} break;
case Variant::QUAT: {
-
ERR_FAIL_COND_V(len < 4 * 4, ERR_INVALID_DATA);
Quat val;
val.x = decode_float(&buf[0]);
@@ -296,7 +278,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
} break;
case Variant::AABB: {
-
ERR_FAIL_COND_V(len < 4 * 6, ERR_INVALID_DATA);
AABB val;
val.position.x = decode_float(&buf[0]);
@@ -312,12 +293,10 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
} break;
case Variant::BASIS: {
-
ERR_FAIL_COND_V(len < 4 * 9, ERR_INVALID_DATA);
Basis val;
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
-
val.elements[i][j] = decode_float(&buf[(i * 3 + j) * 4]);
}
}
@@ -329,12 +308,10 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
} break;
case Variant::TRANSFORM: {
-
ERR_FAIL_COND_V(len < 4 * 12, ERR_INVALID_DATA);
Transform val;
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
-
val.basis.elements[i][j] = decode_float(&buf[(i * 3 + j) * 4]);
}
}
@@ -351,7 +328,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
// misc types
case Variant::COLOR: {
-
ERR_FAIL_COND_V(len < 4 * 4, ERR_INVALID_DATA);
Color val;
val.r = decode_float(&buf[0]);
@@ -365,7 +341,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
} break;
case Variant::STRING_NAME: {
-
String str;
Error err = _decode_string(buf, len, r_len, str);
if (err)
@@ -375,7 +350,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
} break;
case Variant::NODE_PATH: {
-
ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA);
int32_t strlen = decode_uint32(buf);
@@ -401,7 +375,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
(*r_len) += 12;
for (uint32_t i = 0; i < total; i++) {
-
String str;
Error err = _decode_string(buf, len, r_len, str);
if (err)
@@ -423,11 +396,9 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
} break;
case Variant::_RID: {
-
r_variant = RID();
} break;
case Variant::OBJECT: {
-
if (type & ENCODE_FLAG_OBJECT_AS_ID) {
//this _is_ allowed
ERR_FAIL_COND_V(len < 8, ERR_INVALID_DATA);
@@ -456,7 +427,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
if (str == String()) {
r_variant = (Object *)nullptr;
} else {
-
Object *obj = ClassDB::instance(str);
ERR_FAIL_COND_V(!obj, ERR_UNAVAILABLE);
@@ -470,7 +440,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
}
for (int i = 0; i < count; i++) {
-
str = String();
err = _decode_string(buf, len, r_len, str);
if (err)
@@ -502,16 +471,13 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
} break;
case Variant::CALLABLE: {
-
r_variant = Callable();
} break;
case Variant::SIGNAL: {
-
r_variant = Signal();
} break;
case Variant::DICTIONARY: {
-
ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA);
int32_t count = decode_uint32(buf);
// bool shared = count&0x80000000;
@@ -527,7 +493,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
Dictionary d;
for (int i = 0; i < count; i++) {
-
Variant key, value;
int used;
@@ -556,7 +521,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
} break;
case Variant::ARRAY: {
-
ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA);
int32_t count = decode_uint32(buf);
// bool shared = count&0x80000000;
@@ -572,7 +536,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
Array varr;
for (int i = 0; i < count; i++) {
-
int used = 0;
Variant v;
Error err = decode_variant(v, buf, len, &used, p_allow_objects);
@@ -591,7 +554,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
// arrays
case Variant::PACKED_BYTE_ARRAY: {
-
ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA);
int32_t count = decode_uint32(buf);
buf += 4;
@@ -604,7 +566,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
data.resize(count);
uint8_t *w = data.ptrw();
for (int32_t i = 0; i < count; i++) {
-
w[i] = buf[i];
}
}
@@ -619,7 +580,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
} break;
case Variant::PACKED_INT32_ARRAY: {
-
ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA);
int32_t count = decode_uint32(buf);
buf += 4;
@@ -634,7 +594,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
data.resize(count);
int32_t *w = data.ptrw();
for (int32_t i = 0; i < count; i++) {
-
w[i] = decode_uint32(&buf[i * 4]);
}
}
@@ -645,7 +604,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
} break;
case Variant::PACKED_INT64_ARRAY: {
-
ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA);
int64_t count = decode_uint64(buf);
buf += 4;
@@ -660,7 +618,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
data.resize(count);
int64_t *w = data.ptrw();
for (int64_t i = 0; i < count; i++) {
-
w[i] = decode_uint64(&buf[i * 8]);
}
}
@@ -671,7 +628,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
} break;
case Variant::PACKED_FLOAT32_ARRAY: {
-
ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA);
int32_t count = decode_uint32(buf);
buf += 4;
@@ -686,7 +642,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
data.resize(count);
float *w = data.ptrw();
for (int32_t i = 0; i < count; i++) {
-
w[i] = decode_float(&buf[i * 4]);
}
}
@@ -698,7 +653,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
} break;
case Variant::PACKED_FLOAT64_ARRAY: {
-
ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA);
int64_t count = decode_uint64(buf);
buf += 4;
@@ -713,7 +667,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
data.resize(count);
double *w = data.ptrw();
for (int64_t i = 0; i < count; i++) {
-
w[i] = decode_double(&buf[i * 8]);
}
}
@@ -725,7 +678,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
} break;
case Variant::PACKED_STRING_ARRAY: {
-
ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA);
int32_t count = decode_uint32(buf);
@@ -738,7 +690,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
//printf("string count: %i\n",count);
for (int32_t i = 0; i < count; i++) {
-
String str;
Error err = _decode_string(buf, len, r_len, str);
if (err)
@@ -751,7 +702,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
} break;
case Variant::PACKED_VECTOR2_ARRAY: {
-
ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA);
int32_t count = decode_uint32(buf);
buf += 4;
@@ -770,7 +720,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
Vector2 *w = varray.ptrw();
for (int32_t i = 0; i < count; i++) {
-
w[i].x = decode_float(buf + i * 4 * 2 + 4 * 0);
w[i].y = decode_float(buf + i * 4 * 2 + 4 * 1);
}
@@ -785,7 +734,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
} break;
case Variant::PACKED_VECTOR3_ARRAY: {
-
ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA);
int32_t count = decode_uint32(buf);
buf += 4;
@@ -805,7 +753,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
Vector3 *w = varray.ptrw();
for (int32_t i = 0; i < count; i++) {
-
w[i].x = decode_float(buf + i * 4 * 3 + 4 * 0);
w[i].y = decode_float(buf + i * 4 * 3 + 4 * 1);
w[i].z = decode_float(buf + i * 4 * 3 + 4 * 2);
@@ -821,7 +768,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
} break;
case Variant::PACKED_COLOR_ARRAY: {
-
ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA);
int32_t count = decode_uint32(buf);
buf += 4;
@@ -841,7 +787,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
Color *w = carray.ptrw();
for (int32_t i = 0; i < count; i++) {
-
w[i].r = decode_float(buf + i * 4 * 4 + 4 * 0);
w[i].g = decode_float(buf + i * 4 * 4 + 4 * 1);
w[i].b = decode_float(buf + i * 4 * 4 + 4 * 2);
@@ -866,7 +811,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
}
static void _encode_string(const String &p_string, uint8_t *&buf, int &r_len) {
-
CharString utf8 = p_string.utf8();
if (buf) {
@@ -886,7 +830,6 @@ static void _encode_string(const String &p_string, uint8_t *&buf, int &r_len) {
}
Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bool p_full_objects) {
-
uint8_t *buf = r_buffer;
r_len = 0;
@@ -894,7 +837,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
uint32_t flags = 0;
switch (p_variant.get_type()) {
-
case Variant::INT: {
int64_t val = p_variant;
if (val > (int64_t)INT_MAX || val < (int64_t)INT_MIN) {
@@ -902,7 +844,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
}
} break;
case Variant::FLOAT: {
-
double d = p_variant;
float f = d;
if (double(f) != d) {
@@ -910,7 +851,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
}
} break;
case Variant::OBJECT: {
-
// Test for potential wrong values sent by the debugger when it breaks.
Object *obj = p_variant.get_validated_object();
if (!obj) {
@@ -937,13 +877,10 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
r_len += 4;
switch (p_variant.get_type()) {
-
case Variant::NIL: {
-
//nothing to do
} break;
case Variant::BOOL: {
-
if (buf) {
encode_uint32(p_variant.operator bool(), buf);
}
@@ -952,7 +889,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
} break;
case Variant::INT: {
-
if (flags & ENCODE_FLAG_64) {
//64 bits
if (buf) {
@@ -969,7 +905,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
}
} break;
case Variant::FLOAT: {
-
if (flags & ENCODE_FLAG_64) {
if (buf) {
encode_double(p_variant.operator double(), buf);
@@ -978,7 +913,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
r_len += 8;
} else {
-
if (buf) {
encode_float(p_variant.operator float(), buf);
}
@@ -988,7 +922,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
} break;
case Variant::NODE_PATH: {
-
NodePath np = p_variant;
if (buf) {
encode_uint32(uint32_t(np.get_name_count()) | 0x80000000, buf); //for compatibility with the old format
@@ -1007,7 +940,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
int total = np.get_name_count() + np.get_subname_count();
for (int i = 0; i < total; i++) {
-
String str;
if (i < np.get_name_count())
@@ -1034,19 +966,16 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
} break;
case Variant::STRING: {
-
_encode_string(p_variant, buf, r_len);
} break;
case Variant::STRING_NAME: {
-
_encode_string(p_variant, buf, r_len);
} break;
// math types
case Variant::VECTOR2: {
-
if (buf) {
Vector2 v2 = p_variant;
encode_float(v2.x, &buf[0]);
@@ -1057,7 +986,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
} break;
case Variant::VECTOR2I: {
-
if (buf) {
Vector2i v2 = p_variant;
encode_uint32(v2.x, &buf[0]);
@@ -1068,7 +996,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
} break;
case Variant::RECT2: {
-
if (buf) {
Rect2 r2 = p_variant;
encode_float(r2.position.x, &buf[0]);
@@ -1080,7 +1007,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
} break;
case Variant::RECT2I: {
-
if (buf) {
Rect2i r2 = p_variant;
encode_uint32(r2.position.x, &buf[0]);
@@ -1092,7 +1018,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
} break;
case Variant::VECTOR3: {
-
if (buf) {
Vector3 v3 = p_variant;
encode_float(v3.x, &buf[0]);
@@ -1104,7 +1029,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
} break;
case Variant::VECTOR3I: {
-
if (buf) {
Vector3i v3 = p_variant;
encode_uint32(v3.x, &buf[0]);
@@ -1116,12 +1040,10 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
} break;
case Variant::TRANSFORM2D: {
-
if (buf) {
Transform2D val = p_variant;
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 2; j++) {
-
copymem(&buf[(i * 2 + j) * 4], &val.elements[i][j], sizeof(float));
}
}
@@ -1131,7 +1053,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
} break;
case Variant::PLANE: {
-
if (buf) {
Plane p = p_variant;
encode_float(p.normal.x, &buf[0]);
@@ -1144,7 +1065,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
} break;
case Variant::QUAT: {
-
if (buf) {
Quat q = p_variant;
encode_float(q.x, &buf[0]);
@@ -1157,7 +1077,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
} break;
case Variant::AABB: {
-
if (buf) {
AABB aabb = p_variant;
encode_float(aabb.position.x, &buf[0]);
@@ -1172,12 +1091,10 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
} break;
case Variant::BASIS: {
-
if (buf) {
Basis val = p_variant;
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
-
copymem(&buf[(i * 3 + j) * 4], &val.elements[i][j], sizeof(float));
}
}
@@ -1187,12 +1104,10 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
} break;
case Variant::TRANSFORM: {
-
if (buf) {
Transform val = p_variant;
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
-
copymem(&buf[(i * 3 + j) * 4], &val.basis.elements[i][j], sizeof(float));
}
}
@@ -1208,7 +1123,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
// misc types
case Variant::COLOR: {
-
if (buf) {
Color c = p_variant;
encode_float(c.r, &buf[0]);
@@ -1221,18 +1135,13 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
} break;
case Variant::_RID: {
-
} break;
case Variant::CALLABLE: {
-
} break;
case Variant::SIGNAL: {
-
} break;
case Variant::OBJECT: {
-
if (p_full_objects) {
-
Object *obj = p_variant;
if (!obj) {
if (buf) {
@@ -1248,7 +1157,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
int pc = 0;
for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) {
-
if (!(E->get().usage & PROPERTY_USAGE_STORAGE))
continue;
pc++;
@@ -1262,7 +1170,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
r_len += 4;
for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) {
-
if (!(E->get().usage & PROPERTY_USAGE_STORAGE))
continue;
@@ -1280,7 +1187,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
}
} else {
if (buf) {
-
Object *obj = p_variant.get_validated_object();
ObjectID id;
if (obj) {
@@ -1295,7 +1201,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
} break;
case Variant::DICTIONARY: {
-
Dictionary d = p_variant;
if (buf) {
@@ -1308,7 +1213,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
d.get_key_list(&keys);
for (List<Variant>::Element *E = keys.front(); E; E = E->next()) {
-
/*
CharString utf8 = E->->utf8();
@@ -1339,7 +1243,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
} break;
case Variant::ARRAY: {
-
Array v = p_variant;
if (buf) {
@@ -1350,7 +1253,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
r_len += 4;
for (int i = 0; i < v.size(); i++) {
-
int len;
encode_variant(v.get(i), buf, len, p_full_objects);
ERR_FAIL_COND_V(len % 4, ERR_BUG);
@@ -1362,7 +1264,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
} break;
// arrays
case Variant::PACKED_BYTE_ARRAY: {
-
Vector<uint8_t> data = p_variant;
int datalen = data.size();
int datasize = sizeof(uint8_t);
@@ -1384,7 +1285,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
} break;
case Variant::PACKED_INT32_ARRAY: {
-
Vector<int32_t> data = p_variant;
int datalen = data.size();
int datasize = sizeof(int32_t);
@@ -1401,7 +1301,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
} break;
case Variant::PACKED_INT64_ARRAY: {
-
Vector<int64_t> data = p_variant;
int datalen = data.size();
int datasize = sizeof(int64_t);
@@ -1418,7 +1317,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
} break;
case Variant::PACKED_FLOAT32_ARRAY: {
-
Vector<float> data = p_variant;
int datalen = data.size();
int datasize = sizeof(float);
@@ -1435,7 +1333,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
} break;
case Variant::PACKED_FLOAT64_ARRAY: {
-
Vector<double> data = p_variant;
int datalen = data.size();
int datasize = sizeof(double);
@@ -1452,7 +1349,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
} break;
case Variant::PACKED_STRING_ARRAY: {
-
Vector<String> data = p_variant;
int len = data.size();
@@ -1464,7 +1360,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
r_len += 4;
for (int i = 0; i < len; i++) {
-
CharString utf8 = data.get(i).utf8();
if (buf) {
@@ -1484,7 +1379,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
} break;
case Variant::PACKED_VECTOR2_ARRAY: {
-
Vector<Vector2> data = p_variant;
int len = data.size();
@@ -1496,9 +1390,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
r_len += 4;
if (buf) {
-
for (int i = 0; i < len; i++) {
-
Vector2 v = data.get(i);
encode_float(v.x, &buf[0]);
@@ -1511,7 +1403,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
} break;
case Variant::PACKED_VECTOR3_ARRAY: {
-
Vector<Vector3> data = p_variant;
int len = data.size();
@@ -1523,9 +1414,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
r_len += 4;
if (buf) {
-
for (int i = 0; i < len; i++) {
-
Vector3 v = data.get(i);
encode_float(v.x, &buf[0]);
@@ -1539,7 +1428,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
} break;
case Variant::PACKED_COLOR_ARRAY: {
-
Vector<Color> data = p_variant;
int len = data.size();
@@ -1551,9 +1439,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
r_len += 4;
if (buf) {
-
for (int i = 0; i < len; i++) {
-
Color c = data.get(i);
encode_float(c.r, &buf[0]);