summaryrefslogtreecommitdiff
path: root/ext/phar/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/phar/util.c')
-rw-r--r--ext/phar/util.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/ext/phar/util.c b/ext/phar/util.c
index d8152cf459..7029c6f26b 100644
--- a/ext/phar/util.c
+++ b/ext/phar/util.c
@@ -350,7 +350,7 @@ splitted:
* appended, truncated, or read. For read, if the entry is marked unmodified, it is
* assumed that the file pointer, if present, is opened for reading
*/
-int phar_get_entry_data(phar_entry_data **ret, char *fname, int fname_len, char *path, int path_len, char *mode, char allow_dir, char **error, int security TSRMLS_DC) /* {{{ */
+int phar_get_entry_data(phar_entry_data **ret, char *fname, int fname_len, char *path, int path_len, const char *mode, char allow_dir, char **error, int security TSRMLS_DC) /* {{{ */
{
phar_archive_data *phar;
phar_entry_info *entry;
@@ -511,7 +511,7 @@ really_get_entry:
/**
* Create a new dummy file slot within a writeable phar for a newly created file
*/
-phar_entry_data *phar_get_or_create_entry_data(char *fname, int fname_len, char *path, int path_len, char *mode, char allow_dir, char **error, int security TSRMLS_DC) /* {{{ */
+phar_entry_data *phar_get_or_create_entry_data(char *fname, int fname_len, char *path, int path_len, const char *mode, char allow_dir, char **error, int security TSRMLS_DC) /* {{{ */
{
phar_archive_data *phar;
phar_entry_info *entry, etemp;
@@ -673,7 +673,7 @@ int phar_copy_entry_fp(phar_entry_info *source, phar_entry_info *dest, char **er
link = source;
}
- if (SUCCESS != phar_stream_copy_to_stream(phar_get_efp(link, 0 TSRMLS_CC), dest->fp, link->uncompressed_filesize, NULL)) {
+ if (SUCCESS != php_stream_copy_to_stream_ex(phar_get_efp(link, 0 TSRMLS_CC), dest->fp, link->uncompressed_filesize, NULL)) {
php_stream_close(dest->fp);
dest->fp_type = PHAR_FP;
if (error) {
@@ -775,7 +775,7 @@ int phar_open_entry_fp(phar_entry_info *entry, char **error, int follow_links TS
php_stream_seek(phar_get_entrypfp(entry TSRMLS_CC), phar_get_fp_offset(entry TSRMLS_CC), SEEK_SET);
if (entry->uncompressed_filesize) {
- if (SUCCESS != phar_stream_copy_to_stream(phar_get_entrypfp(entry TSRMLS_CC), ufp, entry->compressed_filesize, NULL)) {
+ if (SUCCESS != php_stream_copy_to_stream_ex(phar_get_entrypfp(entry TSRMLS_CC), ufp, entry->compressed_filesize, NULL)) {
spprintf(error, 4096, "phar error: internal corruption of phar \"%s\" (actual filesize mismatch on file \"%s\")", phar->fname, entry->filename);
php_stream_filter_remove(filter, 1 TSRMLS_CC);
return FAILURE;
@@ -882,7 +882,7 @@ int phar_separate_entry_fp(phar_entry_info *entry, char **error TSRMLS_DC) /* {{
link = entry;
}
- if (SUCCESS != phar_stream_copy_to_stream(phar_get_efp(link, 0 TSRMLS_CC), fp, link->uncompressed_filesize, NULL)) {
+ if (SUCCESS != php_stream_copy_to_stream_ex(phar_get_efp(link, 0 TSRMLS_CC), fp, link->uncompressed_filesize, NULL)) {
if (error) {
spprintf(error, 4096, "phar error: cannot separate entry file \"%s\" contents in phar archive \"%s\" for write access", entry->filename, entry->phar->fname);
}
@@ -1299,21 +1299,17 @@ phar_entry_info *phar_get_entry_info_dir(phar_archive_data *phar, char *path, in
}
if (phar->mounted_dirs.arBuckets && zend_hash_num_elements(&phar->mounted_dirs)) {
- phar_zstr key;
char *str_key;
ulong unused;
uint keylen;
zend_hash_internal_pointer_reset(&phar->mounted_dirs);
while (FAILURE != zend_hash_has_more_elements(&phar->mounted_dirs)) {
- if (HASH_KEY_NON_EXISTENT == zend_hash_get_current_key_ex(&phar->mounted_dirs, &key, &keylen, &unused, 0, NULL)) {
+ if (HASH_KEY_NON_EXISTENT == zend_hash_get_current_key_ex(&phar->mounted_dirs, &str_key, &keylen, &unused, 0, NULL)) {
break;
}
- PHAR_STR(key, str_key);
-
if ((int)keylen >= path_len || strncmp(str_key, path, keylen)) {
- PHAR_STR_FREE(str_key);
continue;
} else {
char *test;
@@ -1324,7 +1320,6 @@ phar_entry_info *phar_get_entry_info_dir(phar_archive_data *phar, char *path, in
if (error) {
spprintf(error, 4096, "phar internal error: mounted path \"%s\" could not be retrieved from manifest", str_key);
}
- PHAR_STR_FREE(str_key);
return NULL;
}
@@ -1332,10 +1327,8 @@ phar_entry_info *phar_get_entry_info_dir(phar_archive_data *phar, char *path, in
if (error) {
spprintf(error, 4096, "phar internal error: mounted path \"%s\" is not properly initialized as a mounted path", str_key);
}
- PHAR_STR_FREE(str_key);
return NULL;
}
- PHAR_STR_FREE(str_key);
test_len = spprintf(&test, MAXPATHLEN, "%s%s", entry->tmp, path + keylen);