cellog          Sat Aug 30 23:47:55 2008 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src/ext/phar   dirstream.c phar.phar stream.c 
  Log:
  sync with pecl/phar, this does not change any functionality in PHP 5.3, but 
makes syncing easier.  This commit is only functional changes, WS will be next
  
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/dirstream.c?r1=1.26.2.8&r2=1.26.2.9&diff_format=u
Index: php-src/ext/phar/dirstream.c
diff -u php-src/ext/phar/dirstream.c:1.26.2.8 
php-src/ext/phar/dirstream.c:1.26.2.9
--- php-src/ext/phar/dirstream.c:1.26.2.8       Fri Aug  1 13:48:44 2008
+++ php-src/ext/phar/dirstream.c        Sat Aug 30 23:47:55 2008
@@ -569,8 +569,8 @@
        int arch_len, entry_len;
        php_url *resource = NULL;
        uint host_len;
-       int key_type;
-       char *key;
+       phar_zstr key;
+       char *str_key;
        uint key_len;
        ulong unused;
        uint path_len;
@@ -640,9 +640,11 @@
        }
 
        for (zend_hash_internal_pointer_reset(&phar->manifest);
-               HASH_KEY_NON_EXISTANT != (key_type = 
zend_hash_get_current_key_ex(&phar->manifest, &key, &key_len, &unused, 0, 
NULL));
+               HASH_KEY_NON_EXISTANT != 
zend_hash_get_current_key_ex(&phar->manifest, &key, &key_len, &unused, 0, NULL);
                zend_hash_move_forward(&phar->manifest)) {
 
+               PHAR_STR(key, str_key);
+
                if (!entry->is_deleted && 
                        key_len > path_len && 
                        memcmp(key, resource->path+1, path_len) == 0 && 
@@ -658,13 +660,15 @@
        }
 
        for (zend_hash_internal_pointer_reset(&phar->virtual_dirs);
-               HASH_KEY_NON_EXISTANT != (key_type = 
zend_hash_get_current_key_ex(&phar->virtual_dirs, &key, &key_len, &unused, 0, 
NULL));
+               HASH_KEY_NON_EXISTANT != 
zend_hash_get_current_key_ex(&phar->virtual_dirs, &key, &key_len, &unused, 0, 
NULL);
                zend_hash_move_forward(&phar->virtual_dirs)) {
 
+               PHAR_STR(key, str_key);
+
                if (!entry->is_deleted && 
                        key_len > path_len && 
-                       memcmp(key, resource->path+1, path_len) == 0 && 
-                       IS_SLASH(key[path_len])) {
+                       memcmp(str_key, resource->path+1, path_len) == 0 && 
+                       IS_SLASH(str_key[path_len])) {
                        php_stream_wrapper_log_error(wrapper, options 
TSRMLS_CC, "phar error: Directory not empty");
                        if (entry->is_temp_dir) {
                                efree(entry->filename);
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/phar.phar?r1=1.7.2.31&r2=1.7.2.32&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.14&r2=1.27.2.15&diff_format=u
Index: php-src/ext/phar/stream.c
diff -u php-src/ext/phar/stream.c:1.27.2.14 php-src/ext/phar/stream.c:1.27.2.15
--- php-src/ext/phar/stream.c:1.27.2.14 Thu Aug 21 05:17:27 2008
+++ php-src/ext/phar/stream.c   Sat Aug 30 23:47:55 2008
@@ -886,7 +886,8 @@
        /* Rename directory. Update all nested paths */
        if (is_dir) {
                int key_type;
-               char *key, *new_key;
+               phar_zstr key, new_key;
+               char *str_key, *new_str_key;
                uint key_len, new_key_len;
                ulong unused;
                uint from_len = strlen(resource_from->path+1);
@@ -897,22 +898,31 @@
                        SUCCESS == zend_hash_get_current_data(&phar->manifest, 
(void **) &entry);
                        zend_hash_move_forward(&phar->manifest)) {
 
+                       PHAR_STR(key, str_key);
+
                        if (!entry->is_deleted &&
                                key_len > from_len &&
-                               memcmp(key, resource_from->path+1, from_len) == 
0 &&
-                               IS_SLASH(key[from_len])) {
+                               memcmp(str_key, resource_from->path+1, 
from_len) == 0 &&
+                               IS_SLASH(str_key[from_len])) {
 
                                new_key_len = key_len + to_len - from_len;
-                               new_key = emalloc(new_key_len+1);
-                               memcpy(new_key, resource_to->path + 1, to_len);
-                               memcpy(new_key + to_len, key + from_len, 
key_len - from_len);
-                               new_key[new_key_len] = 0;
+                               new_str_key = emalloc(new_key_len+1);
+                               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);
-                               entry->filename = new_key;
+                               entry->filename = new_str_key;
                                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
                                
zend_hash_update_current_key_ex(&phar->manifest, key_type, new_key, 
new_key_len, 0, HASH_UPDATE_KEY_ANYWAY, NULL);
+#endif
                        }
                }
 
@@ -920,17 +930,25 @@
                        HASH_KEY_NON_EXISTANT != (key_type = 
zend_hash_get_current_key_ex(&phar->virtual_dirs, &key, &key_len, &unused, 0, 
NULL));
                        zend_hash_move_forward(&phar->virtual_dirs)) {
 
+                       PHAR_STR(key, str_key);
+
                        if (key_len >= from_len &&
-                               memcmp(key, resource_from->path+1, from_len) == 
0 &&
-                               (key_len == from_len || 
IS_SLASH(key[from_len]))) {
+                               memcmp(str_key, resource_from->path+1, 
from_len) == 0 &&
+                               (key_len == from_len || 
IS_SLASH(str_key[from_len]))) {
 
                                new_key_len = key_len + to_len - from_len;
-                               new_key = emalloc(new_key_len+1);
-                               memcpy(new_key, resource_to->path + 1, to_len);
-                               memcpy(new_key + to_len, key + from_len, 
key_len - from_len);
-                               new_key[new_key_len] = 0;
+                               new_str_key = emalloc(new_key_len+1);
+                               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;
+
+                               PHAR_ZSTR(new_str_key, new_key);
+#if PHP_VERSION_ID < 50300
+                               
zend_hash_update_current_key_ex(&phar->virtual_dirs, key_type, new_key, 
new_key_len, 0, NULL);
+#else
                                
zend_hash_update_current_key_ex(&phar->virtual_dirs, key_type, new_key, 
new_key_len, 0, HASH_UPDATE_KEY_ANYWAY, NULL);
-                               efree(new_key);
+#endif
+                               efree(new_str_key);
                        }
                }
 
@@ -939,17 +957,25 @@
                        SUCCESS == 
zend_hash_get_current_data(&phar->mounted_dirs, (void **) &entry);
                        zend_hash_move_forward(&phar->mounted_dirs)) {
 
+                       PHAR_STR(key, str_key);
+
                        if (key_len >= from_len &&
-                               memcmp(key, resource_from->path+1, from_len) == 
0 &&
-                               (key_len == from_len || 
IS_SLASH(key[from_len]))) {
+                               memcmp(str_key, resource_from->path+1, 
from_len) == 0 &&
+                               (key_len == from_len || 
IS_SLASH(str_key[from_len]))) {
 
                                new_key_len = key_len + to_len - from_len;
-                               new_key = emalloc(new_key_len+1);
-                               memcpy(new_key, resource_to->path + 1, to_len);
-                               memcpy(new_key + to_len, key + from_len, 
key_len - from_len);
-                               new_key[new_key_len] = 0;
+                               new_str_key = emalloc(new_key_len+1);
+                               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;
+
+                               PHAR_ZSTR(new_str_key, new_key);
+#if PHP_VERSION_ID < 50300
+                               
zend_hash_update_current_key_ex(&phar->mounted_dirs, key_type, new_key, 
new_key_len, 0, NULL);
+#else
                                
zend_hash_update_current_key_ex(&phar->mounted_dirs, key_type, new_key, 
new_key_len, 0, HASH_UPDATE_KEY_ANYWAY, NULL);
-                               efree(new_key);
+#endif
+                               efree(new_str_key);
                        }
                }
        }



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

Reply via email to