for(s=0;s<num;s++) {
int i1 = swf_GetU30(tag);
int i2 = swf_GetU30(tag);
- char*key = i1?pool_lookup_string(pool, i1):"";
- char*value = i2?pool_lookup_string(pool, i2):"";
+ const char*key = i1?pool_lookup_string(pool, i1):"";
+ const char*value = i2?pool_lookup_string(pool, i2):"";
DEBUG printf(" %s=%s\n", key, value);
array_append(items, key, strdup(value));
}
else
return_type = strdup("void");
char*paramstr = params_tostring(m->parameters);
- fprintf(fo, "%s%s %s %s=%s %s (%d params)\n", prefix, type, return_type, name, m->name, paramstr, list_length(m->parameters));
+ fprintf(fo, "%s%s %s %s=%s %s (%d params, %d optional)\n", prefix, type, return_type, name, m->name, paramstr,
+ list_length(m->parameters),
+ list_length(m->optional_parameters)
+ );
free(paramstr);paramstr=0;
free(return_type);return_type=0;
DEBUG printf("method %d) %s %s flags=%02x\n", t, m->name, params_tostring(m->parameters), m->flags);
if(m->flags&0x08) {
- /* TODO optional parameters */
m->optional_parameters = list_new();
int num = swf_GetU30(tag);
int s;
/* debug information- not used by avm2 */
multiname_list_t*l = m->parameters;
while(l) {
- char*name = pool_lookup_string(pool, swf_GetU30(tag));
+ const char*name = pool_lookup_string(pool, swf_GetU30(tag));
l = l->next;
}
}
//swf_SetU30(tag, c->old.max_scope_depth);
swf_SetU30(tag, c->stats->max_stack);
- if(list_length(c->method->parameters)+1 <= c->stats->local_count)
+
+ int param_num = list_length(c->method->parameters)+1;
+ if(c->method->flags&METHOD_NEED_REST)
+ param_num++;
+ if(param_num <= c->stats->local_count)
swf_SetU30(tag, c->stats->local_count);
else
- swf_SetU30(tag, list_length(c->method->parameters)+1);
+ swf_SetU30(tag, param_num);
+
swf_SetU30(tag, c->init_scope_depth);
swf_SetU30(tag, c->stats->max_scope_depth+
c->init_scope_depth);