[Swfed-svn] swfed-svn [423] author: yoya

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2011年 3月 15日 (火) 17:29:05 JST


Revision: 423
          http://sourceforge.jp/projects/swfed/svn/view?view=rev&revision=423
Author:   yoya
Date:     2011-03-15 17:29:05 +0900 (Tue, 15 Mar 2011)

Log Message:
-----------
author: yoya
- swf_object_replace_tagdata で detail が存在した場合に free したデータを使い続けていたので修正
- swf_tag_destroy から swf_tag_destroy_detail を分離

Modified Paths:
--------------
    trunk/src/swf_object.c
    trunk/src/swf_tag.c
    trunk/src/swf_tag.h


-------------- next part --------------
Modified: trunk/src/swf_object.c
===================================================================
--- trunk/src/swf_object.c	2011-03-12 03:42:54 UTC (rev 422)
+++ trunk/src/swf_object.c	2011-03-15 08:29:05 UTC (rev 423)
@@ -246,9 +246,11 @@
     if (tag) {
         if (tag->data) {
             free(tag->data);
+            tag->data = NULL;
         }
-        if (tag->detail) { // FIXME
-            swf_tag_destroy(tag);
+        if (tag->detail) {
+            swf_tag_detail_destroy(tag);
+	    tag->detail = NULL;
         }
         tag->length = length;
         tag->data = malloc(length);

Modified: trunk/src/swf_tag.c
===================================================================
--- trunk/src/swf_tag.c	2011-03-12 03:42:54 UTC (rev 422)
+++ trunk/src/swf_tag.c	2011-03-15 08:29:05 UTC (rev 423)
@@ -111,7 +111,7 @@
 }
 
 void swf_tag_destroy(swf_tag_t *tag) {
-    if (! tag) {
+    if (tag == NULL) {
         return;
     }
     if (tag->data) {
@@ -119,18 +119,8 @@
         tag->data = NULL;
     }
     if (tag->detail) {
-        swf_tag_info_t *tag_info = get_swf_tag_info(tag->tag);
-        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);
-            } else {
-                fprintf(stderr, "detail_handler->destroy == NULL (tag=%d)\n",
-                        tag->tag);
-            }
-        } else {
-            fprintf(stderr, "not impremented yet. destroy tag detail\n");
-        }
+        swf_tag_destroy_detail(tag);
+	tag->detail = NULL;
     }
     free(tag);
 }
@@ -279,6 +269,28 @@
     return tag->detail;
 }
 
+void swf_tag_destroy_detail(swf_tag_t *tag) {
+    if (tag == NULL) {
+        return;
+    }
+    if (tag->detail) {
+        swf_tag_info_t *tag_info = get_swf_tag_info(tag->tag);
+        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);
+            } else {
+	        fprintf(stderr, "detail_handler->destroy == NULL (tag=%d)\n",
+                        tag->tag);
+            }
+        } else {
+	    fprintf(stderr, "not impremented yet. destroy tag detail\n");
+        }
+	tag->detail = NULL;
+    }
+}
+
+
 int
 swf_tag_get_cid(swf_tag_t *tag) {
     swf_tag_info_t *tag_info = NULL;

Modified: trunk/src/swf_tag.h
===================================================================
--- trunk/src/swf_tag.h	2011-03-12 03:42:54 UTC (rev 422)
+++ trunk/src/swf_tag.h	2011-03-15 08:29:05 UTC (rev 423)
@@ -47,6 +47,8 @@
 extern void swf_tag_destroy(swf_tag_t *tag);
 extern int swf_tag_build(bitstream_t *bs, swf_tag_t *tag, struct swf_object_ *swf);
 extern void swf_tag_print(swf_tag_t *tag, struct swf_object_ *swf, int indent_depth);
+extern void *swf_tag_create_input_detail(swf_tag_t *tag, struct swf_object_ *swf);
+extern void swf_tag_destroy_detail(swf_tag_t *tag);
 
 extern int swf_tag_get_cid(swf_tag_t *tag);
 extern int swf_tag_replace_cid(swf_tag_t *tag, int cid);
@@ -94,8 +96,6 @@
                                        int initial_text_len,
                                        struct swf_object_ *swf);
 
-extern void *swf_tag_create_input_detail(swf_tag_t *tag, struct swf_object_ *swf);
-
 extern int swf_tag_apply_shape_matrix_factor(swf_tag_t *tag, int shape_id,
                                              double scale_x, double scale_y,
                                              double rotate_rad,



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