From: kramm Date: Mon, 24 Nov 2008 16:17:36 +0000 (+0000) Subject: fixed some bugs in Get/SetU30 X-Git-Tag: release-0-9-0~751 X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=commitdiff_plain;h=f37b0cbc930fb3d9907044f24471d57c9f68dd43 fixed some bugs in Get/SetU30 --- diff --git a/lib/rfxswf.c b/lib/rfxswf.c index ecc5fd3..b6062c5 100644 --- a/lib/rfxswf.c +++ b/lib/rfxswf.c @@ -282,13 +282,19 @@ int swf_GetU30(TAG*tag) { U32 shift = 0; U32 s = 0; + int nr=0; while(1) { U8 b = swf_GetU8(tag); + nr++; s|=(b&127)<=32) break; } + /*int nr2= swf_SetU30(0, s); + if(nr!=nr2) { + printf("Signed value %d stored in %d bytes, I'd store it in %d bytes\n", s, nr, nr2); + }*/ return s; } int swf_GetS30(TAG*tag) @@ -301,20 +307,26 @@ int swf_GetS30(TAG*tag) nr++; s|=(b&127)<=32) { if(b&64) { s|=0xffffffff<len; + int nr=0; while(1) { U8 val = s&0x7f; U8 vsign = s&0x80; @@ -339,6 +351,10 @@ int swf_SetS30(TAG*tag, S32 s) } int swf_SetU30(TAG*tag, U32 u) { + if(u&0x80000000) { + fprintf(stderr, "Bit 31 set in U30 value"); + u&=0x7fffffff; + } int nr = 0; do { if(tag)