[Swfed-svn] swfed-svn [385] Sprite タグのインスタンス名検索が機能してなかったので修正

アーカイブの一覧に戻る

svnno****@sourc***** svnno****@sourc*****
2011年 3月 7日 (月) 10:31:53 JST


Revision: 385
          http://sourceforge.jp/projects/swfed/svn/view?view=rev&revision=385
Author:   yoya
Date:     2011-03-07 10:31:52 +0900 (Mon, 07 Mar 2011)

Log Message:
-----------
Sprite タグのインスタンス名検索が機能してなかったので修正
- 検索の条件分岐が逆
- Sprite タグ分解処理が動いていない

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


-------------- next part --------------
Modified: trunk/src/swf_object.c
===================================================================
--- trunk/src/swf_object.c	2011-03-06 15:44:33 UTC (rev 384)
+++ trunk/src/swf_object.c	2011-03-07 01:31:52 UTC (rev 385)
@@ -870,7 +870,7 @@
     }
     for (tag=swf->tag ; tag ; tag=tag->next) {
         if (tag->tag == 26) { // PlaceObject2
-            cid = swf_tag_place_get_cid_by_instance_name(tag, instance_name, instance_name_len);
+            cid = swf_tag_place_get_cid_by_instance_name(tag, instance_name, instance_name_len, swf);
             if (cid > 0) {
                 break; // found
             }
@@ -887,8 +887,8 @@
                 sprite_tag = tag;
                 break;
             }
-            prev_sprite_tag = tag;
         }
+        prev_sprite_tag = tag;
     }
     if (sprite_tag == NULL) {
         fprintf(stderr, "swf_object_replace_movieclip: sprite_tag == NULL\n");
@@ -900,22 +900,17 @@
         fprintf(stderr, "swf_object_replace_movieclip: swf_object_input (swf_data_len=%d) failed\n", swf_data_len);
         return ret;
     }
-    swf_tag_sprite = tag->detail;
     // Sprite タグの中を綺麗にする
-    if (sprite_tag->tag) {
-        swf_tag_t *next_tag;
-        for (tag=swf_tag_sprite->tag ; tag ; tag=next_tag) {
-            next_tag = tag->next;
-            swf_tag_destroy(tag);
-        }
-        free(swf);
-        swf_tag_sprite->tag = NULL;
-    }
-    swf_tag_sprite->frame_count = 0;
+    swf_tag_info_t *tag_info = get_swf_tag_info(sprite_tag->tag);
+    swf_tag_detail_handler_t * detail_handler = tag_info->detail_handler();
     free(sprite_tag->data);
     sprite_tag->data = NULL;
     sprite_tag->length = 0;
-    
+    if (sprite_tag->detail) {
+        detail_handler->destroy(sprite_tag);
+    }
+    tag->detail = detail_handler->create();
+    swf_tag_sprite = tag->detail;
     // Sprite 中のタグを削除
     for (tag=swf4sprite->tag ; tag ; tag=tag->next) {
         int tag_no = tag->tag;
@@ -981,7 +976,8 @@
             // TODO: 変数スコープ
               ;
               if (sprite_tag_tail == NULL) {
-                  sprite_tag_tail = swf_tag_sprite->tag = swf_tag_move(tag);
+                  swf_tag_sprite->tag = swf_tag_move(tag);
+                  sprite_tag_tail = swf_tag_sprite->tag;
               } else {
                   sprite_tag_tail->next = swf_tag_move(tag);
                   sprite_tag_tail = sprite_tag_tail->next;

Modified: trunk/src/swf_tag_place.c
===================================================================
--- trunk/src/swf_tag_place.c	2011-03-06 15:44:33 UTC (rev 384)
+++ trunk/src/swf_tag_place.c	2011-03-07 01:31:52 UTC (rev 385)
@@ -251,14 +251,14 @@
 }
 
 int
-swf_tag_place_get_cid_by_instance_name(swf_tag_t *tag, unsigned char *instance_name, int instance_name_len) {
+swf_tag_place_get_cid_by_instance_name(swf_tag_t *tag, unsigned char *instance_name, int instance_name_len, struct swf_object_ *swf) {
     swf_tag_place_detail_t *swf_tag_place;
     if (! isPlaceTag(tag->tag)) {
         fprintf(stderr, "swf_tag_place_get_cid_by_instance_name: ! isPlaceTag(%d)\n", tag->tag);
         return -1; // wrong tag
     }
     if (! tag->detail) {
-        tag->detail = swf_tag_place_create_detail();
+        swf_tag_create_input_detail(tag, swf);
     }
     swf_tag_place = (swf_tag_place_detail_t *) tag->detail;
     if (swf_tag_place->flag_has_name == 0) {

Modified: trunk/src/swf_tag_place.h
===================================================================
--- trunk/src/swf_tag_place.h	2011-03-06 15:44:33 UTC (rev 384)
+++ trunk/src/swf_tag_place.h	2011-03-07 01:31:52 UTC (rev 385)
@@ -41,7 +41,7 @@
                                        int indent_depth);
 extern void swf_tag_place_destroy_detail(swf_tag_t *tag);
 
-extern int swf_tag_place_get_cid_by_instance_name(swf_tag_t *tag, unsigned char *instance_name, int instance_name_len);
+extern int swf_tag_place_get_cid_by_instance_name(swf_tag_t *tag, unsigned char *instance_name, int instance_name_len, struct swf_object_ *swf);
 
 #endif /* __SWF_TAG_PLACE__H__ */
 



Swfed-svn メーリングリストの案内
アーカイブの一覧に戻る