X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=lib%2Fmodules%2Fswfaction.c;h=3d701bbad8685e259a85fa7ccc283b032dc52415;hp=9a447989b58e44a4a661478ddc229060b3114fa2;hb=879d0eec420fe0fd5ddcd56c8fe62b82a6744edd;hpb=6c3ab5574d31504d24710c2756899d49275c1a37 diff --git a/lib/modules/swfaction.c b/lib/modules/swfaction.c index 9a44798..3d701bb 100644 --- a/lib/modules/swfaction.c +++ b/lib/modules/swfaction.c @@ -182,7 +182,6 @@ ActionTAG* swf_ActionGet(TAG*tag) void swf_ActionFree(ActionTAG*action) { if(!action) { - fprintf(stderr, "Warning: freeing zero action"); return; } action = action->parent; @@ -208,6 +207,9 @@ void swf_ActionFree(ActionTAG*action) void swf_ActionSet(TAG*tag, ActionTAG*action) { + if(!action) { + return; + } action=action->parent; while(action) { @@ -832,7 +834,7 @@ void action_fixjump(ActionMarker m1, ActionMarker m2) if (a1->op == ACTION_IF || a1->op == ACTION_JUMP) { - *(U16*)(a1->data) = SWAP16(len); + *(U16*)(a1->data) = LE_16_TO_NATIVE(len); } else if(a1->op == ACTION_WAITFORFRAME) { @@ -922,20 +924,20 @@ ActionTAG* action_End(ActionTAG*atag) {return swf_AddActionTAG(atag, ACTION_END, ActionTAG* action_GotoFrame(ActionTAG*atag, U16 frame) { atag = swf_AddActionTAG(atag, ACTION_GOTOFRAME, 0, 2); - *(U16*)atag->tmp = SWAP16(frame); + *(U16*)atag->tmp = LE_16_TO_NATIVE(frame); return atag; } ActionTAG* action_Jump(ActionTAG*atag, U16 branch) { atag = swf_AddActionTAG(atag, ACTION_JUMP, 0, 2); - *(U16*)atag->tmp = SWAP16(branch); + *(U16*)atag->tmp = LE_16_TO_NATIVE(branch); return atag; } ActionTAG* action_If(ActionTAG*atag, U16 branch) { atag = swf_AddActionTAG(atag, ACTION_IF, 0, 2); - *(U16*)atag->tmp = SWAP16(branch); + *(U16*)atag->tmp = LE_16_TO_NATIVE(branch); return atag; } ActionTAG* action_StoreRegister(ActionTAG*atag, U8 reg) @@ -965,11 +967,11 @@ ActionTAG* action_WaitForFrame2(ActionTAG*atag, U8 skip) ActionTAG* action_WaitForFrame(ActionTAG*atag, U16 frame, U8 skip) { atag = swf_AddActionTAG(atag, ACTION_WAITFORFRAME, 0, 3); - *(U16*)atag->tmp = SWAP16(frame); + *(U16*)atag->tmp = LE_16_TO_NATIVE(frame); *(U8*)&atag->tmp[2] = skip; return atag; } -ActionTAG* action_SetTarget(ActionTAG*atag, char* target) +ActionTAG* action_SetTarget(ActionTAG*atag, const char* target) { char*ptr = strdup(target); return swf_AddActionTAG(atag, ACTION_SETTARGET, (U8*)ptr, strlen(ptr)+1); @@ -1102,7 +1104,7 @@ ActionTAG* swf_ActionCompile(const char* source, int version) rfx_free(buffer); a = swf_ActionGet(tag); - swf_DeleteTag(tag); + swf_DeleteTag(0, tag); return a; }