Try to make the new serialization format backward-compatible with the old one.

[INTERPRETER]
* BUG: Try to make the new serialization format backward-compatible with the old one.
This commit is contained in:
gambas 2022-02-11 18:59:31 +01:00
parent da4002dede
commit dbd1091373

View file

@ -1272,11 +1272,14 @@ void STREAM_read_type(STREAM *stream, TYPE type, VALUE *value)
THROW_SERIAL();
}
else
{
atype = ((CLASS *)type)->array_type;
}
if (TYPE_is_pure_object(atype))
CLASS_load((CLASS *)atype);
STREAM_read(stream, &buffer._byte, 1); // Compatibility with old format
size = read_length(stream);
GB_ArrayNew((GB_ARRAY *)&array, atype, size);
@ -1783,6 +1786,12 @@ void STREAM_write_type(STREAM *stream, TYPE type, VALUE *value)
STREAM_write(stream, &buffer._byte, 1);
}
if (TYPE_is_pure_object(array->type))
buffer._byte = T_OBJECT;
else
buffer._byte = (uchar)array->type;
STREAM_write(stream, &buffer._byte, 1); // Compatibility with old format
write_length(stream, array->count);
}