]> granicus.if.org Git - php/commitdiff
- Moved phar_unixify_path_separators() to a single central point
authorSteph Fox <sfox@php.net>
Mon, 28 Jan 2008 14:39:17 +0000 (14:39 +0000)
committerSteph Fox <sfox@php.net>
Mon, 28 Jan 2008 14:39:17 +0000 (14:39 +0000)
- The last two VC 6 compiler warnings gone. Please test under *nix.

ext/phar/config.w32
ext/phar/phar.c
ext/phar/phar_internal.h
ext/phar/phar_object.c
ext/phar/tar.c
ext/phar/zip.c

index 7589a48c4e055cb8c26f579fc00ad88172d40413..35127a7b139cf706e6ab4d88ec44efdd7c552e0f 100644 (file)
@@ -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 ");
        }
index 1c454a1bf01faa3de7899f0d61ccf2c3a463c479..5f412abeb15cd79814a3eb9d9958db532c848cef 100644 (file)
@@ -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 {
index 540c8df1c7fdcd7b9903609817eeac518c0e7354..b764b87c9f23352ed76b43035d5c7ec79abad1bc 100755 (executable)
@@ -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);
index 63b479ea742267c44707ef2d9282ccb8b00a607a..5c48ea4869cb8b6f15ef4f99af2cb6fdf8e21203 100755 (executable)
@@ -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*);
index 8c395761e17e2d18b072f3879010a8a55d5c2c79..74f6c4984ef600c7ff5900c01b80ffa66c9fbde5 100644 (file)
@@ -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
index b7c35acdcd8fcd603332037ec9d1989b70174c3a..367702f9e0c638cfd66c949261688dfb8fd1db9e 100644 (file)
 
 #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);
                        }