From d76c6ece4a8e3d3e5a9ce9a24bf7dcad531b97ed Mon Sep 17 00:00:00 2001 From: kramm Date: Sat, 23 Mar 2002 21:24:07 +0000 Subject: [PATCH] new option --used --- src/swfdump.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/swfdump.c b/src/swfdump.c index 616dbbf..7ce9773 100644 --- a/src/swfdump.c +++ b/src/swfdump.c @@ -34,12 +34,14 @@ char * filename = 0; to detect errors in the file. (i.e. ids which are defined more than once */ char idtab[65536]; +char * indent = " "; int action = 0; int html = 0; int xy = 0; int showtext = 0; int hex = 0; +int used = 0; struct options_t options[] = { @@ -49,6 +51,7 @@ struct options_t options[] = {"Y","height"}, {"r","rate"}, {"e","html"}, + {"u","used"}, {"v","verbose"}, {"V","version"}, {"d","hex"}, @@ -90,6 +93,10 @@ int args_callback_option(char*name,char*val) hex = 1; return 0; } + else if(name[0]=='u') { + used = 1; + return 0; + } else { printf("Unknown option: -%s\n", name); } @@ -111,6 +118,7 @@ void args_callback_usage(char*name) printf("\t-a , --action\t\t Disassemble action tags\n"); printf("\t-t , --text\t\t Show text data\n"); printf("\t-d , --hex\t\t Print hex output of tag data, too\n"); + printf("\t-u , --used\t\t Show referred IDs for each Tag\n"); printf("\t-V , --version\t\t Print program version and exit\n"); } int args_callback_command(char*name,char*val) @@ -619,6 +627,23 @@ int main (int argc,char ** argv) else printf("\n"); } + + if(tag->len && used) { + int num = swf_GetNumUsedIDs(tag); + int* used; + int t; + if(num) { + used = (int*)malloc(sizeof(int)*num); + swf_GetUsedIDs(tag, used); + printf("%s%suses IDs: ", indent, prefix); + for(t=0;tpos = used[t]; + printf("%d%s", swf_GetU16(tag), tlen && hex) { int t; printf(" %s-=> ",prefix); -- 1.7.10.4