X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fas3%2Fpool.c;h=a74ddb2907448cc5c302248605425bafdbd0fb6b;hb=36a1fac8ea3a7457f25b1b4209b5fc918cc6af44;hp=54609d0f23bcc3485c4644d4604f6f6b276d16a1;hpb=9ee97b0258700c746404edfcd9640a0a327eb21f;p=swftools.git diff --git a/lib/as3/pool.c b/lib/as3/pool.c index 54609d0..a74ddb2 100644 --- a/lib/as3/pool.c +++ b/lib/as3/pool.c @@ -250,7 +250,7 @@ namespace_t* namespace_new(U8 access, const char*name) ns->name = name?strdup(name):0; return ns; } -namespace_t* namespace_new_undefined(const char*name) { +namespace_t* namespace_new_namespace(const char*name) { return namespace_new(0x08, name); // public? } namespace_t* namespace_new_package(const char*name) { @@ -275,7 +275,7 @@ namespace_t* namespace_new_private(const char*name) { void namespace_destroy(namespace_t*n) { if(n) { - free(n->name);n->name=0; + free((char*)n->name);n->name=0; n->access=0x00; free(n); } @@ -521,7 +521,7 @@ char* multiname_tostring(multiname_t*m) char*name = m->name?escape_string(m->name):strdup("*"); int namelen = strlen(name); - if(m->type==QNAME || m->type==QNAMEA) { + if(m->type==QNAME || m->type==QNAMEA || m->type==POSTFIXTYPE) { char*nsname = escape_string(m->ns->name); mname = malloc(strlen(nsname)+namelen+32); strcpy(mname, "type = CONSTANT_UNDEFINED; return c; } +constant_t* constant_clone(constant_t*other) +{ + if(!other) return 0; + constant_t*c = malloc(sizeof(constant_t)); + memcpy(c, other, sizeof(constant_t)); + if(NS_TYPE(c->type)) { + c->ns = namespace_clone(other->ns); + } else if(c->type == CONSTANT_STRING) { + c->s = string_dup3(other->s); + } + return c; +} constant_t* constant_fromindex(pool_t*pool, int index, int type) { if(!index) { @@ -1171,16 +1180,11 @@ void pool_read(pool_t*pool, TAG*tag) int namespace_set_index = swf_GetU30(tag); m.namespace_set = (namespace_set_t*)array_getkey(pool->x_namespace_sets, namespace_set_index); } else if(m.type==0x1d) { - int v1 = swf_GetU30(tag); - int v2 = swf_GetU30(tag); - int v3 = swf_GetU30(tag); - //printf("%02x %02x %02x\n", v1, v2, v3); - m.type = 0x07; - m.namespace_set = 0; - m.name = pool_lookup_string(pool, v1); - m.ns = pool_lookup_namespace(pool, v2); - /* not sure what to do with v3- - it's definitely not a namespace */ + int v1 = swf_GetU30(tag); //multiname + int v2 = swf_GetU30(tag); //counter? + int v3 = swf_GetU30(tag); //multiname + // e.g. Vector ... we only store the parent object + m = *(multiname_t*)array_getkey(pool->x_multinames, v1); } else { printf("can't parse type %d multinames yet\n", m.type); }