From 257ed4061ae88802538a6f22724c57fda052e36e Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Wed, 27 Aug 2014 17:31:24 +0200 Subject: 's' works with size_t round 2 --- ext/bcmath/bcmath.c | 2 +- ext/bz2/bz2.c | 3 ++- ext/com_dotnet/com_com.c | 2 +- ext/com_dotnet/com_variant.c | 2 +- ext/date/php_date.c | 34 +++++++++++++++---------------- ext/date/php_date.h | 2 +- ext/dom/characterdata.c | 6 ++++-- ext/dom/document.c | 44 +++++++++++++++++++++++++++-------------- ext/dom/element.c | 28 ++++++++++++++------------ ext/intl/converter/converter.c | 2 +- ext/mbstring/mbstring.c | 4 ++-- ext/mysql/php_mysql.c | 4 ++-- ext/mysqli/mysqli_api.c | 10 +++++----- ext/mysqli/mysqli_nonapi.c | 4 ++-- ext/pdo_pgsql/pgsql_driver.c | 2 +- ext/pgsql/pgsql.c | 30 +++++++++++++++++----------- ext/reflection/php_reflection.c | 11 ++++++----- ext/session/session.c | 6 +++--- ext/simplexml/simplexml.c | 2 +- ext/spl/spl_directory.c | 22 +++++++++++---------- ext/standard/basic_functions.c | 4 ++-- ext/standard/file.c | 4 ++-- ext/standard/http.c | 2 +- ext/standard/string.c | 14 ++++++------- ext/standard/url.c | 2 +- 25 files changed, 137 insertions(+), 109 deletions(-) diff --git a/ext/bcmath/bcmath.c b/ext/bcmath/bcmath.c index 51bb0597f2..53d85a541b 100644 --- a/ext/bcmath/bcmath.c +++ b/ext/bcmath/bcmath.c @@ -472,7 +472,7 @@ PHP_FUNCTION(bcpow) PHP_FUNCTION(bcsqrt) { char *left; - int left_len; + size_t left_len; zend_long scale_param = 0; bc_num result; int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS(); diff --git a/ext/bz2/bz2.c b/ext/bz2/bz2.c index 4bfebce706..e04a75c1b5 100644 --- a/ext/bz2/bz2.c +++ b/ext/bz2/bz2.c @@ -543,7 +543,8 @@ static PHP_FUNCTION(bzcompress) static PHP_FUNCTION(bzdecompress) { char *source, *dest; - int source_len, error; + size_t source_len; + int error; zend_long small = 0; #if defined(PHP_WIN32) unsigned __int64 size = 0; diff --git a/ext/com_dotnet/com_com.c b/ext/com_dotnet/com_com.c index 7590ad43c5..132c74bf3a 100644 --- a/ext/com_dotnet/com_com.c +++ b/ext/com_dotnet/com_com.c @@ -813,7 +813,7 @@ PHP_FUNCTION(com_message_pump) PHP_FUNCTION(com_load_typelib) { char *name; - int namelen; + size_t namelen; ITypeLib *pTL = NULL; zend_bool cs = TRUE; int codepage = COMG(code_page); diff --git a/ext/com_dotnet/com_variant.c b/ext/com_dotnet/com_variant.c index 9931e7182f..36b6e82116 100644 --- a/ext/com_dotnet/com_variant.c +++ b/ext/com_dotnet/com_variant.c @@ -222,7 +222,7 @@ PHP_COM_DOTNET_API int php_com_zval_from_variant(zval *z, VARIANT *v, int codepa case VT_BSTR: olestring = V_BSTR(v); if (olestring) { - int len; + size_t len; char *str = php_com_olestring_to_string(olestring, &len, codepage TSRMLS_CC); ZVAL_STRINGL(z, str, len); diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 16310784a1..982c06bfc6 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -1372,7 +1372,7 @@ PHP_FUNCTION(gmdate) PHP_FUNCTION(idate) { char *format; - int format_len; + size_t format_len; zend_long ts = 0; int ret; @@ -1626,7 +1626,7 @@ PHP_FUNCTION(checkdate) PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt) { char *format; - int format_len; + size_t format_len; zend_long timestamp = 0; struct tm ta; int max_reallocs = 5; @@ -2596,7 +2596,7 @@ PHP_FUNCTION(date_create) { zval *timezone_object = NULL; char *time_str = NULL; - int time_str_len = 0; + size_t time_str_len = 0; zval datetime_object; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sO!", &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) { @@ -2619,7 +2619,7 @@ PHP_FUNCTION(date_create_immutable) { zval *timezone_object = NULL; char *time_str = NULL; - int time_str_len = 0; + size_t time_str_len = 0; zval datetime_object; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sO!", &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) { @@ -2665,7 +2665,7 @@ PHP_FUNCTION(date_create_immutable_from_format) { zval *timezone_object = NULL; char *time_str = NULL, *format_str = NULL; - int time_str_len = 0, format_str_len = 0; + size_t time_str_len = 0, format_str_len = 0; zval datetime_object; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|O", &format_str, &format_str_len, &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) { @@ -2688,7 +2688,7 @@ PHP_METHOD(DateTime, __construct) { zval *timezone_object = NULL; char *time_str = NULL; - int time_str_len = 0; + size_t time_str_len = 0; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC); @@ -2708,7 +2708,7 @@ PHP_METHOD(DateTimeImmutable, __construct) { zval *timezone_object = NULL; char *time_str = NULL; - int time_str_len = 0; + size_t time_str_len = 0; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC); @@ -2980,7 +2980,7 @@ void php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAMETERS, timelib_time * PHP_FUNCTION(date_parse) { char *date; - size_t date_len; + size_t date_len; struct timelib_error_container *error; timelib_time *parsed_time; @@ -2999,7 +2999,7 @@ PHP_FUNCTION(date_parse) PHP_FUNCTION(date_parse_from_format) { char *date, *format; - int date_len, format_len; + size_t date_len, format_len; struct timelib_error_container *error; timelib_time *parsed_time; @@ -3020,7 +3020,7 @@ PHP_FUNCTION(date_format) zval *object; php_date_obj *dateobj; char *format; - int format_len; + size_t format_len; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &object, date_ce_interface, &format, &format_len) == FAILURE) { RETURN_FALSE; @@ -3100,7 +3100,7 @@ PHP_FUNCTION(date_modify) { zval *object; char *modify; - int modify_len; + size_t modify_len; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &object, date_ce_date, &modify, &modify_len) == FAILURE) { RETURN_FALSE; @@ -3120,7 +3120,7 @@ PHP_METHOD(DateTimeImmutable, modify) { zval *object, new_object; char *modify; - int modify_len; + size_t modify_len; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &object, date_ce_immutable, &modify, &modify_len) == FAILURE) { RETURN_FALSE; @@ -3652,7 +3652,7 @@ static int timezone_initialize(php_timezone_obj *tzobj, /*const*/ char *tz TSRML PHP_FUNCTION(timezone_open) { char *tz; - int tz_len; + size_t tz_len; php_timezone_obj *tzobj; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &tz, &tz_len) == FAILURE) { @@ -3671,7 +3671,7 @@ PHP_FUNCTION(timezone_open) PHP_METHOD(DateTimeZone, __construct) { char *tz; - int tz_len; + size_t tz_len; php_timezone_obj *tzobj; zend_error_handling error_handling; @@ -4092,7 +4092,7 @@ void date_interval_write_property(zval *object, zval *member, zval *value, void PHP_METHOD(DateInterval, __construct) { char *interval_string = NULL; - int interval_string_length; + size_t interval_string_length; php_interval_obj *diobj; timelib_rel_time *reltime; zend_error_handling error_handling; @@ -4200,7 +4200,7 @@ PHP_METHOD(DateInterval, __wakeup) PHP_FUNCTION(date_interval_create_from_date_string) { char *time_str = NULL; - int time_str_len = 0; + size_t time_str_len = 0; timelib_time *time; timelib_error_container *err = NULL; php_interval_obj *diobj; @@ -4290,7 +4290,7 @@ PHP_FUNCTION(date_interval_format) zval *object; php_interval_obj *diobj; char *format; - int format_len; + size_t format_len; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &object, date_ce_interval, &format, &format_len) == FAILURE) { RETURN_FALSE; diff --git a/ext/date/php_date.h b/ext/date/php_date.h index 0290bb8823..ad82666cd7 100644 --- a/ext/date/php_date.h +++ b/ext/date/php_date.h @@ -222,7 +222,7 @@ PHPAPI zend_class_entry *php_date_get_timezone_ce(void); /* Functions for creating DateTime objects, and initializing them from a string */ PHPAPI zval *php_date_instantiate(zend_class_entry *pce, zval *object TSRMLS_DC); -PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str, size_t time_str_len, char *format, zval *timezone_object, size_t ctor TSRMLS_DC); +PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str, size_t time_str_len, char *format, zval *timezone_object, int ctor TSRMLS_DC); #endif /* PHP_DATE_H */ diff --git a/ext/dom/characterdata.c b/ext/dom/characterdata.c index ab407f2caa..45306dde68 100644 --- a/ext/dom/characterdata.c +++ b/ext/dom/characterdata.c @@ -240,7 +240,8 @@ PHP_FUNCTION(dom_characterdata_insert_data) xmlNodePtr node; char *arg; zend_long offset; - int length, arg_len; + int length; + size_t arg_len; dom_object *intern; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ols", &id, dom_characterdata_class_entry, &offset, &arg, &arg_len) == FAILURE) { @@ -343,7 +344,8 @@ PHP_FUNCTION(dom_characterdata_replace_data) xmlNodePtr node; char *arg; zend_long offset, count; - int length, arg_len; + int length; + size_t arg_len; dom_object *intern; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Olls", &id, dom_characterdata_class_entry, &offset, &count, &arg, &arg_len) == FAILURE) { diff --git a/ext/dom/document.c b/ext/dom/document.c index f305d58e30..9fa1dce9cb 100644 --- a/ext/dom/document.c +++ b/ext/dom/document.c @@ -786,7 +786,8 @@ PHP_FUNCTION(dom_document_create_comment) zval *id; xmlNode *node; xmlDocPtr docp; - int ret, value_len; + int ret; + size_t value_len; dom_object *intern; char *value; @@ -814,7 +815,8 @@ PHP_FUNCTION(dom_document_create_cdatasection) zval *id; xmlNode *node; xmlDocPtr docp; - int ret, value_len; + int ret; + size_t value_len; dom_object *intern; char *value; @@ -842,7 +844,8 @@ PHP_FUNCTION(dom_document_create_processing_instruction) zval *id; xmlNode *node; xmlDocPtr docp; - int ret, value_len, name_len = 0; + int ret; + size_t value_len, name_len = 0; dom_object *intern; char *name, *value = NULL; @@ -877,7 +880,8 @@ PHP_FUNCTION(dom_document_create_attribute) zval *id; xmlAttrPtr node; xmlDocPtr docp; - int ret, name_len; + int ret; + size_t name_len; dom_object *intern; char *name; @@ -912,7 +916,8 @@ PHP_FUNCTION(dom_document_create_entity_reference) xmlNode *node; xmlDocPtr docp = NULL; dom_object *intern; - int ret, name_len; + int ret; + size_t name_len; char *name; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &name, &name_len) == FAILURE) { @@ -1026,7 +1031,8 @@ PHP_FUNCTION(dom_document_create_element_ns) xmlDocPtr docp; xmlNodePtr nodep = NULL; xmlNsPtr nsptr = NULL; - int ret, uri_len = 0, name_len = 0, value_len = 0; + int ret; + size_t uri_len = 0, name_len = 0, value_len = 0; char *uri, *name, *value = NULL; char *localname = NULL, *prefix = NULL; int errorcode; @@ -1089,7 +1095,8 @@ PHP_FUNCTION(dom_document_create_attribute_ns) xmlDocPtr docp; xmlNodePtr nodep = NULL, root; xmlNsPtr nsptr; - int ret, uri_len = 0, name_len = 0; + int ret; + size_t uri_len = 0, name_len = 0; char *uri, *name; char *localname = NULL, *prefix = NULL; dom_object *intern; @@ -1180,7 +1187,8 @@ PHP_FUNCTION(dom_document_get_element_by_id) zval *id; xmlDocPtr docp; xmlAttrPtr attrp; - int ret, idname_len; + int ret; + size_t idname_len; dom_object *intern; char *idname; @@ -1249,7 +1257,8 @@ PHP_METHOD(domdocument, __construct) xmlDoc *docp = NULL, *olddoc; dom_object *intern; char *encoding, *version = NULL; - size_t encoding_len = 0, version_len = 0, refcount; + size_t encoding_len = 0, version_len = 0; + int refcount; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, dom_domexception_class_entry, &error_handling TSRMLS_CC); @@ -1466,7 +1475,8 @@ static void dom_parse_document(INTERNAL_FUNCTION_PARAMETERS, int mode) { dom_doc_propsptr doc_prop; dom_object *intern; char *source; - int source_len, refcount, ret; + size_t source_len; + int refcount, ret; zend_long options = 0; id = getThis(); @@ -1545,7 +1555,8 @@ PHP_FUNCTION(dom_document_save) { zval *id; xmlDoc *docp; - size_t file_len = 0, bytes, format, saveempty = 0; + size_t file_len = 0; + int bytes, format, saveempty = 0; dom_object *intern; dom_doc_propsptr doc_props; char *file; @@ -1773,7 +1784,8 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type xmlDoc *docp; dom_object *intern; char *source = NULL, *valid_file = NULL; - int source_len = 0, valid_opts = 0; + size_t source_len = 0; + int valid_opts = 0; zend_long flags = 0; xmlSchemaParserCtxtPtr parser; xmlSchemaPtr sptr; @@ -1870,7 +1882,7 @@ static void _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAMETERS, int typ xmlDoc *docp; dom_object *intern; char *source = NULL, *valid_file = NULL; - int source_len = 0; + size_t source_len = 0; xmlRelaxNGParserCtxtPtr parser; xmlRelaxNGPtr sptr; xmlRelaxNGValidCtxtPtr vptr; @@ -1964,7 +1976,8 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */ dom_object *intern; dom_doc_propsptr doc_prop; char *source; - int source_len, refcount, ret; + size_t source_len; + int refcount, ret; zend_long options = 0; htmlParserCtxtPtr ctxt; @@ -2062,7 +2075,8 @@ PHP_FUNCTION(dom_document_save_html_file) { zval *id; xmlDoc *docp; - int file_len, bytes, format; + size_t file_len; + int bytes, format; dom_object *intern; dom_doc_propsptr doc_props; char *file; diff --git a/ext/dom/element.c b/ext/dom/element.c index 47ba6a31e0..b2b8b10fad 100644 --- a/ext/dom/element.c +++ b/ext/dom/element.c @@ -159,8 +159,8 @@ PHP_METHOD(domelement, __construct) dom_object *intern; char *name, *value = NULL, *uri = NULL; char *localname = NULL, *prefix = NULL; - int errorcode = 0, uri_len = 0; - size_t name_len, value_len = 0; + int errorcode = 0; + size_t name_len, value_len = 0, uri_len = 0; int name_valid; xmlNsPtr nsptr = NULL; zend_error_handling error_handling; @@ -331,7 +331,7 @@ PHP_FUNCTION(dom_element_get_attribute) xmlChar *value = NULL; dom_object *intern; xmlNodePtr attr; - int name_len; + size_t name_len; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_element_class_entry, &name, &name_len) == FAILURE) { return; @@ -438,7 +438,7 @@ PHP_FUNCTION(dom_element_remove_attribute) zval *id; xmlNodePtr nodep, attrp; dom_object *intern; - int name_len; + size_t name_len; char *name; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_element_class_entry, &name, &name_len) == FAILURE) { @@ -485,7 +485,8 @@ PHP_FUNCTION(dom_element_get_attribute_node) { zval *id; xmlNodePtr nodep, attrp; - int name_len, ret; + size_t name_len; + int ret; dom_object *intern; char *name; @@ -634,7 +635,7 @@ PHP_FUNCTION(dom_element_get_elements_by_tag_name) { zval *id; xmlNodePtr elemp; - int name_len; + size_t name_len; dom_object *intern, *namednode; char *name; xmlChar *local; @@ -871,7 +872,7 @@ PHP_FUNCTION(dom_element_remove_attribute_ns) xmlAttr *attrp; xmlNsPtr nsptr; dom_object *intern; - int name_len, uri_len; + size_t name_len, uri_len; char *name, *uri; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) { @@ -927,7 +928,8 @@ PHP_FUNCTION(dom_element_get_attribute_node_ns) xmlNodePtr elemp; xmlAttrPtr attrp; dom_object *intern; - int uri_len, name_len, ret; + size_t uri_len, name_len; + int ret; char *uri, *name; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) { @@ -1028,7 +1030,7 @@ PHP_FUNCTION(dom_element_get_elements_by_tag_name_ns) { zval *id; xmlNodePtr elemp; - int uri_len, name_len; + size_t uri_len, name_len; dom_object *intern, *namednode; char *uri, *name; xmlChar *local, *nsuri; @@ -1058,7 +1060,7 @@ PHP_FUNCTION(dom_element_has_attribute) xmlNode *nodep; dom_object *intern; char *name; - int name_len; + size_t name_len; xmlNodePtr attr; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_element_class_entry, &name, &name_len) == FAILURE) { @@ -1086,7 +1088,7 @@ PHP_FUNCTION(dom_element_has_attribute_ns) xmlNodePtr elemp; xmlNs *nsp; dom_object *intern; - int uri_len, name_len; + size_t uri_len, name_len; char *uri, *name; xmlChar *value; @@ -1144,7 +1146,7 @@ PHP_FUNCTION(dom_element_set_id_attribute) xmlAttrPtr attrp; dom_object *intern; char *name; - int name_len; + size_t name_len; zend_bool is_id; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Osb", &id, dom_element_class_entry, &name, &name_len, &is_id) == FAILURE) { @@ -1179,7 +1181,7 @@ PHP_FUNCTION(dom_element_set_id_attribute_ns) xmlNodePtr elemp; xmlAttrPtr attrp; dom_object *intern; - int uri_len, name_len; + size_t uri_len, name_len; char *uri, *name; zend_bool is_id; diff --git a/ext/intl/converter/converter.c b/ext/intl/converter/converter.c index f00dd003ec..f2adc31d0c 100644 --- a/ext/intl/converter/converter.c +++ b/ext/intl/converter/converter.c @@ -775,7 +775,7 @@ static PHP_METHOD(UConverter, convert) { intl_errors_reset(&objval->error TSRMLS_CC); if (php_converter_do_convert(reverse ? objval->src : objval->dest, - &dest, &dest_len, + &dest, (int32_t *)&dest_len, reverse ? objval->dest : objval->src, str, str_len, objval TSRMLS_CC)) { diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index ee99d31b54..12b64004a5 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -1733,7 +1733,7 @@ PHP_MINFO_FUNCTION(mbstring) PHP_FUNCTION(mb_language) { char *name = NULL; - int name_len = 0; + size_t name_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &name, &name_len) == FAILURE) { return; @@ -1758,7 +1758,7 @@ PHP_FUNCTION(mb_language) PHP_FUNCTION(mb_internal_encoding) { const char *name = NULL; - int name_len; + size_t name_len; const mbfl_encoding *encoding; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &name, &name_len) == FAILURE) { diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c index 985f1888be..4b316b4526 100644 --- a/ext/mysql/php_mysql.c +++ b/ext/mysql/php_mysql.c @@ -1555,7 +1555,7 @@ static void php_mysql_do_query_general(php_mysql_conn *mysql, char *query, int q static void php_mysql_do_query(INTERNAL_FUNCTION_PARAMETERS, int use_store) { char *query; - int query_len; + size_t query_len; zval *mysql_link = NULL; php_mysql_conn *mysql; @@ -1596,7 +1596,7 @@ PHP_FUNCTION(mysql_unbuffered_query) PHP_FUNCTION(mysql_db_query) { char *db, *query; - int db_len, query_len; + size_t db_len, query_len; php_mysql_conn *mysql; zval *mysql_link = NULL; diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c index b8de1dfe85..10793060ae 100644 --- a/ext/mysqli/mysqli_api.c +++ b/ext/mysqli/mysqli_api.c @@ -325,7 +325,7 @@ PHP_FUNCTION(mysqli_stmt_bind_param) MY_STMT *stmt; zval *mysql_stmt; char *types; - int types_len; + size_t types_len; zend_ulong rc; /* calculate and check number of parameters */ @@ -1924,7 +1924,7 @@ PHP_FUNCTION(mysqli_real_query) MY_MYSQL *mysql; zval *mysql_link; char *query = NULL; - int query_len; + size_t query_len; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &mysql_link, mysqli_link_class_entry, &query, &query_len) == FAILURE) { return; @@ -1954,7 +1954,7 @@ PHP_FUNCTION(mysqli_real_escape_string) { MY_MYSQL *mysql; zval *mysql_link = NULL; char *escapestr; - int escapestr_len; + size_t escapestr_len; zend_string *newstr; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &mysql_link, mysqli_link_class_entry, &escapestr, &escapestr_len) == FAILURE) { @@ -2238,7 +2238,7 @@ PHP_FUNCTION(mysqli_ssl_set) MY_MYSQL *mysql; zval *mysql_link; char *ssl_parm[5]; - int ssl_parm_len[5], i; + size_t ssl_parm_len[5], i; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Osssss", &mysql_link, mysqli_link_class_entry, &ssl_parm[0], &ssl_parm_len[0], &ssl_parm[1], &ssl_parm_len[1], &ssl_parm[2], &ssl_parm_len[2], &ssl_parm[3], &ssl_parm_len[3], &ssl_parm[4], &ssl_parm_len[4]) == FAILURE) { return; @@ -2460,7 +2460,7 @@ PHP_FUNCTION(mysqli_stmt_prepare) MY_STMT *stmt; zval *mysql_stmt; char *query; - int query_len; + size_t query_len; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &mysql_stmt, mysqli_stmt_class_entry, &query, &query_len) == FAILURE) { return; diff --git a/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c index 0342c0282d..9c9a109ba2 100644 --- a/ext/mysqli/mysqli_nonapi.c +++ b/ext/mysqli/mysqli_nonapi.c @@ -548,7 +548,7 @@ PHP_FUNCTION(mysqli_query) MYSQLI_RESOURCE *mysqli_resource; MYSQL_RES *result = NULL; char *query = NULL; - int query_len; + size_t query_len; zend_long resultmode = MYSQLI_STORE_RESULT; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|l", &mysql_link, mysqli_link_class_entry, &query, &query_len, &resultmode) == FAILURE) { @@ -944,7 +944,7 @@ PHP_FUNCTION(mysqli_set_charset) MY_MYSQL *mysql; zval *mysql_link; char *cs_name; - int csname_len; + size_t csname_len; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &mysql_link, mysqli_link_class_entry, &cs_name, &csname_len) == FAILURE) { return; diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c index d7f7eced23..dfc6f4025a 100644 --- a/ext/pdo_pgsql/pgsql_driver.c +++ b/ext/pdo_pgsql/pgsql_driver.c @@ -730,7 +730,7 @@ static PHP_METHOD(PDO, pgsqlCopyToFile) pdo_pgsql_db_handle *H; char *table_name, *pg_delim = NULL, *pg_null_as = NULL, *pg_fields = NULL, *filename = NULL; - int table_name_len, pg_delim_len = 0, pg_null_as_len = 0, pg_fields_len, filename_len; + size_t table_name_len, pg_delim_len = 0, pg_null_as_len = 0, pg_fields_len, filename_len; char *query; PGresult *pgsql_result; diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 6ecf92351f..a646933e76 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -1748,7 +1748,7 @@ PHP_FUNCTION(pg_parameter_status) int id; PGconn *pgsql; char *param; - int len; + size_t len; if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "rs", &pgsql_link, ¶m, &len) == SUCCESS) { id = -1; @@ -1818,7 +1818,8 @@ PHP_FUNCTION(pg_query) { zval *pgsql_link = NULL; char *query; - int id = -1, query_len, argc = ZEND_NUM_ARGS(); + int id = -1, argc = ZEND_NUM_ARGS(); + size_t query_len; int leftover = 0; PGconn *pgsql; PGresult *pgsql_result; @@ -2035,7 +2036,8 @@ PHP_FUNCTION(pg_prepare) { zval *pgsql_link = NULL; char *query, *stmtname; - int query_len, stmtname_len, id = -1, argc = ZEND_NUM_ARGS(); + size_t query_len, stmtname_len; + int id = -1, argc = ZEND_NUM_ARGS(); int leftover = 0; PGconn *pgsql; PGresult *pgsql_result; @@ -2119,7 +2121,8 @@ PHP_FUNCTION(pg_execute) zval *pgsql_link = NULL; zval *pv_param_arr, *tmp; char *stmtname; - size_t stmtname_len, id = -1, argc = ZEND_NUM_ARGS(); + size_t stmtname_len; + int id = -1, argc = ZEND_NUM_ARGS(); int leftover = 0; int num_params = 0; char **params = NULL; @@ -2570,7 +2573,7 @@ PHP_FUNCTION(pg_field_num) { zval *result; char *field; - int field_len; + size_t field_len; PGresult *pgsql_result; pgsql_result_handle *pg_result; @@ -3853,7 +3856,7 @@ PHP_FUNCTION(pg_set_error_verbosity) PHP_FUNCTION(pg_set_client_encoding) { char *encoding; - int encoding_len; + size_t encoding_len; zval *pgsql_link = NULL; int id = -1, argc = ZEND_NUM_ARGS(); PGconn *pgsql; @@ -3954,7 +3957,8 @@ PHP_FUNCTION(pg_put_line) { char *query; zval *pgsql_link = NULL; - int query_len, id = -1; + size_t query_len; + int id = -1; PGconn *pgsql; int result = 0, argc = ZEND_NUM_ARGS(); @@ -4292,7 +4296,8 @@ PHP_FUNCTION(pg_escape_bytea) { char *from = NULL, *to = NULL; size_t to_len; - int from_len, id = -1; + size_t from_len; + int id = -1; #ifdef HAVE_PQESCAPE_BYTEA_CONN PGconn *pgsql; #endif @@ -4439,7 +4444,7 @@ PHP_FUNCTION(pg_unescape_bytea) { char *from = NULL, *to = NULL, *tmp = NULL; size_t to_len; - int from_len; + size_t from_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &from, &from_len) == FAILURE) { return; @@ -4467,7 +4472,7 @@ static void php_pgsql_escape_internal(INTERNAL_FUNCTION_PARAMETERS, int escape_l char *from = NULL; zval *pgsql_link = NULL; PGconn *pgsql; - int from_len; + size_t from_len; int id = -1; char *tmp; @@ -4763,7 +4768,7 @@ PHP_FUNCTION(pg_send_query) { zval *pgsql_link; char *query; - int len; + size_t len; int id = -1; PGconn *pgsql; int is_non_blocking; @@ -4835,7 +4840,8 @@ PHP_FUNCTION(pg_send_query_params) int num_params = 0; char **params = NULL; char *query; - int query_len, id = -1; + size_t query_len; + int id = -1; PGconn *pgsql; int is_non_blocking; int ret; diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 962f59dc68..8c4c487da3 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -3635,7 +3635,7 @@ ZEND_METHOD(reflection_class, hasMethod) reflection_object *intern; zend_class_entry *ce; char *name, *lc_name; - int name_len; + size_t name_len; METHOD_NOTSTATIC(reflection_class_ptr); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { @@ -3665,7 +3665,7 @@ ZEND_METHOD(reflection_class, getMethod) zend_function *mptr; zval obj_tmp; char *name, *lc_name; - int name_len; + size_t name_len; METHOD_NOTSTATIC(reflection_class_ptr); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { @@ -4734,7 +4734,8 @@ ZEND_METHOD(reflection_property, __construct) zval propname, cname, *classname; char *name_str; const char *class_name, *prop_name; - int name_len, dynam_prop = 0; + size_t name_len; + int dynam_prop = 0; zval *object; reflection_object *intern; zend_class_entry *ce; @@ -5129,7 +5130,7 @@ ZEND_METHOD(reflection_extension, __construct) reflection_object *intern; zend_module_entry *module; char *name_str; - int name_len; + size_t name_len; ALLOCA_FLAG(use_heap) if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name_str, &name_len) == FAILURE) { @@ -5489,7 +5490,7 @@ ZEND_METHOD(reflection_zend_extension, __construct) reflection_object *intern; zend_extension *extension; char *name_str; - int name_len; + size_t name_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name_str, &name_len) == FAILURE) { return; diff --git a/ext/session/session.c b/ext/session/session.c index 78a43525e7..9b31bddf3a 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -1707,7 +1707,7 @@ static PHP_FUNCTION(session_get_cookie_params) static PHP_FUNCTION(session_name) { char *name = NULL; - int name_len; + size_t name_len; zend_string *ini_name; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &name, &name_len) == FAILURE) { @@ -1729,7 +1729,7 @@ static PHP_FUNCTION(session_name) static PHP_FUNCTION(session_module_name) { char *name = NULL; - int name_len; + size_t name_len; zend_string *ini_name; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &name, &name_len) == FAILURE) { @@ -1893,7 +1893,7 @@ static PHP_FUNCTION(session_set_save_handler) static PHP_FUNCTION(session_save_path) { char *name = NULL; - int name_len; + size_t name_len; zend_string *ini_name; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &name, &name_len) == FAILURE) { diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index e6754a0dd9..db4944ff5a 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -2114,7 +2114,7 @@ PHP_FUNCTION(simplexml_load_file) { php_sxe_object *sxe; char *filename; - int filename_len; + size_t filename_len; xmlDocPtr docp; char *ns = NULL; size_t ns_len = 0; diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 0feceef25f..e2b743c79c 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -579,7 +579,7 @@ static HashTable *spl_filesystem_object_get_debug_info(zval *object, int *is_tem HashTable *rv; zend_string *pnstr; char *path; - int path_len; + size_t path_len; char stmp[2]; *is_temp = 1; @@ -675,7 +675,7 @@ void spl_filesystem_object_construct(INTERNAL_FUNCTION_PARAMETERS, zend_long cto { spl_filesystem_object *intern; char *path; - int parsed, len; + size_t parsed, len; zend_long flags; zend_error_handling error_handling; @@ -858,7 +858,7 @@ SPL_METHOD(SplFileInfo, getPath) { spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis()); char *path; - int path_len; + size_t path_len; if (zend_parse_parameters_none() == FAILURE) { return; @@ -874,7 +874,7 @@ SPL_METHOD(SplFileInfo, getPath) SPL_METHOD(SplFileInfo, getFilename) { spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis()); - int path_len; + size_t path_len; if (zend_parse_parameters_none() == FAILURE) { return; @@ -912,7 +912,8 @@ SPL_METHOD(SplFileInfo, getExtension) char *fname = NULL; const char *p; size_t flen; - int path_len, idx; + size_t path_len; + int idx; zend_string *ret; if (zend_parse_parameters_none() == FAILURE) { @@ -1004,7 +1005,7 @@ SPL_METHOD(DirectoryIterator, getBasename) { spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis()); char *suffix = 0; - int slen = 0; + size_t slen = 0; zend_string *fname; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &suffix, &slen) == FAILURE) { @@ -1023,7 +1024,7 @@ SPL_METHOD(SplFileInfo, getPathname) { spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis()); char *path; - int path_len; + size_t path_len; if (zend_parse_parameters_none() == FAILURE) { return; @@ -1106,7 +1107,7 @@ SPL_METHOD(SplFileInfo, __construct) { spl_filesystem_object *intern; char *path; - int len; + size_t len; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, &error_handling TSRMLS_CC); @@ -2262,7 +2263,7 @@ SPL_METHOD(SplFileObject, __construct) zend_bool use_include_path = 0; char *p1, *p2; char *tmp_path; - int tmp_path_len; + size_t tmp_path_len; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, &error_handling TSRMLS_CC); @@ -2624,7 +2625,8 @@ SPL_METHOD(SplFileObject, fputcsv) spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis()); char delimiter = intern->u.file.delimiter, enclosure = intern->u.file.enclosure, escape = intern->u.file.escape; char *delim = NULL, *enclo = NULL; - int d_len = 0, e_len = 0, ret; + size_t d_len = 0, e_len = 0; + int ret; zval *fields = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|ss", &fields, &delim, &d_len, &enclo, &e_len) == SUCCESS) { diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 645cff9c2a..6bf64838c9 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -5838,7 +5838,7 @@ static void php_ini_parser_cb_with_sections(zval *arg1, zval *arg2, zval *arg3, PHP_FUNCTION(parse_ini_file) { char *filename = NULL; - int filename_len = 0; + size_t filename_len = 0; zend_bool process_sections = 0; zend_long scanner_mode = ZEND_INI_SCANNER_NORMAL; zend_file_handle fh; @@ -5879,7 +5879,7 @@ PHP_FUNCTION(parse_ini_file) PHP_FUNCTION(parse_ini_string) { char *string = NULL, *str = NULL; - int str_len = 0; + size_t str_len = 0; zend_bool process_sections = 0; zend_long scanner_mode = ZEND_INI_SCANNER_NORMAL; zend_ini_parser_cb_t ini_parser_cb; diff --git a/ext/standard/file.c b/ext/standard/file.c index 3aa6a12b9c..8747d14cb8 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -1339,7 +1339,7 @@ PHPAPI int php_mkdir(const char *dir, zend_long mode TSRMLS_DC) PHP_FUNCTION(mkdir) { char *dir; - int dir_len; + size_t dir_len; zval *zcontext = NULL; zend_long mode = 0777; zend_bool recursive = 0; @@ -1360,7 +1360,7 @@ PHP_FUNCTION(mkdir) PHP_FUNCTION(rmdir) { char *dir; - int dir_len; + size_t dir_len; zval *zcontext = NULL; php_stream_context *context; diff --git a/ext/standard/http.c b/ext/standard/http.c index a5ed7c179f..5547380e08 100644 --- a/ext/standard/http.c +++ b/ext/standard/http.c @@ -239,7 +239,7 @@ PHP_FUNCTION(http_build_query) { zval *formdata; char *prefix = NULL, *arg_sep=NULL; - int arg_sep_len = 0, prefix_len = 0; + size_t arg_sep_len = 0, prefix_len = 0; smart_str formstr = {0}; zend_long enc_type = PHP_QUERY_RFC1738; diff --git a/ext/standard/string.c b/ext/standard/string.c index d7c5490b71..55eb1f1481 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -1525,7 +1525,8 @@ PHP_FUNCTION(pathinfo) { zval tmp; char *path, *dirname; - int path_len, have_basename; + size_t path_len; + int have_basename; zend_long opt = PHP_PATHINFO_ALL; zend_string *ret = NULL; @@ -2183,7 +2184,7 @@ PHP_FUNCTION(chunk_split) { zend_string *str; char *end = "\r\n"; - int endlen = 2; + size_t endlen = 2; zend_long chunklen = 76; zend_string *result; @@ -5044,8 +5045,7 @@ PHP_FUNCTION(str_pad) /* Helper variables */ size_t num_pad_chars; /* Number of padding characters (total - input size) */ - zend_string *pad_str_save; /* Pointer to padding string */ - char *pad_str = " "; + char *pad_str = " "; /* Pointer to padding string */ size_t pad_str_len = 1; zend_long pad_type_val = STR_PAD_RIGHT; /* The padding type value */ size_t i, left_pad=0, right_pad=0; @@ -5057,7 +5057,7 @@ PHP_FUNCTION(str_pad) /* If resulting string turns out to be shorter than input string, we simply copy the input and return. */ - if (pad_length <= input->len) { + if (pad_length == 0 || pad_length <= input->len) { RETURN_STRINGL(input->val, input->len); } @@ -5072,7 +5072,7 @@ PHP_FUNCTION(str_pad) } num_pad_chars = pad_length - input->len; - if (num_pad_chars >= INT_MAX) { + if (num_pad_chars >= ZEND_LONG_MAX) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Padding length is too long"); return; } @@ -5122,7 +5122,7 @@ PHP_FUNCTION(sscanf) { zval *args = NULL; char *str, *format; - int str_len, format_len, result, num_args = 0; + size_t str_len, format_len, result, num_args = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss*", &str, &str_len, &format, &format_len, &args, &num_args) == FAILURE) { diff --git a/ext/standard/url.c b/ext/standard/url.c index dd8f99f832..60ce808f4e 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -375,7 +375,7 @@ end: PHP_FUNCTION(parse_url) { char *str; - int str_len; + size_t str_len; php_url *resource; zend_long key = -1; -- cgit v1.2.1