diff options
Diffstat (limited to 'ext/phar')
-rw-r--r-- | ext/phar/dirstream.c | 6 | ||||
-rw-r--r-- | ext/phar/dirstream.h | 8 | ||||
-rw-r--r-- | ext/phar/phar.c | 18 | ||||
-rw-r--r-- | ext/phar/phar_internal.h | 6 | ||||
-rw-r--r-- | ext/phar/stream.c | 10 | ||||
-rw-r--r-- | ext/phar/stream.h | 10 | ||||
-rw-r--r-- | ext/phar/tests/phpinfo_004.phpt | 30 | ||||
-rw-r--r-- | ext/phar/util.c | 4 |
8 files changed, 45 insertions, 47 deletions
diff --git a/ext/phar/dirstream.c b/ext/phar/dirstream.c index c29ca9d968..b090577306 100644 --- a/ext/phar/dirstream.c +++ b/ext/phar/dirstream.c @@ -319,7 +319,7 @@ PHAR_ADD_ENTRY: /** * Open a directory handle within a phar archive */ -php_stream *phar_wrapper_open_dir(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) /* {{{ */ +php_stream *phar_wrapper_open_dir(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) /* {{{ */ { php_url *resource = NULL; php_stream *ret; @@ -432,7 +432,7 @@ php_stream *phar_wrapper_open_dir(php_stream_wrapper *wrapper, char *path, char /** * Make a new directory within a phar archive */ -int phar_wrapper_mkdir(php_stream_wrapper *wrapper, char *url_from, int mode, int options, php_stream_context *context TSRMLS_DC) /* {{{ */ +int phar_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url_from, int mode, int options, php_stream_context *context TSRMLS_DC) /* {{{ */ { phar_entry_info entry, *e; phar_archive_data *phar = NULL; @@ -564,7 +564,7 @@ int phar_wrapper_mkdir(php_stream_wrapper *wrapper, char *url_from, int mode, in /** * Remove a directory within a phar archive */ -int phar_wrapper_rmdir(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC) /* {{{ */ +int phar_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC) /* {{{ */ { phar_entry_info *entry; phar_archive_data *phar = NULL; diff --git a/ext/phar/dirstream.h b/ext/phar/dirstream.h index 9b07c9d799..030fe6536e 100644 --- a/ext/phar/dirstream.h +++ b/ext/phar/dirstream.h @@ -20,11 +20,11 @@ /* $Id$ */ BEGIN_EXTERN_C() -int phar_wrapper_mkdir(php_stream_wrapper *wrapper, char *url_from, int mode, int options, php_stream_context *context TSRMLS_DC); -int phar_wrapper_rmdir(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC); +int phar_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url_from, int mode, int options, php_stream_context *context TSRMLS_DC); +int phar_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC); #ifdef PHAR_DIRSTREAM -php_url* phar_parse_url(php_stream_wrapper *wrapper, char *filename, char *mode, int options TSRMLS_DC); +php_url* phar_parse_url(php_stream_wrapper *wrapper, const char *filename, const char *mode, int options TSRMLS_DC); /* directory handlers */ static size_t phar_dir_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC); @@ -33,7 +33,7 @@ static int phar_dir_close(php_stream *stream, int close_handle TSRMLS_DC); static int phar_dir_flush(php_stream *stream TSRMLS_DC); static int phar_dir_seek( php_stream *stream, off_t offset, int whence, off_t *newoffset TSRMLS_DC); #else -php_stream* phar_wrapper_open_dir(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); +php_stream* phar_wrapper_open_dir(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); #endif END_EXTERN_C() diff --git a/ext/phar/phar.c b/ext/phar/phar.c index ec8e5fbde7..e8d1139cfa 100644 --- a/ext/phar/phar.c +++ b/ext/phar/phar.c @@ -2251,13 +2251,13 @@ last_time: * * This is used by phar_parse_url() */ -int phar_split_fname(char *filename, int filename_len, char **arch, int *arch_len, char **entry, int *entry_len, int executable, int for_create TSRMLS_DC) /* {{{ */ +int phar_split_fname(const char *filename, int filename_len, char **arch, int *arch_len, char **entry, int *entry_len, int executable, int for_create TSRMLS_DC) /* {{{ */ { const char *ext_str; #ifdef PHP_WIN32 char *save; #endif - int ext_len, free_filename = 0; + int ext_len; if (!strncasecmp(filename, "phar://", 7)) { filename += 7; @@ -2266,7 +2266,6 @@ int phar_split_fname(char *filename, int filename_len, char **arch, int *arch_le ext_len = 0; #ifdef PHP_WIN32 - free_filename = 1; save = filename; filename = estrndup(filename, filename_len); phar_unixify_path_separators(filename, filename_len); @@ -2282,10 +2281,9 @@ int phar_split_fname(char *filename, int filename_len, char **arch, int *arch_le #endif } - if (free_filename) { - efree(filename); - } - +#ifdef PHP_WIN32 + efree(filename); +#endif return FAILURE; } @@ -2308,9 +2306,9 @@ int phar_split_fname(char *filename, int filename_len, char **arch, int *arch_le *entry = estrndup("/", 1); } - if (free_filename) { - efree(filename); - } +#ifdef PHP_WIN32 + efree(filename); +#endif return SUCCESS; } diff --git a/ext/phar/phar_internal.h b/ext/phar/phar_internal.h index daa85f1b70..9b8d608207 100644 --- a/ext/phar/phar_internal.h +++ b/ext/phar/phar_internal.h @@ -690,11 +690,11 @@ int phar_entry_delref(phar_entry_data *idata TSRMLS_DC); phar_entry_info *phar_get_entry_info(phar_archive_data *phar, char *path, int path_len, char **error, int security TSRMLS_DC); phar_entry_info *phar_get_entry_info_dir(phar_archive_data *phar, char *path, int path_len, char 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, 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, 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); +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); int phar_flush(phar_archive_data *archive, char *user_stub, long len, int convert, char **error TSRMLS_DC); int phar_detect_phar_fname_ext(const char *filename, int filename_len, const char **ext_str, int *ext_len, int executable, int for_create, int is_complete TSRMLS_DC); -int phar_split_fname(char *filename, int filename_len, char **arch, int *arch_len, char **entry, int *entry_len, int executable, int for_create TSRMLS_DC); +int phar_split_fname(const char *filename, int filename_len, char **arch, int *arch_len, char **entry, int *entry_len, int executable, int for_create TSRMLS_DC); typedef enum { pcr_use_query, diff --git a/ext/phar/stream.c b/ext/phar/stream.c index 401d81e109..d3d4cd655b 100644 --- a/ext/phar/stream.c +++ b/ext/phar/stream.c @@ -56,7 +56,7 @@ php_stream_wrapper php_stream_phar_wrapper = { /** * Open a phar file for streams API */ -php_url* phar_parse_url(php_stream_wrapper *wrapper, char *filename, char *mode, int options TSRMLS_DC) /* {{{ */ +php_url* phar_parse_url(php_stream_wrapper *wrapper, const char *filename, const char *mode, int options TSRMLS_DC) /* {{{ */ { php_url *resource; char *arch = NULL, *entry = NULL, *error; @@ -155,7 +155,7 @@ php_url* phar_parse_url(php_stream_wrapper *wrapper, char *filename, char *mode, /** * used for fopen('phar://...') and company */ -static php_stream * phar_wrapper_open_url(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) /* {{{ */ +static php_stream * phar_wrapper_open_url(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) /* {{{ */ { phar_archive_data *phar; phar_entry_data *idata; @@ -563,7 +563,7 @@ static int phar_stream_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_D /** * Stream wrapper stat implementation of stat() */ -static int phar_wrapper_stat(php_stream_wrapper *wrapper, char *url, int flags, +static int phar_wrapper_stat(php_stream_wrapper *wrapper, const char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC) /* {{{ */ { php_url *resource = NULL; @@ -686,7 +686,7 @@ free_resource: /** * Unlink a file within a phar archive */ -static int phar_wrapper_unlink(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC) /* {{{ */ +static int phar_wrapper_unlink(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC) /* {{{ */ { php_url *resource; char *internal_file, *error; @@ -762,7 +762,7 @@ static int phar_wrapper_unlink(php_stream_wrapper *wrapper, char *url, int optio } /* }}} */ -static int phar_wrapper_rename(php_stream_wrapper *wrapper, char *url_from, char *url_to, int options, php_stream_context *context TSRMLS_DC) /* {{{ */ +static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from, const char *url_to, int options, php_stream_context *context TSRMLS_DC) /* {{{ */ { php_url *resource_from, *resource_to; char *error; diff --git a/ext/phar/stream.h b/ext/phar/stream.h index b22b67ab01..0155759d12 100644 --- a/ext/phar/stream.h +++ b/ext/phar/stream.h @@ -21,13 +21,13 @@ BEGIN_EXTERN_C() -php_url* phar_parse_url(php_stream_wrapper *wrapper, char *filename, char *mode, int options TSRMLS_DC); +php_url* phar_parse_url(php_stream_wrapper *wrapper, const char *filename, const char *mode, int options TSRMLS_DC); void phar_entry_remove(phar_entry_data *idata, char **error TSRMLS_DC); -static php_stream* phar_wrapper_open_url(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); -static int phar_wrapper_rename(php_stream_wrapper *wrapper, char *url_from, char *url_to, int options, php_stream_context *context TSRMLS_DC); -static int phar_wrapper_unlink(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC); -static int phar_wrapper_stat(php_stream_wrapper *wrapper, char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC); +static php_stream* phar_wrapper_open_url(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); +static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from, const char *url_to, int options, php_stream_context *context TSRMLS_DC); +static int phar_wrapper_unlink(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC); +static int phar_wrapper_stat(php_stream_wrapper *wrapper, const char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC); /* file/stream handlers */ static size_t phar_stream_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC); diff --git a/ext/phar/tests/phpinfo_004.phpt b/ext/phar/tests/phpinfo_004.phpt index 24263f07be..c57e850d82 100644 --- a/ext/phar/tests/phpinfo_004.phpt +++ b/ext/phar/tests/phpinfo_004.phpt @@ -23,9 +23,9 @@ phpinfo(INFO_MODULES); ?> ===DONE=== --EXPECTF-- -%a<br /> +%a <h2><a name="module_Phar">Phar</a></h2> -<table border="0" cellpadding="3" width="600"> +<table> <tr class="h"><th>Phar: PHP Archive support</th><th>enabled</th></tr> <tr><td class="e">Phar EXT version </td><td class="v">%s </td></tr> <tr><td class="e">Phar API version </td><td class="v">1.1.1 </td></tr> @@ -36,20 +36,20 @@ phpinfo(INFO_MODULES); <tr><td class="e">gzip compression </td><td class="v">enabled </td></tr> <tr><td class="e">bzip2 compression </td><td class="v">enabled </td></tr> <tr><td class="e">OpenSSL support </td><td class="v">disabled (install ext/openssl) </td></tr> -</table><br /> -<table border="0" cellpadding="3" width="600"> +</table> +<table> <tr class="v"><td> Phar based on pear/PHP_Archive, original concept by Davey Shafik.<br />Phar fully realized by Gregory Beaver and Marcus Boerger.<br />Portions of tar implementation Copyright (c) %d-%d Tim Kientzle.</td></tr> -</table><br /> -<table border="0" cellpadding="3" width="600"> +</table> +<table> <tr class="h"><th>Directive</th><th>Local Value</th><th>Master Value</th></tr> <tr><td class="e">phar.cache_list</td><td class="v"><i>no value</i></td><td class="v"><i>no value</i></td></tr> <tr><td class="e">phar.readonly</td><td class="v">Off</td><td class="v">Off</td></tr> <tr><td class="e">phar.require_hash</td><td class="v">Off</td><td class="v">Off</td></tr> -</table><br /> -%a<br /> +</table> +%a <h2><a name="module_Phar">Phar</a></h2> -<table border="0" cellpadding="3" width="600"> +<table> <tr class="h"><th>Phar: PHP Archive support</th><th>enabled</th></tr> <tr><td class="e">Phar EXT version </td><td class="v">%s </td></tr> <tr><td class="e">Phar API version </td><td class="v">1.1.1 </td></tr> @@ -60,16 +60,16 @@ Phar based on pear/PHP_Archive, original concept by Davey Shafik.<br />Phar full <tr><td class="e">gzip compression </td><td class="v">enabled </td></tr> <tr><td class="e">bzip2 compression </td><td class="v">enabled </td></tr> <tr><td class="e">OpenSSL support </td><td class="v">disabled (install ext/openssl) </td></tr> -</table><br /> -<table border="0" cellpadding="3" width="600"> +</table> +<table> <tr class="v"><td> Phar based on pear/PHP_Archive, original concept by Davey Shafik.<br />Phar fully realized by Gregory Beaver and Marcus Boerger.<br />Portions of tar implementation Copyright (c) %d-%d Tim Kientzle.</td></tr> -</table><br /> -<table border="0" cellpadding="3" width="600"> +</table> +<table> <tr class="h"><th>Directive</th><th>Local Value</th><th>Master Value</th></tr> <tr><td class="e">phar.cache_list</td><td class="v"><i>no value</i></td><td class="v"><i>no value</i></td></tr> <tr><td class="e">phar.readonly</td><td class="v">On</td><td class="v">Off</td></tr> <tr><td class="e">phar.require_hash</td><td class="v">On</td><td class="v">Off</td></tr> -</table><br /> -%a<br /> +</table> +%a </div></body></html>===DONE=== diff --git a/ext/phar/util.c b/ext/phar/util.c index 8348a47874..38aa549f00 100644 --- a/ext/phar/util.c +++ b/ext/phar/util.c @@ -572,7 +572,7 @@ not_stream: * 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; @@ -733,7 +733,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; |