- pos += read_int(&pktlen, data);
- if(len<pktlen)
- return -1;
- pos += read_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);
-}