X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgldecoder.c;h=f61e327aa92a9217a589ebb8f7174680f8125a7c;hb=03c86c2f632b642aa94f721e326787e91aa69c25;hp=e11d13c46d51ef0a064415eecf7933b7cb0e6b10;hpb=c6b2f7585d51164dc32f4dd2a05855913e464c58;p=gldbg.git diff --git a/source/gldecoder.c b/source/gldecoder.c index e11d13c..f61e327 100644 --- a/source/gldecoder.c +++ b/source/gldecoder.c @@ -9,10 +9,12 @@ Distributed under the GPL #include #include "functions.h" #include "gldecoder.h" +#include "tmpalloc.h" static unsigned read_short(short *, const char *); static unsigned read_int(int *, const char *); -static int decode_func(GlDecoder *, short, const char *); +static int decode_func(GlDecoder *, unsigned short, const char *); +static int decode_gldfunc(GlDecoder *, unsigned short, const char *); GlDecoder *gldecoder_new(void *user_data, void (*destroy)(void *)) { @@ -36,19 +38,22 @@ void gldecoder_delete(GlDecoder *dec) int gldecoder_decode(GlDecoder *dec, const char *data, unsigned len) { unsigned pos = 0; - int pktlen; - short func; + unsigned pktlen; + unsigned short func; int ret; if(lengldError) + dec->gldError(dec->user_data, code); + return pos; +} + +static int decode_gldfunc(GlDecoder *dec, unsigned short func, const char *data) +{ + switch(func) + { + case FUNC_GLDERROR: return decode_gldError(dec, data); + default: return -1; + } +}