From f7df364754f1e995ca99b0f1b2004c58ed8df991 Mon Sep 17 00:00:00 2001 From: kramm Date: Sun, 27 Jul 2008 09:46:03 +0000 Subject: [PATCH] remove duplicate FILEATTRIBUTES, SCENEDESCRIPTION tags during combining --- src/swfcombine.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/swfcombine.c b/src/swfcombine.c index b4dbfb9..1204cc1 100644 --- a/src/swfcombine.c +++ b/src/swfcombine.c @@ -293,6 +293,20 @@ void args_callback_usage(char *name) printf("\n"); } +void removeCommonTags(SWF * swf) +{ + TAG*tag = swf->firstTag; + while(tag) { + if(tag->id == ST_SCENEDESCRIPTION || + tag->id == ST_FILEATTRIBUTES || + tag->id == ST_REFLEX) { + tag = swf_DeleteTag(swf, tag); + } else { + tag = tag->next; + } + } +} + static void makestackmaster(SWF*swf) { TAG*tag; @@ -317,6 +331,7 @@ static void makestackmaster(SWF*swf) } close(fi); swf_RemoveJPEGTables(&head); + removeCommonTags(&head); msg(" File %s has bounding box %d:%d:%d:%d\n", slave_filename[t], head.movieSize.xmin, head.movieSize.ymin, @@ -443,7 +458,7 @@ void jpeg_assert(SWF*master, SWF*slave) { // ok, both have jpegtables, but they're identical. // delete one and don't throw an error - swf_DeleteTag(spos); + swf_DeleteTag(slave, spos); spos = 0; } } @@ -931,9 +946,7 @@ void catcombine(SWF*master, char*slave_name, SWF*slave, SWF*newswf) } tag = swf_InsertTag(tag, ST_END); - tag = newswf->firstTag; - newswf->firstTag = newswf->firstTag->next; //remove temporary tag - swf_DeleteTag(tag); + swf_DeleteTag(newswf, tag); } void normalcombine(SWF*master, char*slave_name, SWF*slave, SWF*newswf) @@ -1045,9 +1058,7 @@ void normalcombine(SWF*master, char*slave_name, SWF*slave, SWF*newswf) FLAGS_WRITEDEFINES|FLAGS_WRITENONDEFINES| FLAGS_WRITESPRITE ); } - tag = newswf->firstTag; - newswf->firstTag = newswf->firstTag->next; //remove temporary tag - swf_DeleteTag(tag); + swf_DeleteTag(newswf, tag); } void combine(SWF*master, char*slave_name, SWF*slave, SWF*newswf) @@ -1186,6 +1197,7 @@ int main(int argn, char *argv[]) exit(1); } swf_RemoveJPEGTables(&master); + removeCommonTags(&master); msg(" Read %d bytes from masterfile\n", ret); close(fi); } @@ -1254,6 +1266,7 @@ int main(int argn, char *argv[]) msg(" Read %d bytes from slavefile\n", ret); close(fi); swf_RemoveJPEGTables(&slave); + removeCommonTags(&slave); } else { -- 1.7.10.4