-static unsigned read_char(char *v, const char *data)
-{
- *v = *data;
- return 1;
-}
-
-static unsigned read_short(short *v, const char *data)
-{
- *v = *(short *)data;
- return sizeof(short);
-}
-
-static unsigned read_int(int *v, const char *data)
-{
- *v = *(int *)data;
- return sizeof(int);
-}
-
-static unsigned read_long(long *v, const char *data)
-{
- *v = *(long *)data;
- return sizeof(long);
-}
-
-static unsigned read_long_long(long long *v, const char *data)
-{
- *v = *(long long *)data;
- return sizeof(long long);
-}
-
-static unsigned read_float(float *v, const char *data)
-{
- *v = *(float *)data;
- return sizeof(float);
-}
-
-static unsigned read_double(double *v, const char *data)
-{
- *v = *(double *)data;
- return sizeof(double);
-}
-
-typedef void *pointer;
-
-static unsigned read_pointer(pointer *v, const char *data)
-{
- *v = *(void **)data;
- return sizeof(void *);
-}
-
-static unsigned read_data(const void **v, const char *data)
-{
- int vlen;
- unsigned pos = 0;
- pos += read_int(&vlen, data);
- if(vlen)
- *v = data+pos;
- else
- *v = NULL;
- return pos+vlen;