X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgldecoder.c;h=999acccc9cec140d141f5db97f878af136282cdf;hb=fab9ed5163a8f4ef5314bc67e48d1690d1126649;hp=f61e327aa92a9217a589ebb8f7174680f8125a7c;hpb=03c86c2f632b642aa94f721e326787e91aa69c25;p=gldbg.git diff --git a/source/gldecoder.c b/source/gldecoder.c index f61e327..999accc 100644 --- a/source/gldecoder.c +++ b/source/gldecoder.c @@ -1,7 +1,7 @@ /* $Id$ This file is part of gldbg -Copyright © 2009 Mikko Rasa, Mikkosoft Productions +Copyright © 2009-2010 Mikko Rasa, Mikkosoft Productions Distributed under the GPL */ @@ -9,12 +9,10 @@ Distributed under the GPL #include #include "functions.h" #include "gldecoder.h" -#include "tmpalloc.h" +#include "packet.h" -static unsigned read_short(short *, const char *); -static unsigned read_int(int *, const char *); -static int decode_func(GlDecoder *, unsigned short, const char *); -static int decode_gldfunc(GlDecoder *, unsigned short, const char *); +static int decode_func(GlDecoder *, unsigned short, GlPacket *); +static int decode_gldfunc(GlDecoder *, unsigned short, GlPacket *); GlDecoder *gldecoder_new(void *user_data, void (*destroy)(void *)) { @@ -37,127 +35,46 @@ void gldecoder_delete(GlDecoder *dec) int gldecoder_decode(GlDecoder *dec, const char *data, unsigned len) { - unsigned pos = 0; - unsigned pktlen; + GlPacket *pkt; 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) +static int decode_gldfunc(GlDecoder *dec, unsigned short func, GlPacket *pkt) { switch(func) { - case FUNC_GLDERROR: return decode_gldError(dec, data); + case FUNC_GLDERROR: decode_gldError(dec, pkt); break; default: return -1; } + return 0; }