X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Frfxswf.c;h=4a409ac5424b8d8ed3cbd77ce28cb3e92e794ede;hb=ff1365c9402d6384c6b21adf8fef24e8d9b8d593;hp=e6f30c15c1fb188e8cc311a0836631734ba82276;hpb=75e8a98f513e75e2a09dc3e96edc5111af9c1abf;p=swftools.git diff --git a/lib/rfxswf.c b/lib/rfxswf.c index e6f30c1..4a409ac 100644 --- a/lib/rfxswf.c +++ b/lib/rfxswf.c @@ -1229,7 +1229,10 @@ void swf_OptimizeTagOrder(SWF*swf) tag->next = level0; tag->prev = level0->prev; level0->prev = tag; - tag->prev->next = tag; + if(tag->prev) + tag->prev->next = tag; + else + swf->firstTag = tag; changes = 1; } } @@ -1311,9 +1314,11 @@ int swf_WriteSWF2(struct writer_t*writer, SWF * swf) // Writes SWF to file, #ifdef INSERT_RFX_TAG - if (swf->firstTag && swf_NextTag(swf->firstTag)) - if (swf_GetTagID(swf_NextTag(swf->firstTag))!=ST_REFLEX) + if (swf->firstTag && swf->firstTag->next && + (swf->firstTag->id != ST_REFLEX || swf->firstTag->next->id != ST_REFLEX) + ) { swf_SetBlock(swf_InsertTagBefore(swf, swf->firstTag,ST_REFLEX),"rfx",3); + } #endif // INSERT_RFX_TAG @@ -1488,6 +1493,22 @@ int swf_WriteCGI(SWF * swf) return swf_WriteSWF(fileno(stdout),swf); } +SWF* swf_CopySWF(SWF*swf) +{ + SWF*nswf = rfx_alloc(sizeof(SWF)); + memcpy(nswf, swf, sizeof(SWF)); + nswf->firstTag = 0; + TAG*tag = swf->firstTag; + TAG*ntag = 0; + while(tag) { + ntag = swf_CopyTag(ntag, tag); + if(!nswf->firstTag) + nswf->firstTag = ntag; + tag = tag->next; + } + return nswf; +} + void swf_FreeTags(SWF * swf) // Frees all malloc'ed memory for tags { TAG * t = swf->firstTag;