added some comments
[swftools.git] / lib / as3 / pool.c
index 65e7793..fc92648 100644 (file)
@@ -38,6 +38,8 @@ char* access2str(int type)
 char* multiname_to_string(multiname_t*m)
 {
     char*mname = 0;
+    if(!m)
+        return strdup("--<UNDEFINED_MULTINAME>--");
     if(m->type==0x07 || m->type==0x0d) {
         mname = malloc(strlen(m->ns->name)+strlen(m->name)+32);
         sprintf(mname, "<%s>\0", access2str(m->ns->access));
@@ -104,8 +106,9 @@ char* namespace_set_to_string(namespace_set_t*set)
         char*s = namespace_to_string(lns->namespace);
         strcat(desc, s);
         free(s);
-        strcat(desc, ",");
         lns = lns->next;
+        if(lns)
+            strcat(desc, ",");
     }
     strcat(desc, "}");
     return desc;
@@ -333,12 +336,12 @@ void pool_read(pool_t*pool, TAG*tag)
         NEW(multiname_t,m);
        m->type = swf_GetU8(tag);
        if(m->type==0x07 || m->type==0x0d) {
-           int namespace_index = swf_GetU30(tag);
+           int namespace_index = swf_GetU30(tag); // 0 = '*' (any)
             m->ns = (namespace_t*)array_getvalue(pool->namespaces, namespace_index);
             int name_index = swf_GetU30(tag);
            m->name = array_getkey(pool->strings, name_index);
        } else if(m->type==0x0f || m->type==0x10) {
-            int name_index = swf_GetU30(tag);
+            int name_index = swf_GetU30(tag); // 0 = '*' (any name)
            m->name = array_getkey(pool->strings, name_index);
        } else if(m->type==0x11 || m->type==0x12) {
        } else if(m->type==0x09 || m->type==0x0e) {