git.asbjorn.biz
/
swftools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
removed debugging code
[swftools.git]
/
lib
/
as3
/
abc.c
diff --git
a/lib/as3/abc.c
b/lib/as3/abc.c
index
e07a066
..
9f4b6c9
100644
(file)
--- a/
lib/as3/abc.c
+++ b/
lib/as3/abc.c
@@
-720,7
+720,6
@@
void* swf_ReadABC(TAG*tag)
}
pool_read(pool, tag);
}
pool_read(pool, tag);
- //pool_dump(pool, stdout);
int num_methods = swf_GetU30(tag);
DEBUG printf("%d methods\n", num_methods);
int num_methods = swf_GetU30(tag);
DEBUG printf("%d methods\n", num_methods);
@@
-737,7
+736,7
@@
void* swf_ReadABC(TAG*tag)
for(s=0;s<param_count;s++) {
int type_index = swf_GetU30(tag);
for(s=0;s<param_count;s++) {
int type_index = swf_GetU30(tag);
- /* type_index might be 0, which probably means "..." (varargs) */
+ /* type_index might be 0 ("*") */
multiname_t*param = type_index?multiname_clone(pool_lookup_multiname(pool, type_index)):0;
list_append(m->parameters, param);
}
multiname_t*param = type_index?multiname_clone(pool_lookup_multiname(pool, type_index)):0;
list_append(m->parameters, param);
}
@@
-876,7
+875,7
@@
void* swf_ReadABC(TAG*tag)
array_append(file->method_bodies, NO_KEY, c);
}
if(tag->len - tag->pos) {
array_append(file->method_bodies, NO_KEY, c);
}
if(tag->len - tag->pos) {
- fprintf(stderr, "%d unparsed bytes remaining in ABC block\n", tag->len - tag->pos);
+ fprintf(stderr, "ERROR: %d unparsed bytes remaining in ABC block\n", tag->len - tag->pos);
return 0;
}
return 0;
}
@@
-926,10
+925,11
@@
void* swf_ReadABC(TAG*tag)
return file;
}
return file;
}
-void swf_WriteABC(TAG*abctag, void*code)
+static pool_t*writeABC(TAG*abctag, void*code, pool_t*pool)
{
abc_file_t*file = (abc_file_t*)code;
{
abc_file_t*file = (abc_file_t*)code;
- pool_t*pool = pool_new();
+ if(!pool)
+ pool = pool_new();
TAG*tmp = swf_InsertTag(0,0);
TAG*tag = tmp;
TAG*tmp = swf_InsertTag(0,0);
TAG*tag = tmp;
@@
-1188,11
+1188,22
@@
void swf_WriteABC(TAG*abctag, void*code)
swf_SetBlock(tag, tmp->data, tmp->len);
swf_DeleteTag(0, tmp);
swf_SetBlock(tag, tmp->data, tmp->len);
swf_DeleteTag(0, tmp);
+ return pool;
+}
+
+void swf_WriteABC(TAG*abctag, void*code)
+{
+ pool_t*pool = writeABC(abctag, code, 0);
+ pool_optimize(pool);
+ swf_ResetTag(abctag, abctag->id);
+ writeABC(abctag, code, pool);
pool_destroy(pool);
}
void abc_file_free(abc_file_t*file)
{
pool_destroy(pool);
}
void abc_file_free(abc_file_t*file)
{
+ if(!file)
+ return;
int t;
if(file->metadata) {
for(t=0;t<file->metadata->num;t++) {
int t;
if(file->metadata) {
for(t=0;t<file->metadata->num;t++) {