com php-src: one more walk through in Zend, fixed (or broken) things being overseen: main/main.c main/php_globals.h main/php_ini .c main/php_ini.h
main/rfc1867.c main/str eams/xp_socket.c
| From: | Anatol Belski | Date: | Sun, 24 Nov 2013 17:55:26 +0000 |
| Subject: | com php-src: one more walk through in Zend, fixed (or broken) things being overseen: main/main.c main/php_globals.h main/php_ini .c main/php_ini.h main/rfc1867.c main/str eams/xp_socket.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-74029@lists.php.net to get a copy of this message | ||
Commit: 9cc9a10efddd0c547c616b9790752bdb143025b8
Author: Anatol Belski <ab@php.net> Sun, 24 Nov 2013 18:55:26 +0100
Parents: cbf40edf067b58f56627861f33305b5bc948723e
Branches: str_size_and_int64
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9cc9a10efddd0c547c616b9790752bdb143025b8
Log:
one more walk through in Zend, fixed (or broken) things being overseen
Changed paths:
M main/main..c
M main/php_globals.h
M main/php_ini.c
M main/php_ini.h
M main/rfc1867.c
M main/streams/xp_socket.c
Diff:
diff --git a/main/main.c b/main/main.c
index 2dcbb61..4f7928d 100644
--- a/main/main.c
+++ b/main/main.c
@@ -160,7 +160,9 @@ static php_win32_disable_functions(TSRMLS_D)
*/
static PHP_INI_MH(OnSetPrecision)
{
- int i = atoi(new_value);
+ php_int_t i;
+
+ ZEND_ATOI(i, new_value);
if (i >= 0) {
EG(precision) = i;
return SUCCESS;
@@ -316,11 +318,11 @@ static PHP_INI_MH(OnUpdateTimeout)
{
if (stage==PHP_INI_STAGE_STARTUP) {
/* Don't set a timeout on startup, only per-request */
- EG(timeout_seconds) = atoi(new_value);
+ ZEND_ATOI(EG(timeout_seconds), new_value);
return SUCCESS;
}
zend_unset_timeout(TSRMLS_C);
- EG(timeout_seconds) = atoi(new_value);
+ ZEND_ATOI(EG(timeout_seconds), new_value);
zend_set_timeout(EG(timeout_seconds), 0);
return SUCCESS;
}
@@ -347,7 +349,7 @@ static int php_get_display_errors_mode(char *value, zend_str_size_int value_leng
} else if (value_length == 6 && !strcasecmp(value, "stdout")) {
mode = PHP_DISPLAY_ERRORS_STDOUT;
} else {
- mode = atoi(value);
+ ZEND_ATOI(mode, value);
if (mode && mode != PHP_DISPLAY_ERRORS_STDOUT && mode !=
PHP_DISPLAY_ERRORS_STDERR) {
mode = PHP_DISPLAY_ERRORS_STDOUT;
}
@@ -2299,7 +2301,7 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry
*additional_mod
const char **p = directives[i].directives;
while(*p) {
- long value;
+ php_int_t value;
if (cfg_get_long((char*)*p, &value) == SUCCESS && value) {
zend_error(directives[i].error_level, directives[i].phrase, *p);
diff --git a/main/php_globals.h b/main/php_globals.h
index 41f1d41..fac9fa8 100644
--- a/main/php_globals.h
+++ b/main/php_globals.h
@@ -56,7 +56,7 @@ typedef struct _arg_separators {
struct _php_core_globals {
zend_bool implicit_flush;
- long output_buffering;
+ zend_int_t output_buffering;
zend_bool sql_safe_mode;
zend_bool enable_dl;
@@ -64,16 +64,16 @@ struct _php_core_globals {
char *output_handler;
char *unserialize_callback_func;
- long serialize_precision;
+ zend_int_t serialize_precision;
zend_int_t memory_limit;
- long max_input_time;
+ zend_int_t max_input_time;
zend_bool track_errors;
zend_bool display_errors;
zend_bool display_startup_errors;
zend_bool log_errors;
- long log_errors_max_len;
+ zend_int_t log_errors_max_len;
zend_bool ignore_repeated_errors;
zend_bool ignore_repeated_source;
zend_bool report_memleaks;
@@ -88,7 +88,7 @@ struct _php_core_globals {
char *sys_temp_dir;
char *upload_tmp_dir;
- long upload_max_filesize;
+ zend_int_t upload_max_filesize;
char *error_append_string;
char *error_prepend_string;
@@ -122,7 +122,7 @@ struct _php_core_globals {
zend_bool html_errors;
zend_bool xmlrpc_errors;
- long xmlrpc_error_number;
+ zend_int_t xmlrpc_error_number;
zend_bool activated_auto_globals[8];
@@ -145,12 +145,12 @@ struct _php_core_globals {
#ifdef PHP_WIN32
zend_bool com_initialized;
#endif
- long max_input_nesting_level;
- long max_input_vars;
+ zend_int_t max_input_nesting_level;
+ zend_int_t max_input_vars;
zend_bool in_user_include;
char *user_ini_filename;
- long user_ini_cache_ttl;
+ zend_int_t user_ini_cache_ttl;
char *request_order;
diff --git a/main/php_ini.c b/main/php_ini.c
index 4207980..0ae4b37 100644
--- a/main/php_ini.c
+++ b/main/php_ini.c
@@ -874,7 +874,7 @@ PHPAPI zval *cfg_get_entry(const char *name, zend_str_size_uint name_length)
/* {{{ cfg_get_long
*/
-PHPAPI int cfg_get_long(const char *varname, long *result)
+PHPAPI int cfg_get_long(const char *varname, zend_int_t *result)
{
zval *tmp, var;
diff --git a/main/php_ini.h b/main/php_ini.h
index 17a5c0e..b175eb8 100644
--- a/main/php_ini.h
+++ b/main/php_ini.h
@@ -29,7 +29,7 @@ int php_init_config(TSRMLS_D);
int php_shutdown_config(void);
void php_ini_register_extensions(TSRMLS_D);
PHPAPI zval *cfg_get_entry(const char *name, zend_str_size_uint name_length);
-PHPAPI int cfg_get_long(const char *varname, long *result);
+PHPAPI int cfg_get_long(const char *varname, zend_int_t *result);
PHPAPI int cfg_get_double(const char *varname, double *result);
PHPAPI int cfg_get_string(const char *varname, char **result);
PHPAPI int php_parse_user_ini_file(const char *dirname, char *ini_filename, HashTable *target_hash
TSRMLS_DC);
diff --git a/main/rfc1867.c b/main/rfc1867.c
index 3c9e160..a86a706 100644
--- a/main/rfc1867.c
+++ b/main/rfc1867.c
@@ -697,7 +697,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
php_rfc1867_getword_t getword;
php_rfc1867_getword_conf_t getword_conf;
php_rfc1867_basename_t _basename;
- long count = 0;
+ php_int_t count = 0;
if (php_rfc1867_encoding_translation(TSRMLS_C) && internal_encoding) {
getword = php_rfc1867_getword;
@@ -1029,14 +1029,14 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
}
}
- if (PG(upload_max_filesize) > 0 && (long)(total_bytes+blen) >
PG(upload_max_filesize)) {
+ if (PG(upload_max_filesize) > 0 && (php_int_t)(total_bytes+blen) >
PG(upload_max_filesize)) {
#if DEBUG_FILE_UPLOAD
- sapi_module.sapi_error(E_NOTICE, "upload_max_filesize of %ld bytes exceeded - file
[%s=%s] not saved", PG(upload_max_filesize), param, filename);
+ sapi_module.sapi_error(E_NOTICE, "upload_max_filesize of " ZEND_INT_FMT " bytes
exceeded - file [%s=%s] not saved", PG(upload_max_filesize), param, filename);
#endif
cancel_upload = UPLOAD_ERROR_A;
- } else if (max_file_size && ((long)(total_bytes+blen) > max_file_size)) {
+ } else if (max_file_size && ((php_int_t)(total_bytes+blen) > max_file_size)) {
#if DEBUG_FILE_UPLOAD
- sapi_module.sapi_error(E_NOTICE, "MAX_FILE_SIZE of %ld bytes exceeded - file [%s=%s] not
saved", max_file_size, param, filename);
+ sapi_module.sapi_error(E_NOTICE, "MAX_FILE_SIZE of " ZEND_INT_FMT " bytes
exceeded - file [%s=%s] not saved", max_file_size, param, filename);
#endif
cancel_upload = UPLOAD_ERROR_B;
} else if (blen > 0) {
@@ -1225,7 +1225,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
if (cancel_upload) {
ZVAL_LONG(&file_size, 0);
} else {
- if (total_bytes > LONG_MAX) {
+ if (total_bytes > ZEND_INT_MAX) {
#ifdef PHP_WIN32
if (_i64toa_s(total_bytes, file_size_buf, 65, 10)) {
file_size_buf[0] = '0';
diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c
index 6244969...e799dfb 100644
--- a/main/streams/xp_socket.c
+++ b/main/streams/xp_socket.c
@@ -102,8 +102,8 @@ retry:
} while (err == EINTR);
}
estr = php_socket_strerror(err, NULL, 0);
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "send of %ld bytes failed with errno=%ld
%s",
- (long)count, err, estr);
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "send of " ZEND_INT_FMT " bytes failed
with errno=%ld %s",
+ (php_int_t)count, err, estr);
efree(estr);
}