[Swfed-svn] swfed-svn [477] - purgeUselessContents メソッドの実装

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2011年 3月 28日 (月) 00:34:52 JST


Revision: 477
          http://sourceforge.jp/projects/swfed/svn/view?view=rev&revision=477
Author:   yoya
Date:     2011-03-28 00:34:47 +0900 (Mon, 28 Mar 2011)

Log Message:
-----------
- purgeUselessContents メソッドの実装
- シンボル内のインスタンス名を探すメソッドで大量にエラーメッセージが出る件の修正(動作自体は問題ない)

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


-------------- next part --------------
Modified: trunk/src/php_swfed.c
===================================================================
--- trunk/src/php_swfed.c	2011-03-27 15:26:34 UTC (rev 476)
+++ trunk/src/php_swfed.c	2011-03-27 15:34:47 UTC (rev 477)
@@ -91,6 +91,7 @@
     PHP_ME(swfed,  setCompressLevel, NULL, 0)
     PHP_ME(swfed,  swfInfo, NULL, 0)
 //    PHP_ME(swfed,  rebuild, NULL, 0)
+    PHP_ME(swfed,  purgeUselessContents, NULL, 0)
     {NULL, NULL, NULL}	/* Must be the last line in swfed_functions[] */
 };
 /* }}} */
@@ -1183,6 +1184,7 @@
         if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssb",
 				  &instance_name, &instance_name_len,
 				  &swf_data, &swf_data_len, &unused_cid_purge) == FAILURE) {
+            // unused_cid_purge は無視します。
 	  RETURN_FALSE;
 	}
 	break;
@@ -1194,9 +1196,6 @@
     if (result) {
         RETURN_FALSE;
     }
-    if (unused_cid_purge) {
-        swf_object_purge_useless_cid(swf);
-    }
     RETURN_TRUE;
 }
 
@@ -1212,6 +1211,12 @@
     RETURN_TRUE;
 }
 
+PHP_METHOD(swfed, purgeUselessContents) {
+    swf_object_t *swf = get_swf_object(getThis() TSRMLS_CC);
+    swf_object_purge_contents(swf);
+    RETURN_TRUE;
+}
+
 PHP_METHOD(swfed, setCompressLevel) {
     unsigned long compress_level = 6 ; // Z_DEFAULT_COMPRESSION
     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,

Modified: trunk/src/php_swfed.h
===================================================================
--- trunk/src/php_swfed.h	2011-03-27 15:26:34 UTC (rev 476)
+++ trunk/src/php_swfed.h	2011-03-27 15:34:47 UTC (rev 477)
@@ -84,6 +84,7 @@
 PHP_METHOD(swfed, swfInfo);
 PHP_METHOD(swfed, setCompressLevel);
 PHP_METHOD(swfed, rebuild);
+PHP_METHOD(swfed, purgeUselessContents);
 
 /* 
   	Declare any global variables you may need between the BEGIN

Modified: trunk/src/swf_object.c
===================================================================
--- trunk/src/swf_object.c	2011-03-27 15:26:34 UTC (rev 476)
+++ trunk/src/swf_object.c	2011-03-27 15:34:47 UTC (rev 477)
@@ -233,16 +233,16 @@
 }
 
 void
-swf_object_purge_useless_cid(swf_object_t *swf) {
+swf_object_purge_contents(swf_object_t *swf) {
     swf_tag_t *tag;
     trans_table_t *refcid_trans_table;
     if (swf == NULL) {
-        fprintf(stderr, "swf_object_purge_useless_cid: swf == NULL\n");
+        fprintf(stderr, "swf_object_purge_contents: swf == NULL\n");
         return ;
     }
     refcid_trans_table = trans_table_open();
     if (refcid_trans_table == NULL) {
-        fprintf(stderr, "swf_object_purge_useless_cid: trans_table_open failed\n");
+        fprintf(stderr, "swf_object_purge_contents: trans_table_open failed\n");
         return ;
     }
     // 後ろから走査
@@ -271,7 +271,7 @@
                 swf_tag_sprite_detail_t *tag_sprite;
                 tag_sprite = swf_tag_create_input_detail(tag, swf);
                 if (tag_sprite == NULL) {
-                    fprintf(stderr, "swf_object_purge_useless_cid: tag_sprite == NULL\n");
+                    fprintf(stderr, "swf_object_purge_contents: tag_sprite == NULL\n");
                 } else {
                     for (t = tag_sprite->tag ; t ; t = t->next) {
                         int rid = swf_tag_get_refcid(t);
@@ -1021,7 +1021,12 @@
                 continue;
             }
             for (t = tag_sprite->tag ; t ; t = t->next) {
-                cid = swf_tag_place_get_cid_by_instance_name(t, instance_name, instance_name_len, swf);
+                if (tag->tag == 26) { // PlaceObject2
+                    cid = swf_tag_place_get_cid_by_instance_name(t, instance_name, instance_name_len, swf);
+                }
+                if (cid > 0) {
+                    break; // found
+                }
             }
         }
         if (cid > 0) {

Modified: trunk/src/swf_object.h
===================================================================
--- trunk/src/swf_object.h	2011-03-27 15:26:34 UTC (rev 476)
+++ trunk/src/swf_object.h	2011-03-27 15:34:47 UTC (rev 477)
@@ -34,8 +34,7 @@
 /* --- */
 
 extern void swf_object_rebuild(swf_object_t *swf);
-extern void swf_object_purge_cid(swf_object_t *swf);
-
+extern void swf_object_purge_contents(swf_object_t *swf);
 /* --- */
 
 extern unsigned char *swf_object_get_tagdata(swf_object_t *swf, int tag_seqno,



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