Distinguish between signed and unsigned in the temporary file

This commit is contained in:
Eric Fischer 2014-12-02 18:03:07 -08:00
parent a1e7426956
commit eaeb55bf71
3 changed files with 9 additions and 3 deletions

View File

@ -179,6 +179,11 @@ void deserialize_int(char **f, int *n) {
*f += sizeof(int);
}
void deserialize_uint(char **f, unsigned *n) {
memcpy(n, *f, sizeof(unsigned));
*f += sizeof(unsigned);
}
void deserialize_byte(char **f, signed char *n) {
memcpy(n, *f, sizeof(signed char));
*f += sizeof(signed char);

View File

@ -28,9 +28,9 @@ drawvec decode_geometry(char **meta, int z, unsigned tx, unsigned ty, int detail
}
if (d.op == VT_MOVETO || d.op == VT_LINETO) {
int wx, wy;
deserialize_int(meta, &wx);
deserialize_int(meta, &wy);
unsigned wx, wy;
deserialize_uint(meta, &wx);
deserialize_uint(meta, &wy);
long long wwx = (unsigned) wx;
long long wwy = (unsigned) wy;

1
tile.h
View File

@ -14,6 +14,7 @@
struct pool;
void deserialize_int(char **f, int *n);
void deserialize_uint(char **f, unsigned *n);
void deserialize_byte(char **f, signed char *n);
struct pool_val *deserialize_string(char **f, struct pool *p, int type);