diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/opcache/ZendAccelerator.c | 8 | ||||
-rw-r--r-- | ext/opcache/ZendAccelerator.h | 4 | ||||
-rw-r--r-- | ext/phar/phar.c | 4 | ||||
-rw-r--r-- | ext/phar/phar_object.c | 12 | ||||
-rw-r--r-- | ext/spl/spl_directory.c | 2 | ||||
-rw-r--r-- | ext/standard/link.c | 2 | ||||
-rw-r--r-- | ext/standard/link_win32.c | 5 | ||||
-rw-r--r-- | ext/standard/streamsfuncs.c | 2 | ||||
-rw-r--r-- | ext/zip/php_zip.c | 8 |
9 files changed, 24 insertions, 23 deletions
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 9b717776cd..a407c88281 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -114,7 +114,7 @@ zend_bool fallback_process = 0; /* process uses file cache fallback */ static zend_op_array *(*accelerator_orig_compile_file)(zend_file_handle *file_handle, int type); static int (*accelerator_orig_zend_stream_open_function)(const char *filename, zend_file_handle *handle ); -static zend_string *(*accelerator_orig_zend_resolve_path)(const char *filename, int filename_len); +static zend_string *(*accelerator_orig_zend_resolve_path)(const char *filename, size_t filename_len); static zif_handler orig_chdir = NULL; static ZEND_INI_MH((*orig_include_path_on_modify)) = NULL; @@ -1015,7 +1015,7 @@ int validate_timestamp_and_record_ex(zend_persistent_script *persistent_script, /* Instead of resolving full real path name each time we need to identify file, * we create a key that consist from requested file name, current working * directory, current include_path, etc */ -char *accel_make_persistent_key(const char *path, int path_length, int *key_len) +char *accel_make_persistent_key(const char *path, size_t path_length, int *key_len) { int key_length; @@ -1171,7 +1171,7 @@ char *accel_make_persistent_key(const char *path, int path_length, int *key_len) return (char*)path; } -int zend_accel_invalidate(const char *filename, int filename_len, zend_bool force) +int zend_accel_invalidate(const char *filename, size_t filename_len, zend_bool force) { zend_string *realpath; zend_persistent_script *persistent_script; @@ -2018,7 +2018,7 @@ static int persistent_stream_open_function(const char *filename, zend_file_handl } /* zend_resolve_path() replacement for PHP 5.3 and above */ -static zend_string* persistent_zend_resolve_path(const char *filename, int filename_len) +static zend_string* persistent_zend_resolve_path(const char *filename, size_t filename_len) { if (ZCG(enabled) && accel_startup_ok && (ZCG(counted) || ZCSG(accelerator_enabled)) && diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h index 17b6f8da52..5c22415d88 100644 --- a/ext/opcache/ZendAccelerator.h +++ b/ext/opcache/ZendAccelerator.h @@ -310,11 +310,11 @@ void zend_accel_schedule_restart_if_necessary(zend_accel_restart_reason reason); accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle, size_t *size); int validate_timestamp_and_record(zend_persistent_script *persistent_script, zend_file_handle *file_handle); int validate_timestamp_and_record_ex(zend_persistent_script *persistent_script, zend_file_handle *file_handle); -int zend_accel_invalidate(const char *filename, int filename_len, zend_bool force); +int zend_accel_invalidate(const char *filename, size_t filename_len, zend_bool force); int accelerator_shm_read_lock(void); void accelerator_shm_read_unlock(void); -char *accel_make_persistent_key(const char *path, int path_length, int *key_len); +char *accel_make_persistent_key(const char *path, size_t path_length, int *key_len); zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type); #define IS_ACCEL_INTERNED(str) \ diff --git a/ext/phar/phar.c b/ext/phar/phar.c index 65ebce0f08..5ff239f17f 100644 --- a/ext/phar/phar.c +++ b/ext/phar/phar.c @@ -27,7 +27,7 @@ static void destroy_phar_data(zval *zv); ZEND_DECLARE_MODULE_GLOBALS(phar) -zend_string *(*phar_save_resolve_path)(const char *filename, int filename_len); +zend_string *(*phar_save_resolve_path)(const char *filename, size_t filename_len); /** * set's phar->is_writeable based on the current INI value @@ -3249,7 +3249,7 @@ static size_t phar_zend_stream_fsizer(void *handle) /* {{{ */ zend_op_array *(*phar_orig_compile_file)(zend_file_handle *file_handle, int type); #define phar_orig_zend_open zend_stream_open_function -static zend_string *phar_resolve_path(const char *filename, int filename_len) +static zend_string *phar_resolve_path(const char *filename, size_t filename_len) { return phar_find_in_include_path((char *) filename, filename_len, NULL); } diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index c3102039f0..7b9f80775d 100644 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -4164,7 +4164,7 @@ PHP_METHOD(Phar, delMetadata) } /* }}} */ -static int phar_extract_file(zend_bool overwrite, phar_entry_info *entry, char *dest, int dest_len, char **error) /* {{{ */ +static int phar_extract_file(zend_bool overwrite, phar_entry_info *entry, char *dest, size_t dest_len, char **error) /* {{{ */ { php_stream_statbuf ssb; size_t len; @@ -4206,13 +4206,13 @@ static int phar_extract_file(zend_bool overwrite, phar_entry_info *entry, char * #ifdef PHP_WIN32 /* unixify the path back, otherwise non zip formats might be broken */ { - int cnt = filename_len; + size_t cnt = 0; do { if ('\\' == filename[cnt]) { filename[cnt] = '/'; } - } while (cnt-- >= 0); + } while (cnt++ < filename_len); } #endif @@ -4433,7 +4433,7 @@ PHP_METHOD(Phar, extractTo) zend_throw_exception_ex(phar_ce_PharException, 0, "Phar Error: attempted to extract non-existent file \"%s\" from phar \"%s\"", Z_STRVAL_P(zval_file), phar_obj->archive->fname); } - if (FAILURE == phar_extract_file(overwrite, entry, pathto, (int)pathto_len, &error)) { + if (FAILURE == phar_extract_file(overwrite, entry, pathto, pathto_len, &error)) { zend_throw_exception_ex(phar_ce_PharException, 0, "Extraction from phar \"%s\" failed: %s", phar_obj->archive->fname, error); efree(error); @@ -4454,7 +4454,7 @@ PHP_METHOD(Phar, extractTo) return; } - if (FAILURE == phar_extract_file(overwrite, entry, pathto, (int)pathto_len, &error)) { + if (FAILURE == phar_extract_file(overwrite, entry, pathto, pathto_len, &error)) { zend_throw_exception_ex(phar_ce_PharException, 0, "Extraction from phar \"%s\" failed: %s", phar_obj->archive->fname, error); efree(error); @@ -4470,7 +4470,7 @@ all_files: } ZEND_HASH_FOREACH_PTR(&phar->manifest, entry) { - if (FAILURE == phar_extract_file(overwrite, entry, pathto, (int)pathto_len, &error)) { + if (FAILURE == phar_extract_file(overwrite, entry, pathto, pathto_len, &error)) { zend_throw_exception_ex(phar_ce_PharException, 0, "Extraction from phar \"%s\" failed: %s", phar->fname, error); efree(error); diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 049b517c46..f168655a27 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -1235,7 +1235,7 @@ FileInfoFunction(isLink, FS_IS_LINK) SPL_METHOD(SplFileInfo, getLinkTarget) { spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis()); - int ret; + ssize_t ret; char buff[MAXPATHLEN]; zend_error_handling error_handling; diff --git a/ext/standard/link.c b/ext/standard/link.c index c55e6f4b0a..7e0a6d3876 100644 --- a/ext/standard/link.c +++ b/ext/standard/link.c @@ -57,7 +57,7 @@ PHP_FUNCTION(readlink) char *link; size_t link_len; char buff[MAXPATHLEN]; - int ret; + ssize_t ret; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_PATH(link, link_len) diff --git a/ext/standard/link_win32.c b/ext/standard/link_win32.c index 53ce7fbb4d..406526128f 100644 --- a/ext/standard/link_win32.c +++ b/ext/standard/link_win32.c @@ -63,7 +63,7 @@ TODO: PHP_FUNCTION(readlink) { char *link; - size_t link_len; + ssize_t link_len; char target[MAXPATHLEN]; if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &link, &link_len) == FAILURE) { @@ -74,7 +74,8 @@ PHP_FUNCTION(readlink) RETURN_FALSE; } - if (php_sys_readlink(link, target, MAXPATHLEN) == -1) { + link_len = php_sys_readlink(link, target, MAXPATHLEN); + if (link_len == -1) { php_error_docref(NULL, E_WARNING, "readlink failed to read the symbolic link (%s), error %d)", link, GetLastError()); RETURN_FALSE; } diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index 475fb060be..979a64b913 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -1559,7 +1559,7 @@ PHP_FUNCTION(stream_resolve_include_path) Z_PARAM_PATH(filename, filename_len) ZEND_PARSE_PARAMETERS_END(); - resolved_path = zend_resolve_path(filename, (int)filename_len); + resolved_path = zend_resolve_path(filename, filename_len); if (resolved_path) { RETURN_STR(resolved_path); diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index 2353519be4..d50c735845 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -137,18 +137,18 @@ static char * php_zip_make_relative_path(char *path, size_t path_len) /* {{{ */ # define CWD_STATE_FREE(s) efree(s) /* {{{ php_zip_extract_file */ -static int php_zip_extract_file(struct zip * za, char *dest, char *file, int file_len) +static int php_zip_extract_file(struct zip * za, char *dest, char *file, size_t file_len) { php_stream_statbuf ssb; struct zip_file *zf; struct zip_stat sb; char b[8192]; - int n, len, ret; + int n, ret; php_stream *stream; char *fullpath; char *file_dirname_fullpath; char file_dirname[MAXPATHLEN]; - size_t dir_len; + size_t dir_len, len; int is_dir_only = 0; char *path_cleaned; size_t path_cleaned_len; @@ -181,7 +181,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, int fil memcpy(file_dirname, path_cleaned, path_cleaned_len); dir_len = php_dirname(file_dirname, path_cleaned_len); - if (dir_len <= 0 || (dir_len == 1 && file_dirname[0] == '.')) { + if (!dir_len || (dir_len == 1 && file_dirname[0] == '.')) { len = spprintf(&file_dirname_fullpath, 0, "%s", dest); } else { len = spprintf(&file_dirname_fullpath, 0, "%s/%s", dest, file_dirname); |