From: Steph Fox Date: Mon, 28 Jan 2008 14:39:17 +0000 (+0000) Subject: - Moved phar_unixify_path_separators() to a single central point X-Git-Tag: RELEASE_2_0_0a1~751 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9fd5c0b43830fe6f002204457916a3df5d941dd3;p=php - Moved phar_unixify_path_separators() to a single central point - The last two VC 6 compiler warnings gone. Please test under *nix. --- diff --git a/ext/phar/config.w32 b/ext/phar/config.w32 index 7589a48c4e..35127a7b13 100644 --- a/ext/phar/config.w32 +++ b/ext/phar/config.w32 @@ -4,7 +4,7 @@ ARG_ENABLE("phar", "enable phar support", "no"); if (PHP_PHAR != "no") { - EXTENSION("phar", "util.c dirstream.c func_interceptors.c phar.c phar_object.c phar_path_check.c stream.c tar.c zip.c"); + EXTENSION("phar", "dirstream.c func_interceptors.c phar.c phar_object.c phar_path_check.c stream.c tar.c util.c zip.c"); if (PHP_PHAR_SHARED) { ADD_FLAG("CFLAGS_PHAR", "/D COMPILE_DL_PHAR "); } diff --git a/ext/phar/phar.c b/ext/phar/phar.c index 1c454a1bf0..5f412abeb1 100644 --- a/ext/phar/phar.c +++ b/ext/phar/phar.c @@ -71,21 +71,6 @@ ZEND_INI_MH(phar_ini_modify_handler) /* {{{ */ } /* }}}*/ -#ifdef PHP_WIN32 -static inline void phar_unixify_path_separators(char *path, int path_len) /* {{{ */ -{ - char *s; - - /* unixify win paths */ - for (s = path; s - path < path_len; s++) { - if (*s == '\\') { - *s = '/'; - } - } -} -/* }}} */ -#endif - static void phar_split_extract_list(TSRMLS_D) { char *tmp = estrdup(PHAR_GLOBALS->extract_list); @@ -868,7 +853,7 @@ int phar_open_file(php_stream *fp, char *fname, int fname_len, char *alias, int buffer += entry.filename_len; PHAR_GET_32(buffer, entry.uncompressed_filesize); PHAR_GET_32(buffer, entry.timestamp); - if (offset == halt_offset + manifest_len + 4) { + if (offset == halt_offset + (int)manifest_len + 4) { mydata->min_timestamp = entry.timestamp; mydata->max_timestamp = entry.timestamp; } else { diff --git a/ext/phar/phar_internal.h b/ext/phar/phar_internal.h index 540c8df1c7..b764b87c9f 100755 --- a/ext/phar/phar_internal.h +++ b/ext/phar/phar_internal.h @@ -332,6 +332,18 @@ union _phar_entry_object { BEGIN_EXTERN_C() #ifdef PHP_WIN32 char *tsrm_strtok_r(char *s, const char *delim, char **last); + +static inline void phar_unixify_path_separators(char *path, int path_len) +{ + char *s; + + /* unixify win paths */ + for (s = path; s - path < path_len; s++) { + if (*s == '\\') { + *s = '/'; + } + } +} #endif void phar_request_initialize(TSRMLS_D); diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index 63b479ea74..5c48ea4869 100755 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -29,21 +29,6 @@ static zend_class_entry *phar_ce_PharException; static zend_class_entry *phar_ce_entry; #endif -#ifdef PHP_WIN32 -static inline void phar_unixify_path_separators(char *path, int path_len) /* {{{ */ -{ - char *s; - - /* unixify win paths */ - for (s = path; s - path < path_len; s++) { - if (*s == '\\') { - *s = '/'; - } - } -} -/* }}} */ -#endif - static int phar_get_extract_list(void *pDest, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */ { zval *return_value = va_arg(args, zval*); diff --git a/ext/phar/tar.c b/ext/phar/tar.c index 8c395761e1..74f6c4984e 100644 --- a/ext/phar/tar.c +++ b/ext/phar/tar.c @@ -37,20 +37,6 @@ static php_uint32 phar_tar_number(char *buf, int len) /* {{{ */ } /* }}} */ -#ifdef PHP_WIN32 -static inline void phar_unixify_path_separators(char *path, int path_len) /* {{{ */ -{ - char *s; - - /* unixify win paths */ - for (s = path; s - path < path_len; s++) { - if (*s == '\\') { - *s = '/'; - } - } -} -/* }}} */ -#endif /* adapted from format_octal() in libarchive * * Copyright (c) 2003-2007 Tim Kientzle diff --git a/ext/phar/zip.c b/ext/phar/zip.c index b7c35acdcd..367702f9e0 100644 --- a/ext/phar/zip.c +++ b/ext/phar/zip.c @@ -18,21 +18,6 @@ #include "phar_internal.h" -#ifdef PHP_WIN32 -static inline void phar_unixify_path_separators(char *path, int path_len) /* {{{ */ -{ - char *s; - - /* unixify win paths */ - for (s = path; s - path < path_len; s++) { - if (*s == '\\') { - *s = '/'; - } - } -} -/* }}} */ -#endif - static int phar_zip_process_extra(php_stream *fp, phar_entry_info *entry, php_uint16 len TSRMLS_DC) { union { @@ -656,7 +641,7 @@ int phar_zip_flush(phar_archive_data *phar, char *user_stub, long len, char **er /* set alias */ if (phar->is_explicit_alias) { entry.fp = php_stream_fopen_tmpfile(); - if (phar->alias_len != php_stream_write(entry.fp, phar->alias, phar->alias_len)) { + if (phar->alias_len != (int)php_stream_write(entry.fp, phar->alias, phar->alias_len)) { if (error) { spprintf(error, 0, "unable to set alias in new zip-based phar \"%s\"", phar->fname); }