Fix binary object marshalling, closes #9472

This commit is contained in:
Juan Linietsky 2017-08-21 11:20:13 -03:00
parent d8cd849a43
commit 1be30f35a6

View file

@ -807,11 +807,16 @@ static void _encode_string(const String &p_string, uint8_t *&buf, int &r_len) {
encode_uint32(utf8.length(), buf);
buf += 4;
copymem(buf, utf8.get_data(), utf8.length());
buf += utf8.length();
}
r_len += 4 + utf8.length();
while (r_len % 4)
while (r_len % 4) {
r_len++; //pad
if (buf) {
buf++;
}
}
}
Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bool p_object_as_id) {