X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Frfxswf.c;h=dbf0cd6e472ef59f64aa2c58854d2dfe5b434a38;hb=89bf852c497d296477ac788f00a06b11e5502fa9;hp=ae33ad5139946802e8b2a8b17121b7aebd31a0a9;hpb=08d4f2d6189db011641111a11c53da37424942fc;p=swftools.git diff --git a/lib/rfxswf.c b/lib/rfxswf.c index ae33ad5..dbf0cd6 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 @@ -1491,14 +1496,16 @@ int swf_WriteCGI(SWF * swf) SWF* swf_CopySWF(SWF*swf) { SWF*nswf = rfx_alloc(sizeof(SWF)); + TAG*tag, *ntag; memcpy(nswf, swf, sizeof(SWF)); nswf->firstTag = 0; - TAG*tag = swf->firstTag; - TAG*ntag = 0; + tag = swf->firstTag; + ntag = 0; while(tag) { ntag = swf_CopyTag(ntag, tag); if(!nswf->firstTag) nswf->firstTag = ntag; + tag = tag->next; } return nswf; }