X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fmodules%2Fswfaction.c;h=4c47d53568de0a81d1031c8c1e3341180f875bec;hb=47959de33e640212bf416d46c4069d1d25cb4643;hp=301c4c94ff4ffa2d1f16790905de6c7c5cb20c51;hpb=2275b63cc1e60eb913a939f4cc773763eef5f8cf;p=swftools.git diff --git a/lib/modules/swfaction.c b/lib/modules/swfaction.c index 301c4c9..4c47d53 100644 --- a/lib/modules/swfaction.c +++ b/lib/modules/swfaction.c @@ -128,7 +128,7 @@ r: register (byte) }; static int definedactions = sizeof(actions)/sizeof(struct Action); -ActionTAG* swf_GetActions(TAG*tag) +ActionTAG* swf_ActionGet(TAG*tag) { U8 op = 1; int length; @@ -149,10 +149,8 @@ ActionTAG* swf_GetActions(TAG*tag) length = swf_GetU16(tag); if(length) { - int t; data = malloc(length); - for(t=0;tdata && action->data != action->tmp) + free(action->data); + tmp = action; + action=action->next; + free(tmp); + } +} + +void swf_ActionSet(TAG*tag, ActionTAG*action) { while(action) { @@ -288,24 +299,27 @@ void swf_DumpActions(ActionTAG*atag, char*prefix) if(type == 0) { printf(" String:\"%s\"", value); } else if (type == 1) { - printf(" Float:\"%f\"", *(float*)value); + printf(" Float:%f", *(float*)value); } else if (type == 2) { printf(" NULL"); } else if (type == 4) { printf(" register:%d", *value); } else if (type == 5) { - printf(" %s", *value?"true":"false"); + printf(" bool:%s", *value?"true":"false"); } else if (type == 6) { - printf(" %f", *(double*)value); + printf(" float:%f", *(double*)value); } else if (type == 7) { - printf(" %d", *(int*)value); + printf(" int:%d", *(int*)value); } else if (type == 8) { printf(" Lookup:%d", *value); + } else { + printf(" UNKNOWN[%02x]",type); } } break; } data += OpAdvance(*cp, data); - if(*cp!='c' || !poollen) + if((*cp!='c' || !poollen) && + (*cp!='p' || !(data<&atag->data[atag->len]))) cp++; if(poollen) poollen--; @@ -315,14 +329,14 @@ void swf_DumpActions(ActionTAG*atag, char*prefix) { int nl = ((atag->data+atag->len)-data); int t; - printf(" remainder of %d bytes:\"", nl); + printf(" (remainder of %d bytes:\"", nl); for(t=0;tnext; @@ -745,8 +759,8 @@ void action_GetUrl(char* url, char* label) int l2= strlen(label); char*ptr = malloc(l1+l2+2); strcpy(ptr, url); - strcat(&ptr[l2+1], label); - swf_AddActionTAG(ACTION_GETURL, ptr, strlen(ptr)); + strcpy(&ptr[l1+1], label); + swf_AddActionTAG(ACTION_GETURL, ptr, l1+l2+2); } //TODO: void action_DefineFunction(U8*data, int len) {}