Use the same serialization in both places, and add sanity checks

This commit is contained in:
Eric Fischer
2016-08-08 17:08:36 -07:00
parent bf571571a9
commit 8b339abd40
3 changed files with 43 additions and 44 deletions
+4 -1
View File
@@ -31,7 +31,10 @@ drawvec decode_geometry(FILE *meta, long long *geompos, int z, unsigned tx, unsi
while (1) {
draw d;
deserialize_byte_io(meta, &d.op, geompos);
if (!deserialize_byte_io(meta, &d.op, geompos)) {
fprintf(stderr, "Internal error: Unexpected end of file in geometry\n");
exit(EXIT_FAILURE);
}
if (d.op == VT_END) {
break;
}