From: kramm Date: Tue, 23 Dec 2008 18:43:50 +0000 (+0000) Subject: added dup stubs X-Git-Tag: release-0-9-0~648 X-Git-Url: http://git.asbjorn.it/?a=commitdiff_plain;h=4987e1acaaadbee119088bcdda9f560a44777261;p=swftools.git added dup stubs --- diff --git a/lib/as3/code.c b/lib/as3/code.c index 62dd2a1..49f794e 100644 --- a/lib/as3/code.c +++ b/lib/as3/code.c @@ -1045,8 +1045,19 @@ code_t* code_append(code_t*code, code_t*toappend) return code_end(toappend); } +lookupswitch_t*lookupswitch_dup(lookupswitch_t*l) +{ + lookupswitch_t*n = malloc(sizeof(lookupswitch_t)); + fprintf(stderr, "lookupswitch dupping not supported yet\n"); + n->targets = list_clone(l->targets); + return 0; +} + code_t*code_dup(code_t*c) { + /* misses branch relocation */ + fprintf(stderr, "dupping not supported yet\n"); + return 0; if(!c) return 0; while(c->prev) c = c->prev; @@ -1055,6 +1066,25 @@ code_t*code_dup(code_t*c) while(c) { NEW(code_t, n); memcpy(n, c, sizeof(code_t)); + + opcode_t*op = opcode_get(c->opcode); + char*p = op?op->params:""; + int pos=0; + while(*p) { + if(*p == '2') { //multiname + c->data[pos] = multiname_clone(c->data[pos]); + } else if(*p == 's' || *p == 'D') { + c->data[pos] = strdup(c->data[pos]); + } else if(*p == 'f') { + double old = *(double*)c->data[pos]; + c->data[pos] = malloc(sizeof(double)); + *(double*)c->data[pos] = old; + } else if(strchr("S", *p)) { + c->data[pos] = lookupswitch_dup(c->data[pos]); + } + p++;pos++; + } + n->prev = last; if(last) { last->next = n;