[Swfed-svn] swfed-svn [512] getTagDataByCID, replaceTagDataByCID の実装

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2011年 4月 1日 (金) 22:42:52 JST


Revision: 512
          http://sourceforge.jp/projects/swfed/svn/view?view=rev&revision=512
Author:   yoya
Date:     2011-04-01 22:42:52 +0900 (Fri, 01 Apr 2011)

Log Message:
-----------
getTagDataByCID, replaceTagDataByCID の実装

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-04-01 13:42:11 UTC (rev 511)
+++ trunk/src/php_swfed.c	2011-04-01 13:42:52 UTC (rev 512)
@@ -65,6 +65,8 @@
     PHP_ME(swfed,  getTagDetail, NULL, 0)
     PHP_ME(swfed,  getTagData, NULL, 0)
     PHP_ME(swfed,  replaceTagData, NULL, 0)
+    PHP_ME(swfed,  getTagDataByCID, NULL, 0)
+    PHP_ME(swfed,  replaceTagDataByCID, NULL, 0)
     PHP_ME(swfed,  getTagContentsByCID, NULL, 0)
     PHP_ME(swfed,  replaceTagContentsByCID, NULL, 0)
 
@@ -623,6 +625,49 @@
     RETURN_TRUE;
 }
 
+PHP_METHOD(swfed, getTagDataByCID) {
+    long cid = 0;
+    swf_object_t *swf = NULL;
+    unsigned char *data_ref = NULL;
+    unsigned long data_len = 0;
+    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &cid) == FAILURE) {
+        RETURN_FALSE;
+    }
+    swf = get_swf_object(getThis() TSRMLS_CC);
+    data_ref = swf_object_get_tagdata_bycid(swf, cid, &data_len);
+    if (data_ref == NULL) {
+        fprintf(stderr, "getTagDataByCID: Can't get_tagdata_bycid\n");
+        RETURN_FALSE;
+    }
+    RETURN_STRINGL(data_ref, data_len, 1);
+}
+
+PHP_METHOD(swfed, replaceTagDataByCID) {
+    char *data = NULL;
+    unsigned long data_len = 0;
+    long cid = 0;
+    swf_object_t *swf = NULL;
+    int result = 0;
+    switch (ZEND_NUM_ARGS()) {
+      default:
+        WRONG_PARAM_COUNT;
+        RETURN_FALSE; /* XXX */
+      case 2:
+        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &cid, &data, &data_len) == FAILURE) {
+            RETURN_FALSE;
+        }
+        break;
+    }
+    swf = get_swf_object(getThis() TSRMLS_CC);
+    result = swf_object_replace_tagdata_bycid(swf, cid,
+					      (unsigned char *)data,
+					      data_len);
+    if (result) {
+        RETURN_FALSE;
+    }
+    RETURN_TRUE;
+}
+
 PHP_METHOD(swfed, getTagContentsByCID) {
     long cid = 0;
     swf_object_t *swf = NULL;

Modified: trunk/src/php_swfed.h
===================================================================
--- trunk/src/php_swfed.h	2011-04-01 13:42:11 UTC (rev 511)
+++ trunk/src/php_swfed.h	2011-04-01 13:42:52 UTC (rev 512)
@@ -57,6 +57,8 @@
 PHP_METHOD(swfed, getTagInfo);
 PHP_METHOD(swfed, getTagData);
 PHP_METHOD(swfed, replaceTagData);
+PHP_METHOD(swfed, getTagDataByCID);
+PHP_METHOD(swfed, replaceTagDataByCID);
 PHP_METHOD(swfed, getTagContentsByCID);
 PHP_METHOD(swfed, replaceTagContentsByCID);
 //

Modified: trunk/src/swf_object.c
===================================================================
--- trunk/src/swf_object.c	2011-04-01 13:42:11 UTC (rev 511)
+++ trunk/src/swf_object.c	2011-04-01 13:42:52 UTC (rev 512)
@@ -339,8 +339,8 @@
 }
 
 unsigned char *
-swf_object_get_tag_bycid(swf_object_t *swf, int cid,
-                       unsigned long *length) {
+swf_object_get_tagdata_bycid(swf_object_t *swf, int cid,
+			     unsigned long *length) {
     swf_tag_t *tag;
     unsigned char *data = NULL;
     tag = swf_object_search_tag_bycid(swf, cid);
@@ -354,7 +354,7 @@
 }
 
 int
-swf_object_replace_tag_bycid(swf_object_t *swf, int cid,
+swf_object_replace_tagdata_bycid(swf_object_t *swf, int cid,
 			      unsigned char *data, unsigned long length) {
     swf_tag_t *old_tag, *new_tag;
     old_tag = swf_object_search_tag_bycid(swf, cid);

Modified: trunk/src/swf_object.h
===================================================================
--- trunk/src/swf_object.h	2011-04-01 13:42:11 UTC (rev 511)
+++ trunk/src/swf_object.h	2011-04-01 13:42:52 UTC (rev 512)
@@ -43,13 +43,13 @@
 extern int swf_object_replace_tagdata(swf_object_t *swf, int tag_seqno,
                                       unsigned char *data,
                                       unsigned long length);
-extern unsigned char *swf_object_get_tag_bycid(swf_object_t *swf,
+extern unsigned char *swf_object_get_tagdata_bycid(swf_object_t *swf,
 						   int cid,
 						   unsigned long *length);
-extern int swf_object_replace_tag_bycid(swf_object_t *swf,
-					int cid,
-					unsigned char *data,
-					unsigned long length);
+extern int swf_object_replace_tagdata_bycid(swf_object_t *swf,
+					    int cid,
+					    unsigned char *data,
+					    unsigned long length);
 extern unsigned char *swf_object_get_tagcontents_bycid(swf_object_t *swf,
                                                        int cid,
                                                        unsigned long *length);



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