diff options
| author | Stanislav Malyshev <stas@php.net> | 2015-01-03 01:22:58 -0800 |
|---|---|---|
| committer | Stanislav Malyshev <stas@php.net> | 2015-01-10 15:07:38 -0800 |
| commit | b7a7b1a624c97945c0aaa49d46ae996fc0bdb6bc (patch) | |
| tree | 0e09490075ee4f9a75a77ef4168d8ee254c52e5b /main | |
| parent | 773c8b0c092a0e9ad5c5548815bcb9991d54d5c1 (diff) | |
| download | php-git-b7a7b1a624c97945c0aaa49d46ae996fc0bdb6bc.tar.gz | |
trailing whitespace removal
Diffstat (limited to 'main')
37 files changed, 218 insertions, 218 deletions
diff --git a/main/SAPI.c b/main/SAPI.c index b05b14be5e..d3e855b771 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -1,4 +1,4 @@ -/* +/* +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ @@ -136,7 +136,7 @@ PHP_FUNCTION(header_register_callback) if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &callback_func) == FAILURE) { return; } - + if (!zend_is_callable(callback_func, 0, NULL)) { RETURN_FALSE; } @@ -158,10 +158,10 @@ static void sapi_run_header_callback(void) zend_fcall_info fci; char *callback_error = NULL; zval retval; - + if (zend_fcall_info_init(&SG(callback_func), 0, &fci, &SG(fci_cache), NULL, &callback_error) == SUCCESS) { fci.retval = &retval; - + error = zend_call_function(&fci, &SG(fci_cache)); if (error == FAILURE) { goto callback_failed; @@ -172,10 +172,10 @@ static void sapi_run_header_callback(void) callback_failed: php_error_docref(NULL, E_WARNING, "Could not call the sapi_header_callback"); } - + if (callback_error) { efree(callback_error); - } + } } SAPI_API void sapi_handle_post(void *arg) @@ -401,11 +401,11 @@ SAPI_API void sapi_activate_headers_only(void) if (SG(request_info).headers_read == 1) return; SG(request_info).headers_read = 1; - zend_llist_init(&SG(sapi_headers).headers, sizeof(sapi_header_struct), + zend_llist_init(&SG(sapi_headers).headers, sizeof(sapi_header_struct), (void (*)(void *)) sapi_free_header, 0); SG(sapi_headers).send_default_content_type = 1; - /* SG(sapi_headers).http_response_code = 200; */ + /* SG(sapi_headers).http_response_code = 200; */ SG(sapi_headers).http_status_line = NULL; SG(sapi_headers).mimetype = NULL; SG(read_post_bytes) = 0; @@ -417,7 +417,7 @@ SAPI_API void sapi_activate_headers_only(void) SG(global_request_time) = 0; /* - * It's possible to override this general case in the activate() callback, + * It's possible to override this general case in the activate() callback, * if necessary. */ if (SG(request_info).request_method && !strcmp(SG(request_info).request_method, "HEAD")) { @@ -503,7 +503,7 @@ static void sapi_send_headers_free(void) SG(sapi_headers).http_status_line = NULL; } } - + SAPI_API void sapi_deactivate(void) { zend_llist_destroy(&SG(sapi_headers).headers); @@ -575,7 +575,7 @@ static int sapi_extract_response_code(const char *header_line) break; } } - + return code; } @@ -595,7 +595,7 @@ static void sapi_update_response_code(int ncode) SG(sapi_headers).http_response_code = ncode; } -/* +/* * since zend_llist_del_element only remove one matched item once, * we should remove them by ourself */ @@ -631,7 +631,7 @@ SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bo { sapi_header_line ctr = {0}; int r; - + ctr.line = header_line; ctr.line_len = header_line_len; @@ -725,7 +725,7 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg) } while(header_line_len && isspace(header_line[header_line_len-1])); header_line[header_line_len]='\0'; } - + if (op == SAPI_HEADER_DELETE) { if (strchr(header_line, ':')) { efree(header_line); @@ -768,7 +768,7 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg) sapi_header.header_len = header_line_len; /* Check the header for a few cases that we have special support for in SAPI */ - if (header_line_len>=5 + if (header_line_len>=5 && !strncasecmp(header_line, "HTTP/", 5)) { /* filter out the response code */ sapi_update_response_code(sapi_extract_response_code(header_line)); @@ -831,8 +831,8 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg) /* Return a Found Redirect if one is not already specified */ if (http_response_code) { /* user specified redirect code */ sapi_update_response_code(http_response_code); - } else if (SG(request_info).proto_num > 1000 && - SG(request_info).request_method && + } else if (SG(request_info).proto_num > 1000 && + SG(request_info).request_method && strcmp(SG(request_info).request_method, "HEAD") && strcmp(SG(request_info).request_method, "GET")) { sapi_update_response_code(303); @@ -1021,7 +1021,7 @@ SAPI_API zend_stat_t *sapi_get_stat(void) SAPI_API char *sapi_getenv(char *name, size_t name_len) { - if (sapi_module.getenv) { + if (sapi_module.getenv) { char *value, *tmp = sapi_module.getenv(name, name_len); if (tmp) { value = estrdup(tmp); diff --git a/main/SAPI.h b/main/SAPI.h index bb523604bd..a1ae0118df 100644 --- a/main/SAPI.h +++ b/main/SAPI.h @@ -38,9 +38,9 @@ #ifdef PHP_WIN32 # ifdef SAPI_EXPORTS -# define SAPI_API __declspec(dllexport) +# define SAPI_API __declspec(dllexport) # else -# define SAPI_API __declspec(dllimport) +# define SAPI_API __declspec(dllimport) # endif #elif defined(__GNUC__) && __GNUC__ >= 4 # define SAPI_API __attribute__ ((visibility("default"))) @@ -157,7 +157,7 @@ SAPI_API void sapi_initialize_empty_request(void); END_EXTERN_C() /* - * This is the preferred and maintained API for + * This is the preferred and maintained API for * operating on HTTP headers. */ @@ -166,7 +166,7 @@ END_EXTERN_C() * * sapi_header_line ctr = {0}; */ - + typedef struct { char *line; /* If you allocated this, you need to free it yourself */ uint line_len; @@ -267,7 +267,7 @@ struct _sapi_module_struct { int (*get_target_gid)(gid_t *); unsigned int (*input_filter)(int arg, char *var, char **val, size_t val_len, size_t *new_val_len); - + void (*ini_defaults)(HashTable *configuration_hash); int phpinfo_as_text; diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c index 9a53276be0..f794705adb 100644 --- a/main/fopen_wrappers.c +++ b/main/fopen_wrappers.c @@ -211,7 +211,7 @@ PHPAPI int php_check_specific_open_basedir(const char *basedir, const char *path if (path_len > 1 && path_tmp[path_len - 2] == ':') { if (path_len != 3) { return -1; - } + } /* this is c:\ */ path_tmp[path_len] = '\0'; } else { @@ -402,7 +402,7 @@ PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle) spprintf(&filename, 0, "%s%c%s%c%s", pw->pw_dir, PHP_DIR_SEPARATOR, PG(user_dir), PHP_DIR_SEPARATOR, s + 1); /* Safe */ } else { filename = SG(request_info).path_translated; - } + } #if defined(ZTS) && defined(HAVE_GETPWNAM_R) && defined(_SC_GETPW_R_SIZE_MAX) efree(pwbuf); #endif @@ -505,8 +505,8 @@ PHPAPI char *php_resolve_path(const char *filename, int filename_length, const c return NULL; } - if ((*filename == '.' && - (IS_SLASH(filename[1]) || + if ((*filename == '.' && + (IS_SLASH(filename[1]) || ((filename[1] == '.') && IS_SLASH(filename[2])))) || IS_ABSOLUTE_PATH(filename, filename_length) || !path || diff --git a/main/internal_functions_win32.c b/main/internal_functions_win32.c index cb0234b4c3..09fbce5272 100644 --- a/main/internal_functions_win32.c +++ b/main/internal_functions_win32.c @@ -1,4 +1,4 @@ -/* +/* +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ @@ -188,7 +188,7 @@ static zend_module_entry *php_builtin_extensions[] = { /* }}} */ #define EXTCOUNT (sizeof(php_builtin_extensions)/sizeof(zend_module_entry *)) - + PHPAPI int php_register_internal_extensions(void) { return php_register_extensions(php_builtin_extensions, EXTCOUNT); diff --git a/main/main.c b/main/main.c index 276058ca3a..cfbc04f12e 100644 --- a/main/main.c +++ b/main/main.c @@ -1195,7 +1195,7 @@ static void php_error_cb(int type, const char *error_filename, const uint error_ { /* new block to allow variable definition */ /* eval() errors do not affect exit_status or response code */ zend_bool during_eval = 0; - + if (type == E_PARSE) { zend_execute_data *execute_data = EG(current_execute_data); @@ -2473,7 +2473,7 @@ PHPAPI int php_execute_script(zend_file_handle *primary_file) { zend_file_handle *prepend_file_p, *append_file_p; zend_file_handle prepend_file = {0}, append_file = {0}; -#if HAVE_BROKEN_GETCWD +#if HAVE_BROKEN_GETCWD volatile int old_cwd_fd = -1; #else char *old_cwd; @@ -2639,7 +2639,7 @@ PHPAPI int php_handle_auth_data(const char *auth) SG(request_info).auth_user = estrndup(user->val, user->len); SG(request_info).auth_password = estrdup(pass); ret = 0; - } + } zend_string_free(user); } } diff --git a/main/output.c b/main/output.c index 09fde94b87..ec6b18b4f7 100644 --- a/main/output.c +++ b/main/output.c @@ -1507,7 +1507,7 @@ PHP_FUNCTION(ob_get_status) if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &full_status) == FAILURE) { return; } - + if (!OG(active)) { array_init(return_value); return; diff --git a/main/php.h b/main/php.h index 515d1bb9c1..2e79a844f6 100644 --- a/main/php.h +++ b/main/php.h @@ -387,7 +387,7 @@ END_EXTERN_C() #define PHP_MINFO_FUNCTION ZEND_MODULE_INFO_D #define PHP_GINIT_FUNCTION ZEND_GINIT_FUNCTION #define PHP_GSHUTDOWN_FUNCTION ZEND_GSHUTDOWN_FUNCTION - + #define PHP_MODULE_GLOBALS ZEND_MODULE_GLOBALS diff --git a/main/php_globals.h b/main/php_globals.h index 76933d8f07..e93d176294 100644 --- a/main/php_globals.h +++ b/main/php_globals.h @@ -89,7 +89,7 @@ struct _php_core_globals { char *upload_tmp_dir; zend_long upload_max_filesize; - + char *error_append_string; char *error_prepend_string; diff --git a/main/php_ini.c b/main/php_ini.c index ebdf526e96..45e27e844a 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -420,8 +420,8 @@ int php_init_config(void) SetLastError(0); - /*If the given bugger is not large enough to hold the data, the return value is - the buffer size, in characters, required to hold the string and its terminating + /*If the given bugger is not large enough to hold the data, the return value is + the buffer size, in characters, required to hold the string and its terminating null character. We use this return value to alloc the final buffer. */ size = GetEnvironmentVariableA("PHPRC", &dummybuf, 0); if (GetLastError() == ERROR_ENVVAR_NOT_FOUND) { diff --git a/main/php_main.h b/main/php_main.h index d821710acc..b4d888f145 100644 --- a/main/php_main.h +++ b/main/php_main.h @@ -1,4 +1,4 @@ -/* +/* +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ diff --git a/main/php_network.h b/main/php_network.h index 5a168cb0f9..ef17721c08 100644 --- a/main/php_network.h +++ b/main/php_network.h @@ -262,13 +262,13 @@ PHPAPI php_socket_t php_network_accept_incoming(php_socket_t srvsock, int *error_code ); -PHPAPI int php_network_get_sock_name(php_socket_t sock, +PHPAPI int php_network_get_sock_name(php_socket_t sock, zend_string **textaddr, struct sockaddr **addr, socklen_t *addrlen ); - -PHPAPI int php_network_get_peer_name(php_socket_t sock, + +PHPAPI int php_network_get_peer_name(php_socket_t sock, zend_string **textaddr, struct sockaddr **addr, socklen_t *addrlen diff --git a/main/php_output.h b/main/php_output.h index f2f5848280..acea05617e 100644 --- a/main/php_output.h +++ b/main/php_output.h @@ -130,10 +130,10 @@ typedef struct _php_output_handler { int level; size_t size; php_output_buffer buffer; - + void *opaq; void (*dtor)(void *opaq); - + union { php_output_handler_user_func_t *user; php_output_handler_context_func_t internal; diff --git a/main/php_reentrancy.h b/main/php_reentrancy.h index 5aac0262a8..8db03e539c 100644 --- a/main/php_reentrancy.h +++ b/main/php_reentrancy.h @@ -130,4 +130,4 @@ void reentrancy_shutdown(void); #define reentrancy_shutdown() #endif -#endif +#endif diff --git a/main/php_scandir.c b/main/php_scandir.c index 5275f3ddd3..4450a18be4 100644 --- a/main/php_scandir.c +++ b/main/php_scandir.c @@ -1,4 +1,4 @@ -/* +/* +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ @@ -35,7 +35,7 @@ #ifdef PHP_WIN32 #include "win32/param.h" #include "win32/readdir.h" -#endif +#endif #include <stdlib.h> #ifndef NETWARE @@ -86,7 +86,7 @@ PHPAPI int php_scandir(const char *dirname, struct dirent **namelist[], int (*se struct dirent **newv; if (vector_size == 0) { vector_size = 10; - } else { + } else { vector_size *= 2; } @@ -122,7 +122,7 @@ fail: free(vector[nfiles]); } free(vector); - return -1; + return -1; } #endif diff --git a/main/php_scandir.h b/main/php_scandir.h index 848f525732..81e2493177 100644 --- a/main/php_scandir.h +++ b/main/php_scandir.h @@ -1,4 +1,4 @@ -/* +/* +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ diff --git a/main/php_syslog.h b/main/php_syslog.h index d39fc9b5b2..df3615cee7 100644 --- a/main/php_syslog.h +++ b/main/php_syslog.h @@ -30,7 +30,7 @@ #endif #endif -/* +/* * The SCO OpenServer 5 Development System (not the UDK) * defines syslog to std_syslog. */ diff --git a/main/php_variables.c b/main/php_variables.c index 38df80d097..28e7091425 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -47,7 +47,7 @@ PHPAPI void php_register_variable_safe(char *var, char *strval, size_t str_len, { zval new_entry; assert(strval != NULL); - + /* Prepare value */ ZVAL_NEW_STR(&new_entry, zend_string_init(strval, str_len, 0)); php_register_variable_ex(var, &new_entry, track_vars_array); @@ -82,7 +82,7 @@ PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars while (*var_name && *var_name==' ') { var_name++; } - + /* * Prepare variable name */ @@ -168,7 +168,7 @@ PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars return; } *ip = 0; - new_idx_len = strlen(index_s); + new_idx_len = strlen(index_s); } if (!index) { @@ -216,7 +216,7 @@ plain_var: zval_ptr_dtor(&gpc_element); } } else { - /* + /* * According to rfc2965, more specific paths are listed above the less specific ones. * If we encounter a duplicate cookie name, we should skip it, since it is not possible * to have the same (plain text) cookie name for the same path and we should not overwrite @@ -361,7 +361,7 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data) int free_buffer = 0; char *strtok_buf = NULL; zend_long count = 0; - + ZVAL_UNDEF(&array); switch (arg) { case PARSE_POST: @@ -427,9 +427,9 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data) separator = ";\0"; break; } - + var = php_strtok_r(res, separator, &strtok_buf); - + while (var) { val = strchr(var, '='); @@ -524,11 +524,11 @@ static void php_build_argv(char *s, zval *track_vars_array) zval arr, argc, tmp; int count = 0; char *ss, *space; - + if (!(SG(request_info).argc || track_vars_array)) { return; } - + array_init(&arr); /* Prepare argv */ @@ -536,7 +536,7 @@ static void php_build_argv(char *s, zval *track_vars_array) int i; 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) { + if (zend_hash_next_index_insert(Z_ARRVAL(arr), &tmp) == NULL) { zend_string_free(Z_STR(tmp)); } } @@ -573,7 +573,7 @@ static void php_build_argv(char *s, zval *track_vars_array) Z_ADDREF(arr); zend_hash_str_update(&EG(symbol_table).ht, "argv", sizeof("argv")-1, &arr); zend_hash_str_add(&EG(symbol_table).ht, "argc", sizeof("argc")-1, &argc); - } + } if (track_vars_array && Z_TYPE_P(track_vars_array) == IS_ARRAY) { Z_ADDREF(arr); zend_hash_str_update(Z_ARRVAL_P(track_vars_array), "argv", sizeof("argv")-1, &arr); @@ -635,7 +635,7 @@ static void php_autoglobal_merge(HashTable *dest, HashTable *src) Z_ADDREF_P(src_entry); } if (string_key) { - if (!globals_check || string_key->len != sizeof("GLOBALS") - 1 + if (!globals_check || string_key->len != sizeof("GLOBALS") - 1 || memcmp(string_key->val, "GLOBALS", sizeof("GLOBALS") - 1)) { zend_hash_update(dest, string_key, src_entry); } else if (Z_REFCOUNTED_P(src_entry)) { @@ -676,7 +676,7 @@ static zend_bool php_auto_globals_create_get(zend_string *name) zend_hash_update(&EG(symbol_table).ht, name, &PG(http_globals)[TRACK_VARS_GET]); Z_ADDREF(PG(http_globals)[TRACK_VARS_GET]); - + return 0; /* don't rearm */ } @@ -695,7 +695,7 @@ static zend_bool php_auto_globals_create_post(zend_string *name) zend_hash_update(&EG(symbol_table).ht, name, &PG(http_globals)[TRACK_VARS_POST]); Z_ADDREF(PG(http_globals)[TRACK_VARS_POST]); - + return 0; /* don't rearm */ } @@ -710,7 +710,7 @@ static zend_bool php_auto_globals_create_cookie(zend_string *name) zend_hash_update(&EG(symbol_table).ht, name, &PG(http_globals)[TRACK_VARS_COOKIE]); Z_ADDREF(PG(http_globals)[TRACK_VARS_COOKIE]); - + return 0; /* don't rearm */ } @@ -722,7 +722,7 @@ static zend_bool php_auto_globals_create_files(zend_string *name) zend_hash_update(&EG(symbol_table).ht, name, &PG(http_globals)[TRACK_VARS_FILES]); Z_ADDREF(PG(http_globals)[TRACK_VARS_FILES]); - + return 0; /* don't rearm */ } @@ -734,7 +734,7 @@ static zend_bool php_auto_globals_create_server(zend_string *name) if (PG(register_argc_argv)) { if (SG(request_info).argc) { zval *argc, *argv; - + if ((argc = zend_hash_str_find(&EG(symbol_table).ht, "argc", sizeof("argc")-1)) != NULL && (argv = zend_hash_str_find(&EG(symbol_table).ht, "argv", sizeof("argv")-1)) != NULL) { Z_ADDREF_P(argv); @@ -745,7 +745,7 @@ static zend_bool php_auto_globals_create_server(zend_string *name) php_build_argv(SG(request_info).query_string, &PG(http_globals)[TRACK_VARS_SERVER]); } } - + } else { zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_SERVER]); array_init(&PG(http_globals)[TRACK_VARS_SERVER]); @@ -753,7 +753,7 @@ static zend_bool php_auto_globals_create_server(zend_string *name) zend_hash_update(&EG(symbol_table).ht, name, &PG(http_globals)[TRACK_VARS_SERVER]); Z_ADDREF(PG(http_globals)[TRACK_VARS_SERVER]); - + return 0; /* don't rearm */ } @@ -761,7 +761,7 @@ static zend_bool php_auto_globals_create_env(zend_string *name) { zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_ENV]); array_init(&PG(http_globals)[TRACK_VARS_ENV]); - + if (PG(variables_order) && (strchr(PG(variables_order),'E') || strchr(PG(variables_order),'e'))) { php_import_environment_variables(&PG(http_globals)[TRACK_VARS_ENV]); } diff --git a/main/reentrancy.c b/main/reentrancy.c index 4aca23eb1a..1df0f37b66 100644 --- a/main/reentrancy.c +++ b/main/reentrancy.c @@ -125,19 +125,19 @@ PHPAPI struct tm *php_gmtime_r(const time_t *const timep, struct tm *p_tm) #if !defined(HAVE_POSIX_READDIR_R) -PHPAPI int php_readdir_r(DIR *dirp, struct dirent *entry, +PHPAPI int php_readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result) { #if defined(HAVE_OLD_READDIR_R) int ret = 0; - + /* We cannot rely on the return value of readdir_r as it differs between various platforms (HPUX returns 0 on success whereas Solaris returns non-zero) */ entry->d_name[0] = '\0'; readdir_r(dirp, entry); - + if (entry->d_name[0] == '\0') { *result = NULL; ret = errno; @@ -150,11 +150,11 @@ PHPAPI int php_readdir_r(DIR *dirp, struct dirent *entry, int ret = 0; local_lock(READDIR_R); - + errno = 0; - + ptr = readdir(dirp); - + if (!ptr && errno != 0) ret = errno; @@ -176,7 +176,7 @@ PHPAPI int php_readdir_r(DIR *dirp, struct dirent *entry, PHPAPI struct tm *php_localtime_r(const time_t *const timep, struct tm *p_tm) { struct tm *tmp; - + local_lock(LOCALTIME_R); tmp = localtime(timep); @@ -184,7 +184,7 @@ PHPAPI struct tm *php_localtime_r(const time_t *const timep, struct tm *p_tm) memcpy(p_tm, tmp, sizeof(struct tm)); tmp = p_tm; } - + local_unlock(LOCALTIME_R); return tmp; @@ -197,14 +197,14 @@ PHPAPI struct tm *php_localtime_r(const time_t *const timep, struct tm *p_tm) PHPAPI char *php_ctime_r(const time_t *clock, char *buf) { char *tmp; - + local_lock(CTIME_R); tmp = ctime(clock); strcpy(buf, tmp); local_unlock(CTIME_R); - + return buf; } @@ -215,7 +215,7 @@ PHPAPI char *php_ctime_r(const time_t *clock, char *buf) PHPAPI char *php_asctime_r(const struct tm *tm, char *buf) { char *tmp; - + local_lock(ASCTIME_R); tmp = asctime(tm); @@ -233,7 +233,7 @@ PHPAPI char *php_asctime_r(const struct tm *tm, char *buf) PHPAPI struct tm *php_gmtime_r(const time_t *const timep, struct tm *p_tm) { struct tm *tmp; - + local_lock(GMTIME_R); tmp = gmtime(timep); @@ -241,7 +241,7 @@ PHPAPI struct tm *php_gmtime_r(const time_t *const timep, struct tm *p_tm) memcpy(p_tm, tmp, sizeof(struct tm)); tmp = p_tm; } - + local_unlock(GMTIME_R); return tmp; @@ -346,11 +346,11 @@ php_rand_r(unsigned int *ctx) * * 1. Redistributions of source code must retain the above copyright * notices, this list of conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright * notices, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * diff --git a/main/rfc1867.c b/main/rfc1867.c index 4ff6507465..47d38857ee 100644 --- a/main/rfc1867.c +++ b/main/rfc1867.c @@ -891,7 +891,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ if (count == PG(max_input_vars) + 1) { php_error_docref(NULL, E_WARNING, "Input variables exceeded " ZEND_LONG_FMT ". To increase the limit change max_input_vars in php.ini.", PG(max_input_vars)); } - + if (php_rfc1867_callback != NULL) { multipart_event_formdata event_formdata; diff --git a/main/rfc1867.h b/main/rfc1867.h index 8df4fa8b52..cb7e25c78f 100644 --- a/main/rfc1867.h +++ b/main/rfc1867.h @@ -54,7 +54,7 @@ typedef struct _multipart_event_file_data { zend_off_t offset; char *data; size_t length; - size_t *newlength; + size_t *newlength; } multipart_event_file_data; typedef struct _multipart_event_file_end { @@ -86,6 +86,6 @@ SAPI_API void php_rfc1867_set_multibyte_callbacks( php_rfc1867_set_input_encoding_t set_input_encoding, php_rfc1867_getword_t getword, php_rfc1867_getword_conf_t getword_conf, - php_rfc1867_basename_t basename); + php_rfc1867_basename_t basename); #endif /* RFC1867_H */ diff --git a/main/snprintf.c b/main/snprintf.c index b9867ebcee..a5fa099735 100644 --- a/main/snprintf.c +++ b/main/snprintf.c @@ -702,7 +702,7 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) / precision = 0; } else precision = 0; - + if (precision > FORMAT_CONV_MAX_PRECISION) { precision = FORMAT_CONV_MAX_PRECISION; } @@ -805,7 +805,7 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) / s = Z_STRVAL_P(zvp); if (adjust_precision && precision < s_len) { s_len = precision; - } + } break; } case 'u': diff --git a/main/spprintf.c b/main/spprintf.c index f860ee3dff..ac415902bd 100644 --- a/main/spprintf.c +++ b/main/spprintf.c @@ -310,7 +310,7 @@ static void xbuf_format_converter(void *xbuf, zend_bool is_char, const char *fmt precision = 0; } else precision = 0; - + if (precision > FORMAT_CONV_MAX_PRECISION) { precision = FORMAT_CONV_MAX_PRECISION; } @@ -378,7 +378,7 @@ static void xbuf_format_converter(void *xbuf, zend_bool is_char, const char *fmt break; case 'p': { char __next = *(fmt+1); - if ('d' == __next || 'u' == __next || 'x' == __next || 'o' == __next) { + if ('d' == __next || 'u' == __next || 'x' == __next || 'o' == __next) { fmt++; modifier = LM_PHP_INT_T; } else { diff --git a/main/streams/cast.c b/main/streams/cast.c index 83236fa47f..1bdcd91e34 100644 --- a/main/streams/cast.c +++ b/main/streams/cast.c @@ -147,7 +147,7 @@ static COOKIE_IO_FUNCTIONS_T stream_cookie_functions = * Result should have at least size 5, e.g. to write wbx+\0 */ void php_stream_mode_sanitize_fdopen_fopencookie(php_stream *stream, char *result) { - /* replace modes not supported by fdopen and fopencookie, but supported + /* replace modes not supported by fdopen and fopencookie, but supported * by PHP's fread(), so that their calls won't fail */ const char *cur_mode = stream->mode; int has_plus = 0, @@ -165,7 +165,7 @@ void php_stream_mode_sanitize_fdopen_fopencookie(php_stream *stream, char *resul /* x is allowed (at least by glibc & compat), but not as the 1st mode * as in PHP and in any case is (at best) ignored by fdopen and fopencookie */ } - + /* assume current mode has at most length 4 (e.g. wbn+) */ for (i = 1; i < 4 && cur_mode[i] != '\0'; i++) { if (cur_mode[i] == 'b') { diff --git a/main/streams/filter.c b/main/streams/filter.c index 62d27e5ee7..67a6caa8d2 100644 --- a/main/streams/filter.c +++ b/main/streams/filter.c @@ -78,18 +78,18 @@ PHPAPI php_stream_bucket *php_stream_bucket_new(php_stream *stream, char *buf, s if (bucket == NULL) { return NULL; } - + bucket->next = bucket->prev = NULL; if (is_persistent && !buf_persistent) { /* all data in a persistent bucket must also be persistent */ bucket->buf = pemalloc(buflen, 1); - + if (bucket->buf == NULL) { pefree(bucket, 1); return NULL; } - + memcpy(bucket->buf, buf, buflen); bucket->buflen = buflen; bucket->own_buf = 1; @@ -117,7 +117,7 @@ PHPAPI php_stream_bucket *php_stream_bucket_make_writeable(php_stream_bucket *bu php_stream_bucket *retval; php_stream_bucket_unlink(bucket); - + if (bucket->refcount == 1 && bucket->own_buf) { return bucket; } @@ -132,7 +132,7 @@ PHPAPI php_stream_bucket *php_stream_bucket_make_writeable(php_stream_bucket *bu retval->own_buf = 1; php_stream_bucket_delref(bucket); - + return retval; } @@ -151,16 +151,16 @@ PHPAPI int php_stream_bucket_split(php_stream_bucket *in, php_stream_bucket **le (*left)->refcount = 1; (*left)->own_buf = 1; (*left)->is_persistent = in->is_persistent; - + (*right)->buflen = in->buflen - length; (*right)->buf = pemalloc((*right)->buflen, in->is_persistent); memcpy((*right)->buf, in->buf + length, (*right)->buflen); (*right)->refcount = 1; (*right)->own_buf = 1; (*right)->is_persistent = in->is_persistent; - + return SUCCESS; - + exit_fail: if (*right) { if ((*right)->buf) { @@ -234,7 +234,7 @@ PHPAPI void php_stream_bucket_unlink(php_stream_bucket *bucket) bucket->brigade = NULL; bucket->next = bucket->prev = NULL; } - + @@ -256,7 +256,7 @@ PHPAPI php_stream_filter *php_stream_filter_create(const char *filtername, zval char *period; n = (int)strlen(filtername); - + if (NULL != (factory = zend_hash_str_find_ptr(filter_hash, filtername, n))) { filter = factory->create_filter(filtername, filterparams, persistent); } else if ((period = strrchr(filtername, '.'))) { @@ -286,7 +286,7 @@ PHPAPI php_stream_filter *php_stream_filter_create(const char *filtername, zval else php_error_docref(NULL, E_WARNING, "unable to create or locate filter \"%s\"", filtername); } - + return filter; } @@ -300,7 +300,7 @@ PHPAPI php_stream_filter *_php_stream_filter_alloc(php_stream_filter_ops *fops, filter->fops = fops; Z_PTR(filter->abstract) = abstract; filter->is_persistent = persistent; - + return filter; } @@ -379,7 +379,7 @@ PHPAPI int php_stream_filter_append_ex(php_stream_filter_chain *chain, php_strea return FAILURE; case PSFS_FEED_ME: /* We don't actually need data yet, - leave this filter in a feed me state until data is needed. + leave this filter in a feed me state until data is needed. Reset stream's internal read buffer since the filter is "holding" it. */ stream->readpos = 0; stream->writepos = 0; diff --git a/main/streams/glob_wrapper.c b/main/streams/glob_wrapper.c index 7822265ea3..f13db43ccb 100644 --- a/main/streams/glob_wrapper.c +++ b/main/streams/glob_wrapper.c @@ -72,7 +72,7 @@ PHPAPI char* _php_glob_stream_get_path(php_stream *stream, int copy, size_t *ple PHPAPI char* _php_glob_stream_get_pattern(php_stream *stream, int copy, size_t *plen STREAMS_DC) /* {{{ */ { glob_s_t *pglob = (glob_s_t *)stream->abstract; - + if (pglob && pglob->pattern) { if (plen) { *plen = pglob->pattern_len; @@ -225,7 +225,7 @@ static php_stream *php_glob_stream_opener(php_stream_wrapper *wrapper, const cha } pglob = ecalloc(sizeof(*pglob), 1); - + if (0 != (ret = glob(path, pglob->flags & GLOB_FLAGMASK, NULL, &pglob->glob))) { #ifdef GLOB_NOMATCH if (GLOB_NOMATCH != ret) diff --git a/main/streams/memory.c b/main/streams/memory.c index b2dca2115c..6757f6ed41 100644 --- a/main/streams/memory.c +++ b/main/streams/memory.c @@ -209,7 +209,7 @@ static int php_stream_memory_stat(php_stream *stream, php_stream_statbuf *ssb) / memset(ssb, 0, sizeof(php_stream_statbuf)); /* read-only across the board */ - + ssb->sb.st_mode = ms->mode & TEMP_STREAM_READONLY ? 0444 : 0666; ssb->sb.st_size = ms->fsize; @@ -248,7 +248,7 @@ static int php_stream_memory_set_option(php_stream *stream, int option, int valu { php_stream_memory_data *ms = (php_stream_memory_data*)stream->abstract; size_t newsize; - + switch(option) { case PHP_STREAM_OPTION_TRUNCATE_API: switch (value) { @@ -277,7 +277,7 @@ static int php_stream_memory_set_option(php_stream *stream, int option, int valu } } /* }}} */ - + PHPAPI php_stream_ops php_stream_memory_ops = { php_stream_memory_write, php_stream_memory_read, php_stream_memory_close, php_stream_memory_flush, @@ -301,7 +301,7 @@ PHPAPI php_stream *_php_stream_memory_create(int mode STREAMS_DC) self->fsize = 0; self->smax = ~0u; self->mode = mode; - + stream = php_stream_alloc_rel(&php_stream_memory_ops, self, 0, mode & TEMP_STREAM_READONLY ? "rb" : "w+b"); stream->flags |= PHP_STREAM_FLAG_NO_BUFFER; return stream; @@ -317,7 +317,7 @@ PHPAPI php_stream *_php_stream_memory_open(int mode, char *buf, size_t length ST if ((stream = php_stream_memory_create_rel(mode)) != NULL) { ms = (php_stream_memory_data*)stream->abstract; - + if (mode == TEMP_STREAM_READONLY || mode == TEMP_STREAM_TAKE_BUFFER) { /* use the buffer directly */ ms->data = buf; @@ -397,11 +397,11 @@ static size_t php_stream_temp_read(php_stream *stream, char *buf, size_t count) if (!ts->innerstream) { return -1; } - + got = php_stream_read(ts->innerstream, buf, count); - + stream->eof = ts->innerstream->eof; - + return got; } /* }}} */ @@ -420,7 +420,7 @@ static int php_stream_temp_close(php_stream *stream, int close_handle) } else { ret = 0; } - + zval_ptr_dtor(&ts->meta); if (ts->tmpdir) { @@ -460,7 +460,7 @@ static int php_stream_temp_seek(php_stream *stream, zend_off_t offset, int whenc ret = php_stream_seek(ts->innerstream, offset, whence); *newoffs = php_stream_tell(ts->innerstream); stream->eof = ts->innerstream->eof; - + return ret; } /* }}} */ @@ -502,7 +502,7 @@ static int php_stream_temp_cast(php_stream *stream, int castas, void **ret) file = php_stream_fopen_tmpfile(); php_stream_write(file, membuf, memsize); pos = php_stream_tell(ts->innerstream); - + php_stream_free_enclosed(ts->innerstream, PHP_STREAM_FREE_CLOSE); ts->innerstream = file; php_stream_encloses(stream, ts->innerstream); @@ -526,7 +526,7 @@ static int php_stream_temp_stat(php_stream *stream, php_stream_statbuf *ssb) /* static int php_stream_temp_set_option(php_stream *stream, int option, int value, void *ptrparam) /* {{{ */ { php_stream_temp_data *ts = (php_stream_temp_data*)stream->abstract; - + switch(option) { case PHP_STREAM_OPTION_META_DATA_API: if (Z_TYPE(ts->meta) != IS_UNDEF) { @@ -651,7 +651,7 @@ static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, con dlen -= mlen; semi = memchr(path, ';', mlen); sep = memchr(path, '/', mlen); - + if (!semi && !sep) { php_stream_wrapper_log_error(wrapper, options, "rfc2397: illegal media type"); return NULL; diff --git a/main/streams/mmap.c b/main/streams/mmap.c index 3eee859c13..17e88554d8 100644 --- a/main/streams/mmap.c +++ b/main/streams/mmap.c @@ -25,7 +25,7 @@ PHPAPI char *_php_stream_mmap_range(php_stream *stream, size_t offset, size_t length, php_stream_mmap_operation_t mode, size_t *mapped_len) { php_stream_mmap_range range; - + range.offset = offset; range.length = length; range.mode = mode; @@ -36,7 +36,7 @@ PHPAPI char *_php_stream_mmap_range(php_stream *stream, size_t offset, size_t le if (length > 4 * 1024 * 1024) { return NULL; } - + if (PHP_STREAM_OPTION_RETURN_OK == php_stream_set_option(stream, PHP_STREAM_OPTION_MMAP_API, PHP_STREAM_MMAP_MAP_RANGE, &range)) { if (mapped_len) { *mapped_len = range.length; diff --git a/main/streams/php_stream_context.h b/main/streams/php_stream_context.h index 836cd9cadb..404e9bdbc3 100644 --- a/main/streams/php_stream_context.h +++ b/main/streams/php_stream_context.h @@ -93,7 +93,7 @@ END_EXTERN_C() #define php_stream_notify_info(context, code, xmsg, xcode) do { if ((context) && (context)->notifier) { \ php_stream_notification_notify((context), (code), PHP_STREAM_NOTIFY_SEVERITY_INFO, \ (xmsg), (xcode), 0, 0, NULL); } } while (0) - + #define php_stream_notify_progress(context, bsofar, bmax) do { if ((context) && (context)->notifier) { \ php_stream_notification_notify((context), PHP_STREAM_NOTIFY_PROGRESS, PHP_STREAM_NOTIFY_SEVERITY_INFO, \ NULL, 0, (bsofar), (bmax), NULL); } } while(0) @@ -112,11 +112,11 @@ END_EXTERN_C() #define php_stream_notify_file_size(context, file_size, xmsg, xcode) do { if ((context) && (context)->notifier) { \ php_stream_notification_notify((context), PHP_STREAM_NOTIFY_FILE_SIZE_IS, PHP_STREAM_NOTIFY_SEVERITY_INFO, \ (xmsg), (xcode), 0, (file_size), NULL); } } while(0) - + #define php_stream_notify_error(context, code, xmsg, xcode) do { if ((context) && (context)->notifier) {\ php_stream_notification_notify((context), (code), PHP_STREAM_NOTIFY_SEVERITY_ERR, \ (xmsg), (xcode), 0, 0, NULL); } } while(0) - + /* * Local variables: diff --git a/main/streams/php_stream_filter_api.h b/main/streams/php_stream_filter_api.h index 7c9248ecc1..3c626fd59d 100644 --- a/main/streams/php_stream_filter_api.h +++ b/main/streams/php_stream_filter_api.h @@ -26,7 +26,7 @@ * it is intentially a light-weight implementation. * * Each stream can have a chain of filters for reading and another for writing. - * + * * When data is written to the stream, it is placed into a bucket and placed at * the start of the input brigade. * @@ -50,7 +50,7 @@ struct _php_stream_bucket { /* if non-zero, buf should be pefreed when the bucket is destroyed */ int own_buf; int is_persistent; - + /* destroy this struct when refcount falls to zero */ int refcount; }; @@ -91,11 +91,11 @@ typedef struct _php_stream_filter_ops { size_t *bytes_consumed, int flags ); - + void (*dtor)(php_stream_filter *thisfilter); - + const char *label; - + } php_stream_filter_ops; typedef struct _php_stream_filter_chain { diff --git a/main/streams/php_stream_mmap.h b/main/streams/php_stream_mmap.h index e58b703095..fa17325481 100644 --- a/main/streams/php_stream_mmap.h +++ b/main/streams/php_stream_mmap.h @@ -37,7 +37,7 @@ typedef enum { /* Unmap the last range that was mapped for the stream */ PHP_STREAM_MMAP_UNMAP } php_stream_mmap_operation_t; - + typedef enum { PHP_STREAM_MAP_MODE_READONLY, PHP_STREAM_MAP_MODE_READWRITE, @@ -50,9 +50,9 @@ typedef struct { * If length is 0, the whole file is mapped */ size_t offset; size_t length; - + php_stream_mmap_access_t mode; - + /* returned mapped address */ char *mapped; diff --git a/main/streams/php_streams_int.h b/main/streams/php_streams_int.h index ac0163ddb4..d59f0287df 100644 --- a/main/streams/php_streams_int.h +++ b/main/streams/php_streams_int.h @@ -49,7 +49,7 @@ #define CHUNK_SIZE 8192 #ifdef PHP_WIN32 -# ifdef EWOULDBLOCK +# ifdef EWOULDBLOCK # undef EWOULDBLOCK # endif # define EWOULDBLOCK WSAEWOULDBLOCK diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c index acb34b8968..f52383dfbf 100644 --- a/main/streams/plain_wrapper.c +++ b/main/streams/plain_wrapper.c @@ -122,7 +122,7 @@ typedef struct { unsigned is_pipe:1; /* don't try and seek */ unsigned cached_fstat:1; /* sb is valid */ unsigned _reserved:29; - + int lock_flag; /* stores the lock state */ char *temp_file_name; /* if non-null, this is the path to a temporary file that * is to be deleted when the stream is closed */ @@ -148,7 +148,7 @@ static int do_fstat(php_stdio_stream_data *d, int force) if (!d->cached_fstat || force) { int fd; int r; - + PHP_STDIOP_GET_FD(fd, d); r = zend_fstat(fd, &d->sb); d->cached_fstat = r == 0; @@ -161,7 +161,7 @@ static int do_fstat(php_stdio_stream_data *d, int force) static php_stream *_php_stream_fopen_from_fd_int(int fd, const char *mode, const char *persistent_id STREAMS_DC) { php_stdio_stream_data *self; - + self = pemalloc_rel_orig(sizeof(*self), persistent_id); memset(self, 0, sizeof(*self)); self->file = NULL; @@ -170,14 +170,14 @@ static php_stream *_php_stream_fopen_from_fd_int(int fd, const char *mode, const self->is_process_pipe = 0; self->temp_file_name = NULL; self->fd = fd; - + return php_stream_alloc_rel(&php_stream_stdio_ops, self, persistent_id, mode); } static php_stream *_php_stream_fopen_from_file_int(FILE *file, const char *mode STREAMS_DC) { php_stdio_stream_data *self; - + self = emalloc_rel_orig(sizeof(*self)); memset(self, 0, sizeof(*self)); self->file = file; @@ -211,7 +211,7 @@ PHPAPI php_stream *_php_stream_fopen_temporary_file(const char *dir, const char self->temp_file_name = opened_path; self->lock_flag = LOCK_UN; - + return stream; } close(fd); @@ -249,7 +249,7 @@ PHPAPI php_stream *_php_stream_fopen_from_fd(int fd, const char *mode, const cha } } #endif - + if (self->is_pipe) { stream->flags |= PHP_STREAM_FLAG_NO_SEEK; } else { @@ -288,7 +288,7 @@ PHPAPI php_stream *_php_stream_fopen_from_file(FILE *file, const char *mode STRE } } #endif - + if (self->is_pipe) { stream->flags |= PHP_STREAM_FLAG_NO_SEEK; } else { @@ -389,9 +389,9 @@ static size_t php_stdiop_read(php_stream *stream, char *buf, size_t count) so script can retry if desired */ ret = read(data->fd, buf, PLAIN_WRAP_BUF_SIZE(count)); } - + stream->eof = (ret == 0 || (ret == (size_t)-1 && errno != EWOULDBLOCK && errno != EINTR && errno != EBADF)); - + } else { #if HAVE_FLUSHIO if (!data->is_pipe && data->last_op == 'w') @@ -428,7 +428,7 @@ static int php_stdiop_close(php_stream *stream, int close_handle) data->file_mapping = NULL; } #endif - + if (close_handle) { if (data->file) { if (data->is_process_pipe) { @@ -498,14 +498,14 @@ static int php_stdiop_seek(php_stream *stream, zend_off_t offset, int whence, ze if (data->fd >= 0) { zend_off_t result; - + result = zend_lseek(data->fd, offset, whence); if (result == (zend_off_t)-1) return -1; *newoffset = result; return 0; - + } else { ret = zend_fseek(data->file, offset, whence); *newoffset = zend_ftell(data->file); @@ -519,7 +519,7 @@ static int php_stdiop_cast(php_stream *stream, int castas, void **ret) php_stdio_stream_data *data = (php_stdio_stream_data*) stream->abstract; assert(data != NULL); - + /* as soon as someone touches the stdio layer, buffering may ensue, * so we need to stop using the fd directly in that case */ @@ -537,7 +537,7 @@ static int php_stdiop_cast(php_stream *stream, int castas, void **ret) return FAILURE; } } - + *(FILE**)ret = data->file; data->fd = SOCK_ERR; } @@ -593,9 +593,9 @@ static int php_stdiop_set_option(php_stream *stream, int option, int value, void int flags; int oldval; #endif - + PHP_STDIOP_GET_FD(fd, data); - + switch(option) { case PHP_STREAM_OPTION_BLOCKING: if (fd == -1) @@ -607,20 +607,20 @@ static int php_stdiop_set_option(php_stream *stream, int option, int value, void flags &= ~O_NONBLOCK; else flags |= O_NONBLOCK; - + if (-1 == fcntl(fd, F_SETFL, flags)) return -1; return oldval; #else return -1; /* not yet implemented */ #endif - + case PHP_STREAM_OPTION_WRITE_BUFFER: if (data->file == NULL) { return -1; } - + if (ptrparam) size = *(size_t *)ptrparam; else @@ -629,10 +629,10 @@ static int php_stdiop_set_option(php_stream *stream, int option, int value, void switch(value) { case PHP_STREAM_BUFFER_NONE: return setvbuf(data->file, NULL, _IONBF, 0); - + case PHP_STREAM_BUFFER_LINE: return setvbuf(data->file, NULL, _IOLBF, size); - + case PHP_STREAM_BUFFER_FULL: return setvbuf(data->file, NULL, _IOFBF, size); @@ -640,7 +640,7 @@ static int php_stdiop_set_option(php_stream *stream, int option, int value, void return -1; } break; - + case PHP_STREAM_OPTION_LOCKING: if (fd == -1) { return -1; @@ -663,7 +663,7 @@ static int php_stdiop_set_option(php_stream *stream, int option, int value, void { php_stream_mmap_range *range = (php_stream_mmap_range*)ptrparam; int prot, flags; - + switch (value) { case PHP_STREAM_MMAP_SUPPORTED: return fd == -1 ? PHP_STREAM_OPTION_RETURN_ERR : PHP_STREAM_OPTION_RETURN_OK; @@ -828,7 +828,7 @@ static int php_stdiop_set_option(php_stream *stream, int option, int value, void return ftruncate(fd, new_size) == 0 ? PHP_STREAM_OPTION_RETURN_OK : PHP_STREAM_OPTION_RETURN_ERR; } } - + default: return PHP_STREAM_OPTION_RETURN_NOTIMPL; } @@ -901,7 +901,7 @@ static php_stream *php_plain_files_dir_opener(php_stream_wrapper *wrapper, const if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(path)) { return NULL; } - + dir = VCWD_OPENDIR(path); #ifdef PHP_WIN32 @@ -919,7 +919,7 @@ static php_stream *php_plain_files_dir_opener(php_stream_wrapper *wrapper, const if (stream == NULL) closedir(dir); } - + return stream; } /* }}} */ @@ -967,7 +967,7 @@ PHPAPI php_stream *_php_stream_fopen(const char *filename, const char *mode, cha return ret; } } - + fd = open(realpath, open_flags, 0666); if (fd != -1) { @@ -1201,7 +1201,7 @@ static int php_plain_files_mkdir(php_stream_wrapper *wrapper, const char *dir, i } if (p && dir_len == 1) { - /* buf == "DEFAULT_SLASH" */ + /* buf == "DEFAULT_SLASH" */ } else { /* find a top level directory we need to create */ @@ -1442,7 +1442,7 @@ not_relative_path: return php_stream_fopen_rel(filename, mode, opened_path, options); } - + #ifdef PHP_WIN32 if (IS_SLASH(filename[0])) { size_t cwd_len; @@ -1450,17 +1450,17 @@ not_relative_path: cwd = virtual_getcwd_ex(&cwd_len); /* getcwd() will return always return [DRIVE_LETTER]:/) on windows. */ *(cwd+3) = '\0'; - + if (snprintf(trypath, MAXPATHLEN, "%s%s", cwd, filename) >= MAXPATHLEN) { php_error_docref(NULL, E_NOTICE, "%s/%s path was truncated to %d", cwd, filename, MAXPATHLEN); } - + efree(cwd); - + if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(trypath)) { return NULL; } - + return php_stream_fopen_rel(trypath, mode, opened_path, options); } #endif @@ -1512,7 +1512,7 @@ not_relative_path: if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir_ex(trypath, 0)) { goto stream_skip; } - + stream = php_stream_fopen_rel(trypath, mode, opened_path, options); if (stream) { efree(pathbuf); diff --git a/main/streams/streams.c b/main/streams/streams.c index fab5d42eb3..e92c7449f7 100644 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -136,7 +136,7 @@ PHPAPI int php_stream_from_persistent_id(const char *persistent_id, php_stream * } zend_hash_move_forward_ex(&EG(regular_list), &pos); } - + *stream = (php_stream*)le->ptr; if (!regentry) { /* not found in regular list */ GC_REFCOUNT(le)++; @@ -271,7 +271,7 @@ PHPAPI void php_stream_wrapper_log_error(php_stream_wrapper *wrapper, int option if (!list) { zend_llist new_list; zend_llist_init(&new_list, sizeof(buffer), wrapper_error_dtor, 0); - list = zend_hash_str_update_mem(FG(wrapper_errors), (const char*)&wrapper, + list = zend_hash_str_update_mem(FG(wrapper_errors), (const char*)&wrapper, sizeof(wrapper), &new_list, sizeof(new_list)); } @@ -400,7 +400,7 @@ PHPAPI int _php_stream_free(php_stream *stream, int close_options) /* {{{ */ fprintf(stderr, "stream_free: %s:%p[%s] in_free=%d opts=%s\n", stream->ops->label, stream, stream->orig_path, stream->in_free, _php_stream_pretty_free_options(close_options, out)); } - + #endif if (stream->in_free) { @@ -1649,7 +1649,7 @@ void php_shutdown_stream_hashes(void) efree(FG(stream_filters)); FG(stream_filters) = NULL; } - + if (FG(wrapper_errors)) { zend_hash_destroy(FG(wrapper_errors)); efree(FG(wrapper_errors)); diff --git a/main/streams/transports.c b/main/streams/transports.c index 6c68f839be..4c3fc8b789 100644 --- a/main/streams/transports.c +++ b/main/streams/transports.c @@ -48,7 +48,7 @@ PHPAPI int php_stream_xport_unregister(const char *protocol) else { php_error_docref(NULL, E_WARNING, fmt, local_err ? local_err->val : "Unspecified error"); \ 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, int flags, const char *persistent_id, struct timeval *timeout, @@ -63,13 +63,13 @@ PHPAPI php_stream *_php_stream_xport_create(const char *name, size_t namelen, in int n = 0, failed = 0; zend_string *error_text = NULL; struct timeval default_timeout = { 0, 0 }; - + default_timeout.tv_sec = FG(default_socket_timeout); if (timeout == NULL) { timeout = &default_timeout; } - + /* check for a cached persistent socket */ if (persistent_id) { switch(php_stream_from_persistent_id(persistent_id, &stream)) { @@ -113,7 +113,7 @@ PHPAPI php_stream *_php_stream_xport_create(const char *name, size_t namelen, in if (n >= sizeof(wrapper_name)) n = sizeof(wrapper_name) - 1; PHP_STRLCPY(wrapper_name, protocol, sizeof(wrapper_name), n); - + ERR_REPORT(error_string, "Unable to find the socket transport \"%s\" - did you forget to enable it when you configured PHP?", wrapper_name); @@ -159,17 +159,17 @@ PHPAPI php_stream *_php_stream_xport_create(const char *name, size_t namelen, in } else if (flags & STREAM_XPORT_LISTEN) { zval *zbacklog = NULL; int backlog = 32; - + if (PHP_STREAM_CONTEXT(stream) && (zbacklog = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "socket", "backlog")) != NULL) { zval *ztmp = zbacklog; - + convert_to_long_ex(ztmp); backlog = Z_LVAL_P(ztmp); if (ztmp != zbacklog) { zval_ptr_dtor(ztmp); } } - + if (0 != php_stream_xport_listen(stream, backlog, &error_text)) { ERR_RETURN(error_string, error_text, "listen() failed: %s"); failed = 1; @@ -200,7 +200,7 @@ PHPAPI int php_stream_xport_bind(php_stream *stream, { php_stream_xport_param param; int ret; - + memset(¶m, 0, sizeof(param)); param.op = STREAM_XPORT_OP_BIND; param.inputs.name = (char*)name; @@ -231,7 +231,7 @@ PHPAPI int php_stream_xport_connect(php_stream *stream, { php_stream_xport_param param; int ret; - + memset(¶m, 0, sizeof(param)); param.op = asynchronous ? STREAM_XPORT_OP_CONNECT_ASYNC: STREAM_XPORT_OP_CONNECT; param.inputs.name = (char*)name; @@ -239,7 +239,7 @@ PHPAPI int php_stream_xport_connect(php_stream *stream, param.inputs.timeout = timeout; param.want_errortext = error_text ? 1 : 0; - + ret = php_stream_set_option(stream, PHP_STREAM_OPTION_XPORT_API, 0, ¶m); if (ret == PHP_STREAM_OPTION_RETURN_OK) { @@ -261,12 +261,12 @@ PHPAPI int php_stream_xport_listen(php_stream *stream, int backlog, zend_string { php_stream_xport_param param; int ret; - + memset(¶m, 0, sizeof(param)); param.op = STREAM_XPORT_OP_LISTEN; param.inputs.backlog = backlog; param.want_errortext = error_text ? 1 : 0; - + ret = php_stream_set_option(stream, PHP_STREAM_OPTION_XPORT_API, 0, ¶m); if (ret == PHP_STREAM_OPTION_RETURN_OK) { @@ -298,7 +298,7 @@ PHPAPI int php_stream_xport_accept(php_stream *stream, php_stream **client, param.want_addr = addr ? 1 : 0; param.want_textaddr = textaddr ? 1 : 0; param.want_errortext = error_text ? 1 : 0; - + ret = php_stream_set_option(stream, PHP_STREAM_OPTION_XPORT_API, 0, ¶m); if (ret == PHP_STREAM_OPTION_RETURN_OK) { @@ -332,7 +332,7 @@ PHPAPI int php_stream_xport_get_name(php_stream *stream, int want_peer, param.op = want_peer ? STREAM_XPORT_OP_GET_PEER_NAME : STREAM_XPORT_OP_GET_NAME; param.want_addr = addr ? 1 : 0; param.want_textaddr = textaddr ? 1 : 0; - + ret = php_stream_set_option(stream, PHP_STREAM_OPTION_XPORT_API, 0, ¶m); if (ret == PHP_STREAM_OPTION_RETURN_OK) { @@ -358,7 +358,7 @@ PHPAPI int php_stream_xport_crypto_setup(php_stream *stream, php_stream_xport_cr param.op = STREAM_XPORT_CRYPTO_OP_SETUP; param.inputs.method = crypto_method; param.inputs.session = session_stream; - + ret = php_stream_set_option(stream, PHP_STREAM_OPTION_CRYPTO_API, 0, ¶m); if (ret == PHP_STREAM_OPTION_RETURN_OK) { @@ -366,7 +366,7 @@ PHPAPI int php_stream_xport_crypto_setup(php_stream *stream, php_stream_xport_cr } php_error_docref("streams.crypto", E_WARNING, "this stream does not support SSL/crypto"); - + return ret; } @@ -378,7 +378,7 @@ PHPAPI int php_stream_xport_crypto_enable(php_stream *stream, int activate) memset(¶m, 0, sizeof(param)); param.op = STREAM_XPORT_CRYPTO_OP_ENABLE; param.inputs.activate = activate; - + ret = php_stream_set_option(stream, PHP_STREAM_OPTION_CRYPTO_API, 0, ¶m); if (ret == PHP_STREAM_OPTION_RETURN_OK) { @@ -386,7 +386,7 @@ PHPAPI int php_stream_xport_crypto_enable(php_stream *stream, int activate) } php_error_docref("streams.crypto", E_WARNING, "this stream does not support SSL/crypto"); - + return ret; } @@ -410,7 +410,7 @@ PHPAPI int php_stream_xport_recvfrom(php_stream *stream, char *buf, size_t bufle php_error_docref(NULL, E_WARNING, "cannot peek or fetch OOB data from a filtered stream"); return -1; } - + oob = (flags & STREAM_OOB) == STREAM_OOB; if (!oob && addr == NULL) { @@ -434,7 +434,7 @@ PHPAPI int php_stream_xport_recvfrom(php_stream *stream, char *buf, size_t bufle #endif /* otherwise, we are going to bypass the buffer */ - + memset(¶m, 0, sizeof(param)); param.op = STREAM_XPORT_OP_RECV; @@ -443,7 +443,7 @@ PHPAPI int php_stream_xport_recvfrom(php_stream *stream, char *buf, size_t bufle param.inputs.buf = buf; param.inputs.buflen = buflen; param.inputs.flags = flags; - + ret = php_stream_set_option(stream, PHP_STREAM_OPTION_XPORT_API, 0, ¶m); if (ret == PHP_STREAM_OPTION_RETURN_OK) { @@ -473,14 +473,14 @@ PHPAPI int php_stream_xport_sendto(php_stream *stream, const char *buf, size_t b return php_stream_write(stream, buf, buflen); } #endif - + oob = (flags & STREAM_OOB) == STREAM_OOB; if ((oob || addr) && stream->writefilters.head) { php_error_docref(NULL, E_WARNING, "cannot write OOB data, or data to a targeted address on a filtered stream"); return -1; } - + memset(¶m, 0, sizeof(param)); param.op = STREAM_XPORT_OP_SEND; @@ -490,7 +490,7 @@ PHPAPI int php_stream_xport_sendto(php_stream *stream, const char *buf, size_t b param.inputs.flags = flags; param.inputs.addr = addr; param.inputs.addrlen = addrlen; - + ret = php_stream_set_option(stream, PHP_STREAM_OPTION_XPORT_API, 0, ¶m); if (ret == PHP_STREAM_OPTION_RETURN_OK) { @@ -510,7 +510,7 @@ PHPAPI int php_stream_xport_shutdown(php_stream *stream, stream_shutdown_t how) param.op = STREAM_XPORT_OP_SHUTDOWN; param.how = how; - + ret = php_stream_set_option(stream, PHP_STREAM_OPTION_XPORT_API, 0, ¶m); if (ret == PHP_STREAM_OPTION_RETURN_OK) { diff --git a/main/streams/userspace.c b/main/streams/userspace.c index c3f167636e..de081cd734 100644 --- a/main/streams/userspace.c +++ b/main/streams/userspace.c @@ -1136,7 +1136,7 @@ static int user_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from int ret = 0; /* create an instance of our class */ - user_stream_create_object(uwrap, context, &object); + user_stream_create_object(uwrap, context, &object); if (Z_TYPE(object) == IS_UNDEF) { return ret; } @@ -1182,7 +1182,7 @@ static int user_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url, int int ret = 0; /* create an instance of our class */ - user_stream_create_object(uwrap, context, &object); + user_stream_create_object(uwrap, context, &object); if (Z_TYPE(object) == IS_UNDEF) { return ret; } @@ -1230,7 +1230,7 @@ static int user_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int ret = 0; /* create an instance of our class */ - user_stream_create_object(uwrap, context, &object); + user_stream_create_object(uwrap, context, &object); if (Z_TYPE(object) == IS_UNDEF) { return ret; } @@ -1300,7 +1300,7 @@ static int user_wrapper_metadata(php_stream_wrapper *wrapper, const char *url, i } /* create an instance of our class */ - user_stream_create_object(uwrap, context, &object); + user_stream_create_object(uwrap, context, &object); if (Z_TYPE(object) == IS_UNDEF) { zval_ptr_dtor(&args[2]); return ret; diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c index 9fa2ae367e..3c293eb40a 100644 --- a/main/streams/xp_socket.c +++ b/main/streams/xp_socket.c @@ -126,7 +126,7 @@ static void php_sock_stream_wait_for_data(php_stream *stream, php_netstream_data if (!sock || sock->socket == -1) { return; } - + sock->timeout_event = 0; if (sock->timeout.tv_sec == -1) @@ -218,7 +218,7 @@ static int php_sockop_close(php_stream *stream, int close_handle) } pefree(sock, php_stream_is_persistent(stream)); - + return 0; } @@ -287,7 +287,7 @@ static int php_sockop_set_option(php_stream *stream, int option, int value, void int oldmode, flags; php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; php_stream_xport_param *xparam; - + if (!sock) { return PHP_STREAM_OPTION_RETURN_NOTIMPL; } @@ -320,7 +320,7 @@ static int php_sockop_set_option(php_stream *stream, int option, int value, void } return alive ? PHP_STREAM_OPTION_RETURN_OK : PHP_STREAM_OPTION_RETURN_ERR; } - + case PHP_STREAM_OPTION_BLOCKING: oldmode = sock->is_blocked; if (SUCCESS == php_set_sock_blocking(sock->socket, value)) { @@ -339,7 +339,7 @@ static int php_sockop_set_option(php_stream *stream, int option, int value, void add_assoc_bool((zval *)ptrparam, "blocked", sock->is_blocked); add_assoc_bool((zval *)ptrparam, "eof", stream->eof); return PHP_STREAM_OPTION_RETURN_OK; - + case PHP_STREAM_OPTION_XPORT_API: xparam = (php_stream_xport_param *)ptrparam; @@ -417,7 +417,7 @@ static int php_sockop_set_option(php_stream *stream, int option, int value, void return PHP_STREAM_OPTION_RETURN_OK; } #endif - + default: return PHP_STREAM_OPTION_RETURN_NOTIMPL; } @@ -648,7 +648,7 @@ static inline int php_tcp_sockop_bind(php_stream *stream, php_netstream_data_t * xparam->want_errortext ? &xparam->outputs.error_text : NULL, &err ); - + if (host) { efree(host); } @@ -723,7 +723,7 @@ static inline int php_tcp_sockop_connect(php_stream *stream, php_netstream_data_ /* Note: the test here for php_stream_udp_socket_ops is important, because we * want the default to be TCP sockets so that the openssl extension can * re-use this code. */ - + sock->socket = php_network_connect_socket_to_host(host, portno, stream->ops == &php_stream_udp_socket_ops ? SOCK_DGRAM : SOCK_STREAM, xparam->op == STREAM_XPORT_OP_CONNECT_ASYNC, @@ -734,7 +734,7 @@ static inline int php_tcp_sockop_connect(php_stream *stream, php_netstream_data_ bindport, sockopts ); - + ret = sock->socket == -1 ? -1 : 0; xparam->outputs.error_code = err; @@ -753,7 +753,7 @@ out: /* indicates pending connection */ return 1; } - + return ret; } @@ -794,7 +794,7 @@ static inline int php_tcp_sockop_accept(php_stream *stream, php_netstream_data_t } } } - + return xparam->outputs.client == NULL ? -1 : 0; } @@ -857,7 +857,7 @@ PHPAPI php_stream *php_stream_generic_socket_factory(const char *proto, size_t p /* should never happen */ return NULL; } - + sock = pemalloc(sizeof(php_netstream_data_t), persistent_id ? 1 : 0); memset(sock, 0, sizeof(php_netstream_data_t)); @@ -868,7 +868,7 @@ PHPAPI php_stream *php_stream_generic_socket_factory(const char *proto, size_t p /* we don't know the socket until we have determined if we are binding or * connecting */ sock->socket = -1; - + stream = php_stream_alloc_rel(ops, sock, persistent_id, "r+"); if (stream == NULL) { diff --git a/main/win95nt.h b/main/win95nt.h index febffecadf..e39304b78c 100644 --- a/main/win95nt.h +++ b/main/win95nt.h @@ -40,7 +40,7 @@ typedef char * caddr_t; #define S_IFIFO _IFIFO #define S_IFBLK _IFBLK #define S_IFLNK _IFLNK -#ifndef S_ISREG +#ifndef S_ISREG #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) #endif #define chdir(path) _chdir(path) |
