char*s = escape_string(ns->name);
char*string = (char*)malloc(strlen(access)+strlen(s)+7);
if(!s)
- sprintf(string, "[%s]NULL", access, s);
+ sprintf(string, "[%s]NULL", access);
else if(!*s)
- sprintf(string, "[%s]\"\"", access, s);
+ sprintf(string, "[%s]\"\"", access);
else
sprintf(string, "[%s]%s", access, s);
free(s);
else if(type==0x19) return "explicit";
else if(type==0x1A) return "staticprotected";
else if(type==0x05) return "private";
+ else if(type==0x00) return "any";
else {
fprintf(stderr, "Undefined access type %02x\n", type);
return "undefined";
{
if(!ns) return 0;
int pos = array_append_or_increase(pool->x_namespaces, ns);
- assert(pos!=0);
+ assert(pos!=0 || ns->access==ZERONAMESPACE);
return pos;
}
int pool_register_namespace_set(pool_t*pool, namespace_set_t*set)
{
int i = array_find(pool->x_ints, &x);
if(i<=0) {
- fprintf(stderr, "Couldn't find int \"%d\" in constant pool\n", x);
+ fprintf(stderr, "Couldn't find int \"%f\" in constant pool\n", x);
return 0;
}
return i;
if(!ns)
return 0;
int i = array_find(pool->x_namespaces, ns);
- if(i<=0) {
+ if(i<0) {
char*s = namespace_tostring(ns);
- fprintf(stderr, "Couldn't find namespace \"%s\" %08x in constant pool\n", s, ns);
+ fprintf(stderr, "Couldn't find namespace \"%s\" %08x in constant pool\n", s, (int)ns);
free(s);
return 0;
}
string_t s = string_new2(str);
int i = array_find(pool->x_strings, &s);
if(i<=0) {
- fprintf(stderr, "Couldn't find string \"%s\" in constant pool\n", s);
+ fprintf(stderr, "Couldn't find string \"%s\" in constant pool\n", str);
return 0;
}
return i;
return (multiname_t*)array_getkey(pool->x_multinames, i);
}
+static namespace_t zeronamespace={ZERONAMESPACE,"*"};
pool_t*pool_new()
{
NEW(pool_t, p);
array_append(p->x_uints, 0, 0);
array_append(p->x_floats, 0, 0);
array_append(p->x_strings, 0, 0);
- array_append(p->x_namespaces, 0, 0);
+ array_append(p->x_namespaces, &zeronamespace, 0);
array_append(p->x_namespace_sets, 0, 0);
array_append(p->x_multinames, 0, 0);
return p;
int freq = (int)(ptroff_t)array_getvalue(pool->x_strings, t);
if(flags&1) fprintf(fo, "%5d %d) ", freq, t);
if(flags&1) fwrite(str.str, str.len, 1, fo);
- if(flags&1) fprintf(fo, "\n", t);
+ if(flags&1) fprintf(fo, "\n");
}
fprintf(fo, "%d namespaces\n", pool->x_namespaces->num);
for(t=1;t<pool->x_namespaces->num;t++) {