[Swfed-svn] swfed-svn [76] - input, identity, output, print, destroy の引数の見直し ( tag が内包してる引数を削除。detail 削除が主 )

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2008年 10月 15日 (水) 04:12:29 JST


Revision: 76
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=swfed&view=rev&rev=76
Author:   yoya
Date:     2008-10-15 04:12:28 +0900 (Wed, 15 Oct 2008)

Log Message:
-----------
- input, identity, output, print, destroy の引数の見直し (tag が内包してる引数を削除。detail 削除が主)

Modified Paths:
--------------
    trunk/src/swf_tag.c
    trunk/src/swf_tag.h
    trunk/src/swf_tag_action.c
    trunk/src/swf_tag_action.h
    trunk/src/swf_tag_edit.c
    trunk/src/swf_tag_edit.h
    trunk/src/swf_tag_jpeg.c
    trunk/src/swf_tag_jpeg.h
    trunk/src/swf_tag_lossless.c
    trunk/src/swf_tag_lossless.h
    trunk/src/swf_tag_sound.c
    trunk/src/swf_tag_sound.h


-------------- next part --------------
Modified: trunk/src/swf_tag.c
===================================================================
--- trunk/src/swf_tag.c	2008-10-14 18:15:52 UTC (rev 75)
+++ trunk/src/swf_tag.c	2008-10-14 19:12:28 UTC (rev 76)
@@ -111,7 +111,7 @@
         if (tag_info && tag_info->detail_handler) {
             swf_tag_detail_handler_t * detail_handler = tag_info->detail_handler();
             if (detail_handler->destroy) {
-               detail_handler->destroy(tag->detail);
+               detail_handler->destroy(tag);
             } else {
                 fprintf(stderr, "detail_handler->destroy == NULL (tag=%d)\n",
                         tag->tag);
@@ -182,7 +182,7 @@
                     tag->tag);
             return 1;
         }
-        data = detail_handler->output(tag->detail, &data_len, tag, swf);
+        data = detail_handler->output(tag, &data_len, swf);
         if (data == NULL) {
             fprintf(stderr, "swf_tag_build: Can't output: data=%p data_len=%lu\n",
                     data, data_len);
@@ -219,7 +219,7 @@
         }
         swf_tag_detail_handler_t * detail_handler = tag_info->detail_handler();
         if (detail_handler->print) {
-            detail_handler->print(tag->detail, tag, swf);
+            detail_handler->print(tag, swf);
         }
     }
 }
@@ -244,7 +244,7 @@
             fprintf(stderr, "can't create tag detail (tag=%d)\n", tag->tag);
             return 1;
         }
-        result = detail_handler->input(tag->data, tag->length, tag, swf);
+        result = detail_handler->input(tag, swf);
         if (result) {
             fprintf(stderr, "can't input tag detail (result=%d)\n", result);
             return 1;
@@ -297,7 +297,7 @@
     if (tag_info && tag_info->detail_handler) {
         swf_tag_detail_handler_t * detail_handler = tag_info->detail_handler();
         if (detail_handler->identity) {
-            if (detail_handler->identity(tag->data, image_id, tag)) {
+            if (detail_handler->identity(tag, image_id)) {
                 return NULL;
             }
         }
@@ -333,11 +333,11 @@
     }
     tag_info = get_swf_tag_info(tag->tag);
     detail_handler = tag_info->detail_handler();
-    if (detail_handler->identity(tag->data, image_id, tag)) {
+    if (detail_handler->identity(tag, image_id)) {
         return 1;
     }
     if (tag->detail) {
-        detail_handler->destroy(tag->detail);
+        detail_handler->destroy(tag);
         tag->detail = NULL;
     }
     if (alpha_data && (alpha_data_len > 0)) {
@@ -358,7 +358,7 @@
         tag->data = NULL;
         tag->length = 0;
     } else {
-        detail_handler->destroy(tag->detail);
+        detail_handler->destroy(tag);
         tag->detail = NULL;
     } 
     return result;
@@ -405,11 +405,11 @@
     }
     tag_info = get_swf_tag_info(tag->tag);
     detail_handler = tag_info->detail_handler();
-    if (detail_handler->identity(tag->data, image_id, tag)) {
+    if (detail_handler->identity(tag, image_id)) {
         return 1;
     }
     if (tag->detail) {
-        detail_handler->destroy(tag->detail);
+        detail_handler->destroy(tag);
         tag->detail = NULL;
     }
     if (tag->tag == 20) {
@@ -428,7 +428,7 @@
         tag->data = NULL;
         tag->length = 0;
     } else {
-        detail_handler->destroy(tag->detail);
+        detail_handler->destroy(tag);
         tag->detail = NULL;
     }
     return result;
@@ -477,7 +477,7 @@
     if (tag_info && tag_info->detail_handler) {
         swf_tag_detail_handler_t * detail_handler = tag_info->detail_handler();
         if (detail_handler->identity) {
-            if (detail_handler->identity(tag->data, sound_id, tag)) {
+            if (detail_handler->identity(tag, sound_id)) {
                 return 1;
             }
         }

Modified: trunk/src/swf_tag.h
===================================================================
--- trunk/src/swf_tag.h	2008-10-14 18:15:52 UTC (rev 75)
+++ trunk/src/swf_tag.h	2008-10-14 19:12:28 UTC (rev 76)
@@ -23,19 +23,12 @@
 
 typedef struct swf_tag_detail_handler_ {
     void          * (*create)   (void);
-    int             (*input)    (unsigned char *data,
-                                 unsigned long length,
-                                 swf_tag_t *tag,
+    int             (*input)    (swf_tag_t *tag, struct swf_object_ *swf);
+    int             (*identity) (swf_tag_t *tag, int id);
+    unsigned char * (*output)   (swf_tag_t *tag, unsigned long *length,
                                  struct swf_object_ *swf);
-    int             (*identity) (unsigned char *data, int id,
-                                 swf_tag_t *tag);
-    unsigned char * (*output)   (void *detail, unsigned long *length,
-                                 swf_tag_t *tag,
-                                 struct swf_object_ *swf);
-    void            (*print)    (void *detail,
-                                 swf_tag_t *tag,
-                                 struct swf_object_ *swf);
-    void            (*destroy)  (void *);
+    void            (*print)    (swf_tag_t *tag, struct swf_object_ *swf);
+    void            (*destroy)  (swf_tag_t *tag);
 } swf_tag_detail_handler_t;
 
 typedef struct swf_tag_info_ {
@@ -85,6 +78,6 @@
                                        int initial_text_len,
                                        struct swf_object_ *swf);
 
-extern int swf_tag_create_detail(swf_tag_t *tag, struct swf_object_ *swf);
+extern int swf_tag_create_input_detail(swf_tag_t *tag, struct swf_object_ *swf);
 
 #endif /* __SWF_TAG_H__ */

Modified: trunk/src/swf_tag_action.c
===================================================================
--- trunk/src/swf_tag_action.c	2008-10-14 18:15:52 UTC (rev 75)
+++ trunk/src/swf_tag_action.c	2008-10-14 19:12:28 UTC (rev 76)
@@ -38,19 +38,18 @@
 }
 
 int
-swf_tag_action_input_detail(unsigned char *data,
-                            unsigned long length,
-                            swf_tag_t *tag,
-                            struct swf_object_ *swf) {
-    swf_tag_action_detail_t *swf_tag_action;
+swf_tag_action_input_detail(swf_tag_t *tag, struct swf_object_ *swf) {
+    swf_tag_action_detail_t *swf_tag_action = tag->detail;
+    unsigned char *data  = tag->data;
+    unsigned long length = tag->length;
     bitstream_t *bs;
     unsigned long pos, len;
     (void) swf;
-    swf_tag_action = tag->detail;
     if (swf_tag_action == NULL) {
         fprintf(stderr, "ERROR: swf_tag_action_create_detail: swf_tag_action == NULL\n");
         return 1;
     }
+
     bs = bitstream_open();
     bitstream_input(bs, data, length);
 
@@ -67,19 +66,16 @@
     return 0;
 }
 
-int swf_tag_action_identity_detail(unsigned char *data, int id,
-                                   swf_tag_t *tag) {
-    (void) data;
-    (void) id;
+int swf_tag_action_identity_detail(swf_tag_t *tag, int id) {
     (void) tag;
+    (void) id;
     return 1;
 }
 
 unsigned char *
-swf_tag_action_output_detail(void *detail, unsigned long *length,
-                             swf_tag_t *tag,
+swf_tag_action_output_detail(swf_tag_t *tag, unsigned long *length,
                              struct swf_object_ *swf) {
-    swf_tag_action_detail_t *swf_tag_action = (swf_tag_action_detail_t *) detail;
+    swf_tag_action_detail_t *swf_tag_action = (swf_tag_action_detail_t *) tag->detail;
     bitstream_t *bs;
     unsigned char *data;
     *length = 0;
@@ -99,12 +95,11 @@
 }
 
 void
-swf_tag_action_print_detail(void *detail,
-                            swf_tag_t *tag,
+swf_tag_action_print_detail(swf_tag_t *tag,
                             struct swf_object_ *swf) {
     bitstream_t *bs;
     swf_action_list_t *action_list;
-    swf_tag_action_detail_t *swf_tag_action = (swf_tag_action_detail_t *) detail;
+    swf_tag_action_detail_t *swf_tag_action = (swf_tag_action_detail_t *) tag->detail;
     (void) swf;
     if (tag->tag == 59) { // DoInitAction
         printf("action_sprite=%d  ", swf_tag_action->action_sprite);
@@ -121,8 +116,8 @@
 }
 
 void
-swf_tag_action_destroy_detail(void *detail) {
-    swf_tag_action_detail_t *swf_tag_action = (swf_tag_action_detail_t *) detail;
+swf_tag_action_destroy_detail(swf_tag_t *tag) {
+    swf_tag_action_detail_t *swf_tag_action = (swf_tag_action_detail_t *) tag->detail;
     if (swf_tag_action) {
         free(swf_tag_action->action_record);
         swf_tag_action->action_record = NULL;

Modified: trunk/src/swf_tag_action.h
===================================================================
--- trunk/src/swf_tag_action.h	2008-10-14 18:15:52 UTC (rev 75)
+++ trunk/src/swf_tag_action.h	2008-10-14 19:12:28 UTC (rev 76)
@@ -19,19 +19,14 @@
 extern swf_tag_detail_handler_t *swf_tag_action_detail_handler(void);
 
 extern void *swf_tag_action_create_detail(void);
-extern int swf_tag_action_input_detail(unsigned char *data,
-                                        unsigned long length,
-                                        swf_tag_t *tag,
-                                        struct swf_object_ *swf);
-extern int swf_tag_action_identity_detail(unsigned char *data, int id,
-                                          swf_tag_t *tag);
-extern unsigned char *swf_tag_action_output_detail(void *detail,
+extern int swf_tag_action_input_detail(swf_tag_t *tag,
+                                       struct swf_object_ *swf);
+extern int swf_tag_action_identity_detail(swf_tag_t *tag, int id);
+extern unsigned char *swf_tag_action_output_detail(swf_tag_t *tag,
                                                    unsigned long *length,
-                                                   swf_tag_t *tag,
                                                    struct swf_object_ *swf);
-extern void swf_tag_action_print_detail(void *detail,
-                                        swf_tag_t *tag,
+extern void swf_tag_action_print_detail(swf_tag_t *tag,
                                         struct swf_object_ *swf);
-extern void swf_tag_action_destroy_detail(void *detail);
+extern void swf_tag_action_destroy_detail(swf_tag_t *tag);
 
 #endif /* __SWF_TAG_ACTION__H__ */

Modified: trunk/src/swf_tag_edit.c
===================================================================
--- trunk/src/swf_tag_edit.c	2008-10-14 18:15:52 UTC (rev 75)
+++ trunk/src/swf_tag_edit.c	2008-10-14 19:12:28 UTC (rev 76)
@@ -37,13 +37,11 @@
 }
 
 int
-swf_tag_edit_input_detail(unsigned char *data, unsigned long length,
-                           swf_tag_t *tag,
-                           struct swf_object_ *swf) {
-    swf_tag_edit_detail_t *swf_tag_edit;
+swf_tag_edit_input_detail(swf_tag_t *tag, struct swf_object_ *swf) {
+    swf_tag_edit_detail_t *swf_tag_edit = tag->detail;
+    unsigned char *data  = tag->data;
+    unsigned long length = tag->length;
     bitstream_t *bs;
-    (void) tag;
-    swf_tag_edit = tag->detail;
     if (swf_tag_edit == NULL) {
         fprintf(stderr, "ERROR: swf_tag_edit_input_detail: swf_tag_edit == NULL\n");
         return 1;
@@ -102,11 +100,17 @@
     return 0;
 }
 
-int swf_tag_edit_identity_detail(unsigned char *data, int id,
-                                 swf_tag_t *tag) {
+int swf_tag_edit_identity_detail(swf_tag_t *tag, int id) {
+    unsigned char *data = tag->data;
     bitstream_t *bs;
     int edit_id;
-    (void) tag;
+    if (tag->detail) {
+        swf_tag_edit_detail_t *swf_tag_edit = (swf_tag_edit_detail_t *) tag->detail;
+        if (swf_tag_edit->edit_id == id) {
+            return 0;
+        }        
+        return 1;
+    }
     bs = bitstream_open();
     bitstream_input(bs, data, 2);
     edit_id = bitstream_getbytesLE(bs, 2);
@@ -118,10 +122,9 @@
 }
 
 unsigned char *
-swf_tag_edit_output_detail(void *detail, unsigned long *length,
-                           swf_tag_t *tag,
+swf_tag_edit_output_detail(swf_tag_t *tag, unsigned long *length,
                            struct swf_object_ *swf) {
-    swf_tag_edit_detail_t *swf_tag_edit = (swf_tag_edit_detail_t *) detail;
+    swf_tag_edit_detail_t *swf_tag_edit = (swf_tag_edit_detail_t *) tag->detail;
     bitstream_t *bs;
     unsigned char *data;
     (void) tag;
@@ -182,10 +185,9 @@
 }
 
 void
-swf_tag_edit_print_detail(void *detail,
-                          swf_tag_t *tag,
+swf_tag_edit_print_detail(swf_tag_t *tag,
                           struct swf_object_ *swf) {
-    swf_tag_edit_detail_t *swf_tag_edit = (swf_tag_edit_detail_t *) detail;
+    swf_tag_edit_detail_t *swf_tag_edit = (swf_tag_edit_detail_t *) tag->detail;
     (void) tag;
     printf("\tedit_id=%d\n", swf_tag_edit->edit_id);
     printf("\t");
@@ -239,8 +241,8 @@
 }
 
 void
-swf_tag_edit_destroy_detail(void *detail) {
-    swf_tag_edit_detail_t *swf_tag_edit = (swf_tag_edit_detail_t *) detail;
+swf_tag_edit_destroy_detail(swf_tag_t *tag) {
+    swf_tag_edit_detail_t *swf_tag_edit = (swf_tag_edit_detail_t *) tag->detail;
     if (swf_tag_edit) {
         free(swf_tag_edit->edit_variable_name);
         free(swf_tag_edit->edit_initial_text);

Modified: trunk/src/swf_tag_edit.h
===================================================================
--- trunk/src/swf_tag_edit.h	2008-10-14 18:15:52 UTC (rev 75)
+++ trunk/src/swf_tag_edit.h	2008-10-14 19:12:28 UTC (rev 76)
@@ -50,20 +50,14 @@
 extern swf_tag_detail_handler_t *swf_tag_edit_detail_handler(void);
 
 extern void *swf_tag_edit_create_detail(void);
-extern int swf_tag_edit_input_detail(unsigned char *data,
-                                     unsigned long length,
-                                     swf_tag_t *tag,
-                                     struct swf_object_ *swf);
-extern int swf_tag_edit_identity_detail(unsigned char *data, int id,
-                                        swf_tag_t *tag);
-extern unsigned char *swf_tag_edit_output_detail(void *detail,
+extern int swf_tag_edit_input_detail(swf_tag_t *tag, struct swf_object_ *swf);
+extern int swf_tag_edit_identity_detail(swf_tag_t *tag, int id);
+extern unsigned char *swf_tag_edit_output_detail(swf_tag_t *tag,
                                                  unsigned long *length,
-                                                 swf_tag_t *tag,
                                                  struct swf_object_ *swf);
-extern void swf_tag_edit_print_detail(void *detail,
-                                      swf_tag_t *tag,
+extern void swf_tag_edit_print_detail(swf_tag_t *tag,
                                       struct swf_object_ *swf);
-extern void swf_tag_edit_destroy_detail(void *detail);
+extern void swf_tag_edit_destroy_detail(swf_tag_t *tag);
 
 extern char *swf_tag_edit_get_string(void *detail,
                                      char *variable_name,

Modified: trunk/src/swf_tag_jpeg.c
===================================================================
--- trunk/src/swf_tag_jpeg.c	2008-10-14 18:15:52 UTC (rev 75)
+++ trunk/src/swf_tag_jpeg.c	2008-10-14 19:12:28 UTC (rev 76)
@@ -40,7 +40,6 @@
 void *
 swf_tag_jpeg_create_detail(void) {
     swf_tag_jpeg_detail_t *swf_tag_jpeg;
-    bitstream_t *bs;
     swf_tag_jpeg = calloc(sizeof(*swf_tag_jpeg), 1);
     if (swf_tag_jpeg == NULL) {
         fprintf(stderr, "ERROR: swf_tag_jpeg_create_detail: can't calloc\n");
@@ -56,14 +55,13 @@
 }
 
 int
-swf_tag_jpeg_input_detail(unsigned char *data, unsigned long length,
-                           swf_tag_t *tag,
-                           struct swf_object_ *swf) {
-    swf_tag_jpeg_detail_t *swf_tag_jpeg;
+swf_tag_jpeg_input_detail(swf_tag_t *tag,
+                          struct swf_object_ *swf) {
+    swf_tag_jpeg_detail_t *swf_tag_jpeg = tag->detail;
+    unsigned char *data  = tag->data;
+    unsigned long length = tag->length;
     bitstream_t *bs;
-    (void) tag;
     (void) swf;
-    swf_tag_jpeg = tag->detail;
     if (swf_tag_jpeg == NULL) {
         fprintf(stderr, "ERROR: swf_tag_jpeg_input_detail: swf_tag_jpeg == NULL\n");
         return 1;
@@ -80,20 +78,18 @@
 }
 
 int
-swf_tag_jpeg3_input_detail(unsigned char *data,
-                           unsigned long length,
-                           swf_tag_t *tag,
+swf_tag_jpeg3_input_detail(swf_tag_t *tag,
                            struct swf_object_ *swf) {
-    swf_tag_jpeg_detail_t *swf_tag_jpeg;
+    swf_tag_jpeg_detail_t *swf_tag_jpeg = tag->detail;
+    unsigned char *data  = tag->data;
+    unsigned long length = tag->length;
     unsigned long offset_to_alpha;
     bitstream_t *bs;
     unsigned long  offset, alpha_data_len;
     unsigned char *old_buff_ref, *new_buff;
     unsigned long origsize;
     int result;
-    (void) tag;
     (void) swf;
-    swf_tag_jpeg = tag->detail;
     if (swf_tag_jpeg == NULL) {
         fprintf(stderr, "ERROR: swf_tag_jpeg3_input_detail: swf_tag_jpeg == NULL\n");
         return 1;
@@ -134,12 +130,12 @@
         free(new_buff);
     }
     bitstream_close(bs);
-    (void *) swf_tag_jpeg;
     return 0;
 }
 
 int
-swf_tag_jpeg_identity_detail(unsigned char *data, int id, swf_tag_t *tag) {
+swf_tag_jpeg_identity_detail(swf_tag_t *tag, int id) {
+    unsigned char *data = tag->data;
     int image_id;
     if (tag->detail) {
         swf_tag_jpeg_detail_t *swf_tag_jpeg = (swf_tag_jpeg_detail_t *) tag->detail;        
@@ -160,13 +156,11 @@
 }
 
 unsigned char *
-swf_tag_jpeg_output_detail(void *detail, unsigned long *length,
-                           swf_tag_t *tag,
+swf_tag_jpeg_output_detail(swf_tag_t *tag, unsigned long *length,
                            struct swf_object_ *swf) {
-    swf_tag_jpeg_detail_t *swf_tag_jpeg = (swf_tag_jpeg_detail_t *) detail;
+    swf_tag_jpeg_detail_t *swf_tag_jpeg = (swf_tag_jpeg_detail_t *) tag->detail;
     bitstream_t *bs;
     unsigned char *data;
-    (void) tag;
     (void) swf;
     *length = 0;
     bs = bitstream_open();
@@ -178,15 +172,13 @@
 }
 
 unsigned char *
-swf_tag_jpeg3_output_detail(void *detail, unsigned long *length,
-                            swf_tag_t *tag,
+swf_tag_jpeg3_output_detail(swf_tag_t *tag, unsigned long *length,
                             struct swf_object_ *swf) {
-    swf_tag_jpeg_detail_t *swf_tag_jpeg = (swf_tag_jpeg_detail_t *) detail;
+    swf_tag_jpeg_detail_t *swf_tag_jpeg = (swf_tag_jpeg_detail_t *) tag->detail;
     bitstream_t *bs;
     unsigned char *data, *new_buff;
     unsigned long offset_to_alpha;
     unsigned long compsize;
-    (void) tag;
     (void) swf;
     *length = 0;
     bs = bitstream_open();
@@ -204,16 +196,14 @@
 }
 
 void
-swf_tag_jpeg_print_detail(void *detail,
-                          swf_tag_t *tag,
+swf_tag_jpeg_print_detail(swf_tag_t *tag,
                           struct swf_object_ *swf) {
-    swf_tag_jpeg_detail_t *swf_tag_jpeg = (swf_tag_jpeg_detail_t *) detail;
+    swf_tag_jpeg_detail_t *swf_tag_jpeg = (swf_tag_jpeg_detail_t *) tag->detail;
     jpeg_segment_t *jpeg_seg;
     jpeg_segment_node_t *node;
-    (void) tag;
     (void) swf;
-    if (detail == NULL) {
-        fprintf(stderr, "swf_tag_jpeg_print_detail: detail == NULL\n");
+    if (swf_tag_jpeg == NULL) {
+        fprintf(stderr, "swf_tag_jpeg_print_detail: swf_tag_jpeg == NULL\n");
         return ;
     }
     printf("\timage_id=%d  jpeg_data_size=%lu\n",
@@ -237,8 +227,8 @@
 }
 
 void
-swf_tag_jpeg_destroy_detail(void *detail) {
-    swf_tag_jpeg_detail_t *swf_tag_jpeg = (swf_tag_jpeg_detail_t *) detail;
+swf_tag_jpeg_destroy_detail(swf_tag_t *tag) {
+    swf_tag_jpeg_detail_t *swf_tag_jpeg = (swf_tag_jpeg_detail_t *) tag->detail;
     if (swf_tag_jpeg) {
         free(swf_tag_jpeg->jpeg_data);
         free(swf_tag_jpeg->alpha_data);

Modified: trunk/src/swf_tag_jpeg.h
===================================================================
--- trunk/src/swf_tag_jpeg.h	2008-10-14 18:15:52 UTC (rev 75)
+++ trunk/src/swf_tag_jpeg.h	2008-10-14 19:12:28 UTC (rev 76)
@@ -23,32 +23,18 @@
 
 extern void *swf_tag_jpeg_create_detail(void);
 
-extern int swf_tag_jpeg_input_detail(unsigned char *data,
-                                     unsigned long length,
-                                     swf_tag_t *tag,
-                                     struct swf_object_ *swf);
-extern int swf_tag_jpeg3_input_detail(unsigned char *data,
-                                      unsigned long length,
-                                      swf_tag_t *tag,
-                                      struct swf_object_ *swf);
-extern int swf_tag_jpeg_identity_detail(unsigned char *data, int id,
-                                        swf_tag_t *tag);
-extern void *swf_tag_jpeg3_create_detail(unsigned char *data,
-                                         unsigned long length,
-                                         swf_tag_t *tag,
-                                         struct swf_object_ *swf);
-extern unsigned char *swf_tag_jpeg_output_detail(void *detail,
+extern int swf_tag_jpeg_input_detail(swf_tag_t *tag, struct swf_object_ *swf);
+extern int swf_tag_jpeg3_input_detail(swf_tag_t *tag, struct swf_object_ *swf);
+extern int swf_tag_jpeg_identity_detail(swf_tag_t *tag, int id);
+extern unsigned char *swf_tag_jpeg_output_detail(swf_tag_t *tag,
                                                  unsigned long *length,
-                                                 swf_tag_t *tag,
                                                  struct swf_object_ *swf);
-extern unsigned char *swf_tag_jpeg3_output_detail(void *detail,
+extern unsigned char *swf_tag_jpeg3_output_detail(swf_tag_t *tag,
                                                   unsigned long *length,
-                                                  swf_tag_t *tag,
                                                   struct swf_object_ *swf);
-extern void swf_tag_jpeg_print_detail(void *detail,
-                                      swf_tag_t *tag,
+extern void swf_tag_jpeg_print_detail(swf_tag_t *tag,
                                       struct swf_object_ *swf);
-extern void swf_tag_jpeg_destroy_detail(void *detail);
+extern void swf_tag_jpeg_destroy_detail(swf_tag_t *tag);
 
 extern unsigned char *swf_tag_jpeg_get_jpeg_data(void *detail,
                                                  unsigned long *length,

Modified: trunk/src/swf_tag_lossless.c
===================================================================
--- trunk/src/swf_tag_lossless.c	2008-10-14 18:15:52 UTC (rev 75)
+++ trunk/src/swf_tag_lossless.c	2008-10-14 19:12:28 UTC (rev 76)
@@ -47,18 +47,17 @@
 }
 
 int
-swf_tag_lossless_input_detail(unsigned char *data,
-                               unsigned long length,
-                               swf_tag_t *tag,
-                               struct swf_object_ *swf) {
-    swf_tag_lossless_detail_t *swf_tag_lossless;
+swf_tag_lossless_input_detail(swf_tag_t *tag,
+                              struct swf_object_ *swf) {
+    swf_tag_lossless_detail_t *swf_tag_lossless = tag->detail;
+    unsigned char *data  = tag->data;
+    unsigned long length = tag->length;
     bitstream_t *bs, *bs2;
     (void) swf;
     unsigned long i;
     unsigned char *tmp_buff, *old_buff_ref;
     unsigned long origsize, old_size, offset;
     int result;
-    swf_tag_lossless = tag->detail;
     if (swf_tag_lossless == NULL) {
         fprintf(stderr, "swf_tag_lossless_input_detail: swf_tag_lossless == NULL\n");
         return 1;
@@ -176,7 +175,8 @@
 }
 
 int
-swf_tag_lossless_identity_detail(unsigned char *data, int id, swf_tag_t *tag) {
+swf_tag_lossless_identity_detail(swf_tag_t *tag, int id) {
+    unsigned char *data = tag->data;
     int image_id;
     if (tag->detail) {
         swf_tag_lossless_detail_t *swf_tag_lossless = (swf_tag_lossless_detail_t *) tag->detail;
@@ -197,10 +197,9 @@
 }
 
 unsigned char *
-swf_tag_lossless_output_detail(void *detail, unsigned long *length,
-                               swf_tag_t *tag,
+swf_tag_lossless_output_detail(swf_tag_t *tag, unsigned long *length,
                                struct swf_object_ *swf) {
-    swf_tag_lossless_detail_t *swf_tag_lossless = (swf_tag_lossless_detail_t *) detail;
+    swf_tag_lossless_detail_t *swf_tag_lossless = (swf_tag_lossless_detail_t *) tag->detail;
     bitstream_t *bs, *bs2;
     unsigned char *data;
     unsigned long i;
@@ -269,14 +268,12 @@
 }
 
 void
-swf_tag_lossless_print_detail(void *detail,
-                              swf_tag_t *tag,
+swf_tag_lossless_print_detail(swf_tag_t *tag,
                               struct swf_object_ *swf) {
-    swf_tag_lossless_detail_t *swf_tag_lossless = (swf_tag_lossless_detail_t *) detail;
-    (void) tag;
+    swf_tag_lossless_detail_t *swf_tag_lossless = (swf_tag_lossless_detail_t *) tag->detail;
     (void) swf;
-    if (detail == NULL) {
-        fprintf(stderr, "swf_tag_lossless_print_detail: detail == NULL\n");
+    if (swf_tag_lossless == NULL) {
+        fprintf(stderr, "swf_tag_lossless_print_detail: swf_tag_lossless == NULL\n");
         return ;
     }
     printf("\timage_id=%d  format=%d  width=%u  height=%u\n",
@@ -305,8 +302,8 @@
 }
 
 void
-swf_tag_lossless_destroy_detail(void *detail) {
-    swf_tag_lossless_detail_t *swf_tag_lossless = (swf_tag_lossless_detail_t *) detail;
+swf_tag_lossless_destroy_detail(swf_tag_t *tag) {
+    swf_tag_lossless_detail_t *swf_tag_lossless = (swf_tag_lossless_detail_t *) tag->detail;
     if (swf_tag_lossless) {
         free(swf_tag_lossless->colormap);
         free(swf_tag_lossless->colormap2);

Modified: trunk/src/swf_tag_lossless.h
===================================================================
--- trunk/src/swf_tag_lossless.h	2008-10-14 18:15:52 UTC (rev 75)
+++ trunk/src/swf_tag_lossless.h	2008-10-14 19:12:28 UTC (rev 76)
@@ -30,23 +30,17 @@
 extern swf_tag_detail_handler_t *swf_tag_lossless_detail_handler(void);
 
 extern void *swf_tag_lossless_create_detail(void);
-extern int swf_tag_lossless_input_detail(unsigned char *data,
-                                         unsigned long length,
-                                         swf_tag_t *tag,
+extern int swf_tag_lossless_input_detail(swf_tag_t *tag,
                                          struct swf_object_ *swf);
-extern int swf_tag_lossless_identity_detail(unsigned char *data, int id,
-                                            swf_tag_t *tag);
-extern unsigned char *swf_tag_lossless_output_detail(void *detail,
+extern int swf_tag_lossless_identity_detail(swf_tag_t *tag, int id);
+extern unsigned char *swf_tag_lossless_output_detail(swf_tag_t *tag,
                                                      unsigned long *length,
-                                                     swf_tag_t *tag,
                                                      struct swf_object_ *swf);
-extern void swf_tag_lossless_print_detail(void *detail,
-                                          swf_tag_t *tag,
+extern void swf_tag_lossless_print_detail(swf_tag_t *tag,
                                           struct swf_object_ *swf);
-extern void swf_tag_lossless2_print_detail(void *detail,
-                                           swf_tag_t *tag,
+extern void swf_tag_lossless2_print_detail(swf_tag_t *tag,
                                            struct swf_object_ *swf);
-extern void swf_tag_lossless_destroy_detail(void *detail);
+extern void swf_tag_lossless_destroy_detail(swf_tag_t *tag);
 
 extern unsigned char *swf_tag_lossless_get_png_data(void *detail,
                                                     unsigned long *length,

Modified: trunk/src/swf_tag_sound.c
===================================================================
--- trunk/src/swf_tag_sound.c	2008-10-14 18:15:52 UTC (rev 75)
+++ trunk/src/swf_tag_sound.c	2008-10-14 19:12:28 UTC (rev 76)
@@ -31,19 +31,19 @@
         fprintf(stderr, "ERROR: swf_tag_sound_create_detail: can't calloc\n");
         return NULL;
     }
+    return swf_tag_sound;
 }
 
 int
-swf_tag_sound_input_detail(unsigned char *data, unsigned long length,
-                            swf_tag_t *tag,
+swf_tag_sound_input_detail(swf_tag_t *tag,
                             struct swf_object_ *swf) {
-    swf_tag_sound_detail_t *swf_tag_sound;
+    swf_tag_sound_detail_t *swf_tag_sound = tag->detail;
+    unsigned char *data  = tag->data;
+    unsigned long length = tag->length;
     bitstream_t *bs;
     unsigned long sound_data_len;
     unsigned char *sound_data_ref;
-    (void) tag;
     (void) swf;
-    swf_tag_sound = tag->detail;
     if (swf_tag_sound == NULL) {
         fprintf(stderr, "ERROR: swf_tag_sound_input_detail: swf_tag_sound == NULL\n");
         return 1;
@@ -72,10 +72,11 @@
 }
 
 int
-swf_tag_sound_identity_detail(unsigned char *data, int id, swf_tag_t *tag) {
+swf_tag_sound_identity_detail(swf_tag_t *tag, int id) {
     int sound_id;
+    unsigned char *data = tag->data;
     if (tag->detail) {
-        swf_tag_sound_detail_t *swf_tag_sound = (swf_tag_sound_detail_t *) tag->detail;        
+        swf_tag_sound_detail_t *swf_tag_sound = (swf_tag_sound_detail_t *) tag->detail;
         if (swf_tag_sound->sound_id == id) {
             return 0;
         }        
@@ -93,10 +94,9 @@
 }
 
 unsigned char *
-swf_tag_sound_output_detail(void *detail, unsigned long *length,
-                           swf_tag_t *tag,
-                           struct swf_object_ *swf) {
-    swf_tag_sound_detail_t *swf_tag_sound = (swf_tag_sound_detail_t *) detail;
+swf_tag_sound_output_detail(swf_tag_t *tag, unsigned long *length,
+                            struct swf_object_ *swf) {
+    swf_tag_sound_detail_t *swf_tag_sound = (swf_tag_sound_detail_t *) tag->detail;
     bitstream_t *bs;
     unsigned char *data;
     (void) tag;
@@ -117,12 +117,10 @@
 }
 
 void
-swf_tag_sound_print_detail(void *detail,
-                          swf_tag_t *tag,
-                          struct swf_object_ *swf) {
-    swf_tag_sound_detail_t *swf_tag_sound = (swf_tag_sound_detail_t *) detail;
+swf_tag_sound_print_detail(swf_tag_t *tag,
+                           struct swf_object_ *swf) {
+    swf_tag_sound_detail_t *swf_tag_sound = (swf_tag_sound_detail_t *) tag->detail;
     char *format_name = "Unknown";
-    (void) tag;
     (void) swf;
     switch(swf_tag_sound->sound_format & 0x0f) {
     case 0:
@@ -156,8 +154,8 @@
 }
 
 void
-swf_tag_sound_destroy_detail(void *detail) {
-    swf_tag_sound_detail_t *swf_tag_sound = (swf_tag_sound_detail_t *) detail;
+swf_tag_sound_destroy_detail(swf_tag_t *tag) {
+    swf_tag_sound_detail_t *swf_tag_sound = (swf_tag_sound_detail_t *) tag->detail;
     if (swf_tag_sound) {
         free(swf_tag_sound->sound_data);
         swf_tag_sound->sound_data = NULL;

Modified: trunk/src/swf_tag_sound.h
===================================================================
--- trunk/src/swf_tag_sound.h	2008-10-14 18:15:52 UTC (rev 75)
+++ trunk/src/swf_tag_sound.h	2008-10-14 19:12:28 UTC (rev 76)
@@ -23,20 +23,14 @@
 extern swf_tag_detail_handler_t *swf_tag_sound_detail_handler(void);
 
 extern void *swf_tag_sound_create_detail(void);
-extern int swf_tag_sound_input_detail(unsigned char *data,
-                                      unsigned long length,
-                                      swf_tag_t *tag,
-                                      struct swf_object_ *swf);
-extern int swf_tag_sound_identity_detail(unsigned char *data, int id,
-                                         swf_tag_t *tag);
-extern unsigned char *swf_tag_sound_output_detail(void *detail,
+extern int swf_tag_sound_input_detail(swf_tag_t *tag, struct swf_object_ *swf);
+extern int swf_tag_sound_identity_detail(swf_tag_t *tag, int id);
+extern unsigned char *swf_tag_sound_output_detail(swf_tag_t *tag,
                                                   unsigned long *length,
-                                                  swf_tag_t *tag,
                                                   struct swf_object_ *swf);
-extern void swf_tag_sound_print_detail(void *detail,
-                                       swf_tag_t *tag,
+extern void swf_tag_sound_print_detail(swf_tag_t *tag,
                                        struct swf_object_ *swf);
-extern void swf_tag_sound_destroy_detail(void *detail);
+extern void swf_tag_sound_destroy_detail(swf_tag_t *tag);
 
 extern unsigned char *swf_tag_sound_get_sound_data(void *detail, unsigned long *length,
                                         int sound_id);


Swfed-svn メーリングリストの案内
Back to archive index