X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=lib%2Fmodules%2Fswftools.c;h=e3d20eeb6ea89a3d949cf9d485d0770fd7ffd6ce;hp=2de52f7020b6c3fd947018faeaafa3703b062920;hb=8526dcf3a698c688e2cc4430ae106b5ecf70677f;hpb=cbc6baaa2cbb83ceb6f13be79051bcceaaa462f3 diff --git a/lib/modules/swftools.c b/lib/modules/swftools.c index 2de52f7..e3d20ee 100644 --- a/lib/modules/swftools.c +++ b/lib/modules/swftools.c @@ -560,7 +560,7 @@ void enumerateUsedIDs(TAG * tag, int base, void (*callback)(TAG*, int, void*), v if(id == ST_END) break; tag2->len = tag2->memsize = len; - tag2->data = malloc(len); + tag2->data = rfx_alloc(len); memcpy(tag2->data, &tag->data[tag->pos], len); /* I never saw recursive sprites, but they are (theoretically) possible, so better add base here again */ @@ -844,7 +844,7 @@ void swf_Relocate (SWF*swf, char*bitmap) } num = swf_GetNumUsedIDs(tag); - ptr = malloc(sizeof(int)*num); + ptr = rfx_alloc(sizeof(int)*num); swf_GetUsedIDs(tag, ptr); for(t=0;tid == ST_DEFINESHAPE || + tag->id == ST_DEFINESHAPE2 || + tag->id == ST_DEFINESHAPE3) + return 1; + return 0; +} + +U8 swf_isImageTag(TAG*tag) +{ + if(tag->id == ST_DEFINEBITSJPEG || + tag->id == ST_DEFINEBITSJPEG2 || + tag->id == ST_DEFINEBITSJPEG3 || + tag->id == ST_DEFINEBITSLOSSLESS || + tag->id == ST_DEFINEBITSLOSSLESS2) + return 1; + return 0; +} + TAG* swf_Concatenate (TAG*list1,TAG*list2) { TAG*tag=0,*lasttag=0; @@ -950,14 +970,11 @@ static int tagHash(TAG*tag) void swf_Optimize(SWF*swf) { const int hash_size = 131072; - char* dontremap = malloc(sizeof(char)*65536); - U16* remap = malloc(sizeof(U16)*65536); - TAG* id2tag = malloc(sizeof(TAG*)*65536); - TAG** hashmap = malloc(sizeof(TAG*)*hash_size); + char* dontremap = rfx_calloc(sizeof(char)*65536); + U16* remap = rfx_alloc(sizeof(U16)*65536); + TAG* id2tag = rfx_calloc(sizeof(TAG*)*65536); + TAG** hashmap = rfx_calloc(sizeof(TAG*)*hash_size); TAG* tag; - memset(dontremap, 0, sizeof(char)*65536); - memset(hashmap, 0, sizeof(TAG*)*hash_size); - memset(id2tag, 0, sizeof(TAG*)*65536); int t; for(t=0;t<65536;t++) { remap[t] = t; @@ -1034,7 +1051,7 @@ void swf_Optimize(SWF*swf) if(doremap) { int num = swf_GetNumUsedIDs(tag); - int*positions = malloc(sizeof(int)*num); + int*positions = rfx_alloc(sizeof(int)*num); int t; swf_GetUsedIDs(tag, positions); for(t=0;tdata[positions[t]], id); } - free(positions); + rfx_free(positions); tag = tag->next; } tag = next; } - free(dontremap); - free(remap); - free(id2tag); - free(hashmap); + rfx_free(dontremap); + rfx_free(remap); + rfx_free(id2tag); + rfx_free(hashmap); }