com php-src: Get basic language tests to all pass (minus xfails): Zend/zend_API.h Zend/zend_types.h ext/pcre/php_pc re.c ext/pcre/php_pcre.h
ext/reflection/php_reflect ion.c ext/standard/html.c ext/standard/streamsfuncs.c ext/standard/user_filters.c main/network.c main/ph p_network.h
main/streams/php_stream_transport.h m ain/streams/transports.c main/streams/userspace.c main/ streams/xp_socket.c

From: Date: Wed, 16 Oct 2013 09:30:25 +0000
Subject: com php-src: Get basic language tests to all pass (minus xfails): Zend/zend_API.h Zend/zend_types.h ext/pcre/php_pc re.c ext/pcre/php_pcre.h
ext/reflection/php_reflect ion.c ext/standard/html.c ext/standard/streamsfuncs.c ext/standard/user_filters.c main/network.c main/ph p_network.h
main/streams/php_stream_transport.h m ain/streams/transports.c main/streams/userspace.c main/ streams/xp_socket.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-73522@lists.php.net to get a copy of this message
Commit: 0cd95c1ee0092cd9528b08e25e5dcbdfe116dedd Author: Anthony Ferrara <ircmaxell@gmail.com> Tue, 2 Jul 2013 11:27:48 -0400 Committer: Anatol Belski <ab@php.net> Wed, 16 Oct 2013 02:30:25 -0700 Parents: 6484eaf77ee80d43297e202b113ab3976f25a708 Branches: str_size_and_int64 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0cd95c1ee0092cd9528b08e25e5dcbdfe116dedd Log: Get basic language tests to all pass (minus xfails) Changed paths: M Zend/zend_API.h M Zend/zend_types.h M ext/pcre/php_pcre.c M ext/pcre/php_pcre.h M ext/reflection/php_reflection.c M ext/standard/html.c M ext/standard/streamsfuncs.c M ext/standard/user_filters.c M main/network.c M main/php_network.h M main/streams/php_stream_transport.h M main/streams/transports.c M main/streams/userspace.c M main/streams/xp_socket.c

diff --git a/Zend/zend_API.h b/Zend/zend_API.h index 5d65b6d..2794fae 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -576,13 +576,13 @@ END_EXTERN_C() #define ZVAL_STRING(z, s, duplicate) do { \ const char *__s=(s); \ zval *__z = (z); \ - Z_STRSIZE_P(__z) = strlen(__s); \ + Z_STRSIZE_P(__z) = (zend_str_size) strlen(__s); \ Z_STRVAL_P(__z) = (duplicate?estrndup(__s, Z_STRSIZE_P(__z)):(char*)__s);\ Z_TYPE_P(__z) = IS_STRING; \ } while (0) #define ZVAL_STRINGL(z, s, l, duplicate) do { \ - const char *__s=(s); zend_str_size __l=l; \ + const char *__s=(s); zend_str_size __l= (zend_str_size) (l); \ zval *__z = (z); \ Z_STRSIZE_P(__z) = __l; \ Z_STRVAL_P(__z) = (duplicate?estrndup(__s, __l):(char*)__s);\ diff --git a/Zend/zend_types.h b/Zend/zend_types.h index d5fb76f..8ae0e68 100644 --- a/Zend/zend_types.h +++ b/Zend/zend_types.h @@ -33,11 +33,13 @@ typedef unsigned short zend_ushort; #define zend_str_size_int int #define zend_str_size_uint unsigned int #define zend_str_size_size_t size_t +#define zend_str_size_long long typedef int zend_str_size; #else #define zend_str_size_int zend_str_size #define zend_str_size_uint zend_str_size #define zend_str_size_size_t zend_str_size +#define zend_str_size_long zend_str_size typedef size_t zend_str_size; #endif diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 7bc5427..cf296fc 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -226,14 +226,14 @@ static char **make_subpats_table(int num_subpats, pcre_cache_entry *pce TSRMLS_D /* {{{ pcre_get_compiled_regex_cache */ -PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, zend_str_size_int regex_len TSRMLS_DC) +PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_len TSRMLS_DC) { pcre *re = NULL; pcre_extra *extra; int coptions = 0; int soptions = 0; const char *error; - zend_str_size erroffset; + int erroffset; char delimiter; char start_delimiter; char end_delimiter; @@ -399,7 +399,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, zend_str_siz re = pcre_compile(pattern, coptions, &error, - &erroffset, + (int *) &erroffset, tables); if (re == NULL) { @@ -508,7 +508,7 @@ PHPAPI pcre* pcre_get_compiled_regex_ex(char *regex, pcre_extra **extra, int *pr /* }}} */ /* {{{ add_offset_pair */ -static inline void add_offset_pair(zval *result, char *str, zend_str_size_int len, zend_str_size_int offset, char *name) +static inline void add_offset_pair(zval *result, char *str, zend_str_size_int len, long offset, char *name) { zval *match_pair; @@ -546,17 +546,17 @@ static void php_do_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global) /* {{{ * } /* Compile regex or get it from cache. */ - if ((pce = pcre_get_compiled_regex_cache(regex, regex_len TSRMLS_CC)) == NULL) { + if ((pce = pcre_get_compiled_regex_cache(regex, (int) regex_len TSRMLS_CC)) == NULL) { RETURN_FALSE; } - php_pcre_match_impl(pce, subject, subject_len, return_value, subpats, + php_pcre_match_impl(pce, subject, (int) subject_len, return_value, subpats, global, ZEND_NUM_ARGS() >= 4, flags, start_offset TSRMLS_CC); } /* }}} */ /* {{{ php_pcre_match_impl() */ -PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, zend_str_size_int subject_len, zval *return_value, +PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value, zval *subpats, int global, int use_flags, long flags, long start_offset TSRMLS_DC) { zval *result_set, /* Holds a set of subpatterns after @@ -855,12 +855,12 @@ static int preg_get_backref(char **str, int *backref) /* {{{ preg_do_repl_func */ -static int preg_do_repl_func(zval *function, char *subject, zend_str_size_int *offsets, char **subpat_names, int count, char **result TSRMLS_DC) +static int preg_do_repl_func(zval *function, char *subject, int *offsets, char **subpat_names, int count, char **result TSRMLS_DC) { zval *retval_ptr; /* Function return value */ zval **args[1]; /* Argument to pass to function */ zval *subpats; /* Captured subpatterns */ - zend_str_size result_len; /* Return value length */ + int result_len; /* Return value length */ int i; MAKE_STD_ZVAL(subpats); @@ -894,8 +894,8 @@ static int preg_do_repl_func(zval *function, char *subject, zend_str_size_int *o /* {{{ preg_do_eval */ -static int preg_do_eval(char *eval_str, zend_str_size_int eval_str_len, char *subject, - zend_str_size_int *offsets, int count, char **result TSRMLS_DC) +static int preg_do_eval(char *eval_str, int eval_str_len, char *subject, + int *offsets, int count, char **result TSRMLS_DC) { zval retval; /* Return value from evaluation */ char *eval_str_end, /* End of eval string */ @@ -904,10 +904,10 @@ static int preg_do_eval(char *eval_str, zend_str_size_int eval_str_len, char *su *walk, /* Used to walk the code string */ *segment, /* Start of segment to append while walking */ walk_last; /* Last walked character */ - zend_str_size match_len; /* Length of the match */ - zend_str_size esc_match_len; /* Length of the quote-escaped match */ - zend_str_size result_len; /* Length of the result of the evaluation */ - zend_str_size backref; /* Current backref */ + zend_str_size match_len; /* Length of the match */ + zend_str_size esc_match_len; /* Length of the quote-escaped match */ + zend_str_size result_len; /* Length of the result of the evaluation */ + int backref; /* Current backref */ char *compiled_string_description; smart_str code = {0}; @@ -982,10 +982,10 @@ static int preg_do_eval(char *eval_str, zend_str_size_int eval_str_len, char *su /* {{{ php_pcre_replace */ -PHPAPI char *php_pcre_replace(char *regex, zend_str_size_int regex_len, - char *subject, zend_str_size_int subject_len, +PHPAPI char *php_pcre_replace(char *regex, int regex_len, + char *subject, int subject_len, zval *replace_val, int is_callable_replace, - zend_str_size_int *result_len, int limit, int *replace_count TSRMLS_DC) + int *result_len, int limit, int *replace_count TSRMLS_DC) { pcre_cache_entry *pce; /* Compiled regular expression */ @@ -1000,27 +1000,27 @@ PHPAPI char *php_pcre_replace(char *regex, zend_str_size_int regex_len, /* }}} */ /* {{{ php_pcre_replace_impl() */ -PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, zend_str_size_int subject_len, zval *replace_val, - int is_callable_replace, zend_str_size_int *result_len, int limit, int *replace_count TSRMLS_DC) +PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int subject_len, zval *replace_val, + int is_callable_replace, int *result_len, int limit, int *replace_count TSRMLS_DC) { pcre_extra *extra = pce->extra;/* Holds results of studying */ pcre_extra extra_data; /* Used locally for exec options */ int exoptions = 0; /* Execution options */ int count = 0; /* Count of matched subpatterns */ - int *offsets; /* Array of subpattern offsets */ + int *offsets; /* Array of subpattern offsets */ char **subpat_names; /* Array for named subpatterns */ int num_subpats; /* Number of captured subpatterns */ int size_offsets; /* Size of the offsets array */ - zend_str_size new_len; /* Length of needed storage */ - zend_str_size alloc_len; /* Actual allocated length */ - zend_str_size eval_result_len=0; /* Length of the eval'ed or + int new_len; /* Length of needed storage */ + int alloc_len; /* Actual allocated length */ + int eval_result_len=0; /* Length of the eval'ed or function-returned string */ - zend_str_size match_len; /* Length of the current match */ - zend_str_size backref; /* Backreference number */ + int match_len; /* Length of the current match */ + int backref; /* Backreference number */ int eval; /* If the replacement string should be eval'ed */ - zend_str_size start_offset; /* Where the new search starts */ + int start_offset; /* Where the new search starts */ int g_notempty=0; /* If the match should not be empty */ - zend_str_size replace_len=0; /* Length of replacement string */ + int replace_len=0; /* Length of replacement string */ char *result, /* Result of replacement */ *replace=NULL, /* Replacement string */ *new_buf, /* Temporary buffer for re-allocation */ @@ -1243,7 +1243,7 @@ PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, zend_st /* {{{ php_replace_in_subject */ -static char *php_replace_in_subject(zval *regex, zval *replace, zval **subject, zend_str_size_int *result_len, int limit, int is_callable_replace, int *replace_count TSRMLS_DC) +static char *php_replace_in_subject(zval *regex, zval *replace, zval **subject, int *result_len, int limit, int is_callable_replace, int *replace_count TSRMLS_DC) { zval **regex_entry, **replace_entry = NULL, @@ -1251,7 +1251,7 @@ static char *php_replace_in_subject(zval *regex, zval *replace, zval **subject, empty_replace; char *subject_value, *result; - zend_str_size subject_len; + int subject_len; /* Make sure we're dealing with strings. */ convert_to_string_ex(subject); @@ -1339,7 +1339,7 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl **subject_entry, **zcount = NULL; char *result; - zend_str_size result_len; + int result_len; int limit_val = -1; long limit = -1; char *string_key; @@ -1397,11 +1397,11 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl switch(zend_hash_get_current_key(Z_ARRVAL_PP(subject), &string_key, &num_key, 0)) { case HASH_KEY_IS_STRING: - add_assoc_stringl(return_value, string_key, result, result_len, 0); + add_assoc_stringl(return_value, string_key, result, (zend_str_size) result_len, 0); break; case HASH_KEY_IS_LONG: - add_index_stringl(return_value, num_key, result, result_len, 0); + add_index_stringl(return_value, num_key, result, (zend_str_size) result_len, 0); break; } } else { @@ -1415,7 +1415,7 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl old_replace_count = replace_count; if ((result = php_replace_in_subject(*regex, *replace, subject, &result_len, limit_val, is_callable_replace, &replace_count TSRMLS_CC)) != NULL) { if (!is_filter || replace_count > old_replace_count) { - RETVAL_STRINGL(result, result_len, 0); + RETVAL_STRINGL(result, (zend_str_size) result_len, 0); } else { efree(result); } @@ -1472,17 +1472,17 @@ static PHP_FUNCTION(preg_split) } /* Compile regex or get it from cache. */ - if ((pce = pcre_get_compiled_regex_cache(regex, regex_len TSRMLS_CC)) == NULL) { + if ((pce = pcre_get_compiled_regex_cache(regex, (int) regex_len TSRMLS_CC)) == NULL) { RETURN_FALSE; } - php_pcre_split_impl(pce, subject, subject_len, return_value, limit_val, flags TSRMLS_CC); + php_pcre_split_impl(pce, subject, (int) subject_len, return_value, limit_val, flags TSRMLS_CC); } /* }}} */ /* {{{ php_pcre_split */ -PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, zend_str_size_int subject_len, zval *return_value, +PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value, long limit_val, long flags TSRMLS_DC) { pcre_extra *extra = NULL; /* Holds results of studying */ @@ -1753,7 +1753,7 @@ static PHP_FUNCTION(preg_grep) } /* Compile regex or get it from cache. */ - if ((pce = pcre_get_compiled_regex_cache(regex, regex_len TSRMLS_CC)) == NULL) { + if ((pce = pcre_get_compiled_regex_cache(regex, (int) regex_len TSRMLS_CC)) == NULL) { RETURN_FALSE; } diff --git a/ext/pcre/php_pcre.h b/ext/pcre/php_pcre.h index 4c3ec35..db14ce3 100644 --- a/ext/pcre/php_pcre.h +++ b/ext/pcre/php_pcre.h @@ -33,7 +33,7 @@ #include <locale.h> #endif -PHPAPI char *php_pcre_replace(char *regex, zend_str_size_int regex_len, char *subject, zend_str_size_int subject_len, zval *replace_val, int is_callable_replace, zend_str_size_int *result_len, int limit, int *replace_count TSRMLS_DC); +PHPAPI char *php_pcre_replace(char *regex, int regex_len, char *subject, int subject_len, zval *replace_val, int is_callable_replace, int *result_len, int limit, int *replace_count TSRMLS_DC); PHPAPI pcre* pcre_get_compiled_regex(char *regex, pcre_extra **extra, int *options TSRMLS_DC); PHPAPI pcre* pcre_get_compiled_regex_ex(char *regex, pcre_extra **extra, int *preg_options, int *coptions TSRMLS_DC); @@ -52,15 +52,15 @@ typedef struct { int refcount; } pcre_cache_entry; -PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, zend_str_size_int regex_len TSRMLS_DC); +PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_len TSRMLS_DC); -PHPAPI void php_pcre_match_impl( pcre_cache_entry *pce, char *subject, zend_str_size_int subject_len, zval *return_value, +PHPAPI void php_pcre_match_impl( pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value, zval *subpats, int global, int use_flags, long flags, long start_offset TSRMLS_DC); -PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, zend_str_size_int subject_len, zval *return_value, - int is_callable_replace, zend_str_size_int *result_len, int limit, int *replace_count TSRMLS_DC); +PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value, + int is_callable_replace, int *result_len, int limit, int *replace_count TSRMLS_DC); -PHPAPI void php_pcre_split_impl( pcre_cache_entry *pce, char *subject, zend_str_size_int subject_len, zval *return_value, +PHPAPI void php_pcre_split_impl( pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value, long limit_val, long flags TSRMLS_DC); PHPAPI void php_pcre_grep_impl( pcre_cache_entry *pce, zval *input, zval *return_value, diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 92c8ec3..a66b195 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -114,8 +114,8 @@ ZEND_DECLARE_MODULE_GLOBALS(reflection) /* {{{ Smart string functions */ typedef struct _string { char *string; - int len; - int alloced; + zend_str_size_int len; + zend_str_size_int alloced; } string; static void string_init(string *str) @@ -128,14 +128,14 @@ static void string_init(string *str) static string *string_printf(string *str, const char *format, ...) { - int len; + zend_str_size len; va_list arg; char *s_tmp; va_start(arg, format); len = zend_vspprintf(&s_tmp, 0, format, arg); if (len) { - register int nlen = (str->len + len + (1024 - 1)) & ~(1024 - 1); + register zend_str_size nlen = (str->len + len + (1024 - 1)) & ~(1024 - 1); if (str->alloced < nlen) { str->alloced = nlen; str->string = erealloc(str->string, str->alloced); @@ -148,9 +148,9 @@ static string *string_printf(string *str, const char *format, ...) return str; } -static string *string_write(string *str, char *buf, int len) +static string *string_write(string *str, char *buf, zend_str_size_int len) { - register int nlen = (str->len + len + (1024 - 1)) & ~(1024 - 1); + register zend_str_size nlen = (str->len + len + (1024 - 1)) & ~(1024 - 1); if (str->alloced < nlen) { str->alloced = nlen; str->string = erealloc(str->string, str->alloced); @@ -188,8 +188,8 @@ typedef struct _property_reference { /* Struct for parameters */ typedef struct _parameter_reference { - zend_uint offset; - zend_uint required; + zend_str_size_uint offset; + zend_str_size_uint required; struct _zend_arg_info *arg_info; zend_function *fptr; } parameter_reference; @@ -216,7 +216,7 @@ typedef struct { static zend_object_handlers reflection_object_handlers; -static void _default_get_entry(zval *object, char *name, int name_len, zval *return_value TSRMLS_DC) /* {{{ */ +static void _default_get_entry(zval *object, char *name, zend_str_size_int name_len, zval *return_value TSRMLS_DC) /* {{{ */ { zval **value; @@ -229,7 +229,7 @@ static void _default_get_entry(zval *object, char *name, int name_len, zval *ret /* }}} */ #ifdef ilia_0 -static void _default_lookup_entry(zval *object, char *name, int name_len, zval **return_value TSRMLS_DC) /* {{{ */ +static void _default_lookup_entry(zval *object, char *name, zend_str_size_int name_len, zval **return_value TSRMLS_DC) /* {{{ */ { zval **value; @@ -435,7 +435,7 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in HashPosition pos; zval **value; char *key; - uint key_len; + zend_str_size key_len; ulong num_index; zend_hash_internal_pointer_reset_ex(&ce->constants_table, &pos); @@ -566,7 +566,7 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in while (zend_hash_get_current_data_ex(properties, (void **) &prop, &pos) == SUCCESS) { char *prop_name; - uint prop_name_size; + zend_str_size prop_name_size; ulong index; if (zend_hash_get_current_key_ex(properties, &prop_name, &prop_name_size, &index, 1, &pos) == HASH_KEY_IS_STRING) { @@ -605,9 +605,9 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in && ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) == 0 || mptr->common.scope == ce)) { char *key; - uint key_len; + zend_str_size key_len; ulong num_index; - uint len = strlen(mptr->common.function_name); + zend_str_size len = strlen(mptr->common.function_name); /* Do not display old-style inherited constructors */ if ((mptr->common.fn_flags & ZEND_ACC_CTOR) == 0 @@ -793,7 +793,7 @@ static void _function_closure_string(string *str, zend_function *fptr, char* ind zend_uint i, count; ulong num_index; char *key; - uint key_len; + zend_str_size key_len; HashTable *static_variables; HashPosition pos; @@ -827,7 +827,7 @@ static void _function_string(string *str, zend_function *fptr, zend_class_entry string param_indent; zend_function *overwrites; char *lc_name; - unsigned int lc_name_len; + zend_str_size lc_name_len; /* TBD: Repair indenting of doc comment (or is this to be done in the parser?) * What's "wrong" is that any whitespace before the doc comment start is @@ -1116,7 +1116,7 @@ static void _extension_string(string *str, zend_module_entry *module, char *inde /* Is there a better way of doing this? */ while (func->fname) { - int fname_len = strlen(func->fname); + zend_str_size fname_len = strlen(func->fname); char *lc_name = zend_str_tolower_dup(func->fname, fname_len); if (zend_hash_find(EG(function_table), lc_name, fname_len + 1, (void**) &fptr) == FAILURE) { @@ -1212,7 +1212,7 @@ static void reflection_extension_factory(zval *object, const char *name_str TSRM { reflection_object *intern; zval *name; - int name_len = strlen(name_str); + zend_str_size name_len = strlen(name_str); char *lcname; struct _zend_module_entry *module; ALLOCA_FLAG(use_heap) @@ -1610,7 +1610,7 @@ ZEND_METHOD(reflection_function, __construct) reflection_object *intern; zend_function *fptr; char *name_str; - int name_len; + zend_str_size name_len; object = getThis(); intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC); @@ -1621,7 +1621,7 @@ ZEND_METHOD(reflection_function, __construct) if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "O", &closure, zend_ce_closure) == SUCCESS) { fptr = (zend_function*)zend_get_closure_method_def(closure TSRMLS_CC); Z_ADDREF_P(closure); - } else if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name_str, &name_len) == SUCCESS) { + } else if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name_str, &name_len) == SUCCESS) { char *nsname; lcname = zend_str_tolower_dup(name_str, name_len); @@ -2165,7 +2165,7 @@ ZEND_METHOD(reflection_parameter, __construct) /* First, find the function */ switch (Z_TYPE_P(reference)) { case IS_STRING: { - unsigned int lcname_len; + zend_str_size lcname_len; char *lcname; lcname_len = Z_STRSIZE_P(reference); @@ -2185,7 +2185,7 @@ ZEND_METHOD(reflection_parameter, __construct) zval **classref; zval **method; zend_class_entry **pce; - unsigned int lcname_len; + zend_str_size lcname_len; char *lcname; if ((zend_hash_index_find(Z_ARRVAL_P(reference), 0, (void **) &classref) == FAILURE) @@ -2691,11 +2691,11 @@ ZEND_METHOD(reflection_method, __construct) zend_class_entry *ce; zend_function *mptr; char *name_str, *tmp; - int name_len, tmp_len; + zend_str_size name_len, tmp_len; zval ztmp; - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "zs", &classname, &name_str, &name_len) == FAILURE) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name_str, &name_len) == FAILURE) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "zS", &classname, &name_str, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name_str, &name_len) == FAILURE) { return; } if ((tmp = strstr(name_str, "::")) == NULL) { @@ -3379,7 +3379,7 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value zend_property_info *prop_info; zval *prop, *prop_copy; char *key; - uint key_len; + zend_str_size key_len; ulong num_index; zend_hash_internal_pointer_reset_ex(&ce->properties_info, &pos); @@ -3450,10 +3450,10 @@ ZEND_METHOD(reflection_class, getStaticPropertyValue) reflection_object *intern; zend_class_entry *ce; char *name; - int name_len; + zend_str_size name_len; zval **prop, *def_value = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z", &name, &name_len, &def_value) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|z", &name, &name_len, &def_value) == FAILURE) { return; } @@ -3482,12 +3482,12 @@ ZEND_METHOD(reflection_class, setStaticPropertyValue) reflection_object *intern; zend_class_entry *ce; char *name; - int name_len; + zend_str_size name_len; zval **variable_ptr, *value; int refcount; zend_uchar is_ref; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz", &name, &name_len, &value) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz", &name, &name_len, &value) == FAILURE) { return; } @@ -3687,10 +3687,10 @@ ZEND_METHOD(reflection_class, hasMethod) reflection_object *intern; zend_class_entry *ce; char *name, *lc_name; - int name_len; + zend_str_size name_len; METHOD_NOTSTATIC(reflection_class_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name, &name_len) == FAILURE) { return; } @@ -3717,10 +3717,10 @@ ZEND_METHOD(reflection_class, getMethod) zend_function *mptr; zval obj_tmp; char *name, *lc_name; - int name_len; + zend_str_size name_len; METHOD_NOTSTATIC(reflection_class_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name, &name_len) == FAILURE) { return; } @@ -3758,7 +3758,7 @@ ZEND_METHOD(reflection_class, getMethod) static void _addmethod(zend_function *mptr, zend_class_entry *ce, zval *retval, long filter, zval *obj TSRMLS_DC) { zval *method; - uint len = strlen(mptr->common.function_name); + zend_str_size len = strlen(mptr->common.function_name); zend_function *closure; if (mptr->common.fn_flags & filter) { @@ -3832,11 +3832,11 @@ ZEND_METHOD(reflection_class, hasProperty) zend_property_info *property_info; zend_class_entry *ce; char *name; - int name_len; + zend_str_size name_len; zval *property; METHOD_NOTSTATIC(reflection_class_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name, &name_len) == FAILURE) { return; } @@ -3869,10 +3869,10 @@ ZEND_METHOD(reflection_class, getProperty) zend_class_entry *ce, **pce; zend_property_info *property_info; char *name, *tmp, *classname; - int name_len, classname_len; + zend_str_size name_len, classname_len; METHOD_NOTSTATIC(reflection_class_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name, &name_len) == FAILURE) { return; } @@ -4019,10 +4019,10 @@ ZEND_METHOD(reflection_class, hasConstant) reflection_object *intern; zend_class_entry *ce; char *name; - int name_len; + zend_str_size name_len; METHOD_NOTSTATIC(reflection_class_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name, &name_len) == FAILURE) { return; } @@ -4061,10 +4061,10 @@ ZEND_METHOD(reflection_class, getConstant) zend_class_entry *ce; zval **value; char *name; - int name_len; + zend_str_size name_len; METHOD_NOTSTATIC(reflection_class_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name, &name_len) == FAILURE) { return; } @@ -4799,7 +4799,8 @@ ZEND_METHOD(reflection_property, __construct) zval *propname, *classname; char *name_str; const char *class_name, *prop_name; - int name_len, dynam_prop = 0; + zend_str_size name_len; + int dynam_prop = 0; zval *object; reflection_object *intern; zend_class_entry **pce; @@ -4807,7 +4808,7 @@ ZEND_METHOD(reflection_property, __construct) zend_property_info *property_info = NULL; property_reference *reference; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs", &classname, &name_str, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zS", &classname, &name_str, &name_len) == FAILURE) { return; } @@ -5118,7 +5119,7 @@ ZEND_METHOD(reflection_property, getDeclaringClass) zend_class_entry *tmp_ce, *ce; zend_property_info *tmp_info; const char *prop_name, *class_name; - int prop_name_len; + zend_str_size prop_name_len; if (zend_parse_parameters_none() == FAILURE) { return; @@ -5205,10 +5206,10 @@ ZEND_METHOD(reflection_extension, __construct) reflection_object *intern; zend_module_entry *module; char *name_str; - int name_len; + zend_str_size name_len; ALLOCA_FLAG(use_heap) - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name_str, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name_str, &name_len) == FAILURE) { return; } @@ -5305,7 +5306,7 @@ ZEND_METHOD(reflection_extension, getFunctions) /* Is there a better way of doing this? */ while (func->fname) { - int fname_len = strlen(func->fname); + zend_str_size fname_len = strlen(func->fname); char *lc_name = zend_str_tolower_dup(func->fname, fname_len); if (zend_hash_find(EG(function_table), lc_name, fname_len + 1, (void**) &fptr) == FAILURE) { @@ -5472,7 +5473,7 @@ ZEND_METHOD(reflection_extension, getDependencies) while(dep->name) { char *relation; char *rel_type; - int len; + zend_str_size len; switch(dep->type) { case MODULE_DEP_REQUIRED: @@ -5566,9 +5567,9 @@ ZEND_METHOD(reflection_zend_extension, __construct) reflection_object *intern; zend_extension *extension; char *name_str; - int name_len; + zend_str_size name_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name_str, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name_str, &name_len) == FAILURE) { return; } diff --git a/ext/standard/html.c b/ext/standard/html.c index b4d9ba1..c00f90c 100644 --- a/ext/standard/html.c +++ b/ext/standard/html.c @@ -89,11 +89,11 @@ static inline unsigned int get_next_char( enum entity_charset charset, const unsigned char *str, - size_t str_len, - size_t *cursor, + zend_str_size_size_t str_len, + zend_str_size_size_t *cursor, int *status) { - size_t pos = *cursor; + zend_str_size pos = *cursor; unsigned int this_char = 0; *status = SUCCESS; @@ -350,8 +350,8 @@ static inline unsigned int get_next_char( * Public interface for get_next_char used with UTF-8 */ PHPAPI unsigned int php_next_utf8_char( const unsigned char *str, - size_t str_len, - size_t *cursor, + zend_str_size_size_t str_len, + zend_str_size_size_t *cursor, int *status) { return get_next_char(cs_utf_8, str, str_len, cursor, status); @@ -365,7 +365,7 @@ static enum entity_charset determine_charset(char *charset_hint TSRMLS_DC) { int i; enum entity_charset charset = cs_utf_8; - int len = 0; + zend_str_size len = 0; const zend_encoding *zenc; /* Default is now UTF-8 */ @@ -456,9 +456,9 @@ det_charset: /* }}} */ /* {{{ php_utf32_utf8 */ -static inline size_t php_utf32_utf8(unsigned char *buf, unsigned k) +static inline zend_str_size_size_t php_utf32_utf8(unsigned char *buf, unsigned k) { - size_t retval = 0; + zend_str_size retval = 0; /* assert(0x0 <= k <= 0x10FFFF); */ @@ -533,7 +533,7 @@ static inline size_t php_mb3_int_to_char(unsigned char *buf, unsigned k) * Returns the code point in the target charset (whose mapping table was given) or 0 if * the unicode code point is not in the table. */ -static inline unsigned char unimap_bsearch(const uni_to_enc *table, unsigned code_key_a, size_t num) +static inline unsigned char unimap_bsearch(const uni_to_enc *table, unsigned code_key_a, zend_str_size_size_t num) { const uni_to_enc *l = table, *h = &table[num-1], @@ -812,7 +812,7 @@ static inline int process_numeric_entity(const char **buf, unsigned *code_point) /* }}} */ /* {{{ process_named_entity */ -static inline int process_named_entity_html(const char **buf, const char **start, size_t *length) +static inline int process_named_entity_html(const char **buf, const char **start, zend_str_size_size_t *length) { *start = *buf; @@ -841,7 +841,7 @@ static inline int process_named_entity_html(const char **buf, const char **start /* }}} */ /* {{{ resolve_named_entity_html */ -static inline int resolve_named_entity_html(const char *start, size_t length, const entity_ht *ht, unsigned *uni_cp1, unsigned *uni_cp2) +static inline int resolve_named_entity_html(const char *start, zend_str_size_size_t length, const entity_ht *ht, unsigned *uni_cp1, unsigned *uni_cp2) { const entity_cp_map *s; ulong hash = zend_inline_hash_func(start, length); @@ -923,9 +923,9 @@ static inline size_t write_octet_sequence(unsigned char *buf, enum entity_charse #define TRAVERSE_FOR_ENTITIES_EXPAND_SIZE(oldlen) ((oldlen) + (oldlen) / 5 + 2) static void traverse_for_entities( const char *old, - size_t oldlen, + zend_str_size_size_t oldlen, char *ret, /* should have allocated TRAVERSE_FOR_ENTITIES_EXPAND_SIZE(olden) */ - size_t *retlen, + zend_str_size_size_t *retlen, int all, int flags, const entity_ht *inv_map, @@ -977,7 +977,7 @@ static void traverse_for_entities( goto invalid_code; } else { const char *start; - size_t ent_len; + zend_str_size ent_len; next = &p[1]; start = next; @@ -1083,13 +1083,13 @@ static entity_table_opt determine_entity_table(int all, int doctype) * only the basic ones, i.e., those in basic_entities_ex + the numeric entities * that correspond to quotes. */ -PHPAPI char *php_unescape_html_entities(unsigned char *old, size_t oldlen, size_t *newlen, int all, int flags, char *hint_charset TSRMLS_DC) +PHPAPI char *php_unescape_html_entities(unsigned char *old, zend_str_size_size_t oldlen, zend_str_size_size_t *newlen, int all, int flags, char *hint_charset TSRMLS_DC) { - size_t retlen; + zend_str_size retlen; char *ret; enum entity_charset charset; const entity_ht *inverse_map = NULL; - size_t new_size = TRAVERSE_FOR_ENTITIES_EXPAND_SIZE(oldlen); + zend_str_size new_size = TRAVERSE_FOR_ENTITIES_EXPAND_SIZE(oldlen); if (all) { charset = determine_charset(hint_charset TSRMLS_CC); @@ -1123,7 +1123,7 @@ empty_source: } /* }}} */ -PHPAPI char *php_escape_html_entities(unsigned char *old, size_t oldlen, size_t *newlen, int all, int flags, char *hint_charset TSRMLS_DC) +PHPAPI char *php_escape_html_entities(unsigned char *old, zend_str_size_size_t oldlen, zend_str_size_size_t *newlen, int all, int flags, char *hint_charset TSRMLS_DC) { return php_escape_html_entities_ex(old, oldlen, newlen, all, flags, hint_charset, 1 TSRMLS_CC); } @@ -1134,10 +1134,10 @@ static inline void find_entity_for_char( enum entity_charset charset, const entity_stage1_row *table, const unsigned char **entity, - size_t *entity_len, + zend_str_size_size_t *entity_len, unsigned char *old, - size_t oldlen, - size_t *cursor) + zend_str_size_size_t oldlen, + zend_str_size_size_t *cursor) { unsigned stage1_idx = ENT_STAGE1_INDEX(k); const entity_stage3_row *c; @@ -1155,7 +1155,7 @@ static inline void find_entity_for_char( *entity_len = c->data.ent.entity_len; } else { /* peek at next char */ - size_t cursor_before = *cursor; + zend_str_size cursor_before = *cursor; int status = SUCCESS; unsigned next_char; @@ -1196,7 +1196,7 @@ static inline void find_entity_for_char_basic( unsigned int k, const entity_stage3_row *table, const unsigned char **entity, - size_t *entity_len) + zend_str_size_size_t *entity_len) { if (k >= 64U) { *entity = NULL; @@ -1211,9 +1211,9 @@ static inline void find_entity_for_char_basic( /* {{{ php_escape_html_entities */ -PHPAPI char *php_escape_html_entities_ex(unsigned char *old, size_t oldlen, size_t *newlen, int all, int flags, char *hint_charset, zend_bool double_encode TSRMLS_DC) +PHPAPI char *php_escape_html_entities_ex(unsigned char *old, zend_str_size_size_t oldlen, zend_str_size_size_t *newlen, int all, int flags, char *hint_charset, zend_bool double_encode TSRMLS_DC) { - size_t cursor, maxlen, len; + zend_str_size cursor, maxlen, len; char *replaced; enum entity_charset charset = determine_charset(hint_charset TSRMLS_CC); int doctype = flags & ENT_HTML_DOC_TYPE_MASK; @@ -1269,7 +1269,7 @@ PHPAPI char *php_escape_html_entities_ex(unsigned char *old, size_t oldlen, size cursor = 0; while (cursor < oldlen) { const unsigned char *mbsequence = NULL; - size_t mbseqlen = 0, + zend_str_size mbseqlen = 0, cursor_before = cursor; int status = SUCCESS; unsigned int this_char = get_next_char(charset, old, oldlen, &cursor, &status); @@ -1374,7 +1374,7 @@ encode_amp: len += sizeof("&amp;") - 1; } else { /* no double encode */ /* check if entity is valid */ - size_t ent_len; /* not counting & or ; */ + zend_str_size ent_len; /* not counting & or ; */ /* peek at next char */ if (old[cursor] == '#') { /* numeric entity */ unsigned code_point; @@ -1433,13 +1433,13 @@ encode_amp: static void php_html_entities(INTERNAL_FUNCTION_PARAMETERS, int all) { char *str, *hint_charset = NULL; - int str_len, hint_charset_len = 0; + zend_str_size str_len, hint_charset_len = 0; size_t new_len; long flags = ENT_COMPAT; char *replaced; zend_bool double_encode = 1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls!b", &str, &str_len, &flags, &hint_charset, &hint_charset_len, &double_encode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|lS!b", &str, &str_len, &flags, &hint_charset, &hint_charset_len, &double_encode) == FAILURE) { return; } @@ -1483,18 +1483,18 @@ PHP_FUNCTION(htmlspecialchars) PHP_FUNCTION(htmlspecialchars_decode) { char *str; - int str_len; - size_t new_len = 0; + zend_str_size str_len; + zend_str_size new_len = 0; long quote_style = ENT_COMPAT; char *replaced; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, &quote_style) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|l", &str, &str_len, &quote_style) == FAILURE) { return; } replaced = php_unescape_html_entities(str, str_len, &new_len, 0 /*!all*/, quote_style, NULL TSRMLS_CC); if (replaced) { - RETURN_STRINGL(replaced, (int)new_len, 0); + RETURN_STRINGL(replaced, new_len, 0); } RETURN_FALSE; } @@ -1505,19 +1505,19 @@ PHP_FUNCTION(htmlspecialchars_decode) PHP_FUNCTION(html_entity_decode) { char *str, *hint_charset = NULL; - int str_len, hint_charset_len = 0; - size_t new_len = 0; + zend_str_size str_len, hint_charset_len = 0; + zend_str_size new_len = 0; long quote_style = ENT_COMPAT; char *replaced; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls", &str, &str_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|lS", &str, &str_len, &quote_style, &hint_charset, &hint_charset_len) == FAILURE) { return; } replaced = php_unescape_html_entities(str, str_len, &new_len, 1 /*all*/, quote_style, hint_charset TSRMLS_CC); if (replaced) { - RETURN_STRINGL(replaced, (int)new_len, 0); + RETURN_STRINGL(replaced, new_len, 0); } RETURN_FALSE; } @@ -1541,12 +1541,12 @@ static inline void write_s3row_data( { char key[9] = ""; /* two unicode code points in UTF-8 */ char entity[LONGEST_ENTITY_LENGTH + 2] = {'&'}; - size_t written_k1; + zend_str_size written_k1; written_k1 = write_octet_sequence(key, charset, orig_cp); if (!r->ambiguous) { - size_t l = r->data.ent.entity_len; + zend_str_size l = r->data.ent.entity_len; memcpy(&entity[1], r->data.ent.entity, l); entity[l + 1] = ';'; add_assoc_stringl_ex(arr, key, written_k1 + 1, entity, l + 2, 1); @@ -1563,7 +1563,7 @@ static inline void write_s3row_data( } num_entries = mcpr[0].leading_entry.size; for (i = 1; i <= num_entries; i++) { - size_t l, + zend_str_size l, written_k2; unsigned uni_cp, spe_cp; @@ -1598,14 +1598,14 @@ PHP_FUNCTION(get_html_translation_table) entity_table_opt entity_table; const enc_to_uni *to_uni_table = NULL; char *charset_hint = NULL; - int charset_hint_len; + zend_str_size charset_hint_len; enum entity_charset charset; /* in this function we have to jump through some loops because we're * getting the translated table from data structures that are optimized for * random access, not traversal */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lls", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|llS", &all, &flags, &charset_hint, &charset_hint_len) == FAILURE) { return; } diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index 0610ecf..7756804 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -86,7 +86,7 @@ PHP_FUNCTION(stream_socket_pair) PHP_FUNCTION(stream_socket_client) { char *host; - int host_len; + zend_str_size host_len; zval *zerrno = NULL, *zerrstr = NULL, *zcontext = NULL; double timeout = FG(default_socket_timeout); php_timeout_ull conv; @@ -100,7 +100,7 @@ PHP_FUNCTION(stream_socket_client) RETVAL_FALSE; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|zzdlr", &host, &host_len, &zerrno, &zerrstr, &timeout, &flags, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|zzdlr", &host, &host_len, &zerrno, &zerrstr, &timeout, &flags, &zcontext) == FAILURE) { RETURN_FALSE; } @@ -175,7 +175,7 @@ PHP_FUNCTION(stream_socket_client) PHP_FUNCTION(stream_socket_server) { char *host; - int host_len; + zend_str_size host_len; zval *zerrno = NULL, *zerrstr = NULL, *zcontext = NULL; php_stream *stream = NULL; int err = 0; @@ -185,7 +185,7 @@ PHP_FUNCTION(stream_socket_server) RETVAL_FALSE; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|zzlr", &host, &host_len, &zerrno, &zerrstr, &flags, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|zzlr", &host, &host_len, &zerrno, &zerrstr, &flags, &zcontext) == FAILURE) { RETURN_FALSE; } @@ -242,7 +242,7 @@ PHP_FUNCTION(stream_socket_accept) double timeout = FG(default_socket_timeout); zval *zpeername = NULL; char *peername = NULL; - int peername_len; + zend_str_size peername_len; php_timeout_ull conv; struct timeval tv; php_stream *stream = NULL, *clistream = NULL; @@ -300,7 +300,7 @@ PHP_FUNCTION(stream_socket_get_name) zval *zstream; zend_bool want_peer; char *name = NULL; - int name_len; + zend_str_size name_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rb", &zstream, &want_peer) == FAILURE) { RETURN_FALSE; @@ -328,11 +328,11 @@ PHP_FUNCTION(stream_socket_sendto) zval *zstream; long flags = 0; char *data, *target_addr = NULL; - int datalen, target_addr_len = 0; + zend_str_size datalen, target_addr_len = 0; php_sockaddr_storage sa; socklen_t sl = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|ls", &zstream, &data, &datalen, &flags, &target_addr, &target_addr_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rS|lS", &zstream, &data, &datalen, &flags, &target_addr, &target_addr_len) == FAILURE) { RETURN_FALSE; } php_stream_from_zval(stream, &zstream); @@ -356,7 +356,7 @@ PHP_FUNCTION(stream_socket_recvfrom) php_stream *stream; zval *zstream, *zremote = NULL; char *remote_addr = NULL; - int remote_addr_len; + zend_str_size remote_addr_len; long to_read = 0; char *read_buf; long flags = 0; @@ -407,7 +407,7 @@ PHP_FUNCTION(stream_get_contents) zval *zsrc; long maxlen = PHP_STREAM_COPY_ALL, desiredpos = -1L; - int len; + zend_str_size len; char *contents = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ll", &zsrc, &maxlen, &desiredpos) == FAILURE) { @@ -417,7 +417,7 @@ PHP_FUNCTION(stream_get_contents) php_stream_from_zval(stream, &zsrc); if (desiredpos >= 0) { - int seek_res = 0; + zend_str_size seek_res = 0; off_t position; position = php_stream_tell(stream); @@ -453,7 +453,7 @@ PHP_FUNCTION(stream_copy_to_stream) php_stream *src, *dest; zval *zsrc, *zdest; long maxlen = PHP_STREAM_COPY_ALL, pos = 0; - size_t len; + zend_str_size len; int ret; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|ll", &zsrc, &zdest, &maxlen, &pos) == FAILURE) { @@ -542,7 +542,7 @@ PHP_FUNCTION(stream_get_transports) { HashTable *stream_xport_hash; char *stream_xport; - uint stream_xport_len; + zend_str_size stream_xport_len; ulong num_key; if (zend_parse_parameters_none() == FAILURE) { @@ -572,7 +572,7 @@ PHP_FUNCTION(stream_get_wrappers) HashTable *url_stream_wrappers_hash; char *stream_protocol; int key_flags; - uint stream_protocol_len = 0; + zend_str_size stream_protocol_len = 0; ulong num_key; if (zend_parse_parameters_none() == FAILURE) { @@ -658,7 +658,7 @@ static int stream_array_from_fd_set(zval *stream_array, fd_set *fds TSRMLS_DC) int type; char *key; - uint key_len; + zend_str_size key_len; ulong num_ind; /* Temporary int fd is needed for the STREAM data type on windows, passing this_fd directly to php_stream_cast() would eventually bring a wrong result on x64. php_stream_cast() casts to int internally, and this will leave @@ -872,7 +872,7 @@ PHP_FUNCTION(stream_select) /* {{{ stream_context related functions */ static void user_space_stream_notifier(php_stream_context *context, int notifycode, int severity, - char *xmsg, int xcode, size_t bytes_sofar, size_t bytes_max, void * ptr TSRMLS_DC) + char *xmsg, int xcode, zend_str_size_size_t bytes_sofar, zend_str_size_size_t bytes_max, void * ptr TSRMLS_DC) { zval *callback = (zval*)context->notifier->ptr; zval *retval = NULL; @@ -923,7 +923,7 @@ static int parse_context_options(php_stream_context *context, zval *options TSRM HashPosition pos, opos; zval **wval, **oval; char *wkey, *okey; - uint wkey_len, okey_len; + zend_str_size wkey_len, okey_len; int ret = SUCCESS; ulong num_key; @@ -1035,10 +1035,10 @@ PHP_FUNCTION(stream_context_set_option) zval *options = NULL, *zcontext = NULL, *zvalue = NULL; php_stream_context *context; char *wrappername, *optionname; - int wrapperlen, optionlen; + zend_str_size wrapperlen, optionlen; if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, - "rssz", &zcontext, &wrappername, &wrapperlen, + "rSSz", &zcontext, &wrappername, &wrapperlen, &optionname, &optionlen, &zvalue) == FAILURE) { if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "ra", &zcontext, &options) == FAILURE) { @@ -1190,13 +1190,13 @@ static void apply_filter_to_stream(int append, INTERNAL_FUNCTION_PARAMETERS) zval *zstream; php_stream *stream; char *filtername; - int filternamelen; + zend_str_size filternamelen; long read_write = 0; zval *filterparams = NULL; php_stream_filter *filter = NULL; int ret; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|lz", &zstream, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rS|lz", &zstream, &filtername, &filternamelen, &read_write, &filterparams) == FAILURE) { RETURN_FALSE; } @@ -1312,14 +1312,14 @@ PHP_FUNCTION(stream_filter_remove) PHP_FUNCTION(stream_get_line) { char *str = NULL; - int str_len = 0; + zend_str_size str_len = 0; long max_length; zval *zstream; char *buf; size_t buf_size; php_stream *stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|s", &zstream, &max_length, &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|S", &zstream, &max_length, &str, &str_len) == FAILURE) { RETURN_FALSE; } @@ -1543,9 +1543,9 @@ Determine what file will be opened by calls to fopen() with a relative path */ PHP_FUNCTION(stream_resolve_include_path) { char *filename, *resolved_path; - int filename_len; + zend_str_size filename_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &filename, &filename_len) == FAILURE) { return; } diff --git a/ext/standard/user_filters.c b/ext/standard/user_filters.c index 5ca85ee..130cbea 100644 --- a/ext/standard/user_filters.c +++ b/ext/standard/user_filters.c @@ -167,7 +167,7 @@ php_stream_filter_status_t userfilter_filter( php_stream_filter *thisfilter, php_stream_bucket_brigade *buckets_in, php_stream_bucket_brigade *buckets_out, - size_t *bytes_consumed, + zend_str_size_size_t *bytes_consumed, int flags TSRMLS_DC) { @@ -283,7 +283,7 @@ static php_stream_filter *user_filter_factory_create(const char *filtername, zval *obj, *zfilter; zval func_name; zval *retval = NULL; - int len; + zend_str_size len; /* some sanity checks */ if (persistent) { @@ -462,7 +462,7 @@ static void php_stream_bucket_attach(int append, INTERNAL_FUNCTION_PARAMETERS) if (!bucket->own_buf) { bucket = php_stream_bucket_make_writeable(bucket TSRMLS_CC); } - if ((int)bucket->buflen != Z_STRSIZE_PP(pzdata)) { + if (bucket->buflen != Z_STRSIZE_PP(pzdata)) { bucket->buf = perealloc(bucket->buf, Z_STRSIZE_PP(pzdata), bucket->is_persistent); bucket->buflen = Z_STRSIZE_PP(pzdata); } @@ -507,10 +507,10 @@ PHP_FUNCTION(stream_bucket_new) php_stream *stream; char *buffer; char *pbuffer; - int buffer_len; + zend_str_size buffer_len; php_stream_bucket *bucket; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs", &zstream, &buffer, &buffer_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zS", &zstream, &buffer, &buffer_len) == FAILURE) { RETURN_FALSE; } @@ -545,7 +545,7 @@ PHP_FUNCTION(stream_get_filters) { char *filter_name; int key_flags; - uint filter_name_len = 0; + zend_str_size filter_name_len = 0; HashTable *filters_hash; ulong num_key; @@ -574,10 +574,10 @@ PHP_FUNCTION(stream_get_filters) PHP_FUNCTION(stream_filter_register) { char *filtername, *classname; - int filtername_len, classname_len; + zend_str_size filtername_len, classname_len; struct php_user_filter_data *fdat; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &filtername, &filtername_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &filtername, &filtername_len, &classname, &classname_len) == FAILURE) { RETURN_FALSE; } diff --git a/main/network.c b/main/network.c index 5c0404b..99e927e 100644 --- a/main/network.c +++ b/main/network.c @@ -499,7 +499,7 @@ bound: } /* }}} */ -PHPAPI int php_network_parse_network_address_with_port(const char *addr, long addrlen, struct sockaddr *sa, socklen_t *sl TSRMLS_DC) +PHPAPI int php_network_parse_network_address_with_port(const char *addr, zend_str_size_long addrlen, struct sockaddr *sa, socklen_t *sl TSRMLS_DC) { char *colon; char *tmp; @@ -590,7 +590,7 @@ PHPAPI void php_network_populate_name_from_sockaddr( /* input address */ struct sockaddr *sa, socklen_t sl, /* output readable address */ - char **textaddr, long *textaddrlen, + char **textaddr, zend_str_size_long *textaddrlen, /* output address */ struct sockaddr **addr, socklen_t *addrlen @@ -655,7 +655,7 @@ PHPAPI void php_network_populate_name_from_sockaddr( } PHPAPI int php_network_get_peer_name(php_socket_t sock, - char **textaddr, long *textaddrlen, + char **textaddr, zend_str_size_long *textaddrlen, struct sockaddr **addr, socklen_t *addrlen TSRMLS_DC) @@ -675,7 +675,7 @@ PHPAPI int php_network_get_peer_name(php_socket_t sock, } PHPAPI int php_network_get_sock_name(php_socket_t sock, - char **textaddr, long *textaddrlen, + char **textaddr, zend_str_size_long *textaddrlen, struct sockaddr **addr, socklen_t *addrlen TSRMLS_DC) @@ -706,7 +706,7 @@ PHPAPI int php_network_get_sock_name(php_socket_t sock, /* {{{ php_network_accept_incoming */ PHPAPI php_socket_t php_network_accept_incoming(php_socket_t srvsock, - char **textaddr, long *textaddrlen, + char **textaddr, zend_str_size_long *textaddrlen, struct sockaddr **addr, socklen_t *addrlen, struct timeval *timeout, @@ -833,7 +833,7 @@ php_socket_t php_network_connect_socket_to_host(const char *host, unsigned short if (bindto) { struct sockaddr *local_address = NULL; - int local_address_len = 0; + zend_str_size local_address_len = 0; if (sa->sa_family == AF_INET) { struct sockaddr_in *in4 = emalloc(sizeof(struct sockaddr_in)); diff --git a/main/php_network.h b/main/php_network.h index c1535ee..cef1ad6 100644 --- a/main/php_network.h +++ b/main/php_network.h @@ -62,7 +62,7 @@ * unless buf is not NULL. * Also works sensibly for win32 */ BEGIN_EXTERN_C() -PHPAPI char *php_socket_strerror(long err, char *buf, size_t bufsize); +PHPAPI char *php_socket_strerror(long err, char *buf, zend_str_size_size_t bufsize); END_EXTERN_C() #ifdef HAVE_NETINET_IN_H @@ -248,7 +248,7 @@ PHPAPI php_socket_t php_network_bind_socket_to_local_addr(const char *host, unsi TSRMLS_DC); PHPAPI php_socket_t php_network_accept_incoming(php_socket_t srvsock, - char **textaddr, long *textaddrlen, + char **textaddr, zend_str_size_long *textaddrlen, struct sockaddr **addr, socklen_t *addrlen, struct timeval *timeout, @@ -257,13 +257,13 @@ PHPAPI php_socket_t php_network_accept_incoming(php_socket_t srvsock, TSRMLS_DC); PHPAPI int php_network_get_sock_name(php_socket_t sock, - char **textaddr, long *textaddrlen, + char **textaddr, zend_str_size_long *textaddrlen, struct sockaddr **addr, socklen_t *addrlen TSRMLS_DC); PHPAPI int php_network_get_peer_name(php_socket_t sock, - char **textaddr, long *textaddrlen, + char **textaddr, zend_str_size_long *textaddrlen, struct sockaddr **addr, socklen_t *addrlen TSRMLS_DC); @@ -277,7 +277,7 @@ struct _php_netstream_data_t { char is_blocked; struct timeval timeout; char timeout_event; - size_t ownsize; + zend_str_size_size_t ownsize; }; typedef struct _php_netstream_data_t php_netstream_data_t; PHPAPI extern php_stream_ops php_stream_socket_ops; @@ -293,14 +293,14 @@ PHPAPI void php_network_populate_name_from_sockaddr( /* input address */ struct sockaddr *sa, socklen_t sl, /* output readable address */ - char **textaddr, long *textaddrlen, + char **textaddr, zend_str_size_long *textaddrlen, /* output address */ struct sockaddr **addr, socklen_t *addrlen TSRMLS_DC); PHPAPI int php_network_parse_network_address_with_port(const char *addr, - long addrlen, struct sockaddr *sa, socklen_t *sl TSRMLS_DC); + zend_str_size_long addrlen, struct sockaddr *sa, socklen_t *sl TSRMLS_DC); END_EXTERN_C() #define php_stream_sock_open_from_socket(socket, persistent) _php_stream_sock_open_from_socket((socket), (persistent) STREAMS_CC TSRMLS_CC) diff --git a/main/streams/php_stream_transport.h b/main/streams/php_stream_transport.h index 52df73d..93f6016 100644 --- a/main/streams/php_stream_transport.h +++ b/main/streams/php_stream_transport.h @@ -81,7 +81,7 @@ PHPAPI int php_stream_xport_listen(php_stream *stream, /* Get the next client and their address as a string, or the underlying address * structure. You must efree either of these if you request them */ PHPAPI int php_stream_xport_accept(php_stream *stream, php_stream **client, - char **textaddr, int *textaddrlen, + char **textaddr, zend_str_size_int *textaddrlen, void **addr, socklen_t *addrlen, struct timeval *timeout, char **error_text @@ -89,7 +89,7 @@ PHPAPI int php_stream_xport_accept(php_stream *stream, php_stream **client, /* Get the name of either the socket or it's peer */ PHPAPI int php_stream_xport_get_name(php_stream *stream, int want_peer, - char **textaddr, int *textaddrlen, + char **textaddr, zend_str_size_int *textaddrlen, void **addr, socklen_t *addrlen TSRMLS_DC); @@ -100,13 +100,13 @@ enum php_stream_xport_send_recv_flags { /* Similar to recv() system call; read data from the stream, optionally * peeking, optionally retrieving OOB data */ -PHPAPI int php_stream_xport_recvfrom(php_stream *stream, char *buf, size_t buflen, +PHPAPI int php_stream_xport_recvfrom(php_stream *stream, char *buf, zend_str_size_size_t buflen, long flags, void **addr, socklen_t *addrlen, - char **textaddr, int *textaddrlen TSRMLS_DC); + char **textaddr, zend_str_size_int *textaddrlen TSRMLS_DC); /* Similar to send() system call; send data to the stream, optionally * sending it as OOB data */ -PHPAPI int php_stream_xport_sendto(php_stream *stream, const char *buf, size_t buflen, +PHPAPI int php_stream_xport_sendto(php_stream *stream, const char *buf, zend_str_size_size_t buflen, long flags, void *addr, socklen_t addrlen TSRMLS_DC); typedef enum { @@ -147,7 +147,7 @@ typedef struct _php_stream_xport_param { struct sockaddr *addr; socklen_t addrlen; char *buf; - size_t buflen; + zend_str_size_size_t buflen; long flags; } inputs; struct { @@ -156,7 +156,7 @@ typedef struct _php_stream_xport_param { struct sockaddr *addr; socklen_t addrlen; char *textaddr; - long textaddrlen; + zend_str_size_long textaddrlen; char *error_text; int error_code; diff --git a/main/streams/transports.c b/main/streams/transports.c index 2d31074..05c28d3 100644 --- a/main/streams/transports.c +++ b/main/streams/transports.c @@ -282,7 +282,7 @@ PHPAPI int php_stream_xport_listen(php_stream *stream, int backlog, char **error /* Get the next client and their address (as a string) */ PHPAPI int php_stream_xport_accept(php_stream *stream, php_stream **client, - char **textaddr, int *textaddrlen, + char **textaddr, zend_str_size_int *textaddrlen, void **addr, socklen_t *addrlen, struct timeval *timeout, char **error_text @@ -321,7 +321,7 @@ PHPAPI int php_stream_xport_accept(php_stream *stream, php_stream **client, } PHPAPI int php_stream_xport_get_name(php_stream *stream, int want_peer, - char **textaddr, int *textaddrlen, + char **textaddr, zend_str_size_int *textaddrlen, void **addr, socklen_t *addrlen TSRMLS_DC) { @@ -394,13 +394,13 @@ PHPAPI int php_stream_xport_crypto_enable(php_stream *stream, int activate TSRML /* Similar to recv() system call; read data from the stream, optionally * peeking, optionally retrieving OOB data */ -PHPAPI int php_stream_xport_recvfrom(php_stream *stream, char *buf, size_t buflen, - long flags, void **addr, socklen_t *addrlen, char **textaddr, int *textaddrlen +PHPAPI int php_stream_xport_recvfrom(php_stream *stream, char *buf, zend_str_size_size_t buflen, + long flags, void **addr, socklen_t *addrlen, char **textaddr, zend_str_size_int *textaddrlen TSRMLS_DC) { php_stream_xport_param param; int ret = 0; - int recvd_len = 0; + zend_str_size recvd_len = 0; #if 0 int oob; @@ -464,7 +464,7 @@ PHPAPI int php_stream_xport_recvfrom(php_stream *stream, char *buf, size_t bufle /* Similar to send() system call; send data to the stream, optionally * sending it as OOB data */ -PHPAPI int php_stream_xport_sendto(php_stream *stream, const char *buf, size_t buflen, +PHPAPI int php_stream_xport_sendto(php_stream *stream, const char *buf, zend_str_size_size_t buflen, long flags, void *addr, socklen_t addrlen TSRMLS_DC) { php_stream_xport_param param; diff --git a/main/streams/userspace.c b/main/streams/userspace.c index e70bda9..5b77392 100644 --- a/main/streams/userspace.c +++ b/main/streams/userspace.c @@ -519,12 +519,12 @@ static php_stream *user_wrapper_opendir(php_stream_wrapper *wrapper, const char PHP_FUNCTION(stream_wrapper_register) { char *protocol, *classname; - int protocol_len, classname_len; + zend_str_size protocol_len, classname_len; struct php_user_stream_wrapper * uwrap; int rsrc_id; long flags = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", &protocol, &protocol_len, &classname, &classname_len, &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|l", &protocol, &protocol_len, &classname, &classname_len, &flags) == FAILURE) { RETURN_FALSE; } @@ -564,9 +564,9 @@ PHP_FUNCTION(stream_wrapper_register) PHP_FUNCTION(stream_wrapper_unregister) { char *protocol; - int protocol_len; + zend_str_size protocol_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &protocol, &protocol_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &protocol, &protocol_len) == FAILURE) { RETURN_FALSE; } @@ -585,11 +585,11 @@ PHP_FUNCTION(stream_wrapper_unregister) PHP_FUNCTION(stream_wrapper_restore) { char *protocol; - int protocol_len; + zend_str_size protocol_len; php_stream_wrapper **wrapperpp = NULL, *wrapper; HashTable *global_wrapper_hash; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &protocol, &protocol_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &protocol, &protocol_len) == FAILURE) { RETURN_FALSE; } @@ -619,7 +619,7 @@ PHP_FUNCTION(stream_wrapper_restore) } /* }}} */ -static size_t php_userstreamop_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC) +static zend_str_size_size_t php_userstreamop_write(php_stream *stream, const char *buf, zend_str_size_size_t count TSRMLS_DC) { zval func_name; zval *retval = NULL; @@ -627,7 +627,7 @@ static size_t php_userstreamop_write(php_stream *stream, const char *buf, size_t php_userstream_data_t *us = (php_userstream_data_t *)stream->abstract; zval **args[1]; zval *zbufptr; - size_t didwrite = 0; + zend_str_size didwrite = 0; assert(us != NULL); @@ -668,13 +668,13 @@ static size_t php_userstreamop_write(php_stream *stream, const char *buf, size_t return didwrite; } -static size_t php_userstreamop_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) +static zend_str_size_size_t php_userstreamop_read(php_stream *stream, char *buf, zend_str_size_size_t count TSRMLS_DC) { zval func_name; zval *retval = NULL; zval **args[1]; int call_result; - size_t didread = 0; + zend_str_size didread = 0; php_userstream_data_t *us = (php_userstream_data_t *)stream->abstract; zval *zcount; @@ -1508,12 +1508,12 @@ static int user_wrapper_stat_url(php_stream_wrapper *wrapper, const char *url, i } -static size_t php_userstreamop_readdir(php_stream *stream, char *buf, size_t count TSRMLS_DC) +static zend_str_size_size_t php_userstreamop_readdir(php_stream *stream, char *buf, zend_str_size_size_t count TSRMLS_DC) { zval func_name; zval *retval = NULL; int call_result; - size_t didread = 0; + zend_str_size didread = 0; php_userstream_data_t *us = (php_userstream_data_t *)stream->abstract; php_stream_dirent *ent = (php_stream_dirent*)buf; diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c index 2eb5fb7..28817a7 100644 --- a/main/streams/xp_socket.c +++ b/main/streams/xp_socket.c @@ -51,10 +51,10 @@ php_stream_ops php_stream_unixdg_socket_ops; static int php_tcp_sockop_set_option(php_stream *stream, int option, int value, void *ptrparam TSRMLS_DC); /* {{{ Generic socket stream operations */ -static size_t php_sockop_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC) +static zend_str_size_size_t php_sockop_write(php_stream *stream, const char *buf, zend_str_size_size_t count TSRMLS_DC) { php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; - int didwrite; + zend_str_size didwrite; struct timeval *ptimeout; if (sock->socket == -1) { @@ -141,10 +141,10 @@ static void php_sock_stream_wait_for_data(php_stream *stream, php_netstream_data } } -static size_t php_sockop_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) +static zend_str_size_size_t php_sockop_read(php_stream *stream, char *buf, zend_str_size_size_t count TSRMLS_DC) { php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; - int nr_bytes = 0; + zend_str_size nr_bytes = 0; if (sock->socket == -1) { return 0;
« previous php.cvs (#73522) next »