sfox Tue May 13 18:35:26 2008 UTC
Modified files:
/php-src/ext/phar dirstream.c func_interceptors.c phar.c
phar_object.c stream.c util.c
/php-src/ext/phar/tests/files phar_test.inc
Log:
- 'It builds on my box'.
- Don't expect any tests to pass.
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/dirstream.c?r1=1.26&r2=1.27&diff_format=u
Index: php-src/ext/phar/dirstream.c
diff -u php-src/ext/phar/dirstream.c:1.26 php-src/ext/phar/dirstream.c:1.27
--- php-src/ext/phar/dirstream.c:1.26 Wed May 7 05:38:29 2008
+++ php-src/ext/phar/dirstream.c Tue May 13 18:35:25 2008
@@ -94,7 +94,7 @@
{
size_t to_read;
HashTable *data = (HashTable *)stream->abstract;
- char *key;
+ zstr key;
uint keylen;
ulong unused;
@@ -110,7 +110,7 @@
return 0;
}
memset(buf, 0, sizeof(php_stream_dirent));
- memcpy(((php_stream_dirent *) buf)->d_name, key, to_read);
+ memcpy(((php_stream_dirent *) buf)->d_name, key.s, to_read);
((php_stream_dirent *) buf)->d_name[to_read + 1] = '\0';
return sizeof(php_stream_dirent);
@@ -186,10 +186,11 @@
{
HashTable *data;
int dirlen = strlen(dir);
- char *save, *found, *key;
+ zstr key;
+ char *entry, *found, *save;
uint keylen;
ulong unused;
- char *entry;
+
ALLOC_HASHTABLE(data);
zend_hash_init(data, 64, zend_get_hash_value, NULL, 0);
@@ -204,7 +205,7 @@
break;
}
if (keylen <= (uint)dirlen) {
- if (keylen < (uint)dirlen || !strncmp(key, dir,
dirlen)) {
+ if (keylen < (uint)dirlen || !strncmp(key.s, dir,
dirlen)) {
if (SUCCESS !=
zend_hash_move_forward(manifest)) {
break;
}
@@ -213,27 +214,27 @@
}
if (*dir == '/') {
/* root directory */
- if (NULL != (found = (char *) memchr(key, '/',
keylen))) {
+ if (NULL != (found = (char *) memchr(key.s, '/',
keylen))) {
/* the entry has a path separator and is a
subdirectory */
- entry = (char *) safe_emalloc(found - key, 1,
1);
- memcpy(entry, key, found - key);
- keylen = found - key;
+ entry = (char *) safe_emalloc(found - key.s, 1,
1);
+ memcpy(entry, key.s, found - key.s);
+ keylen = found - key.s;
entry[keylen] = '\0';
} else {
entry = (char *) safe_emalloc(keylen, 1, 1);
- memcpy(entry, key, keylen);
+ memcpy(entry, key.s, keylen);
entry[keylen] = '\0';
}
goto PHAR_ADD_ENTRY;
} else {
- if (0 != memcmp(key, dir, dirlen)) {
+ if (0 != memcmp(key.s, dir, dirlen)) {
/* entry in directory not found */
if (SUCCESS !=
zend_hash_move_forward(manifest)) {
break;
}
continue;
} else {
- if (key[dirlen] != '/') {
+ if (key.s[dirlen] != '/') {
if (SUCCESS !=
zend_hash_move_forward(manifest)) {
break;
}
@@ -241,7 +242,7 @@
}
}
}
- save = key;
+ save = key.s;
save += dirlen + 1; /* seek to just past the path separator */
if (NULL != (found = (char *) memchr(save, '/', keylen - dirlen
- 1))) {
/* is subdirectory */
@@ -289,7 +290,8 @@
{
php_url *resource = NULL;
php_stream *ret;
- char *internal_file, *key, *error;
+ char *internal_file, *error;
+ zstr key;
uint keylen;
ulong unused;
phar_archive_data *phar;
@@ -367,7 +369,7 @@
if (HASH_KEY_NON_EXISTANT !=
zend_hash_get_current_key_ex(
&phar->manifest, &key, &keylen,
&unused, 0, NULL)) {
- if (keylen > (uint)i_len && 0 == memcmp(key,
internal_file, i_len)) {
+ if (keylen > (uint)i_len && 0 == memcmp(key.s,
internal_file, i_len)) {
/* directory found */
internal_file = estrndup(internal_file,
i_len);
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/func_interceptors.c?r1=1.20&r2=1.21&diff_format=u
Index: php-src/ext/phar/func_interceptors.c
diff -u php-src/ext/phar/func_interceptors.c:1.20
php-src/ext/phar/func_interceptors.c:1.21
--- php-src/ext/phar/func_interceptors.c:1.20 Sun May 11 21:30:04 2008
+++ php-src/ext/phar/func_interceptors.c Tue May 13 18:35:25 2008
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: func_interceptors.c,v 1.20 2008/05/11 21:30:04 cellog Exp $ */
+/* $Id: func_interceptors.c,v 1.21 2008/05/13 18:35:25 sfox Exp $ */
#include "phar_internal.h"
@@ -655,7 +655,7 @@
goto stat_entry;
} else {
phar_archive_data *phar = *pphar;
- char *key;
+ zstr key;
uint keylen;
ulong unused;
@@ -667,11 +667,11 @@
if (HASH_KEY_NON_EXISTANT !=
zend_hash_get_current_key_ex(
&phar->manifest, &key, &keylen, &unused, 0, NULL)) {
- if (!memcmp(actual,
key, actual_len)) {
+ if (!memcmp(actual,
key.s, actual_len)) {
efree(save2);
efree(entry);
/* directory
found, all dirs have the same stat */
- if
(key[actual_len] == '/') {
+ if
(key.s[actual_len] == '/') {
sb.st_size = 0;
sb.st_mode = 0777;
sb.st_mode |= S_IFDIR; /* regular directory */
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/phar.c?r1=1.370&r2=1.371&diff_format=u
Index: php-src/ext/phar/phar.c
diff -u php-src/ext/phar/phar.c:1.370 php-src/ext/phar/phar.c:1.371
--- php-src/ext/phar/phar.c:1.370 Mon May 12 20:42:06 2008
+++ php-src/ext/phar/phar.c Tue May 13 18:35:25 2008
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: phar.c,v 1.370 2008/05/12 20:42:06 cellog Exp $ */
+/* $Id: phar.c,v 1.371 2008/05/13 18:35:25 sfox Exp $ */
#define PHAR_MAIN 1
#include "phar_internal.h"
@@ -1592,7 +1592,7 @@
return FAILURE;
}
} else {
- char *key;
+ zstr key;
uint keylen;
ulong unused;
@@ -1606,7 +1606,7 @@
zend_hash_move_forward(&(PHAR_GLOBALS->phar_fname_map));
continue;
}
- if (!memcmp(filename, key, keylen) &&
(filename_len == keylen
+ if (!memcmp(filename, key.s, keylen) &&
(filename_len == keylen
|| filename[keylen] == '/' ||
filename[keylen] == '\0')) {
if (FAILURE ==
zend_hash_get_current_data(&(PHAR_GLOBALS->phar_fname_map), (void **) &pphar)) {
break;
@@ -2850,7 +2850,7 @@
}
} else if (phar->flags & PHAR_FILE_COMPRESSION_MASK) {
/* compressed phar */
-#if PHP_VERSION_ID >= 50300 && PHP_VERSION_ID < 60000
+#if PHP_VERSION_ID >= 50300
file_handle->type = ZEND_HANDLE_STREAM;
file_handle->free_filename = 0;
file_handle->handle.stream.handle = phar;
@@ -3026,7 +3026,7 @@
php_info_print_table_header(2, "Phar: PHP Archive support", "enabled");
php_info_print_table_row(2, "Phar EXT version", PHP_PHAR_VERSION);
php_info_print_table_row(2, "Phar API version", PHP_PHAR_API_VERSION);
- php_info_print_table_row(2, "CVS revision", "$Revision: 1.370 $");
+ php_info_print_table_row(2, "CVS revision", "$Revision: 1.371 $");
php_info_print_table_row(2, "Phar-based phar archives", "enabled");
php_info_print_table_row(2, "Tar-based phar archives", "enabled");
php_info_print_table_row(2, "ZIP-based phar archives", "enabled");
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/phar_object.c?r1=1.266&r2=1.267&diff_format=u
Index: php-src/ext/phar/phar_object.c
diff -u php-src/ext/phar/phar_object.c:1.266
php-src/ext/phar/phar_object.c:1.267
--- php-src/ext/phar/phar_object.c:1.266 Mon May 12 20:42:06 2008
+++ php-src/ext/phar/phar_object.c Tue May 13 18:35:25 2008
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: phar_object.c,v 1.266 2008/05/12 20:42:06 cellog Exp $ */
+/* $Id: phar_object.c,v 1.267 2008/05/13 18:35:25 sfox Exp $ */
#include "phar_internal.h"
#include "func_interceptors.h"
@@ -778,7 +778,7 @@
mime.len = Z_STRLEN_PP(val); \
} \
mime.type = ret; \
- zend_hash_update(&mimetypes, key, keylen-1, (void *)&mime,
sizeof(phar_mime_type), NULL);
+ zend_hash_update(&mimetypes, key.s, keylen-1, (void *)&mime,
sizeof(phar_mime_type), NULL);
if (mimeoverride) {
if (!zend_hash_num_elements(Z_ARRVAL_P(mimeoverride))) {
@@ -786,7 +786,7 @@
}
for
(zend_hash_internal_pointer_reset(Z_ARRVAL_P(mimeoverride)); SUCCESS ==
zend_hash_has_more_elements(Z_ARRVAL_P(mimeoverride));
zend_hash_move_forward(Z_ARRVAL_P(mimeoverride))) {
zval **val;
- char *key;
+ zstr key;
uint keylen;
ulong intkey;
if (HASH_KEY_IS_LONG ==
zend_hash_get_current_key_ex(Z_ARRVAL_P(mimeoverride), &key, &keylen, &intkey,
0, NULL)) {
@@ -798,7 +798,7 @@
RETURN_FALSE;
}
if (FAILURE ==
zend_hash_get_current_data(Z_ARRVAL_P(mimeoverride), (void **) &val)) {
- zend_throw_exception_ex(phar_ce_PharException,
0 TSRMLS_CC, "Failed to retrieve Mime type for extension \"%s\"", key);
+ zend_throw_exception_ex(phar_ce_PharException,
0 TSRMLS_CC, "Failed to retrieve Mime type for extension \"%s\"", key.s);
phar_entry_delref(phar TSRMLS_CC);
#ifdef PHP_WIN32
efree(fname);
@@ -1315,7 +1315,8 @@
phar_entry_data *data;
php_stream *fp;
long contents_len;
- char *fname, *error, *str_key, *base = p_obj->b, *opened, *save = NULL,
*temp = NULL;
+ char *fname, *error, *base = p_obj->b, *opened, *save = NULL, *temp =
NULL;
+ zstr str_key;
zend_class_entry *ce = p_obj->c;
phar_archive_object *phar_obj = p_obj->p;
char *str = "[stream]";
@@ -1347,8 +1348,8 @@
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator
%s returned an invalid key (must return a string)", ce->name);
return ZEND_HASH_APPLY_STOP;
}
- save = str_key;
- if (str_key[str_key_len - 1] == '\0')
str_key_len--;
+ save = str_key.s;
+ if (str_key.s[str_key_len - 1] == '\0')
str_key_len--;
} else {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator
%s returned an invalid key (must return a string)", ce->name);
return ZEND_HASH_APPLY_STOP;
@@ -1393,7 +1394,7 @@
goto phar_spl_fileinfo;
case SPL_FS_INFO:
case SPL_FS_FILE:
- fname =
expand_filepath(intern->file_name, NULL TSRMLS_CC);
+ fname =
expand_filepath(intern->file_name.s, NULL TSRMLS_CC);
fname_len = strlen(fname);
save = fname;
is_splfileinfo = 1;
@@ -1423,9 +1424,9 @@
}
return ZEND_HASH_APPLY_KEEP;
}
- str_key = fname + base_len;
- if (*str_key == '/' || *str_key == '\\') {
- str_key++;
+ str_key.s = fname + base_len;
+ if (*str_key.s == '/' || *str_key.s == '\\') {
+ str_key.s++;
str_key_len--;
}
} else {
@@ -1446,8 +1447,8 @@
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator
%s returned an invalid key (must return a string)", ce->name);
return ZEND_HASH_APPLY_STOP;
}
- save = str_key;
- if (str_key[str_key_len - 1] == '\0') str_key_len--;
+ save = str_key.s;
+ if (str_key.s[str_key_len - 1] == '\0') str_key_len--;
} else {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator
%s returned an invalid key (must return a string)", ce->name);
return ZEND_HASH_APPLY_STOP;
@@ -1491,8 +1492,8 @@
}
after_open_fp:
- if (!(data =
phar_get_or_create_entry_data(phar_obj->arc.archive->fname,
phar_obj->arc.archive->fname_len, str_key, str_key_len, "w+b", 0, &error
TSRMLS_CC))) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0
TSRMLS_CC, "Entry %s cannot be created: %s", str_key, error);
+ if (!(data =
phar_get_or_create_entry_data(phar_obj->arc.archive->fname,
phar_obj->arc.archive->fname_len, str_key.s, str_key_len, "w+b", 0, &error
TSRMLS_CC))) {
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0
TSRMLS_CC, "Entry %s cannot be created: %s", str_key.s, error);
efree(error);
if (save) {
efree(save);
@@ -1514,7 +1515,7 @@
php_stream_close(fp);
}
- add_assoc_string(p_obj->ret, str_key, opened, 0);
+ add_assoc_string(p_obj->ret, str_key.s, opened, 0);
if (save) {
efree(save);
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/stream.c?r1=1.27&r2=1.28&diff_format=u
Index: php-src/ext/phar/stream.c
diff -u php-src/ext/phar/stream.c:1.27 php-src/ext/phar/stream.c:1.28
--- php-src/ext/phar/stream.c:1.27 Wed May 7 05:38:29 2008
+++ php-src/ext/phar/stream.c Tue May 13 18:35:25 2008
@@ -501,7 +501,8 @@
php_stream_statbuf *ssb, php_stream_context
*context TSRMLS_DC) /* {{{ */
{
php_url *resource = NULL;
- char *internal_file, *key, *error;
+ zstr key;
+ char *internal_file, *error;
uint keylen;
ulong unused;
phar_archive_data *phar;
@@ -562,9 +563,9 @@
if (HASH_KEY_NON_EXISTANT !=
zend_hash_get_current_key_ex(
&phar->manifest, &key, &keylen,
&unused, 0, NULL)) {
- if (keylen >= (uint)internal_file_len && 0 ==
memcmp(internal_file, key, internal_file_len)) {
+ if (keylen >= (uint)internal_file_len && 0 ==
memcmp(internal_file, key.s, internal_file_len)) {
/* directory found, all dirs have the
same stat */
- if (key[internal_file_len] == '/') {
+ if (key.s[internal_file_len] == '/') {
phar_dostat(phar, NULL, ssb, 1,
phar->alias, phar->alias_len TSRMLS_CC);
php_url_free(resource);
return SUCCESS;
@@ -577,7 +578,7 @@
}
/* check for mounted directories */
if (phar->mounted_dirs.arBuckets &&
zend_hash_num_elements(&phar->mounted_dirs)) {
- char *key;
+ zstr key;
ulong unused;
uint keylen;
@@ -586,7 +587,7 @@
if (HASH_KEY_NON_EXISTANT ==
zend_hash_get_current_key_ex(&phar->mounted_dirs, &key, &keylen, &unused, 0,
NULL)) {
break;
}
- if ((int)keylen >= internal_file_len ||
strncmp(key, internal_file, keylen)) {
+ if ((int)keylen >= internal_file_len ||
strncmp(key.s, internal_file, keylen)) {
continue;
} else {
char *test;
@@ -594,7 +595,7 @@
phar_entry_info *entry;
php_stream_statbuf ssbi;
- if (SUCCESS !=
zend_hash_find(&phar->manifest, key, keylen, (void **) &entry)) {
+ if (SUCCESS !=
zend_hash_find(&phar->manifest, key.s, keylen, (void **) &entry)) {
goto free_resource;
}
if (!entry->tmp || !entry->is_mounted) {
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/util.c?r1=1.55&r2=1.56&diff_format=u
Index: php-src/ext/phar/util.c
diff -u php-src/ext/phar/util.c:1.55 php-src/ext/phar/util.c:1.56
--- php-src/ext/phar/util.c:1.55 Mon May 12 20:42:06 2008
+++ php-src/ext/phar/util.c Tue May 13 18:35:25 2008
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: util.c,v 1.55 2008/05/12 20:42:06 cellog Exp $ */
+/* $Id: util.c,v 1.56 2008/05/13 18:35:25 sfox Exp $ */
#include "phar_internal.h"
#if !defined(PHP_VERSION_ID) || PHP_VERSION_ID < 50300
@@ -1183,7 +1183,7 @@
}
return entry;
} else if (phar->mounted_dirs.arBuckets &&
zend_hash_num_elements(&phar->mounted_dirs)) {
- char *key;
+ zstr key;
ulong unused;
uint keylen;
@@ -1192,7 +1192,7 @@
if (HASH_KEY_NON_EXISTANT ==
zend_hash_get_current_key_ex(&phar->mounted_dirs, &key, &keylen, &unused, 0,
NULL)) {
break;
}
- if ((int)keylen >= path_len || strncmp(key, path,
keylen)) {
+ if ((int)keylen >= path_len || strncmp(key.s, path,
keylen)) {
continue;
} else {
char *test;
@@ -1200,15 +1200,15 @@
phar_entry_info *entry;
php_stream_statbuf ssb;
- if (SUCCESS != zend_hash_find(&phar->manifest,
key, keylen, (void **) &entry)) {
+ if (SUCCESS != zend_hash_find(&phar->manifest,
key.s, keylen, (void **) &entry)) {
if (error) {
- spprintf(error, 4096, "phar
internal error: mounted path \"%s\" could not be retrieved from manifest", key);
+ spprintf(error, 4096, "phar
internal error: mounted path \"%s\" could not be retrieved from manifest",
key.s);
}
return NULL;
}
if (!entry->tmp || !entry->is_mounted) {
if (error) {
- spprintf(error, 4096, "phar
internal error: mounted path \"%s\" is not properly initialized as a mounted
path", key);
+ spprintf(error, 4096, "phar
internal error: mounted path \"%s\" is not properly initialized as a mounted
path", key.s);
}
return NULL;
}
@@ -1254,7 +1254,7 @@
if (dir) {
/* try to find a directory */
HashTable *manifest;
- char *key;
+ zstr key;
uint keylen;
ulong unused;
@@ -1267,14 +1267,14 @@
if (HASH_KEY_NON_EXISTANT ==
zend_hash_get_current_key_ex(manifest, &key, &keylen, &unused, 0, NULL)) {
break;
}
- if (0 != memcmp(key, path, path_len)) {
+ if (0 != memcmp(key.s, path, path_len)) {
/* entry in directory not found */
if (SUCCESS !=
zend_hash_move_forward(manifest)) {
break;
}
continue;
} else {
- if (key[path_len] != '/') {
+ if (key.s[path_len] != '/') {
if (SUCCESS !=
zend_hash_move_forward(manifest)) {
break;
}
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/files/phar_test.inc?r1=1.2&r2=1.3&diff_format=u
Index: php-src/ext/phar/tests/files/phar_test.inc
diff -u php-src/ext/phar/tests/files/phar_test.inc:1.2
php-src/ext/phar/tests/files/phar_test.inc:1.3
--- php-src/ext/phar/tests/files/phar_test.inc:1.2 Tue May 6 21:14:52 2008
+++ php-src/ext/phar/tests/files/phar_test.inc Tue May 13 18:35:25 2008
@@ -36,7 +36,7 @@
if (empty($comp)) $comp = $cont;
if (empty($ulen)) $ulen = strlen($cont);
if (empty($clen)) $clen = strlen($comp);
- if (empty($crc32))$crc32= crc32($cont);
+ if (empty($crc32))$crc32= crc32((binary)$cont);
if (isset($meta)) $meta = serialize($meta);
// write manifest entry
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php