[Swfed-svn] swfed-svn [384] 指定するinstance名の Placeタグを探す処理の修正。 ( また不具合あり )

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2011年 3月 7日 (月) 00:44:33 JST


Revision: 384
          http://sourceforge.jp/projects/swfed/svn/view?view=rev&revision=384
Author:   yoya
Date:     2011-03-07 00:44:33 +0900 (Mon, 07 Mar 2011)

Log Message:
-----------
指定するinstance名の Placeタグを探す処理の修正。(また不具合あり)

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


-------------- next part --------------
Modified: trunk/src/swf_object.c
===================================================================
--- trunk/src/swf_object.c	2011-03-06 15:08:18 UTC (rev 383)
+++ trunk/src/swf_object.c	2011-03-06 15:44:33 UTC (rev 384)
@@ -859,11 +859,11 @@
 swf_object_replace_movieclip(swf_object_t *swf,
                              unsigned char *instance_name, int instance_name_len,
                              unsigned char *swf_data, int swf_data_len) {
-    int cid = 0, ret;
-    swf_tag_t *tag;
+    int cid = 0, ret = 0;
+    swf_tag_t *tag = NULL;
     swf_tag_t *sprite_tag = NULL, *prev_sprite_tag = NULL;
-    swf_tag_t *sprite_tag_tail; // sprite の中の最後の tag
-    swf_tag_sprite_detail_t *swf_tag_sprite;
+    swf_tag_t *sprite_tag_tail = NULL; // sprite の中の最後の tag
+    swf_tag_sprite_detail_t *swf_tag_sprite = NULL;
     if (swf == NULL) {
         fprintf(stderr, "swf_object_replace_movieclip: swf == NULL\n");
         return 1;
@@ -877,7 +877,8 @@
         }
     }
     if (cid <= 0) {
-        fprintf(stderr, "swf_object_replace_movieclip: place cid <= 0\n");
+        fprintf(stderr,
+                "swf_object_replace_movieclip: place cid(%d) <= 0\n", cid);
         return 1; // not found instance name;
     }
     for (tag=swf->tag ; tag ; tag=tag->next) {

Modified: trunk/src/swf_tag_place.c
===================================================================
--- trunk/src/swf_tag_place.c	2011-03-06 15:08:18 UTC (rev 383)
+++ trunk/src/swf_tag_place.c	2011-03-06 15:44:33 UTC (rev 384)
@@ -253,20 +253,20 @@
 int
 swf_tag_place_get_cid_by_instance_name(swf_tag_t *tag, unsigned char *instance_name, int instance_name_len) {
     swf_tag_place_detail_t *swf_tag_place;
-    if (isPlaceTag(tag->tag)) {
+    if (! isPlaceTag(tag->tag)) {
         fprintf(stderr, "swf_tag_place_get_cid_by_instance_name: ! isPlaceTag(%d)\n", tag->tag);
-        return 1; // wrong tag
+        return -1; // wrong tag
     }
-    if (tag->detail) {
+    if (! tag->detail) {
         tag->detail = swf_tag_place_create_detail();
     }
     swf_tag_place = (swf_tag_place_detail_t *) tag->detail;
     if (swf_tag_place->flag_has_name == 0) {
-        return 1; // no name
+        return -2; // no name
     }
     if ((strlen(swf_tag_place->name) != (size_t) instance_name_len) ||
         (strncmp(swf_tag_place->name, (char *) instance_name, (int) instance_name_len) != 0)) {
-        return 1; // name no match
+        return -3; // name no match
     }
-    return 0; // found
+    return swf_tag_place->character_id; // found
 }



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