- pos += read_short((short *)&func, data+pos);
- if(dec)
- {
- if(func&0x8000)
- ret = decode_gldfunc(dec, func, data+pos);
- else
- ret = decode_func(dec, func, data+pos);
- if(ret<0)
- return -1;
- }
- return pktlen;
-}
-
-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);
-}