com php-src: fixed ext/wddx: ext/wddx/php_wddx_api.h ex t/wddx/wddx.c

From: Date: Thu, 28 Nov 2013 19:00:27 +0000
Subject: com php-src: fixed ext/wddx: ext/wddx/php_wddx_api.h ex t/wddx/wddx.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-74146@lists.php.net to get a copy of this message
Commit: ef54a95b7184899c63b4bd7be400c4621dd36360 Author: Anatol Belski <ab@php.net> Thu, 28 Nov 2013 20:00:27 +0100 Parents: 262fca3a39137a22c5fb237e453e68ef64dce126 Branches: str_size_and_int64 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ef54a95b7184899c63b4bd7be400c4621dd36360 Log: fixed ext/wddx Changed paths: M ext/wddx/php_wddx_api.h M ext/wddx/wddx.c

diff --git a/ext/wddx/php_wddx_api.h b/ext/wddx/php_wddx_api.h index 1a01945..9487c15 100644 --- a/ext/wddx/php_wddx_api.h +++ b/ext/wddx/php_wddx_api.h @@ -57,11 +57,11 @@ typedef smart_str wddx_packet; wddx_packet* php_wddx_constructor(void); void php_wddx_destructor(wddx_packet *packet); -void php_wddx_packet_start(wddx_packet *packet, char *comment, int comment_len); +void php_wddx_packet_start(wddx_packet *packet, char *comment, zend_str_size_int comment_len); void php_wddx_packet_end(wddx_packet *packet); -void php_wddx_serialize_var(wddx_packet *packet, zval *var, char *name, int name_len TSRMLS_DC); -int php_wddx_deserialize_ex(char *, int, zval *return_value); +void php_wddx_serialize_var(wddx_packet *packet, zval *var, char *name, zend_str_size_int name_len TSRMLS_DC); +int php_wddx_deserialize_ex(char *, zend_str_size_int, zval *return_value); #define php_wddx_gather(packet) estrndup(packet->c, packet->len) #endif /* PHP_WDDX_API_H */ diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c index afeca90..8ed2d35 100644 --- a/ext/wddx/wddx.c +++ b/ext/wddx/wddx.c @@ -295,9 +295,9 @@ PS_SERIALIZER_DECODE_FUNC(wddx) zval *retval; zval **ent; char *key; - uint key_length; + zend_str_size_uint key_length; char tmp[128]; - ulong idx; + php_uint_t idx; int hash_type; int ret; @@ -366,7 +366,7 @@ PHP_MINFO_FUNCTION(wddx) /* {{{ php_wddx_packet_start */ -void php_wddx_packet_start(wddx_packet *packet, char *comment, int comment_len) +void php_wddx_packet_start(wddx_packet *packet, char *comment, zend_str_size_int comment_len) { php_wddx_add_chunk_static(packet, WDDX_PACKET_S); if (comment) { @@ -403,11 +403,11 @@ static void php_wddx_serialize_string(wddx_packet *packet, zval *var TSRMLS_DC) { php_wddx_add_chunk_static(packet, WDDX_STRING_S); - if (Z_STRLEN_P(var) > 0) { + if (Z_STRSIZE_P(var) > 0) { char *buf; size_t buf_len; - buf = php_escape_html_entities(Z_STRVAL_P(var), Z_STRLEN_P(var), &buf_len, 0, ENT_QUOTES, NULL TSRMLS_CC); + buf = php_escape_html_entities(Z_STRVAL_P(var), Z_STRSIZE_P(var), &buf_len, 0, ENT_QUOTES, NULL TSRMLS_CC); php_wddx_add_chunk_ex(packet, buf, buf_len); @@ -458,7 +458,7 @@ static void php_wddx_serialize_object(wddx_packet *packet, zval *obj) zval **ent, *fname, **varname; zval *retval = NULL; const char *key; - ulong idx; + php_uint_t idx; char tmp_buf[WDDX_BUF_LEN]; HashTable *objhash, *sleephash; TSRMLS_FETCH(); @@ -496,15 +496,15 @@ static void php_wddx_serialize_object(wddx_packet *packet, zval *obj) continue; } - if (zend_hash_find(objhash, Z_STRVAL_PP(varname), Z_STRLEN_PP(varname)+1, (void **)&ent) == SUCCESS) { - php_wddx_serialize_var(packet, *ent, Z_STRVAL_PP(varname), Z_STRLEN_PP(varname) TSRMLS_CC); + if (zend_hash_find(objhash, Z_STRVAL_PP(varname), Z_STRSIZE_PP(varname)+1, (void **)&ent) == SUCCESS) { + php_wddx_serialize_var(packet, *ent, Z_STRVAL_PP(varname), Z_STRSIZE_PP(varname) TSRMLS_CC); } } php_wddx_add_chunk_static(packet, WDDX_STRUCT_E); } } else { - uint key_len; + zend_str_size_uint key_len; PHP_CLASS_ATTRIBUTES; @@ -556,12 +556,12 @@ static void php_wddx_serialize_array(wddx_packet *packet, zval *arr) { zval **ent; char *key; - uint key_len; + zend_str_size_uint key_len; int is_struct = 0, ent_type; - ulong idx; + php_uint_t idx; HashTable *target_hash; char tmp_buf[WDDX_BUF_LEN]; - ulong ind = 0; + php_uint_t ind = 0; int type; TSRMLS_FETCH(); @@ -624,7 +624,7 @@ static void php_wddx_serialize_array(wddx_packet *packet, zval *arr) /* {{{ php_wddx_serialize_var */ -void php_wddx_serialize_var(wddx_packet *packet, zval *var, char *name, int name_len TSRMLS_DC) +void php_wddx_serialize_var(wddx_packet *packet, zval *var, char *name, zend_str_size_int name_len TSRMLS_DC) { HashTable *ht; @@ -700,8 +700,8 @@ static void php_wddx_add_var(wddx_packet *packet, zval *name_var) zend_rebuild_symbol_table(TSRMLS_C); } if (zend_hash_find(EG(active_symbol_table), Z_STRVAL_P(name_var), - Z_STRLEN_P(name_var)+1, (void**)&val) != FAILURE) { - php_wddx_serialize_var(packet, *val, Z_STRVAL_P(name_var), Z_STRLEN_P(name_var) TSRMLS_CC); + Z_STRSIZE_P(name_var)+1, (void**)&val) != FAILURE) { + php_wddx_serialize_var(packet, *val, Z_STRVAL_P(name_var), Z_STRSIZE_P(name_var) TSRMLS_CC); } } else if (Z_TYPE_P(name_var) == IS_ARRAY || Z_TYPE_P(name_var) == IS_OBJECT) { int is_array = Z_TYPE_P(name_var) == IS_ARRAY; @@ -754,7 +754,7 @@ static void php_wddx_push_element(void *user_data, const XML_Char *name, const X INIT_PZVAL(ent.data); Z_TYPE_P(ent.data) = IS_STRING; Z_STRVAL_P(ent.data) = STR_EMPTY_ALLOC(); - Z_STRLEN_P(ent.data) = 0; + Z_STRSIZE_P(ent.data) = 0; wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); } else if (!strcmp(name, EL_BINARY)) { ent.type = ST_BINARY; @@ -764,7 +764,7 @@ static void php_wddx_push_element(void *user_data, const XML_Char *name, const X INIT_PZVAL(ent.data); Z_TYPE_P(ent.data) = IS_STRING; Z_STRVAL_P(ent.data) = STR_EMPTY_ALLOC(); - Z_STRLEN_P(ent.data) = 0; + Z_STRSIZE_P(ent.data) = 0; wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); } else if (!strcmp(name, EL_CHAR)) { int i; @@ -934,13 +934,13 @@ static void php_wddx_pop_element(void *user_data, const XML_Char *name) wddx_stack_top(stack, (void**)&ent1); if (!strcmp(name, EL_BINARY)) { - int new_len=0; + zend_str_size_int new_len=0; unsigned char *new_str; - new_str = php_base64_decode(Z_STRVAL_P(ent1->data), Z_STRLEN_P(ent1->data), &new_len); + new_str = php_base64_decode(Z_STRVAL_P(ent1->data), Z_STRSIZE_P(ent1->data), &new_len); STR_FREE(Z_STRVAL_P(ent1->data)); Z_STRVAL_P(ent1->data) = new_str; - Z_STRLEN_P(ent1->data) = new_len; + Z_STRSIZE_P(ent1->data) = new_len; } /* Call __wakeup() method on the object. */ @@ -975,12 +975,12 @@ static void php_wddx_pop_element(void *user_data, const XML_Char *name) if (ent1->varname) { if (!strcmp(ent1->varname, PHP_CLASS_NAME_VAR) && - Z_TYPE_P(ent1->data) == IS_STRING && Z_STRLEN_P(ent1->data)) { + Z_TYPE_P(ent1->data) == IS_STRING && Z_STRSIZE_P(ent1->data)) { zend_bool incomplete_class = 0; - zend_str_tolower(Z_STRVAL_P(ent1->data), Z_STRLEN_P(ent1->data)); + zend_str_tolower(Z_STRVAL_P(ent1->data), Z_STRSIZE_P(ent1->data)); if (zend_hash_find(EG(class_table), Z_STRVAL_P(ent1->data), - Z_STRLEN_P(ent1->data)+1, (void **) &pce)==FAILURE) { + Z_STRSIZE_P(ent1->data)+1, (void **) &pce)==FAILURE) { incomplete_class = 1; pce = &PHP_IC_ENTRY; } @@ -996,7 +996,7 @@ static void php_wddx_pop_element(void *user_data, const XML_Char *name) (void *) &tmp, sizeof(zval *), 0); if (incomplete_class) { - php_store_class_name(obj, Z_STRVAL_P(ent1->data), Z_STRLEN_P(ent1->data)); + php_store_class_name(obj, Z_STRVAL_P(ent1->data), Z_STRSIZE_P(ent1->data)); } /* Clean up old array entry */ @@ -1049,33 +1049,33 @@ static void php_wddx_process_data(void *user_data, const XML_Char *s, int len) wddx_stack_top(stack, (void**)&ent); switch (Z_TYPE_P(ent)) { case ST_STRING: - if (Z_STRLEN_P(ent->data) == 0) { + if (Z_STRSIZE_P(ent->data) == 0) { STR_FREE(Z_STRVAL_P(ent->data)); Z_STRVAL_P(ent->data) = estrndup(s, len); - Z_STRLEN_P(ent->data) = len; + Z_STRSIZE_P(ent->data) = len; } else { - Z_STRVAL_P(ent->data) = erealloc(Z_STRVAL_P(ent->data), Z_STRLEN_P(ent->data) + len + 1); - memcpy(Z_STRVAL_P(ent->data) + Z_STRLEN_P(ent->data), s, len); - Z_STRLEN_P(ent->data) += len; - Z_STRVAL_P(ent->data)[Z_STRLEN_P(ent->data)] = '\0'; + Z_STRVAL_P(ent->data) = erealloc(Z_STRVAL_P(ent->data), Z_STRSIZE_P(ent->data) + len + 1); + memcpy(Z_STRVAL_P(ent->data) + Z_STRSIZE_P(ent->data), s, len); + Z_STRSIZE_P(ent->data) += len; + Z_STRVAL_P(ent->data)[Z_STRSIZE_P(ent->data)] = '\0'; } break; case ST_BINARY: - if (Z_STRLEN_P(ent->data) == 0) { + if (Z_STRSIZE_P(ent->data) == 0) { STR_FREE(Z_STRVAL_P(ent->data)); Z_STRVAL_P(ent->data) = estrndup(s, len + 1); } else { - Z_STRVAL_P(ent->data) = erealloc(Z_STRVAL_P(ent->data), Z_STRLEN_P(ent->data) + len + 1); - memcpy(Z_STRVAL_P(ent->data) + Z_STRLEN_P(ent->data), s, len); + Z_STRVAL_P(ent->data) = erealloc(Z_STRVAL_P(ent->data), Z_STRSIZE_P(ent->data) + len + 1); + memcpy(Z_STRVAL_P(ent->data) + Z_STRSIZE_P(ent->data), s, len); } - Z_STRLEN_P(ent->data) += len; - Z_STRVAL_P(ent->data)[Z_STRLEN_P(ent->data)] = '\0'; + Z_STRSIZE_P(ent->data) += len; + Z_STRVAL_P(ent->data)[Z_STRSIZE_P(ent->data)] = '\0'; break; case ST_NUMBER: Z_TYPE_P(ent->data) = IS_STRING; - Z_STRLEN_P(ent->data) = len; + Z_STRSIZE_P(ent->data) = len; Z_STRVAL_P(ent->data) = estrndup(s, len); convert_scalar_to_number(ent->data TSRMLS_CC); break; @@ -1105,7 +1105,7 @@ static void php_wddx_process_data(void *user_data, const XML_Char *s, int len) /* date out of range < 1969 or > 2038 */ if (Z_LVAL_P(ent->data) == -1) { Z_TYPE_P(ent->data) = IS_STRING; - Z_STRLEN_P(ent->data) = len; + Z_STRSIZE_P(ent->data) = len; Z_STRVAL_P(ent->data) = estrndup(s, len); } efree(tmp); @@ -1121,7 +1121,7 @@ static void php_wddx_process_data(void *user_data, const XML_Char *s, int len) /* {{{ php_wddx_deserialize_ex */ -int php_wddx_deserialize_ex(char *value, int vallen, zval *return_value) +int php_wddx_deserialize_ex(char *value, zend_str_size_int vallen, zval *return_value) { wddx_stack stack; XML_Parser parser; @@ -1160,10 +1160,10 @@ PHP_FUNCTION(wddx_serialize_value) { zval *var; char *comment = NULL; - int comment_len = 0; + zend_str_size_int comment_len = 0; wddx_packet *packet; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|s", &var, &comment, &comment_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|S", &var, &comment, &comment_len) == FAILURE) { return; } @@ -1241,12 +1241,12 @@ void php_wddx_destructor(wddx_packet *packet) PHP_FUNCTION(wddx_packet_start) { char *comment = NULL; - int comment_len = 0; + zend_str_size_int comment_len = 0; wddx_packet *packet; comment = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &comment, &comment_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &comment, &comment_len) == FAILURE) { return; } @@ -1323,7 +1323,7 @@ PHP_FUNCTION(wddx_deserialize) { zval *packet; char *payload; - int payload_len; + zend_str_size_int payload_len; php_stream *stream = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &packet) == FAILURE) { @@ -1332,7 +1332,7 @@ PHP_FUNCTION(wddx_deserialize) if (Z_TYPE_P(packet) == IS_STRING) { payload = Z_STRVAL_P(packet); - payload_len = Z_STRLEN_P(packet); + payload_len = Z_STRSIZE_P(packet); } else if (Z_TYPE_P(packet) == IS_RESOURCE) { php_stream_from_zval(stream, &packet); if (stream) {
« previous php.cvs (#74146) next »