if(m->namespace_set) {
namespace_set_destroy(m->namespace_set);m->namespace_set = 0;
}
+ m->type=0;
free(m);
}
}
{
if(!c)
return 0;
- char buf[30];
+ char buf[32];
if(NS_TYPE(c->type)) {
return namespace_tostring(c->ns);
} else if(c->type == CONSTANT_INT) {
sprintf(buf, "%u", c->u);
return strdup(buf);
} else if(c->type == CONSTANT_FLOAT) {
+ char buf[1024];
sprintf(buf, "%f", c->f);
return strdup(buf);
} else if(c->type == CONSTANT_STRING) {
int pool_register_string(pool_t*pool, const char*s)
{
if(!s) return 0;
- int pos = array_append_if_new(pool->x_strings, s, 0);
+ ptroff_t l = strlen(s);
+ int pos = array_append_if_new(pool->x_strings, s, (void*)l);
assert(pos!=0);
return pos;
}
{
if(!n) return 0;
int pos = array_append_if_new(pool->x_multinames, n, 0);
- if(pos==0) {
- *(int*)0=0xdead;
- }
assert(pos!=0);
return pos;
}
{
return (char*)array_getkey(pool->x_strings, i);
}
+string_t pool_lookup_string2(pool_t*pool, int i)
+{
+ char*s = (char*)array_getkey(pool->x_strings, i);
+ int len = (int)(ptroff_t)array_getvalue(pool->x_strings, i);
+ return string_new(s,len);
+}
namespace_t*pool_lookup_namespace(pool_t*pool, int i)
{
return (namespace_t*)array_getkey(pool->x_namespaces, i);
char*s = malloc(len+1);
swf_GetBlock(tag, s, len);
s[len] = 0;
- array_append(pool->x_strings, s, 0);
+ array_append(pool->x_strings, s, (void*)(ptroff_t)len);
free(s);
DEBUG printf("%d) \"%s\"\n", t, pool->x_strings->d[t].name);
}
However when actually using zero strings as empty namespaces, the
flash player breaks.*/
//if(ns->name && ns->name[0])
- array_append_if_new(pool->x_strings, ns->name, 0);
+ pool_register_string(pool, ns->name);
}
//pool_register_int(pool, 15);
}
swf_SetU30(tag, pool->x_strings->num>1?pool->x_strings->num:0);
for(t=1;t<pool->x_strings->num;t++) {
- swf_SetU30String(tag, array_getkey(pool->x_strings, t));
+ string_t str = pool_lookup_string2(pool, t);
+ swf_SetU30String(tag, str.str, str.len);
}
swf_SetU30(tag, pool->x_namespaces->num>1?pool->x_namespaces->num:0);
for(t=1;t<pool->x_namespaces->num;t++) {