diff options
author | Anatol Belski <ab@php.net> | 2014-08-25 19:24:55 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2014-08-25 19:24:55 +0200 |
commit | c3e3c98ec666812daaaca896cf5ef758a8a6df14 (patch) | |
tree | d82a76de5c8d117d1cf2dcca19bb30a283621870 /main | |
parent | 0cf2dbdf58645b52cb6582b1b2571c5cd9e9e6b3 (diff) | |
download | php-git-c3e3c98ec666812daaaca896cf5ef758a8a6df14.tar.gz |
master renames phase 1
Diffstat (limited to 'main')
-rw-r--r-- | main/SAPI.c | 8 | ||||
-rw-r--r-- | main/SAPI.h | 6 | ||||
-rw-r--r-- | main/main.c | 68 | ||||
-rw-r--r-- | main/network.c | 16 | ||||
-rw-r--r-- | main/output.c | 76 | ||||
-rw-r--r-- | main/php.h | 6 | ||||
-rw-r--r-- | main/php_globals.h | 20 | ||||
-rw-r--r-- | main/php_ini.c | 30 | ||||
-rw-r--r-- | main/php_ini.h | 4 | ||||
-rw-r--r-- | main/php_network.h | 2 | ||||
-rw-r--r-- | main/php_variables.c | 30 | ||||
-rw-r--r-- | main/rfc1867.c | 28 | ||||
-rw-r--r-- | main/snprintf.c | 10 | ||||
-rw-r--r-- | main/spprintf.c | 10 | ||||
-rw-r--r-- | main/streams/cast.c | 2 | ||||
-rw-r--r-- | main/streams/memory.c | 2 | ||||
-rw-r--r-- | main/streams/streams.c | 16 | ||||
-rw-r--r-- | main/streams/transports.c | 4 | ||||
-rw-r--r-- | main/streams/userspace.c | 134 | ||||
-rw-r--r-- | main/streams/xp_socket.c | 4 |
20 files changed, 238 insertions, 238 deletions
diff --git a/main/SAPI.c b/main/SAPI.c index a3826b0e1b..fbfca51743 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -789,9 +789,9 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) /* Disable possible output compression for images */ if (!strncmp(ptr, "image/", sizeof("image/")-1)) { - zend_string *key = STR_INIT("zlib.output_compression", sizeof("zlib.output_compression")-1, 0); + zend_string *key = zend_string_init("zlib.output_compression", sizeof("zlib.output_compression")-1, 0); zend_alter_ini_entry(key, "0", sizeof("0") - 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); - STR_RELEASE(key); + zend_string_release(key); } mimetype = estrdup(ptr); @@ -817,10 +817,10 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) * do disable compression altogether. This contributes to making scripts * portable between setups that have and don't have zlib compression * enabled globally. See req #44164 */ - zend_string *key = STR_INIT("zlib.output_compression", sizeof("zlib.output_compression")-1, 0); + zend_string *key = zend_string_init("zlib.output_compression", sizeof("zlib.output_compression")-1, 0); zend_alter_ini_entry(key, "0", sizeof("0") - 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); - STR_RELEASE(key); + zend_string_release(key); } else if (!STRCASECMP(header_line, "Location")) { if ((SG(sapi_headers).http_response_code < 300 || SG(sapi_headers).http_response_code > 399) && diff --git a/main/SAPI.h b/main/SAPI.h index 4e67a481c5..0654cd6c7f 100644 --- a/main/SAPI.h +++ b/main/SAPI.h @@ -82,7 +82,7 @@ typedef struct { const char *request_method; char *query_string; char *cookie_data; - zend_int_t content_length; + zend_long content_length; char *path_translated; char *request_uri; @@ -129,7 +129,7 @@ typedef struct _sapi_globals_struct { char *default_mimetype; char *default_charset; HashTable *rfc1867_uploaded_files; - zend_int_t post_max_size; + zend_long post_max_size; int options; zend_bool sapi_started; double global_request_time; @@ -170,7 +170,7 @@ END_EXTERN_C() typedef struct { char *line; /* If you allocated this, you need to free it yourself */ uint line_len; - zend_int_t response_code; /* long due to zend_parse_parameters compatibility */ + zend_long response_code; /* long due to zend_parse_parameters compatibility */ } sapi_header_line; typedef enum { /* Parameter: */ diff --git a/main/main.c b/main/main.c index 8f954706cf..b961bbf5b3 100644 --- a/main/main.c +++ b/main/main.c @@ -160,7 +160,7 @@ static php_win32_disable_functions(TSRMLS_D) */ static PHP_INI_MH(OnSetPrecision) { - php_int_t i; + zend_long i; ZEND_ATOI(i, new_value); if (i >= 0) { @@ -691,7 +691,7 @@ PHPAPI void php_log_err(char *log_message TSRMLS_DC) #endif php_ignore_value(write(fd, tmp, len)); efree(tmp); - STR_FREE(error_time_str); + zend_string_free(error_time_str); close(fd); PG(in_error_log) = 0; return; @@ -893,7 +893,7 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c spprintf(&message, 0, "%s: %s", origin, buffer); } if (replace_origin) { - STR_FREE(replace_origin); + zend_string_free(replace_origin); } else { efree(origin); } @@ -914,7 +914,7 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c } } if (replace_buffer) { - STR_FREE(replace_buffer); + zend_string_free(replace_buffer); } else { efree(buffer); } @@ -1138,7 +1138,7 @@ static void php_error_cb(int type, const char *error_filename, const uint error_ if (type == E_ERROR || type == E_PARSE) { zend_string *buf = php_escape_html_entities(buffer, buffer_len, 0, ENT_COMPAT, NULL TSRMLS_CC); php_printf("%s<br />\n<b>%s</b>: %s in <b>%s</b> on line <b>%d</b><br />\n%s", STR_PRINT(prepend_string), error_type_str, buf->val, error_filename, error_lineno, STR_PRINT(append_string)); - STR_FREE(buf); + zend_string_free(buf); } else { php_printf("%s<br />\n<b>%s</b>: %s in <b>%s</b> on line <b>%d</b><br />\n%s", STR_PRINT(prepend_string), error_type_str, buffer, error_filename, error_lineno, STR_PRINT(append_string)); } @@ -1328,24 +1328,24 @@ PHPAPI char *php_get_current_user(TSRMLS_D) Sets the maximum time a script can run */ PHP_FUNCTION(set_time_limit) { - php_int_t new_timeout; + zend_long new_timeout; char *new_timeout_str; int new_timeout_strlen; zend_string *key; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &new_timeout) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &new_timeout) == FAILURE) { return; } new_timeout_strlen = zend_spprintf(&new_timeout_str, 0, ZEND_INT_FMT, new_timeout); - key = STR_INIT("max_execution_time", sizeof("max_execution_time")-1, 0); + key = zend_string_init("max_execution_time", sizeof("max_execution_time")-1, 0); if (zend_alter_ini_entry_ex(key, new_timeout_str, new_timeout_strlen, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC) == SUCCESS) { RETVAL_TRUE; } else { RETVAL_FALSE; } - STR_RELEASE(key); + zend_string_release(key); efree(new_timeout_str); } /* }}} */ @@ -2180,17 +2180,17 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod /* Register constants */ REGISTER_MAIN_STRINGL_CONSTANT("PHP_VERSION", PHP_VERSION, sizeof(PHP_VERSION)-1, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("PHP_MAJOR_VERSION", PHP_MAJOR_VERSION, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("PHP_MINOR_VERSION", PHP_MINOR_VERSION, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("PHP_RELEASE_VERSION", PHP_RELEASE_VERSION, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_MAJOR_VERSION", PHP_MAJOR_VERSION, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_MINOR_VERSION", PHP_MINOR_VERSION, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_RELEASE_VERSION", PHP_RELEASE_VERSION, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_STRINGL_CONSTANT("PHP_EXTRA_VERSION", PHP_EXTRA_VERSION, sizeof(PHP_EXTRA_VERSION) - 1, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("PHP_VERSION_ID", PHP_VERSION_ID, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_VERSION_ID", PHP_VERSION_ID, CONST_PERSISTENT | CONST_CS); #ifdef ZTS - REGISTER_MAIN_INT_CONSTANT("PHP_ZTS", 1, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_ZTS", 1, CONST_PERSISTENT | CONST_CS); #else - REGISTER_MAIN_INT_CONSTANT("PHP_ZTS", 0, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_ZTS", 0, CONST_PERSISTENT | CONST_CS); #endif - REGISTER_MAIN_INT_CONSTANT("PHP_DEBUG", PHP_DEBUG, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_DEBUG", PHP_DEBUG, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_STRINGL_CONSTANT("PHP_OS", php_os, strlen(php_os), CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_STRINGL_CONSTANT("PHP_SAPI", sapi_module.name, strlen(sapi_module.name), CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_STRINGL_CONSTANT("DEFAULT_INCLUDE_PATH", PHP_INCLUDE_PATH, sizeof(PHP_INCLUDE_PATH)-1, CONST_PERSISTENT | CONST_CS); @@ -2210,23 +2210,23 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod REGISTER_MAIN_STRINGL_CONSTANT("PHP_CONFIG_FILE_SCAN_DIR", PHP_CONFIG_FILE_SCAN_DIR, sizeof(PHP_CONFIG_FILE_SCAN_DIR)-1, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_STRINGL_CONSTANT("PHP_SHLIB_SUFFIX", PHP_SHLIB_SUFFIX, sizeof(PHP_SHLIB_SUFFIX)-1, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_STRINGL_CONSTANT("PHP_EOL", PHP_EOL, sizeof(PHP_EOL)-1, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("PHP_MAXPATHLEN", MAXPATHLEN, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("PHP_INT_MAX", PHP_INT_MAX, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("PHP_INT_MIN", PHP_INT_MIN, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("PHP_INT_SIZE", SIZEOF_ZEND_INT, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_MAXPATHLEN", MAXPATHLEN, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_INT_MAX", PHP_INT_MAX, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_INT_MIN", PHP_INT_MIN, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_INT_SIZE", SIZEOF_ZEND_INT, CONST_PERSISTENT | CONST_CS); #ifdef PHP_WIN32 - REGISTER_MAIN_INT_CONSTANT("PHP_WINDOWS_VERSION_MAJOR", EG(windows_version_info).dwMajorVersion, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("PHP_WINDOWS_VERSION_MINOR", EG(windows_version_info).dwMinorVersion, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("PHP_WINDOWS_VERSION_BUILD", EG(windows_version_info).dwBuildNumber, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("PHP_WINDOWS_VERSION_PLATFORM", EG(windows_version_info).dwPlatformId, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("PHP_WINDOWS_VERSION_SP_MAJOR", EG(windows_version_info).wServicePackMajor, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("PHP_WINDOWS_VERSION_SP_MINOR", EG(windows_version_info).wServicePackMinor, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("PHP_WINDOWS_VERSION_SUITEMASK", EG(windows_version_info).wSuiteMask, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("PHP_WINDOWS_VERSION_PRODUCTTYPE", EG(windows_version_info).wProductType, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("PHP_WINDOWS_NT_DOMAIN_CONTROLLER", VER_NT_DOMAIN_CONTROLLER, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("PHP_WINDOWS_NT_SERVER", VER_NT_SERVER, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_INT_CONSTANT("PHP_WINDOWS_NT_WORKSTATION", VER_NT_WORKSTATION, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_WINDOWS_VERSION_MAJOR", EG(windows_version_info).dwMajorVersion, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_WINDOWS_VERSION_MINOR", EG(windows_version_info).dwMinorVersion, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_WINDOWS_VERSION_BUILD", EG(windows_version_info).dwBuildNumber, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_WINDOWS_VERSION_PLATFORM", EG(windows_version_info).dwPlatformId, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_WINDOWS_VERSION_SP_MAJOR", EG(windows_version_info).wServicePackMajor, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_WINDOWS_VERSION_SP_MINOR", EG(windows_version_info).wServicePackMinor, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_WINDOWS_VERSION_SUITEMASK", EG(windows_version_info).wSuiteMask, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_WINDOWS_VERSION_PRODUCTTYPE", EG(windows_version_info).wProductType, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_WINDOWS_NT_DOMAIN_CONTROLLER", VER_NT_DOMAIN_CONTROLLER, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_WINDOWS_NT_SERVER", VER_NT_SERVER, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_WINDOWS_NT_WORKSTATION", VER_NT_WORKSTATION, CONST_PERSISTENT | CONST_CS); #endif php_binary_init(TSRMLS_C); @@ -2374,9 +2374,9 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod const char **p = directives[i].directives; while(*p) { - php_int_t value; + zend_long value; - if (cfg_get_int((char*)*p, &value) == SUCCESS && value) { + if (cfg_get_long((char*)*p, &value) == SUCCESS && value) { zend_error(directives[i].error_level, directives[i].phrase, *p); } @@ -2653,7 +2653,7 @@ PHPAPI int php_handle_auth_data(const char *auth TSRMLS_DC) SG(request_info).auth_password = estrdup(pass); ret = 0; } - STR_FREE(user); + zend_string_free(user); } } diff --git a/main/network.c b/main/network.c index 5edc74c830..0b018c2e87 100644 --- a/main/network.c +++ b/main/network.c @@ -507,7 +507,7 @@ bound: } /* }}} */ -PHPAPI int php_network_parse_network_address_with_port(const char *addr, php_int_t addrlen, struct sockaddr *sa, socklen_t *sl TSRMLS_DC) +PHPAPI int php_network_parse_network_address_with_port(const char *addr, zend_long addrlen, struct sockaddr *sa, socklen_t *sl TSRMLS_DC) { char *colon; char *tmp; @@ -563,7 +563,7 @@ PHPAPI int php_network_parse_network_address_with_port(const char *addr, php_int if (n == 0) { if (errstr) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to resolve `%s': %s", tmp, errstr->val); - STR_RELEASE(errstr); + zend_string_release(errstr); } goto out; } @@ -645,10 +645,10 @@ PHPAPI void php_network_populate_name_from_sockaddr( if (ua->sun_path[0] == '\0') { /* abstract name */ int len = strlen(ua->sun_path + 1) + 1; - *textaddr = STR_INIT((char*)ua->sun_path, len, 0); + *textaddr = zend_string_init((char*)ua->sun_path, len, 0); } else { int len = strlen(ua->sun_path); - *textaddr = STR_INIT((char*)ua->sun_path, len, 0); + *textaddr = zend_string_init((char*)ua->sun_path, len, 0); } } break; @@ -880,7 +880,7 @@ skip_bind: } /* free error string received during previous iteration (if any) */ if (error_string && *error_string) { - STR_RELEASE(*error_string); + zend_string_release(*error_string); *error_string = NULL; } @@ -1050,7 +1050,7 @@ PHPAPI zend_string *php_socket_error_str(long err) char *errstr; errstr = strerror(err); - return STR_INIT(errstr, strlen(errstr), 0); + return zend_string_init(errstr, strlen(errstr), 0); #else zend_string *ret; char *sysbuf; @@ -1070,7 +1070,7 @@ PHPAPI zend_string *php_socket_error_str(long err) sysbuf = "Unknown Error"; } - ret = STR_INIT(sysbuf, strlen(sysbuf), 0); + ret = zend_string_init(sysbuf, strlen(sysbuf), 0); if (free_it) { LocalFree(sysbuf); @@ -1110,7 +1110,7 @@ PHPAPI php_stream *_php_stream_sock_open_host(const char *host, unsigned short p int socktype, struct timeval *timeout, const char *persistent_id STREAMS_DC TSRMLS_DC) { char *res; - php_int_t reslen; + zend_long reslen; php_stream *stream; reslen = spprintf(&res, 0, "tcp://%s:%d", host, port); diff --git a/main/output.c b/main/output.c index 4acdd234f2..1a6f6e5bd8 100644 --- a/main/output.c +++ b/main/output.c @@ -199,20 +199,20 @@ PHPAPI void php_output_deactivate(TSRMLS_D) /* {{{ void php_output_register_constants() */ PHPAPI void php_output_register_constants(TSRMLS_D) { - REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_START", PHP_OUTPUT_HANDLER_START, CONST_CS | CONST_PERSISTENT); - REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_WRITE", PHP_OUTPUT_HANDLER_WRITE, CONST_CS | CONST_PERSISTENT); - REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_FLUSH", PHP_OUTPUT_HANDLER_FLUSH, CONST_CS | CONST_PERSISTENT); - REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_CLEAN", PHP_OUTPUT_HANDLER_CLEAN, CONST_CS | CONST_PERSISTENT); - REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_FINAL", PHP_OUTPUT_HANDLER_FINAL, CONST_CS | CONST_PERSISTENT); - REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_CONT", PHP_OUTPUT_HANDLER_WRITE, CONST_CS | CONST_PERSISTENT); - REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_END", PHP_OUTPUT_HANDLER_FINAL, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_START", PHP_OUTPUT_HANDLER_START, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_WRITE", PHP_OUTPUT_HANDLER_WRITE, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_FLUSH", PHP_OUTPUT_HANDLER_FLUSH, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_CLEAN", PHP_OUTPUT_HANDLER_CLEAN, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_FINAL", PHP_OUTPUT_HANDLER_FINAL, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_CONT", PHP_OUTPUT_HANDLER_WRITE, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_END", PHP_OUTPUT_HANDLER_FINAL, CONST_CS | CONST_PERSISTENT); - REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_CLEANABLE", PHP_OUTPUT_HANDLER_CLEANABLE, CONST_CS | CONST_PERSISTENT); - REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_FLUSHABLE", PHP_OUTPUT_HANDLER_FLUSHABLE, CONST_CS | CONST_PERSISTENT); - REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_REMOVABLE", PHP_OUTPUT_HANDLER_REMOVABLE, CONST_CS | CONST_PERSISTENT); - REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_STDFLAGS", PHP_OUTPUT_HANDLER_STDFLAGS, CONST_CS | CONST_PERSISTENT); - REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_STARTED", PHP_OUTPUT_HANDLER_STARTED, CONST_CS | CONST_PERSISTENT); - REGISTER_MAIN_INT_CONSTANT("PHP_OUTPUT_HANDLER_DISABLED", PHP_OUTPUT_HANDLER_DISABLED, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_CLEANABLE", PHP_OUTPUT_HANDLER_CLEANABLE, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_FLUSHABLE", PHP_OUTPUT_HANDLER_FLUSHABLE, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_REMOVABLE", PHP_OUTPUT_HANDLER_REMOVABLE, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_STDFLAGS", PHP_OUTPUT_HANDLER_STDFLAGS, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_STARTED", PHP_OUTPUT_HANDLER_STARTED, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_DISABLED", PHP_OUTPUT_HANDLER_DISABLED, CONST_CS | CONST_PERSISTENT); } /* }}} */ @@ -404,7 +404,7 @@ PHPAPI int php_output_get_contents(zval *p TSRMLS_DC) PHPAPI int php_output_get_length(zval *p TSRMLS_DC) { if (OG(active)) { - ZVAL_INT(p, OG(active)->buffer.used); + ZVAL_LONG(p, OG(active)->buffer.used); return SUCCESS; } else { ZVAL_NULL(p); @@ -501,8 +501,8 @@ PHPAPI php_output_handler *php_output_handler_create_user(zval *output_handler, handler = php_output_handler_create_internal(ZEND_STRL(php_output_default_handler_name), php_output_handler_default_func, chunk_size, flags TSRMLS_CC); break; case IS_STRING: - if (Z_STRSIZE_P(output_handler) && (alias = php_output_handler_alias(Z_STRVAL_P(output_handler), Z_STRSIZE_P(output_handler) TSRMLS_CC))) { - handler = alias(Z_STRVAL_P(output_handler), Z_STRSIZE_P(output_handler), chunk_size, flags TSRMLS_CC); + if (Z_STRLEN_P(output_handler) && (alias = php_output_handler_alias(Z_STRVAL_P(output_handler), Z_STRLEN_P(output_handler) TSRMLS_CC))) { + handler = alias(Z_STRVAL_P(output_handler), Z_STRLEN_P(output_handler), chunk_size, flags TSRMLS_CC); break; } default: @@ -519,7 +519,7 @@ PHPAPI php_output_handler *php_output_handler_create_user(zval *output_handler, efree(error); } if (handler_name) { - STR_RELEASE(handler_name); + zend_string_release(handler_name); } } @@ -532,11 +532,11 @@ PHPAPI php_output_handler *php_output_handler_create_user(zval *output_handler, PHPAPI php_output_handler *php_output_handler_create_internal(const char *name, size_t name_len, php_output_handler_context_func_t output_handler, size_t chunk_size, int flags TSRMLS_DC) { php_output_handler *handler; - zend_string *str = STR_INIT(name, name_len, 1); + zend_string *str = zend_string_init(name, name_len, 1); handler = php_output_handler_init(str, chunk_size, (flags & ~0xf) | PHP_OUTPUT_HANDLER_INTERNAL TSRMLS_CC); handler->func.internal = output_handler; - STR_RELEASE(str); + zend_string_release(str); return handler; } @@ -718,7 +718,7 @@ PHPAPI int php_output_handler_hook(php_output_handler_hook_t type, void *arg TSR PHPAPI void php_output_handler_dtor(php_output_handler *handler TSRMLS_DC) { if (handler->name) { - STR_RELEASE(handler->name); + zend_string_release(handler->name); } if (handler->buffer.data) { efree(handler->buffer.data); @@ -885,7 +885,7 @@ static inline php_output_handler *php_output_handler_init(zend_string *name, siz php_output_handler *handler; handler = ecalloc(1, sizeof(php_output_handler)); - handler->name = STR_COPY(name); + handler->name = zend_string_copy(name); handler->size = chunk_size; handler->flags = flags; handler->buffer.size = PHP_OUTPUT_HANDLER_INITBUF_SIZE(chunk_size); @@ -973,7 +973,7 @@ static inline php_output_handler_status_t php_output_handler_op(php_output_handl zval retval, ob_data, ob_mode; ZVAL_STRINGL(&ob_data, handler->buffer.data, handler->buffer.used); - ZVAL_INT(&ob_mode, (long) context->op); + ZVAL_LONG(&ob_mode, (long) context->op); zend_fcall_info_argn(&handler->func.user->fci TSRMLS_CC, 2, &ob_data, &ob_mode); #define PHP_OUTPUT_USER_SUCCESS(retval) ((Z_TYPE(retval) != IS_UNDEF) && !(Z_TYPE(retval) == IS_FALSE)) @@ -982,9 +982,9 @@ static inline php_output_handler_status_t php_output_handler_op(php_output_handl status = PHP_OUTPUT_HANDLER_NO_DATA; if (Z_TYPE(retval) != IS_FALSE && Z_TYPE(retval) != IS_TRUE) { convert_to_string_ex(&retval); - if (Z_STRSIZE(retval)) { - context->out.data = estrndup(Z_STRVAL(retval), Z_STRSIZE(retval)); - context->out.used = Z_STRSIZE(retval); + if (Z_STRLEN(retval)) { + context->out.data = estrndup(Z_STRVAL(retval), Z_STRLEN(retval)); + context->out.used = Z_STRLEN(retval); context->out.free = 1; status = PHP_OUTPUT_HANDLER_SUCCESS; } @@ -1172,7 +1172,7 @@ static int php_output_stack_apply_list(void *h, void *z) php_output_handler *handler = *(php_output_handler **) h; zval *array = (zval *) z; - add_next_index_str(array, STR_COPY(handler->name)); + add_next_index_str(array, zend_string_copy(handler->name)); return 0; } /* }}} */ @@ -1196,13 +1196,13 @@ static inline zval *php_output_handler_status(php_output_handler *handler, zval ZEND_ASSERT(entry != NULL); array_init(entry); - add_assoc_str(entry, "name", STR_COPY(handler->name)); - add_assoc_int(entry, "type", (php_int_t) (handler->flags & 0xf)); - add_assoc_int(entry, "flags", (php_int_t) handler->flags); - add_assoc_int(entry, "level", (php_int_t) handler->level); - add_assoc_int(entry, "chunk_size", (php_int_t) handler->size); - add_assoc_int(entry, "buffer_size", (php_int_t) handler->buffer.size); - add_assoc_int(entry, "buffer_used", (php_int_t) handler->buffer.used); + add_assoc_str(entry, "name", zend_string_copy(handler->name)); + add_assoc_long(entry, "type", (zend_long) (handler->flags & 0xf)); + add_assoc_long(entry, "flags", (zend_long) handler->flags); + add_assoc_long(entry, "level", (zend_long) handler->level); + add_assoc_long(entry, "chunk_size", (zend_long) handler->size); + add_assoc_long(entry, "buffer_size", (zend_long) handler->buffer.size); + add_assoc_long(entry, "buffer_used", (zend_long) handler->buffer.used); return entry; } @@ -1316,10 +1316,10 @@ static int php_output_handler_devnull_func(void **handler_context, php_output_co PHP_FUNCTION(ob_start) { zval *output_handler = NULL; - php_int_t chunk_size = 0; - php_int_t flags = PHP_OUTPUT_HANDLER_STDFLAGS; + zend_long chunk_size = 0; + zend_long flags = PHP_OUTPUT_HANDLER_STDFLAGS; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z/ii", &output_handler, &chunk_size, &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z/ll", &output_handler, &chunk_size, &flags) == FAILURE) { return; } @@ -1475,7 +1475,7 @@ PHP_FUNCTION(ob_get_level) return; } - RETURN_INT(php_output_get_level(TSRMLS_C)); + RETURN_LONG(php_output_get_level(TSRMLS_C)); } /* }}} */ @@ -1539,7 +1539,7 @@ PHP_FUNCTION(ob_get_status) Turn implicit flush on/off and is equivalent to calling flush() after every output call */ PHP_FUNCTION(ob_implicit_flush) { - php_int_t flag = 1; + zend_long flag = 1; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flag) == FAILURE) { return; diff --git a/main/php.h b/main/php.h index a271f0d5fc..fc105386db 100644 --- a/main/php.h +++ b/main/php.h @@ -66,9 +66,9 @@ # define PHP_EOL "\n" #endif -#define php_size_t zend_size_t -#define php_int_t zend_int_t -#define php_uint_t zend_uint_t +#define php_size_t size_t +#define zend_long zend_long +#define zend_ulong zend_ulong #define php_off_t zend_off_t #define PHP_INT_MAX ZEND_INT_MAX #define PHP_INT_MIN ZEND_INT_MIN diff --git a/main/php_globals.h b/main/php_globals.h index defb220c76..14d0a03868 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; - zend_int_t output_buffering; + zend_long 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; - zend_int_t serialize_precision; + zend_long serialize_precision; - zend_int_t memory_limit; - zend_int_t max_input_time; + zend_long memory_limit; + zend_long max_input_time; zend_bool track_errors; zend_bool display_errors; zend_bool display_startup_errors; zend_bool log_errors; - zend_int_t log_errors_max_len; + zend_long 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; - zend_int_t upload_max_filesize; + zend_long upload_max_filesize; char *error_append_string; char *error_prepend_string; @@ -126,7 +126,7 @@ struct _php_core_globals { zend_bool html_errors; zend_bool xmlrpc_errors; - zend_int_t xmlrpc_error_number; + zend_long xmlrpc_error_number; zend_bool activated_auto_globals[8]; @@ -149,12 +149,12 @@ struct _php_core_globals { #ifdef PHP_WIN32 zend_bool com_initialized; #endif - zend_int_t max_input_nesting_level; - zend_int_t max_input_vars; + zend_long max_input_nesting_level; + zend_long max_input_vars; zend_bool in_user_include; char *user_ini_filename; - zend_int_t user_ini_cache_ttl; + zend_long user_ini_cache_ttl; char *request_order; diff --git a/main/php_ini.c b/main/php_ini.c index 54944483d2..8621af24d7 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -200,7 +200,7 @@ PHPAPI void config_zval_dtor(zval *zvalue) zend_hash_destroy(Z_ARRVAL_P(zvalue)); free(Z_ARR_P(zvalue)); } else if (Z_TYPE_P(zvalue) == IS_STRING) { - STR_RELEASE(Z_STR_P(zvalue)); + zend_string_release(Z_STR_P(zvalue)); } } /* Reset / free active_ini_sectin global */ @@ -233,17 +233,17 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t /* PHP and Zend extensions are not added into configuration hash! */ if (!is_special_section && !strcasecmp(Z_STRVAL_P(arg1), PHP_EXTENSION_TOKEN)) { /* load PHP extension */ - extension_name = estrndup(Z_STRVAL_P(arg2), Z_STRSIZE_P(arg2)); + extension_name = estrndup(Z_STRVAL_P(arg2), Z_STRLEN_P(arg2)); zend_llist_add_element(&extension_lists.functions, &extension_name); } else if (!is_special_section && !strcasecmp(Z_STRVAL_P(arg1), ZEND_EXTENSION_TOKEN)) { /* load Zend extension */ - extension_name = estrndup(Z_STRVAL_P(arg2), Z_STRSIZE_P(arg2)); + extension_name = estrndup(Z_STRVAL_P(arg2), Z_STRLEN_P(arg2)); zend_llist_add_element(&extension_lists.engine, &extension_name); /* All other entries are added into either configuration_hash or active ini section array */ } else { /* Store in active hash */ entry = zend_hash_update(active_hash, Z_STR_P(arg1), arg2); - Z_STR_P(entry) = STR_DUP(Z_STR_P(entry), 1); + Z_STR_P(entry) = zend_string_dup(Z_STR_P(entry), 1); } } break; @@ -267,12 +267,12 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t } /* arg3 is possible option offset name */ - if (arg3 && Z_STRSIZE_P(arg3) > 0) { + if (arg3 && Z_STRLEN_P(arg3) > 0) { entry = zend_symtable_update(Z_ARRVAL_P(find_arr), Z_STR_P(arg3), arg2); } else { entry = zend_hash_next_index_insert(Z_ARRVAL_P(find_arr), arg2); } - Z_STR_P(entry) = STR_DUP(Z_STR_P(entry), 1); + Z_STR_P(entry) = zend_string_dup(Z_STR_P(entry), 1); } break; @@ -287,7 +287,7 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t if (!strncasecmp(Z_STRVAL_P(arg1), "PATH", sizeof("PATH") - 1)) { key = Z_STRVAL_P(arg1); key = key + sizeof("PATH") - 1; - key_len = Z_STRSIZE_P(arg1) - sizeof("PATH") + 1; + key_len = Z_STRLEN_P(arg1) - sizeof("PATH") + 1; is_special_section = 1; has_per_dir_config = 1; @@ -298,7 +298,7 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t } else if (!strncasecmp(Z_STRVAL_P(arg1), "HOST", sizeof("HOST") - 1)) { key = Z_STRVAL_P(arg1); key = key + sizeof("HOST") - 1; - key_len = Z_STRSIZE_P(arg1) - sizeof("HOST") + 1; + key_len = Z_STRLEN_P(arg1) - sizeof("HOST") + 1; is_special_section = 1; has_per_host_config = 1; zend_str_tolower(key, key_len); /* host names are case-insensitive. */ @@ -593,12 +593,12 @@ int php_init_config(TSRMLS_D) { zval tmp; - ZVAL_NEW_STR(&tmp, STR_INIT(fh.filename, strlen(fh.filename), 1)); + ZVAL_NEW_STR(&tmp, zend_string_init(fh.filename, strlen(fh.filename), 1)); zend_hash_str_update(&configuration_hash, "cfg_file_path", sizeof("cfg_file_path")-1, &tmp); if (php_ini_opened_path) { efree(php_ini_opened_path); } - php_ini_opened_path = zend_strndup(Z_STRVAL(tmp), Z_STRSIZE(tmp)); + php_ini_opened_path = zend_strndup(Z_STRVAL(tmp), Z_STRLEN(tmp)); } } @@ -778,7 +778,7 @@ PHPAPI void php_ini_activate_config(HashTable *source_hash, int modify_type, int { zend_string *str; zval *data; - zend_uint_t num_index; + zend_ulong num_index; /* Walk through config hash and alter matching ini entries using the values found in the hash */ for (zend_hash_internal_pointer_reset(source_hash); @@ -786,7 +786,7 @@ PHPAPI void php_ini_activate_config(HashTable *source_hash, int modify_type, int zend_hash_move_forward(source_hash) ) { data = zend_hash_get_current_data(source_hash); - zend_alter_ini_entry_ex(str, Z_STRVAL_P(data), Z_STRSIZE_P(data), modify_type, stage, 0 TSRMLS_CC); + zend_alter_ini_entry_ex(str, Z_STRVAL_P(data), Z_STRLEN_P(data), modify_type, stage, 0 TSRMLS_CC); } } /* }}} */ @@ -873,9 +873,9 @@ PHPAPI zval *cfg_get_entry(const char *name, uint name_length) } /* }}} */ -/* {{{ cfg_get_int +/* {{{ cfg_get_long */ -PHPAPI int cfg_get_int(const char *varname, zend_int_t *result) +PHPAPI int cfg_get_long(const char *varname, zend_long *result) { zval *tmp, var; @@ -885,7 +885,7 @@ PHPAPI int cfg_get_int(const char *varname, zend_int_t *result) } ZVAL_DUP(&var, tmp); convert_to_int(&var); - *result = Z_IVAL(var); + *result = Z_LVAL(var); return SUCCESS; } /* }}} */ diff --git a/main/php_ini.h b/main/php_ini.h index 491ad1cbd8..5e6f03680a 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, uint name_length); -PHPAPI int cfg_get_int(const char *varname, zend_int_t *result); +PHPAPI int cfg_get_long(const char *varname, zend_long *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); @@ -83,7 +83,7 @@ END_EXTERN_C() #define php_alter_ini_entry zend_alter_ini_entry -#define php_ini_long zend_ini_int +#define php_ini_long zend_ini_long #define php_ini_double zend_ini_double #define php_ini_string zend_ini_string diff --git a/main/php_network.h b/main/php_network.h index cc6e1c54e7..1528447c73 100644 --- a/main/php_network.h +++ b/main/php_network.h @@ -306,7 +306,7 @@ PHPAPI void php_network_populate_name_from_sockaddr( TSRMLS_DC); PHPAPI int php_network_parse_network_address_with_port(const char *addr, - php_int_t addrlen, struct sockaddr *sa, socklen_t *sl TSRMLS_DC); + zend_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/php_variables.c b/main/php_variables.c index 949bd6c6b0..a455b1b790 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -49,7 +49,7 @@ PHPAPI void php_register_variable_safe(char *var, char *strval, php_size_t str_l assert(strval != NULL); /* Prepare value */ - ZVAL_NEW_STR(&new_entry, STR_INIT(strval, str_len, 0)); + ZVAL_NEW_STR(&new_entry, zend_string_init(strval, str_len, 0)); php_register_variable_ex(var, &new_entry, track_vars_array TSRMLS_CC); } @@ -358,7 +358,7 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data) zval array; int free_buffer = 0; char *strtok_buf = NULL; - php_int_t count = 0; + zend_long count = 0; ZVAL_UNDEF(&array); switch (arg) { @@ -535,7 +535,7 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC) for (i = 0; i < SG(request_info).argc; i++) { ZVAL_STRING(&tmp, SG(request_info).argv[i]); if (zend_hash_next_index_insert(Z_ARRVAL(arr), &tmp) == NULL) { - STR_FREE(Z_STR(tmp)); + zend_string_free(Z_STR(tmp)); } } } else if (s && *s) { @@ -549,7 +549,7 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC) ZVAL_STRING(&tmp, ss); count++; if (zend_hash_next_index_insert(Z_ARRVAL(arr), &tmp) == NULL) { - STR_FREE(Z_STR(tmp)); + zend_string_free(Z_STR(tmp)); } if (space) { *space = '+'; @@ -562,9 +562,9 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC) /* prepare argc */ if (SG(request_info).argc) { - ZVAL_INT(&argc, SG(request_info).argc); + ZVAL_LONG(&argc, SG(request_info).argc); } else { - ZVAL_INT(&argc, count); + ZVAL_LONG(&argc, count); } if (SG(request_info).argc) { @@ -608,7 +608,7 @@ static inline void php_register_server_variables(TSRMLS_D) zval request_time_float, request_time_long; ZVAL_DOUBLE(&request_time_float, sapi_get_request_time(TSRMLS_C)); php_register_variable_ex("REQUEST_TIME_FLOAT", &request_time_float, &PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC); - ZVAL_INT(&request_time_long, zend_dval_to_ival(Z_DVAL(request_time_float))); + ZVAL_LONG(&request_time_long, zend_dval_to_lval(Z_DVAL(request_time_float))); php_register_variable_ex("REQUEST_TIME", &request_time_long, &PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC); } @@ -621,7 +621,7 @@ static void php_autoglobal_merge(HashTable *dest, HashTable *src TSRMLS_DC) { zval *src_entry, *dest_entry; zend_string *string_key; - php_uint_t num_key; + zend_ulong num_key; int globals_check = (dest == (&EG(symbol_table).ht)); ZEND_HASH_FOREACH_KEY_VAL(src, num_key, string_key, src_entry) { @@ -816,13 +816,13 @@ static zend_bool php_auto_globals_create_request(zend_string *name TSRMLS_DC) void php_startup_auto_globals(TSRMLS_D) { - zend_register_auto_global(STR_INIT("_GET", sizeof("_GET")-1, 1), 0, php_auto_globals_create_get TSRMLS_CC); - zend_register_auto_global(STR_INIT("_POST", sizeof("_POST")-1, 1), 0, php_auto_globals_create_post TSRMLS_CC); - zend_register_auto_global(STR_INIT("_COOKIE", sizeof("_COOKIE")-1, 1), 0, php_auto_globals_create_cookie TSRMLS_CC); - zend_register_auto_global(STR_INIT("_SERVER", sizeof("_SERVER")-1, 1), PG(auto_globals_jit), php_auto_globals_create_server TSRMLS_CC); - zend_register_auto_global(STR_INIT("_ENV", sizeof("_ENV")-1, 1), PG(auto_globals_jit), php_auto_globals_create_env TSRMLS_CC); - zend_register_auto_global(STR_INIT("_REQUEST", sizeof("_REQUEST")-1, 1), PG(auto_globals_jit), php_auto_globals_create_request TSRMLS_CC); - zend_register_auto_global(STR_INIT("_FILES", sizeof("_FILES")-1, 1), 0, php_auto_globals_create_files TSRMLS_CC); + zend_register_auto_global(zend_string_init("_GET", sizeof("_GET")-1, 1), 0, php_auto_globals_create_get TSRMLS_CC); + zend_register_auto_global(zend_string_init("_POST", sizeof("_POST")-1, 1), 0, php_auto_globals_create_post TSRMLS_CC); + zend_register_auto_global(zend_string_init("_COOKIE", sizeof("_COOKIE")-1, 1), 0, php_auto_globals_create_cookie TSRMLS_CC); + zend_register_auto_global(zend_string_init("_SERVER", sizeof("_SERVER")-1, 1), PG(auto_globals_jit), php_auto_globals_create_server TSRMLS_CC); + zend_register_auto_global(zend_string_init("_ENV", sizeof("_ENV")-1, 1), PG(auto_globals_jit), php_auto_globals_create_env TSRMLS_CC); + zend_register_auto_global(zend_string_init("_REQUEST", sizeof("_REQUEST")-1, 1), PG(auto_globals_jit), php_auto_globals_create_request TSRMLS_CC); + zend_register_auto_global(zend_string_init("_FILES", sizeof("_FILES")-1, 1), 0, php_auto_globals_create_files TSRMLS_CC); } /* diff --git a/main/rfc1867.c b/main/rfc1867.c index 2d76d6c975..263c214af3 100644 --- a/main/rfc1867.c +++ b/main/rfc1867.c @@ -78,14 +78,14 @@ static void safe_php_register_variable(char *var, char *strval, php_size_t val_l void php_rfc1867_register_constants(TSRMLS_D) /* {{{ */ { - REGISTER_MAIN_INT_CONSTANT("UPLOAD_ERR_OK", UPLOAD_ERROR_OK, CONST_CS | CONST_PERSISTENT); - REGISTER_MAIN_INT_CONSTANT("UPLOAD_ERR_INI_SIZE", UPLOAD_ERROR_A, CONST_CS | CONST_PERSISTENT); - REGISTER_MAIN_INT_CONSTANT("UPLOAD_ERR_FORM_SIZE", UPLOAD_ERROR_B, CONST_CS | CONST_PERSISTENT); - REGISTER_MAIN_INT_CONSTANT("UPLOAD_ERR_PARTIAL", UPLOAD_ERROR_C, CONST_CS | CONST_PERSISTENT); - REGISTER_MAIN_INT_CONSTANT("UPLOAD_ERR_NO_FILE", UPLOAD_ERROR_D, CONST_CS | CONST_PERSISTENT); - REGISTER_MAIN_INT_CONSTANT("UPLOAD_ERR_NO_TMP_DIR", UPLOAD_ERROR_E, CONST_CS | CONST_PERSISTENT); - REGISTER_MAIN_INT_CONSTANT("UPLOAD_ERR_CANT_WRITE", UPLOAD_ERROR_F, CONST_CS | CONST_PERSISTENT); - REGISTER_MAIN_INT_CONSTANT("UPLOAD_ERR_EXTENSION", UPLOAD_ERROR_X, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_OK", UPLOAD_ERROR_OK, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_INI_SIZE", UPLOAD_ERROR_A, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_FORM_SIZE", UPLOAD_ERROR_B, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_PARTIAL", UPLOAD_ERROR_C, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_NO_FILE", UPLOAD_ERROR_D, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_NO_TMP_DIR", UPLOAD_ERROR_E, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_CANT_WRITE", UPLOAD_ERROR_F, CONST_CS | CONST_PERSISTENT); + REGISTER_MAIN_LONG_CONSTANT("UPLOAD_ERR_EXTENSION", UPLOAD_ERROR_X, CONST_CS | CONST_PERSISTENT); } /* }}} */ @@ -701,7 +701,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; - php_int_t count = 0; + zend_long count = 0; if (php_rfc1867_encoding_translation(TSRMLS_C) && internal_encoding) { getword = php_rfc1867_getword; @@ -1034,12 +1034,12 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ } } - if (PG(upload_max_filesize) > 0 && (php_int_t)(total_bytes+blen) > PG(upload_max_filesize)) { + if (PG(upload_max_filesize) > 0 && (zend_long)(total_bytes+blen) > PG(upload_max_filesize)) { #if DEBUG_FILE_UPLOAD 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 && ((php_int_t)(total_bytes+blen) > max_file_size)) { + } else if (max_file_size && ((zend_long)(total_bytes+blen) > max_file_size)) { #if DEBUG_FILE_UPLOAD 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 @@ -1224,11 +1224,11 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ int size_overflow = 0; char file_size_buf[65]; - ZVAL_INT(&error_type, cancel_upload); + ZVAL_LONG(&error_type, cancel_upload); /* Add $foo[error] */ if (cancel_upload) { - ZVAL_INT(&file_size, 0); + ZVAL_LONG(&file_size, 0); } else { if (total_bytes > ZEND_INT_MAX) { #ifdef PHP_WIN32 @@ -1245,7 +1245,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ size_overflow = 1; } else { - ZVAL_INT(&file_size, total_bytes); + ZVAL_LONG(&file_size, total_bytes); } } diff --git a/main/snprintf.c b/main/snprintf.c index 7a55034341..8f32f3977d 100644 --- a/main/snprintf.c +++ b/main/snprintf.c @@ -793,7 +793,7 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) / if (free_zcopy) { zvp = &zcopy; } - s_len = Z_STRSIZE_P(zvp); + s_len = Z_STRLEN_P(zvp); s = Z_STRVAL_P(zvp); if (adjust_precision && precision < s_len) { s_len = precision; @@ -829,7 +829,7 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) / break; #endif case LM_PHP_INT_T: - i_num = (wide_int) va_arg(ap, php_uint_t); + i_num = (wide_int) va_arg(ap, zend_ulong); break; } /* @@ -874,7 +874,7 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) / break; #endif case LM_PHP_INT_T: - i_num = (wide_int) va_arg(ap, php_int_t); + i_num = (wide_int) va_arg(ap, zend_long); break; } } @@ -923,7 +923,7 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) / break; #endif case LM_PHP_INT_T: - ui_num = (u_wide_int) va_arg(ap, php_uint_t); + ui_num = (u_wide_int) va_arg(ap, zend_ulong); break; } s = ap_php_conv_p2(ui_num, 3, *fmt, &num_buf[NUM_BUF_SIZE], &s_len); @@ -965,7 +965,7 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) / break; #endif case LM_PHP_INT_T: - ui_num = (u_wide_int) va_arg(ap, php_uint_t); + ui_num = (u_wide_int) va_arg(ap, zend_ulong); break; } s = ap_php_conv_p2(ui_num, 4, *fmt, &num_buf[NUM_BUF_SIZE], &s_len); diff --git a/main/spprintf.c b/main/spprintf.c index 5c0310fd9d..0194722418 100644 --- a/main/spprintf.c +++ b/main/spprintf.c @@ -407,7 +407,7 @@ static void xbuf_format_converter(void *xbuf, zend_bool is_char, const char *fmt if (free_zcopy) { zvp = &zcopy; } - s_len = Z_STRSIZE_P(zvp); + s_len = Z_STRLEN_P(zvp); s = Z_STRVAL_P(zvp); if (adjust_precision && precision < s_len) { s_len = precision; @@ -443,7 +443,7 @@ static void xbuf_format_converter(void *xbuf, zend_bool is_char, const char *fmt break; #endif case LM_PHP_INT_T: - i_num = (wide_int) va_arg(ap, php_uint_t); + i_num = (wide_int) va_arg(ap, zend_ulong); break; } /* @@ -488,7 +488,7 @@ static void xbuf_format_converter(void *xbuf, zend_bool is_char, const char *fmt break; #endif case LM_PHP_INT_T: - i_num = (wide_int) va_arg(ap, php_int_t); + i_num = (wide_int) va_arg(ap, zend_long); break; } } @@ -536,7 +536,7 @@ static void xbuf_format_converter(void *xbuf, zend_bool is_char, const char *fmt break; #endif case LM_PHP_INT_T: - ui_num = (u_wide_int) va_arg(ap, php_uint_t); + ui_num = (u_wide_int) va_arg(ap, zend_ulong); break; } s = ap_php_conv_p2(ui_num, 3, *fmt, @@ -579,7 +579,7 @@ static void xbuf_format_converter(void *xbuf, zend_bool is_char, const char *fmt break; #endif case LM_PHP_INT_T: - ui_num = (u_wide_int) va_arg(ap, php_uint_t); + ui_num = (u_wide_int) va_arg(ap, zend_ulong); break; } s = ap_php_conv_p2(ui_num, 4, *fmt, diff --git a/main/streams/cast.c b/main/streams/cast.c index 4780d46eea..d26ceceeef 100644 --- a/main/streams/cast.c +++ b/main/streams/cast.c @@ -334,7 +334,7 @@ exit_success: * will be accessing the stream. Emit a warning so that the end-user will * know that they should try something else */ - php_error_docref(NULL TSRMLS_CC, E_WARNING, ZEND_INT_FMT " bytes of buffered data lost during stream conversion!", (php_int_t)(stream->writepos - stream->readpos)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, ZEND_INT_FMT " bytes of buffered data lost during stream conversion!", (zend_long)(stream->writepos - stream->readpos)); } if (castas == PHP_STREAM_AS_STDIO && ret) { diff --git a/main/streams/memory.c b/main/streams/memory.c index 71e9005fa7..f08c192581 100644 --- a/main/streams/memory.c +++ b/main/streams/memory.c @@ -741,7 +741,7 @@ static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, con ZVAL_COPY_VALUE(&ts->meta, &meta); } if (base64_comma) { - STR_FREE(base64_comma); + zend_string_free(base64_comma); } else { efree(comma); } diff --git a/main/streams/streams.c b/main/streams/streams.c index 1a6c4d24a0..88b6aeada1 100644 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -1101,7 +1101,7 @@ PHPAPI zend_string *php_stream_get_record(php_stream *stream, size_t maxlen, con } } - ret_buf = STR_ALLOC(tent_ret_len, 0); + ret_buf = zend_string_alloc(tent_ret_len, 0); /* php_stream_read will not call ops->read here because the necessary * data is guaranteedly buffered */ ret_buf->len = php_stream_read(stream, ret_buf->val, tent_ret_len); @@ -1445,7 +1445,7 @@ PHPAPI zend_string *_php_stream_copy_to_mem(php_stream *src, size_t maxlen, int } if (maxlen > 0) { - result = STR_ALLOC(maxlen, persistent); + result = zend_string_alloc(maxlen, persistent); ptr = result->val; while ((len < maxlen) && !php_stream_eof(src)) { ret = php_stream_read(src, ptr, maxlen - len); @@ -1459,7 +1459,7 @@ PHPAPI zend_string *_php_stream_copy_to_mem(php_stream *src, size_t maxlen, int *ptr = '\0'; result->len = len; } else { - STR_FREE(result); + zend_string_free(result); result = NULL; } return result; @@ -1477,13 +1477,13 @@ PHPAPI zend_string *_php_stream_copy_to_mem(php_stream *src, size_t maxlen, int max_len = step; } - result = STR_ALLOC(max_len, persistent); + result = zend_string_alloc(max_len, persistent); ptr = result->val; while ((ret = php_stream_read(src, ptr, max_len - len))) { len += ret; if (len + min_room >= max_len) { - result = STR_REALLOC(result, max_len + step, persistent); + result = zend_string_realloc(result, max_len + step, persistent); max_len += step; ptr = result->val + len; } else { @@ -1491,10 +1491,10 @@ PHPAPI zend_string *_php_stream_copy_to_mem(php_stream *src, size_t maxlen, int } } if (len) { - result = STR_REALLOC(result, len, persistent); + result = zend_string_realloc(result, len, persistent); result->val[len] = '\0'; } else { - STR_FREE(result); + zend_string_free(result); result = NULL; } @@ -2310,7 +2310,7 @@ PHPAPI int _php_stream_scandir(const char *dirname, zend_string **namelist[], in vector = (zend_string **) safe_erealloc(vector, vector_size, sizeof(char *), 0); } - vector[nfiles] = STR_INIT(sdp.d_name, strlen(sdp.d_name), 0); + vector[nfiles] = zend_string_init(sdp.d_name, strlen(sdp.d_name), 0); nfiles++; if(vector_size < 10 || nfiles == 0) { diff --git a/main/streams/transports.c b/main/streams/transports.c index 7f1d13faaa..a0c8d61aa6 100644 --- a/main/streams/transports.c +++ b/main/streams/transports.c @@ -46,7 +46,7 @@ PHPAPI int php_stream_xport_unregister(const char *protocol TSRMLS_DC) #define ERR_RETURN(out_err, local_err, fmt) \ if (out_err) { *out_err = local_err; } \ else { php_error_docref(NULL TSRMLS_CC, E_WARNING, fmt, local_err ? local_err->val : "Unspecified error"); \ - if (local_err) { STR_RELEASE(local_err); local_err = NULL; } \ + if (local_err) { zend_string_release(local_err); local_err = NULL; } \ } PHPAPI php_stream *_php_stream_xport_create(const char *name, size_t namelen, int options, @@ -164,7 +164,7 @@ PHPAPI php_stream *_php_stream_xport_create(const char *name, size_t namelen, in zval *ztmp = zbacklog; convert_to_int_ex(ztmp); - backlog = Z_IVAL_P(ztmp); + backlog = Z_LVAL_P(ztmp); if (ztmp != zbacklog) { zval_ptr_dtor(ztmp); } diff --git a/main/streams/userspace.c b/main/streams/userspace.c index 82ff445c4f..6561febec4 100644 --- a/main/streams/userspace.c +++ b/main/streams/userspace.c @@ -86,35 +86,35 @@ PHP_MINIT_FUNCTION(user_streams) if (le_protocols == FAILURE) return FAILURE; - REGISTER_INT_CONSTANT("STREAM_USE_PATH", USE_PATH, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_IGNORE_URL", IGNORE_URL, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_REPORT_ERRORS", REPORT_ERRORS, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_MUST_SEEK", STREAM_MUST_SEEK, CONST_CS|CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("STREAM_URL_STAT_LINK", PHP_STREAM_URL_STAT_LINK, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_URL_STAT_QUIET", PHP_STREAM_URL_STAT_QUIET, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_MKDIR_RECURSIVE", PHP_STREAM_MKDIR_RECURSIVE, CONST_CS|CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("STREAM_IS_URL", PHP_STREAM_IS_URL, CONST_CS|CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("STREAM_OPTION_BLOCKING", PHP_STREAM_OPTION_BLOCKING, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_OPTION_READ_TIMEOUT", PHP_STREAM_OPTION_READ_TIMEOUT, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_OPTION_READ_BUFFER", PHP_STREAM_OPTION_READ_BUFFER, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_OPTION_WRITE_BUFFER", PHP_STREAM_OPTION_WRITE_BUFFER, CONST_CS|CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("STREAM_BUFFER_NONE", PHP_STREAM_BUFFER_NONE, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_BUFFER_LINE", PHP_STREAM_BUFFER_LINE, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_BUFFER_FULL", PHP_STREAM_BUFFER_FULL, CONST_CS|CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("STREAM_CAST_AS_STREAM", PHP_STREAM_AS_STDIO, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_CAST_FOR_SELECT", PHP_STREAM_AS_FD_FOR_SELECT, CONST_CS|CONST_PERSISTENT); - - REGISTER_INT_CONSTANT("STREAM_META_TOUCH", PHP_STREAM_META_TOUCH, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_META_OWNER", PHP_STREAM_META_OWNER, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_META_OWNER_NAME", PHP_STREAM_META_OWNER_NAME, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_META_GROUP", PHP_STREAM_META_GROUP, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_META_GROUP_NAME", PHP_STREAM_META_GROUP_NAME, CONST_CS|CONST_PERSISTENT); - REGISTER_INT_CONSTANT("STREAM_META_ACCESS", PHP_STREAM_META_ACCESS, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_USE_PATH", USE_PATH, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_IGNORE_URL", IGNORE_URL, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_REPORT_ERRORS", REPORT_ERRORS, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_MUST_SEEK", STREAM_MUST_SEEK, CONST_CS|CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("STREAM_URL_STAT_LINK", PHP_STREAM_URL_STAT_LINK, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_URL_STAT_QUIET", PHP_STREAM_URL_STAT_QUIET, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_MKDIR_RECURSIVE", PHP_STREAM_MKDIR_RECURSIVE, CONST_CS|CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("STREAM_IS_URL", PHP_STREAM_IS_URL, CONST_CS|CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("STREAM_OPTION_BLOCKING", PHP_STREAM_OPTION_BLOCKING, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_OPTION_READ_TIMEOUT", PHP_STREAM_OPTION_READ_TIMEOUT, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_OPTION_READ_BUFFER", PHP_STREAM_OPTION_READ_BUFFER, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_OPTION_WRITE_BUFFER", PHP_STREAM_OPTION_WRITE_BUFFER, CONST_CS|CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("STREAM_BUFFER_NONE", PHP_STREAM_BUFFER_NONE, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_BUFFER_LINE", PHP_STREAM_BUFFER_LINE, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_BUFFER_FULL", PHP_STREAM_BUFFER_FULL, CONST_CS|CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("STREAM_CAST_AS_STREAM", PHP_STREAM_AS_STDIO, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_CAST_FOR_SELECT", PHP_STREAM_AS_FD_FOR_SELECT, CONST_CS|CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("STREAM_META_TOUCH", PHP_STREAM_META_TOUCH, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_META_OWNER", PHP_STREAM_META_OWNER, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_META_OWNER_NAME", PHP_STREAM_META_OWNER_NAME, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_META_GROUP", PHP_STREAM_META_GROUP, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_META_GROUP_NAME", PHP_STREAM_META_GROUP_NAME, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("STREAM_META_ACCESS", PHP_STREAM_META_ACCESS, CONST_CS|CONST_PERSISTENT); return SUCCESS; } @@ -367,7 +367,7 @@ static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, const char * /* call it's stream_open method - set up params first */ ZVAL_STRING(&args[0], filename); ZVAL_STRING(&args[1], mode); - ZVAL_INT(&args[2], options); + ZVAL_LONG(&args[2], options); ZVAL_NEW_REF(&args[3], &EG(uninitialized_zval)); ZVAL_STRING(&zfuncname, USERSTREAM_OPEN); @@ -385,7 +385,7 @@ static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, const char * /* if the opened path is set, copy it out */ if (Z_ISREF(args[3]) && Z_TYPE_P(Z_REFVAL(args[3])) == IS_STRING && opened_path) { - *opened_path = estrndup(Z_STRVAL_P(Z_REFVAL(args[3])), Z_STRSIZE_P(Z_REFVAL(args[3]))); + *opened_path = estrndup(Z_STRVAL_P(Z_REFVAL(args[3])), Z_STRLEN_P(Z_REFVAL(args[3]))); } /* set wrapper data to be a reference to our object */ @@ -443,7 +443,7 @@ static php_stream *user_wrapper_opendir(php_stream_wrapper *wrapper, const char /* call it's dir_open method - set up params first */ ZVAL_STRING(&args[0], filename); - ZVAL_INT(&args[1], options); + ZVAL_LONG(&args[1], options); ZVAL_STRING(&zfuncname, USERSTREAM_DIR_OPEN); @@ -490,7 +490,7 @@ PHP_FUNCTION(stream_wrapper_register) zend_string *protocol, *classname; struct php_user_stream_wrapper * uwrap; zend_resource *rsrc; - php_int_t flags = 0; + zend_long flags = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|l", &protocol, &classname, &flags) == FAILURE) { RETURN_FALSE; @@ -609,7 +609,7 @@ static size_t php_userstreamop_write(php_stream *stream, const char *buf, size_t didwrite = 0; if (call_result == SUCCESS && Z_TYPE(retval) != IS_UNDEF) { convert_to_int(&retval); - didwrite = Z_IVAL(retval); + didwrite = Z_LVAL(retval); } else if (call_result == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_WRITE " is not implemented!", us->wrapper->classname); @@ -619,7 +619,7 @@ static size_t php_userstreamop_write(php_stream *stream, const char *buf, size_t if (didwrite > count) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_WRITE " wrote " ZEND_INT_FMT " bytes more data than requested (" ZEND_INT_FMT " written, " ZEND_INT_FMT " max)", us->wrapper->classname, - (php_int_t)(didwrite - count), (php_int_t)didwrite, (php_int_t)count); + (zend_long)(didwrite - count), (zend_long)didwrite, (zend_long)count); didwrite = count; } @@ -641,7 +641,7 @@ static size_t php_userstreamop_read(php_stream *stream, char *buf, size_t count ZVAL_STRINGL(&func_name, USERSTREAM_READ, sizeof(USERSTREAM_READ)-1); - ZVAL_INT(&args[0], count); + ZVAL_LONG(&args[0], count); call_result = call_user_function_ex(NULL, Z_ISUNDEF(us->object)? NULL : &us->object, @@ -652,10 +652,10 @@ static size_t php_userstreamop_read(php_stream *stream, char *buf, size_t count if (call_result == SUCCESS && Z_TYPE(retval) != IS_UNDEF) { convert_to_string(&retval); - didread = Z_STRSIZE(retval); + didread = Z_STRLEN(retval); if (didread > count) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_READ " - read " ZEND_INT_FMT " bytes more data than requested (" ZEND_INT_FMT " read, " ZEND_INT_FMT " max) - excess data will be lost", - us->wrapper->classname, (php_int_t)(didread - count), (php_int_t)didread, (php_int_t)count); + us->wrapper->classname, (zend_long)(didread - count), (zend_long)didread, (zend_long)count); didread = count; } if (didread > 0) @@ -763,8 +763,8 @@ static int php_userstreamop_seek(php_stream *stream, off_t offset, int whence, o ZVAL_STRINGL(&func_name, USERSTREAM_SEEK, sizeof(USERSTREAM_SEEK)-1); - ZVAL_INT(&args[0], offset); - ZVAL_INT(&args[1], whence); + ZVAL_LONG(&args[0], offset); + ZVAL_LONG(&args[1], whence); call_result = call_user_function_ex(NULL, Z_ISUNDEF(us->object)? NULL : &us->object, @@ -807,8 +807,8 @@ static int php_userstreamop_seek(php_stream *stream, off_t offset, int whence, o &retval, 0, NULL, 0, NULL TSRMLS_CC); - if (call_result == SUCCESS && Z_TYPE(retval) == IS_INT) { - *newoffs = Z_IVAL(retval); + if (call_result == SUCCESS && Z_TYPE(retval) == IS_LONG) { + *newoffs = Z_LVAL(retval); ret = 0; } else if (call_result == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_TELL " is not implemented!", us->wrapper->classname); @@ -832,7 +832,7 @@ static int statbuf_from_array(zval *array, php_stream_statbuf *ssb TSRMLS_DC) if (NULL != (elem = zend_hash_str_find(Z_ARRVAL_P(array), #name, sizeof(#name)-1))) { \ SEPARATE_ZVAL(elem); \ convert_to_int(elem); \ - ssb->sb.st_##name2 = Z_IVAL_P(elem); \ + ssb->sb.st_##name2 = Z_LVAL_P(elem); \ } #define STAT_PROP_ENTRY(name) STAT_PROP_ENTRY_EX(name,name) @@ -927,20 +927,20 @@ static int php_userstreamop_set_option(php_stream *stream, int option, int value break; case PHP_STREAM_OPTION_LOCKING: - ZVAL_INT(&args[0], 0); + ZVAL_LONG(&args[0], 0); if (value & LOCK_NB) { - Z_IVAL_P(&args[0]) |= PHP_LOCK_NB; + Z_LVAL_P(&args[0]) |= PHP_LOCK_NB; } switch(value & ~LOCK_NB) { case LOCK_SH: - Z_IVAL_P(&args[0]) |= PHP_LOCK_SH; + Z_LVAL_P(&args[0]) |= PHP_LOCK_SH; break; case LOCK_EX: - Z_IVAL_P(&args[0]) |= PHP_LOCK_EX; + Z_LVAL_P(&args[0]) |= PHP_LOCK_EX; break; case LOCK_UN: - Z_IVAL_P(&args[0]) |= PHP_LOCK_UN; + Z_LVAL_P(&args[0]) |= PHP_LOCK_UN; break; } @@ -987,7 +987,7 @@ static int php_userstreamop_set_option(php_stream *stream, int option, int value case PHP_STREAM_TRUNCATE_SET_SIZE: { ptrdiff_t new_size = *(ptrdiff_t*) ptrparam; if (new_size >= 0 && new_size <= (ptrdiff_t)LONG_MAX) { - ZVAL_INT(&args[0], (long)new_size); + ZVAL_LONG(&args[0], (long)new_size); call_result = call_user_function_ex(NULL, Z_ISUNDEF(us->object)? NULL : &us->object, &func_name, @@ -1025,28 +1025,28 @@ static int php_userstreamop_set_option(php_stream *stream, int option, int value ZVAL_STRINGL(&func_name, USERSTREAM_SET_OPTION, sizeof(USERSTREAM_SET_OPTION)-1); - ZVAL_INT(&args[0], option); + ZVAL_LONG(&args[0], option); ZVAL_NULL(&args[1]); ZVAL_NULL(&args[2]); switch(option) { case PHP_STREAM_OPTION_READ_BUFFER: case PHP_STREAM_OPTION_WRITE_BUFFER: - ZVAL_INT(&args[1], value); + ZVAL_LONG(&args[1], value); if (ptrparam) { - ZVAL_INT(&args[2], *(long *)ptrparam); + ZVAL_LONG(&args[2], *(long *)ptrparam); } else { - ZVAL_INT(&args[2], BUFSIZ); + ZVAL_LONG(&args[2], BUFSIZ); } break; case PHP_STREAM_OPTION_READ_TIMEOUT: { struct timeval tv = *(struct timeval*)ptrparam; - ZVAL_INT(&args[1], tv.tv_sec); - ZVAL_INT(&args[2], tv.tv_usec); + ZVAL_LONG(&args[1], tv.tv_sec); + ZVAL_LONG(&args[2], tv.tv_usec); break; } case PHP_STREAM_OPTION_BLOCKING: - ZVAL_INT(&args[1], value); + ZVAL_LONG(&args[1], value); break; default: break; @@ -1189,8 +1189,8 @@ static int user_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url, int /* call the mkdir method */ ZVAL_STRING(&args[0], url); - ZVAL_INT(&args[1], mode); - ZVAL_INT(&args[2], options); + ZVAL_LONG(&args[1], mode); + ZVAL_LONG(&args[2], options); ZVAL_STRING(&zfuncname, USERSTREAM_MKDIR); @@ -1237,7 +1237,7 @@ static int user_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, /* call the rmdir method */ ZVAL_STRING(&args[0], url); - ZVAL_INT(&args[1], options); + ZVAL_LONG(&args[1], options); ZVAL_STRING(&zfuncname, USERSTREAM_RMDIR); @@ -1280,14 +1280,14 @@ static int user_wrapper_metadata(php_stream_wrapper *wrapper, const char *url, i array_init(&args[2]); if(value) { struct utimbuf *newtime = (struct utimbuf *)value; - add_index_int(&args[2], 0, newtime->modtime); - add_index_int(&args[2], 1, newtime->actime); + add_index_long(&args[2], 0, newtime->modtime); + add_index_long(&args[2], 1, newtime->actime); } break; case PHP_STREAM_META_GROUP: case PHP_STREAM_META_OWNER: case PHP_STREAM_META_ACCESS: - ZVAL_INT(&args[2], *(long *)value); + ZVAL_LONG(&args[2], *(long *)value); break; case PHP_STREAM_META_GROUP_NAME: case PHP_STREAM_META_OWNER_NAME: @@ -1308,7 +1308,7 @@ static int user_wrapper_metadata(php_stream_wrapper *wrapper, const char *url, i /* call the mkdir method */ ZVAL_STRING(&args[0], url); - ZVAL_INT(&args[1], option); + ZVAL_LONG(&args[1], option); ZVAL_STRING(&zfuncname, USERSTREAM_METADATA); @@ -1356,7 +1356,7 @@ static int user_wrapper_stat_url(php_stream_wrapper *wrapper, const char *url, i /* call it's stat_url method - set up params first */ ZVAL_STRING(&args[0], url); - ZVAL_INT(&args[1], flags); + ZVAL_LONG(&args[1], flags); ZVAL_STRING(&zfuncname, USERSTREAM_STATURL); @@ -1414,7 +1414,7 @@ static size_t php_userstreamop_readdir(php_stream *stream, char *buf, size_t cou if (call_result == SUCCESS && Z_TYPE(retval) != IS_FALSE && Z_TYPE(retval) != IS_TRUE) { convert_to_string(&retval); - PHP_STRLCPY(ent->d_name, Z_STRVAL(retval), sizeof(ent->d_name), Z_STRSIZE(retval)); + PHP_STRLCPY(ent->d_name, Z_STRVAL(retval), sizeof(ent->d_name), Z_STRLEN(retval)); didread = sizeof(php_stream_dirent); } else if (call_result == FAILURE) { @@ -1489,10 +1489,10 @@ static int php_userstreamop_cast(php_stream *stream, int castas, void **retptr T switch(castas) { case PHP_STREAM_AS_FD_FOR_SELECT: - ZVAL_INT(&args[0], PHP_STREAM_AS_FD_FOR_SELECT); + ZVAL_LONG(&args[0], PHP_STREAM_AS_FD_FOR_SELECT); break; default: - ZVAL_INT(&args[0], PHP_STREAM_AS_STDIO); + ZVAL_LONG(&args[0], PHP_STREAM_AS_STDIO); break; } diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c index d2aaef0bc3..25059afe32 100644 --- a/main/streams/xp_socket.c +++ b/main/streams/xp_socket.c @@ -103,7 +103,7 @@ retry: } estr = php_socket_strerror(err, NULL, 0); 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); + (zend_long)count, err, estr); efree(estr); } @@ -702,7 +702,7 @@ static inline int php_tcp_sockop_connect(php_stream *stream, php_netstream_data_ efree(host); return -1; } - bindto = parse_ip_address_ex(Z_STRVAL_P(tmpzval), Z_STRSIZE_P(tmpzval), &bindport, xparam->want_errortext, &xparam->outputs.error_text TSRMLS_CC); + bindto = parse_ip_address_ex(Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval), &bindport, xparam->want_errortext, &xparam->outputs.error_text TSRMLS_CC); } #ifdef SO_BROADCAST |