cellog          Sun Aug 31 02:14:03 2008 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src/ext/phar   phar.phar stream.c util.c zip.c 
  Log:
  2 fixes, merge minor fixes from pecl/phar.  Merge in corrected fix from 
pecl/phar for is_tar setting of tar_type
  
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/phar.phar?r1=1.7.2.32&r2=1.7.2.33&diff_format=u
Index: php-src/ext/phar/phar.phar
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/stream.c?r1=1.27.2.15&r2=1.27.2.16&diff_format=u
Index: php-src/ext/phar/stream.c
diff -u php-src/ext/phar/stream.c:1.27.2.15 php-src/ext/phar/stream.c:1.27.2.16
--- php-src/ext/phar/stream.c:1.27.2.15 Sat Aug 30 23:47:55 2008
+++ php-src/ext/phar/stream.c   Sun Aug 31 02:14:03 2008
@@ -910,6 +910,7 @@
                                memcpy(new_str_key, resource_to->path + 1, 
to_len);
                                memcpy(new_str_key + to_len, str_key + 
from_len, key_len - from_len);
                                new_str_key[new_key_len] = 0;
+
                                is_modified = 1;
                                entry->is_modified = 1;
                                efree(entry->filename);
@@ -917,7 +918,6 @@
                                entry->filename_len = new_key_len;
 
                                PHAR_ZSTR(new_str_key, new_key);
-
 #if PHP_VERSION_ID < 50300
                                
zend_hash_update_current_key_ex(&phar->manifest, key_type, new_key, 
new_key_len, 0, NULL);
 #else
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/util.c?r1=1.55.2.29&r2=1.55.2.30&diff_format=u
Index: php-src/ext/phar/util.c
diff -u php-src/ext/phar/util.c:1.55.2.29 php-src/ext/phar/util.c:1.55.2.30
--- php-src/ext/phar/util.c:1.55.2.29   Thu Aug 21 05:17:27 2008
+++ php-src/ext/phar/util.c     Sun Aug 31 02:14:03 2008
@@ -18,7 +18,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: util.c,v 1.55.2.29 2008/08/21 05:17:27 cellog Exp $ */
+/* $Id: util.c,v 1.55.2.30 2008/08/31 02:14:03 cellog Exp $ */
 
 #include "phar_internal.h"
 
@@ -686,7 +686,7 @@
                if (entry->link) {
                        efree(entry->link);
                        entry->link = NULL;
-                       entry->tar_type = (entry->tar_type ? TAR_FILE : 0);
+                       entry->tar_type = (entry->is_tar ? TAR_FILE : 0);
                }
 
                if (for_write) {
@@ -740,7 +740,7 @@
        phar_unixify_path_separators(path, path_len);
 #endif
 
-       is_dir = (path_len > 0 && path != NULL) ? path[path_len - 1] == '/' : 0;
+       is_dir = (path_len && path[path_len - 1] == '/') ? 1 : 0;
 
        if (FAILURE == phar_get_archive(&phar, fname, fname_len, NULL, 0, error 
TSRMLS_CC)) {
                return NULL;
@@ -877,7 +877,7 @@
        if (dest->link) {
                efree(dest->link);
                dest->link = NULL;
-               dest->tar_type = (dest->tar_type ? TAR_FILE : 0);
+               dest->tar_type = (dest->is_tar ? TAR_FILE : 0);
        }
 
        dest->fp_type = PHAR_MOD;
@@ -1082,7 +1082,7 @@
        if (entry->link) {
                efree(entry->link);
                entry->link = NULL;
-               entry->tar_type = (entry->tar_type ? TAR_FILE : 0);
+               entry->tar_type = (entry->is_tar ? TAR_FILE : 0);
        }
 
        entry->fp = php_stream_fopen_tmpfile();
@@ -1139,7 +1139,7 @@
        if (entry->link) {
                efree(entry->link);
                entry->link = NULL;
-               entry->tar_type = (entry->tar_type ? TAR_FILE : 0);
+               entry->tar_type = (entry->is_tar ? TAR_FILE : 0);
        }
 
        entry->offset = 0;
@@ -1459,7 +1459,7 @@
        phar_unixify_path_separators(path, path_len);
 #endif
 
-       is_dir = path_len && (path[path_len - 1] == '/');
+       is_dir = (path_len && (path[path_len - 1] == '/')) ? 1 : 0;
 
        if (error) {
                *error = NULL;
@@ -1550,7 +1550,6 @@
                        } else {
                                char *test;
                                int test_len;
-                               phar_entry_info *entry;
                                php_stream_statbuf ssb;
 
                                if (SUCCESS != zend_hash_find(&phar->manifest, 
str_key, keylen, (void **) &entry)) {
@@ -1663,6 +1662,7 @@
                zval_dtor(zkey);
                return FAILURE;
        }
+
 #if PHP_VERSION_ID < 50300
        if (FAILURE == zend_fcall_info_init(openssl, &fci, &fcc TSRMLS_CC)) {
 #else
@@ -1680,7 +1680,9 @@
        fci.params = zp;
 #if PHP_VERSION_ID < 50300
        ++(zdata->refcount);
-       ++(zsig->refcount);
+       if (!is_sign) {
+               ++(zsig->refcount);
+       }
        ++(zkey->refcount);
 #else
        Z_ADDREF_P(zdata);
@@ -1709,7 +1711,9 @@
        efree(openssl);
 #if PHP_VERSION_ID < 50300
        --(zdata->refcount);
-       --(zsig->refcount);
+       if (!is_sign) {
+               --(zsig->refcount);
+       }
        --(zkey->refcount);
 #else
        Z_DELREF_P(zdata);
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/zip.c?r1=1.47.2.17&r2=1.47.2.18&diff_format=u
Index: php-src/ext/phar/zip.c
diff -u php-src/ext/phar/zip.c:1.47.2.17 php-src/ext/phar/zip.c:1.47.2.18
--- php-src/ext/phar/zip.c:1.47.2.17    Thu Aug 21 05:17:27 2008
+++ php-src/ext/phar/zip.c      Sun Aug 31 02:14:03 2008
@@ -159,7 +159,6 @@
        phar_zip_dir_end locator;
        char buf[sizeof(locator) + 65536];
        long size;
-       size_t read;
        php_uint16 i;
        phar_archive_data *mydata = NULL;
        phar_entry_info entry = {0};
@@ -181,7 +180,7 @@
                php_stream_seek(fp, 0, SEEK_SET);
        }
 
-       if (!(read = php_stream_read(fp, buf, size))) {
+       if (!php_stream_read(fp, buf, size)) {
                php_stream_close(fp);
                if (error) {
                        spprintf(error, 4096, "phar error: unable to read in 
data to search for end of central directory in zip-based phar \"%s\"", fname);
@@ -491,7 +490,6 @@
                                php_stream_filter_remove(filter, 1 TSRMLS_CC);
 
                        } else if (entry.flags & PHAR_ENT_COMPRESSED_BZ2) {
-                               php_stream_filter *filter;
                                filter = 
php_stream_filter_create("bzip2.decompress", NULL, php_stream_is_persistent(fp) 
TSRMLS_CC);
 
                                if (!filter) {



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to