X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fas3%2Fpool.c;h=a74ddb2907448cc5c302248605425bafdbd0fb6b;hb=36a1fac8ea3a7457f25b1b4209b5fc918cc6af44;hp=bedc23bfffc6d308b96ca91c9445aad9158d6a89;hpb=3a6bca721cad44853f77a3e76f937d0ef5ff7bf5;p=swftools.git diff --git a/lib/as3/pool.c b/lib/as3/pool.c index bedc23b..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); } @@ -634,9 +634,6 @@ type_t multiname_type = { // ------------------------------- constants ------------------------------------- -#define NS_TYPE(x) ((x) == 0x08 || (x) == 0x16 || (x) == 0x17 || (x) == 0x18 || \ - (x) == 0x19 || (x) == 0x1a || (x) == 0x05) - #define UNIQUE_CONSTANT(x) ((x) == CONSTANT_TRUE || (x) == CONSTANT_FALSE || (x) == CONSTANT_NULL || (x) == CONSTANT_UNDEFINED) constant_t* constant_new_int(int i) @@ -706,6 +703,18 @@ constant_t* constant_new_undefined() c->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) {