small print refinement
[swftools.git] / lib / as3 / pool.c
index 59fc2e3..952dcb5 100644 (file)
@@ -181,7 +181,13 @@ char* namespace_tostring(namespace_t*ns)
     access = access2str(type);
     char*s = escape_string(ns->name);
     char*string = (char*)malloc(strlen(access)+strlen(s)+3);
-    int l = sprintf(string, "[%s]%s", access, s);
+    if(!s)
+        sprintf(string, "[%s]NULL", access, s);
+    else if(!*s)
+        sprintf(string, "[%s]\"\"", access, s);
+    else 
+        sprintf(string, "[%s]", access, s);
+
     free(s);
     return string;
 }
@@ -611,6 +617,7 @@ void multiname_destroy(multiname_t*m)
         if(m->namespace_set) {
             namespace_set_destroy(m->namespace_set);m->namespace_set = 0;
         }
+        m->type=0;
         free(m);
     }
 }
@@ -720,7 +727,7 @@ char* constant_tostring(constant_t*c)
 {
     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) {
@@ -730,6 +737,7 @@ char* constant_tostring(constant_t*c)
         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) {
@@ -836,9 +844,6 @@ int pool_register_multiname(pool_t*pool, multiname_t*n)
 {
     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;
 }