X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fmodules%2Fswftools.c;h=cd57d6f06f0608b1f913e74155b3c1fe5f8fe119;hb=ba795e71ec2ec6c4285f69e632b229c794aaf19e;hp=426ea41cd828f45c152545c18854cd59b3411d32;hpb=4a566feb5f1074db505f5f8a78c7fdf487d94b9a;p=swftools.git diff --git a/lib/modules/swftools.c b/lib/modules/swftools.c index 426ea41..cd57d6f 100644 --- a/lib/modules/swftools.c +++ b/lib/modules/swftools.c @@ -123,6 +123,7 @@ U16 swf_GetDefineID(TAG * t) case ST_DEFINEFONTALIGNZONES: //pseudodefine case ST_DEFINEFONTNAME: //pseudodefine case ST_DEFINETEXT: + case ST_DEFINEBINARY: case ST_DEFINETEXT2: case ST_DEFINESOUND: case ST_DEFINESPRITE: @@ -635,6 +636,10 @@ void enumerateUsedIDs(TAG * tag, int base, void (*callback)(TAG*, int, void*), v } } break; + case ST_DOABC: + case ST_RAWABC: + break; + case ST_FREECHARACTER: /* unusual tags, which all start with an ID */ case ST_NAMECHARACTER: case ST_DEFINEBINARY: @@ -961,12 +966,13 @@ void swf_GetUsedIDs(TAG * t, int * positions) enumerateUsedIDs(t, 0, callbackFillin, &ptr); } -void swf_Relocate (SWF*swf, char*bitmap) +char swf_Relocate (SWF*swf, char*bitmap) { TAG*tag; int slaveids[65536]; memset(slaveids, -1, sizeof(slaveids)); tag = swf->firstTag; + char ok = 1; while(tag) { int num; @@ -982,8 +988,7 @@ void swf_Relocate (SWF*swf, char*bitmap) if(!bitmap[id]) { //free newid = id; - } - else { + } else { newid = 0; for (t=1;t<65536;t++) { @@ -993,6 +998,10 @@ void swf_Relocate (SWF*swf, char*bitmap) break; } } + if(t==65536) { + fprintf(stderr, "swf_Relocate: Couldn't relocate: Out of IDs"); + return 0; + } } bitmap[newid] = 1; slaveids[id] = newid; @@ -1010,6 +1019,7 @@ void swf_Relocate (SWF*swf, char*bitmap) if(slaveids[id]<0) { fprintf(stderr, "swf_Relocate: Mapping id (%d) never encountered before in %s\n", id, swf_TagGetName(tag)); + ok = 0; } else { id = slaveids[id]; PUT16(&tag->data[ptr[t]], id); @@ -1018,6 +1028,7 @@ void swf_Relocate (SWF*swf, char*bitmap) } tag=tag->next; } + return ok; } /* untested */