summaryrefslogtreecommitdiff
path: root/ext/standard
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2014-10-22 17:27:33 +0200
committerAnatol Belski <ab@php.net>2014-10-22 17:56:30 +0200
commita5e4f1f598f3a53e5793d290619806b41f1f1380 (patch)
treec14e503df19ab21a36dfd09f2602a8bc86e27f16 /ext/standard
parentcccd538512c3d345a73eeb5f1cc29643a1bb2715 (diff)
downloadphp-git-a5e4f1f598f3a53e5793d290619806b41f1f1380.tar.gz
fix several datatype mismatches
Diffstat (limited to 'ext/standard')
-rw-r--r--ext/standard/basic_functions.c38
-rw-r--r--ext/standard/basic_functions.h2
2 files changed, 20 insertions, 20 deletions
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 5bcd3d3386..2743909f5a 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -3952,7 +3952,7 @@ PHP_FUNCTION(long2ip)
/* "It's a long but it's not, PHP ints are signed */
char *ip;
size_t ip_len;
- zend_ulong n;
+ uint32_t n;
struct in_addr myaddr;
#ifdef HAVE_INET_PTON
char str[40];
@@ -4076,7 +4076,7 @@ PHP_FUNCTION(putenv)
#endif
}
- pe.key_len = strlen(pe.key);
+ pe.key_len = (int)strlen(pe.key);
#ifdef PHP_WIN32
if (equals) {
if (pe.key_len < setting_len - 1) {
@@ -4289,7 +4289,7 @@ PHP_FUNCTION(getopt)
opts->need_param = 0;
opts->opt_name = estrdup(arg_str->val);
- len = strlen(opts->opt_name);
+ len = (int)strlen(opts->opt_name);
if ((len > 0) && (opts->opt_name[len - 1] == ':')) {
opts->need_param++;
opts->opt_name[len - 1] = '\0';
@@ -4345,7 +4345,7 @@ PHP_FUNCTION(getopt)
}
/* Add this option / argument pair to the result hash. */
- optname_len = strlen(optname);
+ optname_len = (int)strlen(optname);
if (!(optname_len > 1 && optname[0] == '0') && is_numeric_string(optname, optname_len, NULL, NULL, 0) == IS_LONG) {
/* numeric string */
int optname_int = atoi(optname);
@@ -4400,9 +4400,9 @@ PHP_FUNCTION(sleep)
RETURN_FALSE;
}
#ifdef PHP_SLEEP_NON_VOID
- RETURN_LONG(php_sleep(num));
+ RETURN_LONG(php_sleep((unsigned int)num));
#else
- php_sleep(num);
+ php_sleep((unsigned int)num);
#endif
}
@@ -4422,7 +4422,7 @@ PHP_FUNCTION(usleep)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number of microseconds must be greater than or equal to 0");
RETURN_FALSE;
}
- usleep(num);
+ usleep((unsigned int)num);
#endif
}
/* }}} */
@@ -4449,7 +4449,7 @@ PHP_FUNCTION(time_nanosleep)
}
php_req.tv_sec = (time_t) tv_sec;
- php_req.tv_nsec = tv_nsec;
+ php_req.tv_nsec = (long)tv_nsec;
if (!nanosleep(&php_req, &php_rem)) {
RETURN_TRUE;
} else if (errno == EINTR) {
@@ -4529,7 +4529,7 @@ static int add_config_entry_cb(zval *entry TSRMLS_DC, int num_args, va_list args
if (Z_TYPE_P(entry) == IS_STRING) {
if (hash_key->key) {
- add_assoc_str_ex(retval, hash_key->key->val, hash_key->key->len, zend_string_copy(Z_STR_P(entry)));
+ add_assoc_str_ex(retval, hash_key->key->val, (uint)hash_key->key->len, zend_string_copy(Z_STR_P(entry)));
} else {
add_index_str(retval, hash_key->h, zend_string_copy(Z_STR_P(entry)));
}
@@ -4554,7 +4554,7 @@ PHP_FUNCTION(get_cfg_var)
return;
}
- retval = cfg_get_entry(varname, varname_len);
+ retval = cfg_get_entry(varname, (uint)varname_len);
if (retval) {
if (Z_TYPE_P(retval) == IS_ARRAY) {
@@ -4637,7 +4637,7 @@ PHP_FUNCTION(error_log)
}
if (argc > 1) {
- opt_err = erropt;
+ opt_err = (int)erropt;
}
if (_php_error_log_ex(opt_err, message, message_len, opt, headers TSRMLS_CC) == FAILURE) {
@@ -4655,7 +4655,7 @@ PHPAPI int _php_error_log(int opt_err, char *message, char *opt, char *headers T
}
/* }}} */
-PHPAPI int _php_error_log_ex(int opt_err, char *message, int message_len, char *opt, char *headers TSRMLS_DC) /* {{{ */
+PHPAPI int _php_error_log_ex(int opt_err, char *message, size_t message_len, char *opt, char *headers TSRMLS_DC) /* {{{ */
{
php_stream *stream = NULL;
@@ -5212,7 +5212,7 @@ PHP_FUNCTION(ini_get)
return;
}
- str = zend_ini_string(varname, varname_len, 0);
+ str = zend_ini_string(varname, (uint)varname_len, 0);
if (!str) {
RETURN_FALSE;
@@ -5322,7 +5322,7 @@ PHP_FUNCTION(ini_set)
return;
}
- old_value = zend_ini_string(varname->val, varname->len, 0);
+ old_value = zend_ini_string(varname->val, (int)varname->len, 0);
/* copy to return here, because alter might free it! */
if (old_value) {
@@ -5331,7 +5331,7 @@ PHP_FUNCTION(ini_set)
RETVAL_FALSE;
}
-#define _CHECK_PATH(var, var_len, ini) php_ini_check_path(var, var_len, ini, sizeof(ini))
+#define _CHECK_PATH(var, var_len, ini) php_ini_check_path(var, (int)var_len, ini, sizeof(ini))
/* open basedir check */
if (PG(open_basedir)) {
if (_CHECK_PATH(varname->val, varname->len, "error_log") ||
@@ -5592,7 +5592,7 @@ PHP_FUNCTION(getprotobynumber)
return;
}
- ent = getprotobynumber(proto);
+ ent = getprotobynumber((int)proto);
if (ent == NULL) {
RETURN_FALSE;
@@ -5790,7 +5790,7 @@ static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int cal
}
if (!(Z_STRLEN_P(arg1) > 1 && Z_STRVAL_P(arg1)[0] == '0') && is_numeric_string(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1), NULL, NULL, 0) == IS_LONG) {
- zend_ulong key = (zend_ulong) zend_atol(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1));
+ zend_ulong key = (zend_ulong) zend_atol(Z_STRVAL_P(arg1), (int)Z_STRLEN_P(arg1));
if ((find_hash = zend_hash_index_find(Z_ARRVAL_P(arr), key)) == NULL) {
array_init(&hash);
find_hash = zend_hash_index_update(Z_ARRVAL_P(arr), key, &hash);
@@ -5878,7 +5878,7 @@ PHP_FUNCTION(parse_ini_file)
fh.type = ZEND_HANDLE_FILENAME;
array_init(return_value);
- if (zend_parse_ini_file(&fh, 0, scanner_mode, ini_parser_cb, return_value TSRMLS_CC) == FAILURE) {
+ if (zend_parse_ini_file(&fh, 0, (int)scanner_mode, ini_parser_cb, return_value TSRMLS_CC) == FAILURE) {
zval_dtor(return_value);
RETURN_FALSE;
}
@@ -5917,7 +5917,7 @@ PHP_FUNCTION(parse_ini_string)
memset(string + str_len, 0, ZEND_MMAP_AHEAD);
array_init(return_value);
- if (zend_parse_ini_string(string, 0, scanner_mode, ini_parser_cb, return_value TSRMLS_CC) == FAILURE) {
+ if (zend_parse_ini_string(string, 0, (int)scanner_mode, ini_parser_cb, return_value TSRMLS_CC) == FAILURE) {
zval_dtor(return_value);
RETVAL_FALSE;
}
diff --git a/ext/standard/basic_functions.h b/ext/standard/basic_functions.h
index eaac7a1609..ee04a4f89b 100644
--- a/ext/standard/basic_functions.h
+++ b/ext/standard/basic_functions.h
@@ -142,7 +142,7 @@ PHP_RSHUTDOWN_FUNCTION(browscap);
/* Left for BC (not binary safe!) */
PHPAPI int _php_error_log(int opt_err, char *message, char *opt, char *headers TSRMLS_DC);
-PHPAPI int _php_error_log_ex(int opt_err, char *message, int message_len, char *opt, char *headers TSRMLS_DC);
+PHPAPI int _php_error_log_ex(int opt_err, char *message, size_t message_len, char *opt, char *headers TSRMLS_DC);
PHPAPI int php_prefix_varname(zval *result, zval *prefix, char *var_name, int var_name_len, zend_bool add_underscore TSRMLS_DC);
#if SIZEOF_INT == 4