From 640f88519d969397ceb22183267755da2da4ce94 Mon Sep 17 00:00:00 2001 From: withgod Date: Thu, 3 Dec 2020 17:04:22 +0900 Subject: [PATCH] Remove TSRMLS_(C|CC|DC) macro. --- src/php_swfed.c | 232 +++++++++++++++++++++++++++++--------------------------- src/php_swfed.h | 12 +-- 2 files changed, 125 insertions(+), 119 deletions(-) diff --git a/src/php_swfed.c b/src/php_swfed.c index bc16e9b..2ba9280 100644 --- a/src/php_swfed.c +++ b/src/php_swfed.c @@ -59,9 +59,9 @@ } while (0); static int -param_is_null(int n TSRMLS_DC) { +param_is_null(int n) { zval *p; - zend_parse_parameters(n TSRMLS_CC, "z", &p); + zend_parse_parameters(n, "z", &p); if(Z_TYPE_P(p) == IS_NULL) { return 1; // true } @@ -156,6 +156,9 @@ zend_module_entry swfed_module_entry = { /* }}} */ #ifdef COMPILE_DL_SWFED +#ifdef ZTS +ZEND_TSRMLS_CACHE_DEFINE(); +#endif ZEND_GET_MODULE(swfed) #endif @@ -181,8 +184,8 @@ static void php_swfed_init_globals(zend_swfed_globals *swfed_globals) /* }}} */ -static void free_swfed_resource(zend_resource *resource TSRMLS_DC); -static swf_object_t *get_swf_object(zval *obj TSRMLS_DC); +static void free_swfed_resource(zend_resource *resource); +static swf_object_t *get_swf_object(zval *obj); /* {{{ PHP_MINIT_FUNCTION */ @@ -194,7 +197,7 @@ PHP_MINIT_FUNCTION(swfed) */ zend_class_entry ce; INIT_CLASS_ENTRY(ce, "SWFEditor", swfed_functions); - swfeditor_ce = zend_register_internal_class(&ce TSRMLS_CC); + swfeditor_ce = zend_register_internal_class(&ce); le_swfed = zend_register_list_destructors_ex(free_swfed_resource, NULL, "SWFEditor", module_number); //zend_declare_property_stringl(swfeditor_ce, @@ -227,6 +230,9 @@ PHP_MSHUTDOWN_FUNCTION(swfed) */ PHP_RINIT_FUNCTION(swfed) { +#if defined(COMPILE_DL_EXTNAME) && defined(ZTS) + ZEND_TSRMLS_CACHE_UPDATE(); +#endif return SUCCESS; } /* }}} */ @@ -279,7 +285,7 @@ PHP_FUNCTION(confirm_swfed_compiled) size_t arg_len, len; zend_string *string = zend_string_alloc(255, 0); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arg_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &arg, &arg_len) == FAILURE) { return; } @@ -309,7 +315,7 @@ PHP_METHOD(swfed, __construct) { swf_object_t *swf = swf_object_open(); zval *ret = 0; if (swf == NULL) { - php_error_docref(NULL TSRMLS_CC, E_ERROR, "Couldn't create swf object"); + php_error_docref(NULL, E_ERROR, "Couldn't create swf object"); } ret = zend_list_insert(swf, le_swfed); //object_init_ex(getThis(), swfeditor_ce); @@ -322,11 +328,11 @@ PHP_METHOD(swfed, input) { size_t data_len = 0; swf_object_t *swf = NULL; int result = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &data, &data_len) == FAILURE) { RETURN_FALSE; } - swf = get_swf_object(getThis() TSRMLS_CC); + swf = get_swf_object(getThis()); result = swf_object_input(swf, (unsigned char *) data, data_len); if (result) { RETURN_FALSE; @@ -343,7 +349,7 @@ PHP_METHOD(swfed, output) { WRONG_PARAM_COUNT; RETURN_FALSE; /* XXX */ } - swf = get_swf_object(getThis() TSRMLS_CC); + swf = get_swf_object(getThis()); data = swf_object_output(swf, &len); new_buff = emalloc(len); if (new_buff == NULL) { @@ -360,20 +366,20 @@ PHP_METHOD(swfed, output) { } PHP_METHOD(swfed, swfInfo) { - swf_object_t *swf = get_swf_object(getThis() TSRMLS_CC); + swf_object_t *swf = get_swf_object(getThis()); swf_object_print(swf); RETURN_TRUE; } PHP_METHOD(swfed, _destroy_and_exit) { // for debug swf_object_t *swf = NULL; - swf = get_swf_object(getThis() TSRMLS_CC); + swf = get_swf_object(getThis()); swf_object_close(swf); exit(0); } PHP_METHOD(swfed, getHeaderInfo) { - swf_object_t *swf = get_swf_object(getThis() TSRMLS_CC); + swf_object_t *swf = get_swf_object(getThis()); array_init(return_value); if (memcmp(swf->header.magic, "CWS", 3) == 0) { add_assoc_bool(return_value, "compress", 1); @@ -395,12 +401,12 @@ PHP_METHOD(swfed, setHeaderInfo) { swf_object_t *swf = NULL; HashTable *header_table = NULL; zval *tmp = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &header_info) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters"); + php_error_docref(NULL, E_ERROR, "Invalid parameters"); RETURN_FALSE; } - swf = get_swf_object(getThis() TSRMLS_CC); + swf = get_swf_object(getThis()); header_table = Z_ARRVAL_P(header_info); // FWS or CWS @@ -449,7 +455,7 @@ PHP_METHOD(swfed, getTagList) { WRONG_PARAM_COUNT; RETURN_FALSE; /* XXX */ } - swf = get_swf_object(getThis() TSRMLS_CC); + swf = get_swf_object(getThis()); array_init(return_value); for (tag=swf->tag_head ; tag ; tag=tag->next) { array_init(&data); @@ -476,11 +482,11 @@ PHP_METHOD(swfed, getTagDetail) { swf_tag_t *tag = NULL; swf_tag_info_t *tag_info = NULL; int i = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &tag_seqno) == FAILURE) { RETURN_FALSE; } - swf = get_swf_object(getThis() TSRMLS_CC); + swf = get_swf_object(getThis()); i = 0; for (tag=swf->tag_head ; tag ; tag=tag->next) { if (i == tag_seqno) { @@ -629,10 +635,10 @@ PHP_METHOD(swfed, getTagData) { unsigned char *data = NULL, *new_buff; unsigned long data_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &tag_seqno) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &tag_seqno) == FAILURE) { RETURN_FALSE; } - swf = get_swf_object(getThis() TSRMLS_CC); + swf = get_swf_object(getThis()); data = swf_object_get_tagdata(swf, tag_seqno, &data_len); if (data == NULL) { @@ -658,12 +664,12 @@ PHP_METHOD(swfed, replaceTagData) { WRONG_PARAM_COUNT; RETURN_FALSE; /* XXX */ case 2: - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &tag_seqno, &data, &data_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &tag_seqno, &data, &data_len) == FAILURE) { RETURN_FALSE; } break; } - swf = get_swf_object(getThis() TSRMLS_CC); + swf = get_swf_object(getThis()); result = swf_object_replace_tagdata(swf, tag_seqno, (unsigned char *)data, (unsigned long) data_len); @@ -678,10 +684,10 @@ PHP_METHOD(swfed, getTagDataByCID) { 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) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &cid) == FAILURE) { RETURN_FALSE; } - swf = get_swf_object(getThis() TSRMLS_CC); + swf = get_swf_object(getThis()); data_ref = swf_object_get_tagdata_bycid(swf, cid, &data_len); if (data_ref == NULL) { @@ -704,12 +710,12 @@ PHP_METHOD(swfed, replaceTagDataByCID) { WRONG_PARAM_COUNT; RETURN_FALSE; /* XXX */ case 2: - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &cid, &data, &data_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &cid, &data, &data_len) == FAILURE) { RETURN_FALSE; } break; } - swf = get_swf_object(getThis() TSRMLS_CC); + swf = get_swf_object(getThis()); result = swf_object_replace_tagdata_bycid(swf, cid, (unsigned char *)data, data_len); @@ -724,10 +730,10 @@ PHP_METHOD(swfed, getTagContentsByCID) { 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) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &cid) == FAILURE) { RETURN_FALSE; } - swf = get_swf_object(getThis() TSRMLS_CC); + swf = get_swf_object(getThis()); data_ref = swf_object_get_tagcontents_bycid(swf, cid, &data_len); if (data_ref == NULL) { @@ -751,12 +757,12 @@ PHP_METHOD(swfed, replaceTagContentsByCID) { WRONG_PARAM_COUNT; RETURN_FALSE; /* XXX */ case 2: - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &cid, &data, &data_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &cid, &data, &data_len) == FAILURE) { RETURN_FALSE; } break; } - swf = get_swf_object(getThis() TSRMLS_CC); + swf = get_swf_object(getThis()); result = swf_object_replace_tagcontents_bycid(swf, cid, (unsigned char *)data, data_len); @@ -774,17 +780,17 @@ PHP_METHOD(swfed, removeTag) { switch (ZEND_NUM_ARGS()) { case 1: - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &tag_seqno) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &tag_seqno) == FAILURE) { RETURN_FALSE; } break; case 2: - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &tag_seqno, &tag_seqno_in_sprite) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &tag_seqno, &tag_seqno_in_sprite) == FAILURE) { RETURN_FALSE; } break; } - swf = get_swf_object(getThis() TSRMLS_CC); + swf = get_swf_object(getThis()); ret = swf_object_remove_tag(swf, tag_seqno, tag_seqno_in_sprite); if (ret) { RETURN_FALSE; @@ -802,12 +808,12 @@ PHP_METHOD(swfed, printTagData) { WRONG_PARAM_COUNT; RETURN_FALSE; /* XXX */ case 1: - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data, &data_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &data, &data_len) == FAILURE) { RETURN_FALSE; } break; } - swf = get_swf_object(getThis() TSRMLS_CC); + swf = get_swf_object(getThis()); ret = swf_object_print_tagdata(swf, (unsigned char *)data, (unsigned long) data_len); if (ret) { @@ -821,10 +827,10 @@ PHP_METHOD(swfed, getShapeData) { swf_object_t *swf = NULL; unsigned char *data = NULL, *new_buff; unsigned long data_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &cid) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &cid) == FAILURE) { RETURN_FALSE; } - swf = get_swf_object(getThis() TSRMLS_CC); + swf = get_swf_object(getThis()); data = swf_object_get_shapedata(swf, cid, &data_len); if (data == NULL) { @@ -851,12 +857,12 @@ PHP_METHOD(swfed, replaceShapeData) { WRONG_PARAM_COUNT; RETURN_FALSE; /* XXX */ case 2: - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &cid, &data, &data_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &cid, &data, &data_len) == FAILURE) { RETURN_FALSE; } break; } - swf = get_swf_object(getThis() TSRMLS_CC); + swf = get_swf_object(getThis()); result = swf_object_replace_shapedata(swf, cid, (unsigned char *)data, (unsigned long)data_len); @@ -869,11 +875,11 @@ PHP_METHOD(swfed, replaceShapeData) { PHP_METHOD(swfed, setShapeAdjustMode) { swf_object_t *swf = NULL; zend_long mode = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &mode) == FAILURE) { RETURN_FALSE; } - swf = get_swf_object(getThis() TSRMLS_CC); + swf = get_swf_object(getThis()); swf_object_set_shape_adjust_mode(swf, mode); RETURN_TRUE; } @@ -884,11 +890,11 @@ PHP_METHOD(swfed, getShapeIdListByBitmapRef) { swf_object_t *swf = NULL; swf_tag_t *tag = NULL; int i; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &bitmap_id) == FAILURE) { RETURN_FALSE; } - swf = get_swf_object(getThis() TSRMLS_CC); + swf = get_swf_object(getThis()); array_init(return_value); i = 0; for (tag = swf->tag_head ; tag ; tag=tag->next) { @@ -916,11 +922,11 @@ PHP_METHOD(swfed, getBitmapSize) { swf_object_t *swf = NULL; int width, height; int ret; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &bitmap_id) == FAILURE) { RETURN_FALSE; } - swf = get_swf_object(getThis() TSRMLS_CC); + swf = get_swf_object(getThis()); ret = swf_object_get_bitmap_size(swf, bitmap_id, &width, &height); if (ret) { RETURN_FALSE; @@ -936,11 +942,11 @@ PHP_METHOD(swfed, getJpegData) { unsigned char *data = NULL; char *new_buff = NULL; swf_object_t *swf = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &image_id) == FAILURE) { RETURN_FALSE; } - swf = get_swf_object(getThis() TSRMLS_CC); + swf = get_swf_object(getThis()); data = swf_object_get_jpegdata(swf, &len, image_id); if (data == NULL) { RETURN_FALSE; @@ -966,11 +972,11 @@ PHP_METHOD(swfed, getJpegAlpha) { unsigned char *data = NULL; char *new_buff = NULL; swf_object_t *swf = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &image_id) == FAILURE) { RETURN_FALSE; } - swf = get_swf_object(getThis() TSRMLS_CC); + swf = get_swf_object(getThis()); data = swf_object_get_alphadata(swf, &len, image_id); if (data == NULL) { RETURN_FALSE; @@ -1001,17 +1007,17 @@ PHP_METHOD(swfed, replaceJpegData) { WRONG_PARAM_COUNT; RETURN_FALSE; /* XXX */ case 2: - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &image_id, &data, &data_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &image_id, &data, &data_len) == FAILURE) { RETURN_FALSE; } break; case 3: - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lss", &image_id, &data, &data_len, &alpha_data, &alpha_data_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "lss", &image_id, &data, &data_len, &alpha_data, &alpha_data_len) == FAILURE) { RETURN_FALSE; } break; } - swf = get_swf_object(getThis() TSRMLS_CC); + swf = get_swf_object(getThis()); result = swf_object_replace_jpegdata(swf, image_id, (unsigned char *)data, (unsigned long) data_len, @@ -1034,11 +1040,11 @@ PHP_METHOD(swfed, getPNGData) { unsigned char *data = NULL; char *new_buff = NULL; swf_object_t *swf = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &image_id) == FAILURE) { RETURN_FALSE; } - swf = get_swf_object(getThis() TSRMLS_CC); + swf = get_swf_object(getThis()); data = swf_object_get_pngdata(swf, &len, image_id); if (data == NULL) { RETURN_FALSE; @@ -1077,7 +1083,7 @@ PHP_METHOD(swfed, replacePNGData) { RETURN_FALSE; /* XXX */ case 2: case 3: - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls|a", &image_id, &data, &data_len, &opts) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls|a", &image_id, &data, &data_len, &opts) == FAILURE) { RETURN_FALSE; } break; @@ -1087,7 +1093,7 @@ PHP_METHOD(swfed, replacePNGData) { get_zend_hash_value_boolean(opts_table, "rgb15", rgb15); } - swf = get_swf_object(getThis() TSRMLS_CC); + swf = get_swf_object(getThis()); result = swf_object_replace_pngdata(swf, image_id, (unsigned char *)data, @@ -1115,12 +1121,12 @@ PHP_METHOD(swfed, replaceGIFData) { WRONG_PARAM_COUNT; RETURN_FALSE; /* XXX */ case 2: - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &image_id, &data, &data_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &image_id, &data, &data_len) == FAILURE) { RETURN_FALSE; } break; } - swf = get_swf_object(getThis() TSRMLS_CC); + swf = get_swf_object(getThis()); result = swf_object_replace_gifdata(swf, image_id, (unsigned char *)data, (unsigned long) data_len); @@ -1145,8 +1151,8 @@ PHP_METHOD(swfed, replaceBitmapData) { swf_object_t *swf = NULL; int result = 0; int bitmap_format; - if (param_is_null(1 TSRMLS_CC)) { - php_error(E_WARNING, "%s() 1st arg must be not NULL", get_active_function_name(TSRMLS_C)); + if (param_is_null(1)) { + php_error(E_WARNING, "%s() 1st arg must be not NULL", get_active_function_name()); RETURN_FALSE; /* XXX */ } switch (ZEND_NUM_ARGS()) { @@ -1158,15 +1164,15 @@ PHP_METHOD(swfed, replaceBitmapData) { case 4: case 5: if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, - ZEND_NUM_ARGS() TSRMLS_CC, "zs|sz", &arg1, &data, &data_len, &alpha_data, &alpha_data_len, &arg4) == SUCCESS) { + ZEND_NUM_ARGS(), "zs|sz", &arg1, &data, &data_len, &alpha_data, &alpha_data_len, &arg4) == SUCCESS) { ; // OK } else { - php_error(E_WARNING, "%s() expects parameter 2 to be string given", get_active_function_name(TSRMLS_C)); + php_error(E_WARNING, "%s() expects parameter 2 to be string given", get_active_function_name()); RETURN_FALSE; } break; } - swf = get_swf_object(getThis() TSRMLS_CC); + swf = get_swf_object(getThis()); if (Z_TYPE_P(arg1) != IS_ARRAY) { // image_id (integer) if (Z_TYPE_P(arg1) != IS_LONG) { @@ -1183,7 +1189,7 @@ PHP_METHOD(swfed, replaceBitmapData) { image_id = swf_object_search_cid_by_bitmap_condition(swf, width, height, red, green, blue); if (image_id <= 0) { - php_error(E_WARNING, "%s() cid not found by bitmap condition(width=%d height=%d red=%d green=%d blue=%d)", get_active_function_name(TSRMLS_C), + php_error(E_WARNING, "%s() cid not found by bitmap condition(width=%d height=%d red=%d green=%d blue=%d)", get_active_function_name(), width, height, red, green, blue); RETURN_FALSE; } @@ -1214,7 +1220,7 @@ PHP_METHOD(swfed, replaceBitmapData) { 1); break; default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown Bitmap Format"); + php_error_docref(NULL, E_WARNING, "Unknown Bitmap Format"); RETURN_FALSE; } } else { @@ -1241,7 +1247,7 @@ PHP_METHOD(swfed, replaceBitmapData) { break; default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown Bitmap Format"); + php_error_docref(NULL, E_WARNING, "Unknown Bitmap Format"); RETURN_FALSE; } } @@ -1254,7 +1260,7 @@ PHP_METHOD(swfed, replaceBitmapData) { PHP_METHOD(swfed, convertBitmapDataToJpegTag) { swf_object_t *swf = NULL; int ret; - swf = get_swf_object(getThis() TSRMLS_CC); + swf = get_swf_object(getThis()); ret = swf_object_convert_bitmapdata_tojpegtag(swf); if (ret) { RETURN_FALSE; @@ -1268,16 +1274,16 @@ PHP_METHOD(swfed, applyShapeMatrixFactor) { zend_long trans_x = 0, trans_y = 0; swf_object_t *swf = NULL; int result; - if (param_is_null(1 TSRMLS_CC)) { - php_error(E_WARNING, "%s() 1st arg must be not NULL", get_active_function_name(TSRMLS_C)); + if (param_is_null(1)) { + php_error(E_WARNING, "%s() 1st arg must be not NULL", get_active_function_name()); RETURN_FALSE; /* XXX */ } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ldddll", &shape_id, &scale_x, &scale_y, &rotate_rad, &trans_x, &trans_y) == FAILURE) { RETURN_FALSE; } - swf = get_swf_object(getThis() TSRMLS_CC); + swf = get_swf_object(getThis()); result = swf_object_apply_shapematrix_factor(swf, shape_id, -1, scale_x, scale_y, rotate_rad, trans_x, trans_y); @@ -1294,16 +1300,16 @@ PHP_METHOD(swfed, applyShapeRectFactor) { zend_long trans_x = 0, trans_y = 0; swf_object_t *swf = NULL; int result; - if (param_is_null(1 TSRMLS_CC)) { - php_error(E_WARNING, "%s() 1st arg must be not NULL", get_active_function_name(TSRMLS_C)); + if (param_is_null(1)) { + php_error(E_WARNING, "%s() 1st arg must be not NULL", get_active_function_name()); RETURN_FALSE; /* XXX */ } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, + if (zend_parse_parameters(ZEND_NUM_ARGS(), "lddll", &shape_id, &scale_x, &scale_y, &trans_x, &trans_y) == FAILURE) { RETURN_FALSE; } - swf = get_swf_object(getThis() TSRMLS_CC); + swf = get_swf_object(getThis()); result = swf_object_apply_shaperect_factor(swf, shape_id, -1, scale_x, scale_y, trans_x, trans_y); @@ -1329,15 +1335,15 @@ PHP_METHOD(swfed, getSoundData) { unsigned char *data = NULL; char *new_buff = NULL; swf_object_t *swf = NULL; - if (param_is_null(1 TSRMLS_CC)) { - php_error(E_WARNING, "%s() 1st arg must be not NULL", get_active_function_name(TSRMLS_C)); + if (param_is_null(1)) { + php_error(E_WARNING, "%s() 1st arg must be not NULL", get_active_function_name()); RETURN_FALSE; /* XXX */ } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &sound_id) == FAILURE) { RETURN_FALSE; } - swf = get_swf_object(getThis() TSRMLS_CC); + swf = get_swf_object(getThis()); data = swf_object_get_sounddata(swf, &len, sound_id); if (data == NULL) { RETURN_FALSE; @@ -1363,8 +1369,8 @@ PHP_METHOD(swfed, replaceMLDData) { size_t data_len = 0; swf_object_t *swf = NULL; int result = 0; - if (param_is_null(1 TSRMLS_CC)) { - php_error(E_WARNING, "%s() 1st arg must be not NULL", get_active_function_name(TSRMLS_C)); + if (param_is_null(1)) { + php_error(E_WARNING, "%s() 1st arg must be not NULL", get_active_function_name()); RETURN_FALSE; } switch (ZEND_NUM_ARGS()) { @@ -1372,12 +1378,12 @@ PHP_METHOD(swfed, replaceMLDData) { WRONG_PARAM_COUNT; RETURN_FALSE; /* XXX */ case 2: - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &sound_id, &data, &data_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &sound_id, &data, &data_len) == FAILURE) { RETURN_FALSE; } break; } - swf = get_swf_object(getThis() TSRMLS_CC); + swf = get_swf_object(getThis()); result = swf_object_replace_melodata(swf, sound_id, (unsigned char *)data, (unsigned long) data_len); @@ -1394,15 +1400,15 @@ PHP_METHOD(swfed, getEditString) { char *data = NULL, *new_buff = NULL; int str_len = 0; int error = 0; - if (param_is_null(1 TSRMLS_CC)) { - php_error(E_WARNING, "%s() 1st arg must be not NULL", get_active_function_name(TSRMLS_C)); + if (param_is_null(1)) { + php_error(E_WARNING, "%s() 1st arg must be not NULL", get_active_function_name()); RETURN_FALSE; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &var_name, &var_name_len) == FAILURE) { RETURN_FALSE; } - swf = get_swf_object(getThis() TSRMLS_CC); + swf = get_swf_object(getThis()); data = swf_object_get_editstring(swf, var_name, var_name_len, &error); if (data == NULL) { if (error) { @@ -1432,16 +1438,16 @@ PHP_METHOD(swfed, replaceEditString) { size_t var_name_len = 0, ini_text_len = 0; swf_object_t *swf = NULL; int result = 0; - if (param_is_null(1 TSRMLS_CC)) { - php_error(E_WARNING, "%s() 1st arg must be not NULL", get_active_function_name(TSRMLS_C)); + if (param_is_null(1)) { + php_error(E_WARNING, "%s() 1st arg must be not NULL", get_active_function_name()); RETURN_FALSE; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &var_name, &var_name_len, &ini_text, &ini_text_len) == FAILURE) { RETURN_FALSE; } - swf = get_swf_object(getThis() TSRMLS_CC); + swf = get_swf_object(getThis()); result = swf_object_replace_editstring(swf, var_name, var_name_len, ini_text, ini_text_len); if (result) { @@ -1457,10 +1463,10 @@ PHP_METHOD(swfed, getActionData) { char *new_buff = NULL; unsigned long data_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &tag_seqno) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &tag_seqno) == FAILURE) { RETURN_FALSE; } - swf = get_swf_object(getThis() TSRMLS_CC); + swf = get_swf_object(getThis()); data = swf_object_get_actiondata(swf, &data_len, tag_seqno); if (data == NULL) { fprintf(stderr, "getActionData: Can't get_actiondata\n"); @@ -1486,7 +1492,7 @@ PHP_METHOD(swfed, disasmActionData) { size_t data_len = 0; bitstream_t *bs = NULL; swf_action_list_t *action_list = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &data, &data_len) == FAILURE) { RETURN_FALSE; } @@ -1515,12 +1521,12 @@ PHP_METHOD(swfed, setActionVariables) { uint str_key_len, str_value_len; int ret; y_keyvalue_t *kv; - swf_object_t *swf = get_swf_object(getThis() TSRMLS_CC); + swf_object_t *swf = get_swf_object(getThis()); zend_ulong loop_num_key; zend_string *loop_key = NULL; zval *loop_val; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &arr) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &arr) == FAILURE) { RETURN_FALSE; } kv = y_keyvalue_open(); @@ -1549,12 +1555,12 @@ PHP_METHOD(swfed, replaceActionStrings) { uint str_key_len, str_value_len; int ret; y_keyvalue_t *kv; - swf_object_t *swf = get_swf_object(getThis() TSRMLS_CC); + swf_object_t *swf = get_swf_object(getThis()); zend_string *loop_key = NULL; zval *loop_val; ulong loop_num_key; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &arr) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &arr) == FAILURE) { RETURN_FALSE; } kv = y_keyvalue_open(); @@ -1583,8 +1589,8 @@ PHP_METHOD(swfed, replaceMovieClip) { swf_object_t *swf = NULL; zend_bool unused_cid_purge = 1; // デフォルト on int result = 0; - if (param_is_null(1 TSRMLS_CC)) { - php_error(E_WARNING, "%s() 1st arg must be not NULL", get_active_function_name(TSRMLS_C)); + if (param_is_null(1)) { + php_error(E_WARNING, "%s() 1st arg must be not NULL", get_active_function_name()); RETURN_FALSE; } switch (ZEND_NUM_ARGS()) { @@ -1592,14 +1598,14 @@ PHP_METHOD(swfed, replaceMovieClip) { WRONG_PARAM_COUNT; RETURN_FALSE; /* XXX */ case 2: - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &instance_name, &instance_name_len, &swf_data, &swf_data_len) == FAILURE) { RETURN_FALSE; } break; case 3: - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssb", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ssb", &instance_name, &instance_name_len, &swf_data, &swf_data_len, &unused_cid_purge) == FAILURE) { // unused_cid_purge は無視します。 @@ -1607,7 +1613,7 @@ PHP_METHOD(swfed, replaceMovieClip) { } break; } - swf = get_swf_object(getThis() TSRMLS_CC); + swf = get_swf_object(getThis()); result = swf_object_replace_movieclip(swf, (unsigned char *)instance_name, instance_name_len, @@ -1620,7 +1626,7 @@ PHP_METHOD(swfed, replaceMovieClip) { } PHP_METHOD(swfed, rebuild) { - swf_object_t *swf = get_swf_object(getThis() TSRMLS_CC); + swf_object_t *swf = get_swf_object(getThis()); if (swf_object_rebuild(swf)) { RETURN_FALSE; } @@ -1628,7 +1634,7 @@ PHP_METHOD(swfed, rebuild) { } PHP_METHOD(swfed, purgeUselessContents) { - swf_object_t *swf = get_swf_object(getThis() TSRMLS_CC); + swf_object_t *swf = get_swf_object(getThis()); swf_object_purge_contents(swf); RETURN_TRUE; } @@ -1636,11 +1642,11 @@ PHP_METHOD(swfed, purgeUselessContents) { PHP_METHOD(swfed, setCompressLevel) { zend_long compress_level = 6 ; // Z_DEFAULT_COMPRESSION swf_object_t *swf; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &compress_level) == FAILURE) { RETURN_FALSE; } - swf = get_swf_object(getThis() TSRMLS_CC); + swf = get_swf_object(getThis()); swf->compress_level = compress_level; RETURN_TRUE; } @@ -1648,7 +1654,7 @@ PHP_METHOD(swfed, setCompressLevel) { PHP_METHOD(swfed, isShapeTagData) { char *data = NULL; size_t data_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &data, &data_len) == FAILURE) { RETURN_FALSE; } @@ -1662,7 +1668,7 @@ PHP_METHOD(swfed, isShapeTagData) { PHP_METHOD(swfed, isBitmapTagData) { char *data = NULL; size_t data_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &data, &data_len) == FAILURE) { RETURN_FALSE; } @@ -1674,14 +1680,14 @@ PHP_METHOD(swfed, isBitmapTagData) { } -static swf_object_t *get_swf_object(zval *obj TSRMLS_DC) { +static swf_object_t *get_swf_object(zval *obj) { // zval *data, **tmp; zval *tmp = NULL; swf_object_t *swf = NULL; int id = 0, type = 0; /* XXX: zend_read_property data = zend_read_property(Z_OBJCE_P(obj), obj, "swf_object", - strlen("swf_object"), 1 TSRMLS_CC); + strlen("swf_object"), 1); */ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(obj), ZEND_STRL("swf_object"))) == NULL) { printf("coudnt found swf_object\n"); @@ -1697,7 +1703,7 @@ static swf_object_t *get_swf_object(zval *obj TSRMLS_DC) { return swf; } -static void free_swfed_resource(zend_resource *resource TSRMLS_DC) +static void free_swfed_resource(zend_resource *resource) { // printf("SWFEditor->destory\n"); swf_object_close((swf_object_t *) resource->ptr); diff --git a/src/php_swfed.h b/src/php_swfed.h index 0670a33..fa4e8fb 100644 --- a/src/php_swfed.h +++ b/src/php_swfed.h @@ -98,9 +98,9 @@ PHP_METHOD(swfed, purgeUselessContents); PHP_METHOD(swfed, isShapeTagData); PHP_METHOD(swfed, isBitmapTagData); -/* +/* Declare any global variables you may need between the BEGIN - and END macros here: + and END macros here: ZEND_BEGIN_MODULE_GLOBALS(swfed) long global_value; @@ -108,12 +108,12 @@ ZEND_BEGIN_MODULE_GLOBALS(swfed) ZEND_END_MODULE_GLOBALS(swfed) */ -/* In every utility function you add that needs to use variables - in php_swfed_globals, call TSRMLS_FETCH(); after declaring other +/* In every utility function you add that needs to use variables + in php_swfed_globals, call TSRMLS_FETCH(); after declaring other variables used by that function, or better yet, pass in TSRMLS_CC after the last function argument and declare your utility function with TSRMLS_DC after the last declared argument. Always refer to - the globals in your function as SWFED_G(variable). You are + the globals in your function as SWFED_G(variable). You are encouraged to rename these macros something shorter, see examples in any other php module directory. */ @@ -125,7 +125,7 @@ ZEND_END_MODULE_GLOBALS(swfed) #endif #define REGISTER_SWFED_CLASS_CONST_LONG(const_name, value) \ - zend_declare_class_constant_long(swfeditor_ce, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); + zend_declare_class_constant_long(swfeditor_ce, const_name, sizeof(const_name)-1, (long)value); #endif /* PHP_SWFED_H */ -- 2.11.0