cvs: pecl /zip package.xml php_zip.c php_zip.h zip_stream.c /zip/lib zip_close.c zip_open.c zip_source_file.c zip_stat_index.c zipint.h /zip/tests
oo_namelocate.phpt
| From: | Pierre-Alain Joye | Date: | Thu, 16 Nov 2006 00:19:22 +0000 |
| Subject: | cvs: pecl /zip package.xml php_zip.c php_zip.h zip_stream.c /zip/lib zip_close.c zip_open.c zip_source_file.c zip_stat_index.c zipint.h /zip/tests oo_namelocate.phpt |
||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-6639@lists.php.net to get a copy of this message | ||
pajoye Thu Nov 16 00:19:22 2006 UTC
Modified files:
/pecl/zip package.xml php_zip.c php_zip.h zip_stream.c
/pecl/zip/lib zip_close.c zip_open.c zip_source_file.c
zip_stat_index.c zipint.h
/pecl/zip/tests oo_namelocate.phpt
Log:
- sync with php-src
- Fix #9278, fix binary access issues on windows in non CGI/CLI/embed sapi
- use static function if possible (Nuno Lopes)
- fix protos
- createEmptyDir returns true on success
http://cvs.php.net/viewvc.cgi/pecl/zip/package.xml?r1=1.68&r2=1.69&diff_format=u Index: pecl/zip/package.xml diff -u pecl/zip/package.xml:1.68 pecl/zip/package.xml:1.69 --- pecl/zip/package.xml:1.68 Wed Nov 1 23:00:12 2006 +++ pecl/zip/package.xml Thu Nov 16 00:19:21 2006 @@ -20,10 +20,12 @@ <api>stable</api> </stability> <license uri="http://www.php.net/license">PHP License</license> - <notes>- Fixed a possible leak in statName and statIndex -- Added zipArchive::adEmptyDir() method, creates an empty directory -- Fixed setComment when used with a freshly added entry -- setComment now returns the expected value (boolean) (Hannes) + <notes>- PECL #9278, Binary access issues on Windows in any SAPI but CGI, CLI and embed + (windows API does not respect "b" mode give to fopen) +- Fixed a possible leak in the entries managements (Nuno Lopes) +- createEmptyDir returns true one success +- Use static for each internal functions when possible (Nuno Lopes) +- Update protos in the sources </notes> <contents> <dir name="/"> @@ -162,6 +164,23 @@ <providesextension>zip</providesextension> <extsrcrelease/> <changelog> +<release> + <date>2006-11-01</date> + <version> + <release>1.8.0</release> + <api>2.0.0</api> + </version> + <stability> + <release>stable</release> + <api>stable</api> + </stability> + <license uri="http://www.php.net/license">PHP License</license> + <notes>- Fixed a possible leak in statName and statIndex +- Added zipArchive::adEmptyDir() method, creates an empty directory +- Fixed setComment when used with a freshly added entry +- setComment now returns the expected value (boolean) (Hannes) +</notes> +</release> <release> <date>2006-10-25</date> <version> http://cvs.php.net/viewvc.cgi/pecl/zip/php_zip.c?r1=1.87&r2=1.88&diff_format=u Index: pecl/zip/php_zip.c diff -u pecl/zip/php_zip.c:1.87 pecl/zip/php_zip.c:1.88 --- pecl/zip/php_zip.c:1.87 Sun Nov 12 00:36:51 2006 +++ pecl/zip/php_zip.c Thu Nov 16 00:19:21 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_zip.c,v 1.87 2006/11/12 00:36:51 nlopess Exp $ */ +/* $Id: php_zip.c,v 1.88 2006/11/16 00:19:21 pajoye Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -381,7 +381,7 @@ } /* }}} */ -zval **php_zip_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC) /* {{{ */ +static zval **php_zip_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC) /* {{{ */ { ze_zip_object *obj; zval tmp_member; @@ -418,7 +418,7 @@ } /* }}} */ -zval* php_zip_read_property(zval *object, zval *member, int type TSRMLS_DC) /* {{{ */ +static zval* php_zip_read_property(zval *object, zval *member, int type TSRMLS_DC) /* {{{ */ { ze_zip_object *obj; zval tmp_member; @@ -540,7 +540,7 @@ } /* }}} */ -PHP_ZIP_API zend_object_value php_zip_object_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */ +static zend_object_value php_zip_object_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */ { ze_zip_object *intern; zval *tmp; @@ -610,9 +610,9 @@ /* }}}*/ /* {{{ function prototypes */ -PHP_MINIT_FUNCTION(zip); -PHP_MSHUTDOWN_FUNCTION(zip); -PHP_MINFO_FUNCTION(zip); +static PHP_MINIT_FUNCTION(zip); +static PHP_MSHUTDOWN_FUNCTION(zip); +static PHP_MINFO_FUNCTION(zip); /* }}} */ /* {{{ zip_module_entry @@ -637,7 +637,7 @@ /* {{{ proto resource zip_open(string filename) Create new zip using source uri for output */ -PHP_FUNCTION(zip_open) +static PHP_FUNCTION(zip_open) { char *filename; int filename_len; @@ -669,7 +669,7 @@ /* {{{ proto void zip_close(resource zip) Close a Zip archive */ -PHP_FUNCTION(zip_close) +static PHP_FUNCTION(zip_close) { zval * zip; zip_rsrc *z_rsrc = NULL; @@ -686,7 +686,7 @@ /* {{{ proto resource zip_read(resource zip) Returns the next file in the archive */ -PHP_FUNCTION(zip_read) +static PHP_FUNCTION(zip_read) { zval *zip_dp; zip_read_rsrc *zr_rsrc; @@ -729,7 +729,7 @@ /* {{{ proto bool zip_entry_open(resource zip_dp, resource zip_entry [, string mode]) Open a Zip File, pointed by the resource entry */ /* Dummy function to follow the old API */ -PHP_FUNCTION(zip_entry_open) +static PHP_FUNCTION(zip_entry_open) { zval * zip; zval * zip_entry; @@ -756,7 +756,7 @@ /* {{{ proto void zip_entry_close(resource zip_ent) Close a zip entry */ /* another dummy function to fit in the old api*/ -PHP_FUNCTION(zip_entry_close) +static PHP_FUNCTION(zip_entry_close) { zval * zip_entry; zip_read_rsrc * zr_rsrc; @@ -773,7 +773,7 @@ /* {{{ proto mixed zip_entry_read(resource zip_entry [, int len]) Read from an open directory entry */ -PHP_FUNCTION(zip_entry_read) +static PHP_FUNCTION(zip_entry_read) { zval * zip_entry; long len = 0; @@ -872,7 +872,7 @@ /* {{{ proto string zip_entry_name(resource zip_entry) Return the name given a ZZip entry */ -PHP_FUNCTION(zip_entry_name) +static PHP_FUNCTION(zip_entry_name) { php_zip_entry_get_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); } @@ -880,7 +880,7 @@ /* {{{ proto int zip_entry_compressedsize(resource zip_entry) Return the compressed size of a ZZip entry */ -PHP_FUNCTION(zip_entry_compressedsize) +static PHP_FUNCTION(zip_entry_compressedsize) { php_zip_entry_get_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); } @@ -888,7 +888,7 @@ /* {{{ proto int zip_entry_filesize(resource zip_entry) Return the actual filesize of a ZZip entry */ -PHP_FUNCTION(zip_entry_filesize) +static PHP_FUNCTION(zip_entry_filesize) { php_zip_entry_get_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, 2); } @@ -896,7 +896,7 @@ /* {{{ proto string zip_entry_compressionmethod(resource zip_entry) Return a string containing the compression method used on a particular entry */ -PHP_FUNCTION(zip_entry_compressionmethod) +static PHP_FUNCTION(zip_entry_compressionmethod) { php_zip_entry_get_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, 3); } @@ -905,7 +905,7 @@ #ifdef ZEND_ENGINE_2_1 /* {{{ proto mixed open(string source [, int flags]) Create new zip using source uri for output, return TRUE on success or the error code */ -ZIPARCHIVE_METHOD(open) +static ZIPARCHIVE_METHOD(open) { struct zip *intern; char *filename; @@ -955,7 +955,7 @@ /* {{{ proto bool close() close the zip archive */ -ZIPARCHIVE_METHOD(close) +static ZIPARCHIVE_METHOD(close) { struct zip *intern; zval *this = getThis(); @@ -984,7 +984,7 @@ /* {{{ proto bool createEmptyDir(string dirname) U Returns the index of the entry named filename in the archive */ -ZIPARCHIVE_METHOD(addEmptyDir) +static ZIPARCHIVE_METHOD(addEmptyDir) { struct zip *intern; zval *this = getThis(); @@ -1013,7 +1013,7 @@ /* {{{ proto bool addFile(string filepath[, string entryname[, int start [, int length]]]) Add a file in a Zip archive using its path and the name to use. */ -ZIPARCHIVE_METHOD(addFile) +static ZIPARCHIVE_METHOD(addFile) { struct zip *intern; zval *this = getThis(); @@ -1085,7 +1085,7 @@ /* {{{ proto bool addFromString(string name, string content) Add a file using content and the entry name */ -ZIPARCHIVE_METHOD(addFromString) +static ZIPARCHIVE_METHOD(addFromString) { struct zip *intern; zval *this = getThis(); @@ -1150,7 +1150,7 @@ /* {{{ proto array statName(string filename[, int flags]) Returns the information about a the zip entry filename */ -ZIPARCHIVE_METHOD(statName) +static ZIPARCHIVE_METHOD(statName) { struct zip *intern; zval *this = getThis(); @@ -1178,7 +1178,7 @@ /* {{{ proto resource statIndex(int index[, int flags]) Returns the zip entry informations using its index */ -ZIPARCHIVE_METHOD(statIndex) +static ZIPARCHIVE_METHOD(statIndex) { struct zip *intern; zval *this = getThis(); @@ -1206,7 +1206,7 @@ /* {{{ proto int locateName(string filename[, int flags]) Returns the index of the entry named filename in the archive */ -ZIPARCHIVE_METHOD(locateName) +static ZIPARCHIVE_METHOD(locateName) { struct zip *intern; zval *this = getThis(); @@ -1228,6 +1228,7 @@ if (name_len<1) { RETURN_FALSE; } + idx = (long)zip_name_locate(intern, (const char *)name, flags); if (idx<0) { @@ -1245,7 +1246,7 @@ /* {{{ proto string getNameIndex(int index [, int flags]) Returns the name of the file at position index */ -ZIPARCHIVE_METHOD(getNameIndex) +static ZIPARCHIVE_METHOD(getNameIndex) { struct zip *intern; zval *this = getThis(); @@ -1275,7 +1276,7 @@ /* {{{ proto bool setArchiveComment(string name, string comment) Set or remove (NULL/'') the comment of the archive */ -ZIPARCHIVE_METHOD(setArchiveComment) +static ZIPARCHIVE_METHOD(setArchiveComment) { struct zip *intern; zval *this = getThis(); @@ -1301,7 +1302,7 @@ /* {{{ proto string getArchiveComment() Returns the comment of an entry using its index */ -ZIPARCHIVE_METHOD(getArchiveComment) +static ZIPARCHIVE_METHOD(getArchiveComment) { struct zip *intern; zval *this = getThis(); @@ -1326,12 +1327,13 @@ /* {{{ proto bool setCommentName(string name, string comment) Set or remove (NULL/'') the comment of an entry using its Name */ -ZIPARCHIVE_METHOD(setCommentName) +static ZIPARCHIVE_METHOD(setCommentName) { struct zip *intern; zval *this = getThis(); - int comment_len, name_len, idx; + int comment_len, name_len; char * comment, *name; + int idx; if (!this) { RETURN_FALSE; @@ -1344,18 +1346,21 @@ return; } - idx = zip_name_locate(intern, name, 0); - if (idx < 0) { - RETURN_FALSE; - } + if (name_len < 1) { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Empty string as entry name"); + } + idx = zip_name_locate(intern, name, 0); + if (idx < 0) { + RETURN_FALSE; + } PHP_ZIP_SET_FILE_COMMENT(intern, idx, comment, comment_len); } /* }}} */ /* {{{ proto bool setCommentIndex(int index, string comment) Set or remove (NULL/'') the comment of an entry using its index */ -ZIPARCHIVE_METHOD(setCommentIndex) +static ZIPARCHIVE_METHOD(setCommentIndex) { struct zip *intern; zval *this = getThis(); @@ -1382,16 +1387,15 @@ /* {{{ proto string getCommentName(string name) Returns the comment of an entry using its name */ -ZIPARCHIVE_METHOD(getCommentName) +static ZIPARCHIVE_METHOD(getCommentName) { struct zip *intern; zval *this = getThis(); int name_len, idx; - int comment_len = 0; long flags = 0; + int comment_len = 0; const char * comment; char *name; - struct zip_stat sb; if (!this) { RETURN_FALSE; @@ -1403,16 +1407,15 @@ &name, &name_len, &flags) == FAILURE) { return; } - if (name_len < 1) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Empty string as entry name"); RETURN_FALSE; } - idx = zip_name_locate(intern, name, 0); - if (idx < 0) { - RETURN_FALSE; - } + idx = zip_name_locate(intern, name, 0); + if (idx < 0) { + RETURN_FALSE; + } comment = zip_get_file_comment(intern, idx, &comment_len, (int)flags); RETURN_STRINGL((char *)comment, (long)comment_len, 1); @@ -1421,7 +1424,7 @@ /* {{{ proto string getCommentIndex(int index) Returns the comment of an entry using its index */ -ZIPARCHIVE_METHOD(getCommentIndex) +static ZIPARCHIVE_METHOD(getCommentIndex) { struct zip *intern; zval *this = getThis(); @@ -1449,7 +1452,7 @@ /* {{{ proto bool deleteIndex(int index) Delete a file using its index */ -ZIPARCHIVE_METHOD(deleteIndex) +static ZIPARCHIVE_METHOD(deleteIndex) { struct zip *intern; zval *this = getThis(); @@ -1479,7 +1482,7 @@ /* {{{ proto bool deleteName(string name) Delete a file using its index */ -ZIPARCHIVE_METHOD(deleteName) +static ZIPARCHIVE_METHOD(deleteName) { struct zip *intern; zval *this = getThis(); @@ -1510,7 +1513,7 @@ /* {{{ proto bool renameIndex(int index, string new_name) Rename an entry selected by its index to new_name */ -ZIPARCHIVE_METHOD(renameIndex) +static ZIPARCHIVE_METHOD(renameIndex) { struct zip *intern; zval *this = getThis(); @@ -1546,7 +1549,7 @@ /* {{{ proto bool renameName(string name, string new_name) Rename an entry selected by its name to new_name */ -ZIPARCHIVE_METHOD(renameName) +static ZIPARCHIVE_METHOD(renameName) { struct zip *intern; zval *this = getThis(); @@ -1580,7 +1583,7 @@ /* {{{ proto bool unchangeIndex(int index) Changes to the file at position index are reverted */ -ZIPARCHIVE_METHOD(unchangeIndex) +static ZIPARCHIVE_METHOD(unchangeIndex) { struct zip *intern; zval *this = getThis(); @@ -1610,7 +1613,7 @@ /* {{{ proto bool unchangeName(string name) Changes to the file named 'name' are reverted */ -ZIPARCHIVE_METHOD(unchangeName) +static ZIPARCHIVE_METHOD(unchangeName) { struct zip *intern; zval *this = getThis(); @@ -1644,7 +1647,7 @@ /* {{{ proto bool unchangeAll() All changes to files and global information in archive are reverted */ -ZIPARCHIVE_METHOD(unchangeAll) +static ZIPARCHIVE_METHOD(unchangeAll) { struct zip *intern; zval *this = getThis(); @@ -1665,7 +1668,7 @@ /* {{{ proto bool unchangeAll() Revert all global changes to the archive archive. For now, this only reverts archive comment changes. */ -ZIPARCHIVE_METHOD(unchangeArchive) +static ZIPARCHIVE_METHOD(unchangeArchive) { struct zip *intern; zval *this = getThis(); @@ -1691,7 +1694,7 @@ * - replace path * - patterns */ -ZIPARCHIVE_METHOD(extractTo) +static ZIPARCHIVE_METHOD(extractTo) { struct zip *intern; @@ -1845,17 +1848,17 @@ } /* }}} */ -/* {{{ proto resource getFromName(string entryname[, int len [, int flags]]) +/* {{{ proto string getFromName(string entryname[, int len [, int flags]]) get the contents of an entry using its name */ -ZIPARCHIVE_METHOD(getFromName) +static ZIPARCHIVE_METHOD(getFromName) { php_zip_get_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); } /* }}} */ -/* {{{ proto resource getFromIndex(string entryname[, int len [, int flags]]) +/* {{{ proto string getFromIndex(string entryname[, int len [, int flags]]) get the contents of an entry using its index */ -ZIPARCHIVE_METHOD(getFromIndex) +static ZIPARCHIVE_METHOD(getFromIndex) { php_zip_get_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); } @@ -1863,7 +1866,7 @@ /* {{{ proto resource getStream(string entryname) get a stream for an entry using its name */ -ZIPARCHIVE_METHOD(getStream) +static ZIPARCHIVE_METHOD(getStream) { struct zip *intern; zval *this = getThis(); @@ -1932,14 +1935,14 @@ #endif /* {{{ PHP_MINIT_FUNCTION */ -PHP_MINIT_FUNCTION(zip) +static PHP_MINIT_FUNCTION(zip) { #ifdef ZEND_ENGINE_2_1 zend_class_entry ce; memcpy(&zip_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); zip_object_handlers.clone_obj = NULL; - zip_object_handlers.get_property_ptr_ptr = php_zip_get_property_ptr_ptr; + zip_object_handlers.get_property_ptr_ptr = php_zip_get_property_ptr_ptr; zip_object_handlers.get_properties = php_zip_get_properties; zip_object_handlers.read_property = php_zip_read_property; @@ -2014,7 +2017,7 @@ /* {{{ PHP_MSHUTDOWN_FUNCTION */ -PHP_MSHUTDOWN_FUNCTION(zip) +static PHP_MSHUTDOWN_FUNCTION(zip) { #ifdef ZEND_ENGINE_2_1 zend_hash_destroy(&zip_prop_handlers); @@ -2026,12 +2029,12 @@ /* {{{ PHP_MINFO_FUNCTION */ -PHP_MINFO_FUNCTION(zip) +static PHP_MINFO_FUNCTION(zip) { php_info_print_table_start(); php_info_print_table_row(2, "Zip", "enabled"); - php_info_print_table_row(2, "Extension Version","$Id: php_zip.c,v 1.87 2006/11/12 00:36:51 nlopess Exp $"); + php_info_print_table_row(2, "Extension Version","$Id: php_zip.c,v 1.88 2006/11/16 00:19:21 pajoye Exp $"); php_info_print_table_row(2, "Zip version", "@PACKAGE_VERSION@"); php_info_print_table_row(2, "Libzip version", "0.7.1"); http://cvs.php.net/viewvc.cgi/pecl/zip/php_zip.h?r1=1.13&r2=1.14&diff_format=u Index: pecl/zip/php_zip.h diff -u pecl/zip/php_zip.h:1.13 pecl/zip/php_zip.h:1.14 --- pecl/zip/php_zip.h:1.13 Sun Aug 13 20:19:19 2006 +++ pecl/zip/php_zip.h Thu Nov 16 00:19:21 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_zip.h,v 1.13 2006/08/13 20:19:19 pajoye Exp $ */ +/* $Id: php_zip.h,v 1.14 2006/11/16 00:19:21 pajoye Exp $ */ #ifndef PHP_ZIP_H #define PHP_ZIP_H @@ -78,16 +78,16 @@ extern php_stream_wrapper php_stream_zip_wrapper; #endif -PHP_FUNCTION(zip_open); -PHP_FUNCTION(zip_read); -PHP_FUNCTION(zip_close); -PHP_FUNCTION(zip_entry_read); -PHP_FUNCTION(zip_entry_filesize); -PHP_FUNCTION(zip_entry_name); -PHP_FUNCTION(zip_entry_compressedsize); -PHP_FUNCTION(zip_entry_compressionmethod); -PHP_FUNCTION(zip_entry_open); -PHP_FUNCTION(zip_entry_close); +static PHP_FUNCTION(zip_open); +static PHP_FUNCTION(zip_read); +static PHP_FUNCTION(zip_close); +static PHP_FUNCTION(zip_entry_read); +static PHP_FUNCTION(zip_entry_filesize); +static PHP_FUNCTION(zip_entry_name); +static PHP_FUNCTION(zip_entry_compressedsize); +static PHP_FUNCTION(zip_entry_compressionmethod); +static PHP_FUNCTION(zip_entry_open); +static PHP_FUNCTION(zip_entry_close); #endif /* PHP_ZIP_H */ http://cvs.php.net/viewvc.cgi/pecl/zip/zip_stream.c?r1=1.11&r2=1.12&diff_format=u Index: pecl/zip/zip_stream.c diff -u pecl/zip/zip_stream.c:1.11 pecl/zip/zip_stream.c:1.12 --- pecl/zip/zip_stream.c:1.11 Sun Nov 12 00:42:21 2006 +++ pecl/zip/zip_stream.c Thu Nov 16 00:19:21 2006 @@ -1,4 +1,4 @@ -/* $Id: zip_stream.c,v 1.11 2006/11/12 00:42:21 nlopess Exp $ */ +/* $Id: zip_stream.c,v 1.12 2006/11/16 00:19:21 pajoye Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" #endif @@ -7,9 +7,10 @@ #ifdef ZEND_ENGINE_2 #include "lib/zip.h" -#include "ext/standard/php_string.h" + #include "php_streams.h" #include "ext/standard/file.h" +#include "ext/standard/php_string.h" #include "fopen_wrappers.h" #include "ext/standard/url.h" http://cvs.php.net/viewvc.cgi/pecl/zip/lib/zip_close.c?r1=1.11&r2=1.12&diff_format=u Index: pecl/zip/lib/zip_close.c diff -u pecl/zip/lib/zip_close.c:1.11 pecl/zip/lib/zip_close.c:1.12 --- pecl/zip/lib/zip_close.c:1.11 Sat Aug 12 17:04:39 2006 +++ pecl/zip/lib/zip_close.c Thu Nov 16 00:19:21 2006 @@ -247,7 +247,7 @@ chmod(za->zn, 0666&~mask); _zip_free(za); - + free(temp); return 0; } @@ -548,6 +548,9 @@ free(temp); return NULL; } +#ifdef PHP_WIN32 + _setmode(_fileno(tfp), _O_BINARY ); +#endif *outp = tfp; return temp; http://cvs.php.net/viewvc.cgi/pecl/zip/lib/zip_open.c?r1=1.5&r2=1.6&diff_format=u Index: pecl/zip/lib/zip_open.c diff -u pecl/zip/lib/zip_open.c:1.5 pecl/zip/lib/zip_open.c:1.6 --- pecl/zip/lib/zip_open.c:1.5 Sun Aug 13 20:19:19 2006 +++ pecl/zip/lib/zip_open.c Thu Nov 16 00:19:21 2006 @@ -100,7 +100,6 @@ return NULL; } - /* ZIP_CREATE gets ignored if file exists and not ZIP_EXCL, just like open() */ if ((fp=fopen(fn, "rb")) == NULL) { @@ -108,6 +107,10 @@ return NULL; } +#ifdef PHP_WIN32 + _setmode(_fileno(fp), _O_BINARY ); +#endif + clearerr(fp); fseek(fp, 0, SEEK_END); len = ftell(fp); http://cvs.php.net/viewvc.cgi/pecl/zip/lib/zip_source_file.c?r1=1.1&r2=1.2&diff_format=u Index: pecl/zip/lib/zip_source_file.c diff -u pecl/zip/lib/zip_source_file.c:1.1 pecl/zip/lib/zip_source_file.c:1.2 --- pecl/zip/lib/zip_source_file.c:1.1 Sat Jan 14 01:45:34 2006 +++ pecl/zip/lib/zip_source_file.c Thu Nov 16 00:19:21 2006 @@ -62,6 +62,10 @@ return NULL; } +#ifdef PHP_WIN32 + _setmode(_fileno(fp), _O_BINARY ); +#endif + if ((zs=zip_source_filep(za, fp, start, len)) == NULL) { fclose(fp); return NULL; http://cvs.php.net/viewvc.cgi/pecl/zip/lib/zip_stat_index.c?r1=1.3&r2=1.4&diff_format=u Index: pecl/zip/lib/zip_stat_index.c diff -u pecl/zip/lib/zip_stat_index.c:1.3 pecl/zip/lib/zip_stat_index.c:1.4 --- pecl/zip/lib/zip_stat_index.c:1.3 Wed Nov 1 22:51:36 2006 +++ pecl/zip/lib/zip_stat_index.c Thu Nov 16 00:19:21 2006 @@ -67,7 +67,7 @@ _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return -1; } - + st->crc = za->cdir->entry[index].crc; st->size = za->cdir->entry[index].uncomp_size; st->mtime = za->cdir->entry[index].last_mod; http://cvs.php.net/viewvc.cgi/pecl/zip/lib/zipint.h?r1=1.5&r2=1.6&diff_format=u Index: pecl/zip/lib/zipint.h diff -u pecl/zip/lib/zipint.h:1.5 pecl/zip/lib/zipint.h:1.6 --- pecl/zip/lib/zipint.h:1.5 Sun Jul 9 02:01:26 2006 +++ pecl/zip/lib/zipint.h Thu Nov 16 00:19:21 2006 @@ -199,6 +199,7 @@ void _zip_entry_init(struct zip *, int); struct zip_entry *_zip_entry_new(struct zip *); +void _zip_error_clear(struct zip_error *); void _zip_error_copy(struct zip_error *, struct zip_error *); void _zip_error_fini(struct zip_error *); void _zip_error_get(struct zip_error *, int *, int *); http://cvs.php.net/viewvc.cgi/pecl/zip/tests/oo_namelocate.phpt?r1=1.5&r2=1.6&diff_format=u Index: pecl/zip/tests/oo_namelocate.phpt diff -u pecl/zip/tests/oo_namelocate.phpt:1.5 pecl/zip/tests/oo_namelocate.phpt:1.6 --- pecl/zip/tests/oo_namelocate.phpt:1.5 Mon Oct 2 14:42:09 2006 +++ pecl/zip/tests/oo_namelocate.phpt Thu Nov 16 00:19:21 2006 @@ -2,7 +2,7 @@ Locate entries by name --SKIPIF-- <?php -/* $Id: oo_namelocate.phpt,v 1.5 2006/10/02 14:42:09 bjori Exp $ */ +/* $Id: oo_namelocate.phpt,v 1.6 2006/11/16 00:19:21 pajoye Exp $ */ if(!extension_loaded('zip')) die('skip'); ?> --FILE-- @@ -31,6 +31,7 @@ exit('failed'); } + var_dump($zip->locateName('entry1.txt')); var_dump($zip->locateName('eNtry2.txt')); var_dump($zip->locateName('eNtry2.txt', ZIPARCHIVE::FL_NOCASE));
http://cvs.php.net/viewvc.cgi/pecl/zip/package.xml?r1=1.68&r2=1.69&diff_format=u Index: pecl/zip/package.xml diff -u pecl/zip/package.xml:1.68 pecl/zip/package.xml:1.69 --- pecl/zip/package.xml:1.68 Wed Nov 1 23:00:12 2006 +++ pecl/zip/package.xml Thu Nov 16 00:19:21 2006 @@ -20,10 +20,12 @@ <api>stable</api> </stability> <license uri="http://www.php.net/license">PHP License</license> - <notes>- Fixed a possible leak in statName and statIndex -- Added zipArchive::adEmptyDir() method, creates an empty directory -- Fixed setComment when used with a freshly added entry -- setComment now returns the expected value (boolean) (Hannes) + <notes>- PECL #9278, Binary access issues on Windows in any SAPI but CGI, CLI and embed + (windows API does not respect "b" mode give to fopen) +- Fixed a possible leak in the entries managements (Nuno Lopes) +- createEmptyDir returns true one success +- Use static for each internal functions when possible (Nuno Lopes) +- Update protos in the sources </notes> <contents> <dir name="/"> @@ -162,6 +164,23 @@ <providesextension>zip</providesextension> <extsrcrelease/> <changelog> +<release> + <date>2006-11-01</date> + <version> + <release>1.8.0</release> + <api>2.0.0</api> + </version> + <stability> + <release>stable</release> + <api>stable</api> + </stability> + <license uri="http://www.php.net/license">PHP License</license> + <notes>- Fixed a possible leak in statName and statIndex +- Added zipArchive::adEmptyDir() method, creates an empty directory +- Fixed setComment when used with a freshly added entry +- setComment now returns the expected value (boolean) (Hannes) +</notes> +</release> <release> <date>2006-10-25</date> <version> http://cvs.php.net/viewvc.cgi/pecl/zip/php_zip.c?r1=1.87&r2=1.88&diff_format=u Index: pecl/zip/php_zip.c diff -u pecl/zip/php_zip.c:1.87 pecl/zip/php_zip.c:1.88 --- pecl/zip/php_zip.c:1.87 Sun Nov 12 00:36:51 2006 +++ pecl/zip/php_zip.c Thu Nov 16 00:19:21 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_zip.c,v 1.87 2006/11/12 00:36:51 nlopess Exp $ */ +/* $Id: php_zip.c,v 1.88 2006/11/16 00:19:21 pajoye Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -381,7 +381,7 @@ } /* }}} */ -zval **php_zip_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC) /* {{{ */ +static zval **php_zip_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC) /* {{{ */ { ze_zip_object *obj; zval tmp_member; @@ -418,7 +418,7 @@ } /* }}} */ -zval* php_zip_read_property(zval *object, zval *member, int type TSRMLS_DC) /* {{{ */ +static zval* php_zip_read_property(zval *object, zval *member, int type TSRMLS_DC) /* {{{ */ { ze_zip_object *obj; zval tmp_member; @@ -540,7 +540,7 @@ } /* }}} */ -PHP_ZIP_API zend_object_value php_zip_object_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */ +static zend_object_value php_zip_object_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */ { ze_zip_object *intern; zval *tmp; @@ -610,9 +610,9 @@ /* }}}*/ /* {{{ function prototypes */ -PHP_MINIT_FUNCTION(zip); -PHP_MSHUTDOWN_FUNCTION(zip); -PHP_MINFO_FUNCTION(zip); +static PHP_MINIT_FUNCTION(zip); +static PHP_MSHUTDOWN_FUNCTION(zip); +static PHP_MINFO_FUNCTION(zip); /* }}} */ /* {{{ zip_module_entry @@ -637,7 +637,7 @@ /* {{{ proto resource zip_open(string filename) Create new zip using source uri for output */ -PHP_FUNCTION(zip_open) +static PHP_FUNCTION(zip_open) { char *filename; int filename_len; @@ -669,7 +669,7 @@ /* {{{ proto void zip_close(resource zip) Close a Zip archive */ -PHP_FUNCTION(zip_close) +static PHP_FUNCTION(zip_close) { zval * zip; zip_rsrc *z_rsrc = NULL; @@ -686,7 +686,7 @@ /* {{{ proto resource zip_read(resource zip) Returns the next file in the archive */ -PHP_FUNCTION(zip_read) +static PHP_FUNCTION(zip_read) { zval *zip_dp; zip_read_rsrc *zr_rsrc; @@ -729,7 +729,7 @@ /* {{{ proto bool zip_entry_open(resource zip_dp, resource zip_entry [, string mode]) Open a Zip File, pointed by the resource entry */ /* Dummy function to follow the old API */ -PHP_FUNCTION(zip_entry_open) +static PHP_FUNCTION(zip_entry_open) { zval * zip; zval * zip_entry; @@ -756,7 +756,7 @@ /* {{{ proto void zip_entry_close(resource zip_ent) Close a zip entry */ /* another dummy function to fit in the old api*/ -PHP_FUNCTION(zip_entry_close) +static PHP_FUNCTION(zip_entry_close) { zval * zip_entry; zip_read_rsrc * zr_rsrc; @@ -773,7 +773,7 @@ /* {{{ proto mixed zip_entry_read(resource zip_entry [, int len]) Read from an open directory entry */ -PHP_FUNCTION(zip_entry_read) +static PHP_FUNCTION(zip_entry_read) { zval * zip_entry; long len = 0; @@ -872,7 +872,7 @@ /* {{{ proto string zip_entry_name(resource zip_entry) Return the name given a ZZip entry */ -PHP_FUNCTION(zip_entry_name) +static PHP_FUNCTION(zip_entry_name) { php_zip_entry_get_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); } @@ -880,7 +880,7 @@ /* {{{ proto int zip_entry_compressedsize(resource zip_entry) Return the compressed size of a ZZip entry */ -PHP_FUNCTION(zip_entry_compressedsize) +static PHP_FUNCTION(zip_entry_compressedsize) { php_zip_entry_get_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); } @@ -888,7 +888,7 @@ /* {{{ proto int zip_entry_filesize(resource zip_entry) Return the actual filesize of a ZZip entry */ -PHP_FUNCTION(zip_entry_filesize) +static PHP_FUNCTION(zip_entry_filesize) { php_zip_entry_get_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, 2); } @@ -896,7 +896,7 @@ /* {{{ proto string zip_entry_compressionmethod(resource zip_entry) Return a string containing the compression method used on a particular entry */ -PHP_FUNCTION(zip_entry_compressionmethod) +static PHP_FUNCTION(zip_entry_compressionmethod) { php_zip_entry_get_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, 3); } @@ -905,7 +905,7 @@ #ifdef ZEND_ENGINE_2_1 /* {{{ proto mixed open(string source [, int flags]) Create new zip using source uri for output, return TRUE on success or the error code */ -ZIPARCHIVE_METHOD(open) +static ZIPARCHIVE_METHOD(open) { struct zip *intern; char *filename; @@ -955,7 +955,7 @@ /* {{{ proto bool close() close the zip archive */ -ZIPARCHIVE_METHOD(close) +static ZIPARCHIVE_METHOD(close) { struct zip *intern; zval *this = getThis(); @@ -984,7 +984,7 @@ /* {{{ proto bool createEmptyDir(string dirname) U Returns the index of the entry named filename in the archive */ -ZIPARCHIVE_METHOD(addEmptyDir) +static ZIPARCHIVE_METHOD(addEmptyDir) { struct zip *intern; zval *this = getThis(); @@ -1013,7 +1013,7 @@ /* {{{ proto bool addFile(string filepath[, string entryname[, int start [, int length]]]) Add a file in a Zip archive using its path and the name to use. */ -ZIPARCHIVE_METHOD(addFile) +static ZIPARCHIVE_METHOD(addFile) { struct zip *intern; zval *this = getThis(); @@ -1085,7 +1085,7 @@ /* {{{ proto bool addFromString(string name, string content) Add a file using content and the entry name */ -ZIPARCHIVE_METHOD(addFromString) +static ZIPARCHIVE_METHOD(addFromString) { struct zip *intern; zval *this = getThis(); @@ -1150,7 +1150,7 @@ /* {{{ proto array statName(string filename[, int flags]) Returns the information about a the zip entry filename */ -ZIPARCHIVE_METHOD(statName) +static ZIPARCHIVE_METHOD(statName) { struct zip *intern; zval *this = getThis(); @@ -1178,7 +1178,7 @@ /* {{{ proto resource statIndex(int index[, int flags]) Returns the zip entry informations using its index */ -ZIPARCHIVE_METHOD(statIndex) +static ZIPARCHIVE_METHOD(statIndex) { struct zip *intern; zval *this = getThis(); @@ -1206,7 +1206,7 @@ /* {{{ proto int locateName(string filename[, int flags]) Returns the index of the entry named filename in the archive */ -ZIPARCHIVE_METHOD(locateName) +static ZIPARCHIVE_METHOD(locateName) { struct zip *intern; zval *this = getThis(); @@ -1228,6 +1228,7 @@ if (name_len<1) { RETURN_FALSE; } + idx = (long)zip_name_locate(intern, (const char *)name, flags); if (idx<0) { @@ -1245,7 +1246,7 @@ /* {{{ proto string getNameIndex(int index [, int flags]) Returns the name of the file at position index */ -ZIPARCHIVE_METHOD(getNameIndex) +static ZIPARCHIVE_METHOD(getNameIndex) { struct zip *intern; zval *this = getThis(); @@ -1275,7 +1276,7 @@ /* {{{ proto bool setArchiveComment(string name, string comment) Set or remove (NULL/'') the comment of the archive */ -ZIPARCHIVE_METHOD(setArchiveComment) +static ZIPARCHIVE_METHOD(setArchiveComment) { struct zip *intern; zval *this = getThis(); @@ -1301,7 +1302,7 @@ /* {{{ proto string getArchiveComment() Returns the comment of an entry using its index */ -ZIPARCHIVE_METHOD(getArchiveComment) +static ZIPARCHIVE_METHOD(getArchiveComment) { struct zip *intern; zval *this = getThis(); @@ -1326,12 +1327,13 @@ /* {{{ proto bool setCommentName(string name, string comment) Set or remove (NULL/'') the comment of an entry using its Name */ -ZIPARCHIVE_METHOD(setCommentName) +static ZIPARCHIVE_METHOD(setCommentName) { struct zip *intern; zval *this = getThis(); - int comment_len, name_len, idx; + int comment_len, name_len; char * comment, *name; + int idx; if (!this) { RETURN_FALSE; @@ -1344,18 +1346,21 @@ return; } - idx = zip_name_locate(intern, name, 0); - if (idx < 0) { - RETURN_FALSE; - } + if (name_len < 1) { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Empty string as entry name"); + } + idx = zip_name_locate(intern, name, 0); + if (idx < 0) { + RETURN_FALSE; + } PHP_ZIP_SET_FILE_COMMENT(intern, idx, comment, comment_len); } /* }}} */ /* {{{ proto bool setCommentIndex(int index, string comment) Set or remove (NULL/'') the comment of an entry using its index */ -ZIPARCHIVE_METHOD(setCommentIndex) +static ZIPARCHIVE_METHOD(setCommentIndex) { struct zip *intern; zval *this = getThis(); @@ -1382,16 +1387,15 @@ /* {{{ proto string getCommentName(string name) Returns the comment of an entry using its name */ -ZIPARCHIVE_METHOD(getCommentName) +static ZIPARCHIVE_METHOD(getCommentName) { struct zip *intern; zval *this = getThis(); int name_len, idx; - int comment_len = 0; long flags = 0; + int comment_len = 0; const char * comment; char *name; - struct zip_stat sb; if (!this) { RETURN_FALSE; @@ -1403,16 +1407,15 @@ &name, &name_len, &flags) == FAILURE) { return; } - if (name_len < 1) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Empty string as entry name"); RETURN_FALSE; } - idx = zip_name_locate(intern, name, 0); - if (idx < 0) { - RETURN_FALSE; - } + idx = zip_name_locate(intern, name, 0); + if (idx < 0) { + RETURN_FALSE; + } comment = zip_get_file_comment(intern, idx, &comment_len, (int)flags); RETURN_STRINGL((char *)comment, (long)comment_len, 1); @@ -1421,7 +1424,7 @@ /* {{{ proto string getCommentIndex(int index) Returns the comment of an entry using its index */ -ZIPARCHIVE_METHOD(getCommentIndex) +static ZIPARCHIVE_METHOD(getCommentIndex) { struct zip *intern; zval *this = getThis(); @@ -1449,7 +1452,7 @@ /* {{{ proto bool deleteIndex(int index) Delete a file using its index */ -ZIPARCHIVE_METHOD(deleteIndex) +static ZIPARCHIVE_METHOD(deleteIndex) { struct zip *intern; zval *this = getThis(); @@ -1479,7 +1482,7 @@ /* {{{ proto bool deleteName(string name) Delete a file using its index */ -ZIPARCHIVE_METHOD(deleteName) +static ZIPARCHIVE_METHOD(deleteName) { struct zip *intern; zval *this = getThis(); @@ -1510,7 +1513,7 @@ /* {{{ proto bool renameIndex(int index, string new_name) Rename an entry selected by its index to new_name */ -ZIPARCHIVE_METHOD(renameIndex) +static ZIPARCHIVE_METHOD(renameIndex) { struct zip *intern; zval *this = getThis(); @@ -1546,7 +1549,7 @@ /* {{{ proto bool renameName(string name, string new_name) Rename an entry selected by its name to new_name */ -ZIPARCHIVE_METHOD(renameName) +static ZIPARCHIVE_METHOD(renameName) { struct zip *intern; zval *this = getThis(); @@ -1580,7 +1583,7 @@ /* {{{ proto bool unchangeIndex(int index) Changes to the file at position index are reverted */ -ZIPARCHIVE_METHOD(unchangeIndex) +static ZIPARCHIVE_METHOD(unchangeIndex) { struct zip *intern; zval *this = getThis(); @@ -1610,7 +1613,7 @@ /* {{{ proto bool unchangeName(string name) Changes to the file named 'name' are reverted */ -ZIPARCHIVE_METHOD(unchangeName) +static ZIPARCHIVE_METHOD(unchangeName) { struct zip *intern; zval *this = getThis(); @@ -1644,7 +1647,7 @@ /* {{{ proto bool unchangeAll() All changes to files and global information in archive are reverted */ -ZIPARCHIVE_METHOD(unchangeAll) +static ZIPARCHIVE_METHOD(unchangeAll) { struct zip *intern; zval *this = getThis(); @@ -1665,7 +1668,7 @@ /* {{{ proto bool unchangeAll() Revert all global changes to the archive archive. For now, this only reverts archive comment changes. */ -ZIPARCHIVE_METHOD(unchangeArchive) +static ZIPARCHIVE_METHOD(unchangeArchive) { struct zip *intern; zval *this = getThis(); @@ -1691,7 +1694,7 @@ * - replace path * - patterns */ -ZIPARCHIVE_METHOD(extractTo) +static ZIPARCHIVE_METHOD(extractTo) { struct zip *intern; @@ -1845,17 +1848,17 @@ } /* }}} */ -/* {{{ proto resource getFromName(string entryname[, int len [, int flags]]) +/* {{{ proto string getFromName(string entryname[, int len [, int flags]]) get the contents of an entry using its name */ -ZIPARCHIVE_METHOD(getFromName) +static ZIPARCHIVE_METHOD(getFromName) { php_zip_get_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); } /* }}} */ -/* {{{ proto resource getFromIndex(string entryname[, int len [, int flags]]) +/* {{{ proto string getFromIndex(string entryname[, int len [, int flags]]) get the contents of an entry using its index */ -ZIPARCHIVE_METHOD(getFromIndex) +static ZIPARCHIVE_METHOD(getFromIndex) { php_zip_get_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); } @@ -1863,7 +1866,7 @@ /* {{{ proto resource getStream(string entryname) get a stream for an entry using its name */ -ZIPARCHIVE_METHOD(getStream) +static ZIPARCHIVE_METHOD(getStream) { struct zip *intern; zval *this = getThis(); @@ -1932,14 +1935,14 @@ #endif /* {{{ PHP_MINIT_FUNCTION */ -PHP_MINIT_FUNCTION(zip) +static PHP_MINIT_FUNCTION(zip) { #ifdef ZEND_ENGINE_2_1 zend_class_entry ce; memcpy(&zip_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); zip_object_handlers.clone_obj = NULL; - zip_object_handlers.get_property_ptr_ptr = php_zip_get_property_ptr_ptr; + zip_object_handlers.get_property_ptr_ptr = php_zip_get_property_ptr_ptr; zip_object_handlers.get_properties = php_zip_get_properties; zip_object_handlers.read_property = php_zip_read_property; @@ -2014,7 +2017,7 @@ /* {{{ PHP_MSHUTDOWN_FUNCTION */ -PHP_MSHUTDOWN_FUNCTION(zip) +static PHP_MSHUTDOWN_FUNCTION(zip) { #ifdef ZEND_ENGINE_2_1 zend_hash_destroy(&zip_prop_handlers); @@ -2026,12 +2029,12 @@ /* {{{ PHP_MINFO_FUNCTION */ -PHP_MINFO_FUNCTION(zip) +static PHP_MINFO_FUNCTION(zip) { php_info_print_table_start(); php_info_print_table_row(2, "Zip", "enabled"); - php_info_print_table_row(2, "Extension Version","$Id: php_zip.c,v 1.87 2006/11/12 00:36:51 nlopess Exp $"); + php_info_print_table_row(2, "Extension Version","$Id: php_zip.c,v 1.88 2006/11/16 00:19:21 pajoye Exp $"); php_info_print_table_row(2, "Zip version", "@PACKAGE_VERSION@"); php_info_print_table_row(2, "Libzip version", "0.7.1"); http://cvs.php.net/viewvc.cgi/pecl/zip/php_zip.h?r1=1.13&r2=1.14&diff_format=u Index: pecl/zip/php_zip.h diff -u pecl/zip/php_zip.h:1.13 pecl/zip/php_zip.h:1.14 --- pecl/zip/php_zip.h:1.13 Sun Aug 13 20:19:19 2006 +++ pecl/zip/php_zip.h Thu Nov 16 00:19:21 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_zip.h,v 1.13 2006/08/13 20:19:19 pajoye Exp $ */ +/* $Id: php_zip.h,v 1.14 2006/11/16 00:19:21 pajoye Exp $ */ #ifndef PHP_ZIP_H #define PHP_ZIP_H @@ -78,16 +78,16 @@ extern php_stream_wrapper php_stream_zip_wrapper; #endif -PHP_FUNCTION(zip_open); -PHP_FUNCTION(zip_read); -PHP_FUNCTION(zip_close); -PHP_FUNCTION(zip_entry_read); -PHP_FUNCTION(zip_entry_filesize); -PHP_FUNCTION(zip_entry_name); -PHP_FUNCTION(zip_entry_compressedsize); -PHP_FUNCTION(zip_entry_compressionmethod); -PHP_FUNCTION(zip_entry_open); -PHP_FUNCTION(zip_entry_close); +static PHP_FUNCTION(zip_open); +static PHP_FUNCTION(zip_read); +static PHP_FUNCTION(zip_close); +static PHP_FUNCTION(zip_entry_read); +static PHP_FUNCTION(zip_entry_filesize); +static PHP_FUNCTION(zip_entry_name); +static PHP_FUNCTION(zip_entry_compressedsize); +static PHP_FUNCTION(zip_entry_compressionmethod); +static PHP_FUNCTION(zip_entry_open); +static PHP_FUNCTION(zip_entry_close); #endif /* PHP_ZIP_H */ http://cvs.php.net/viewvc.cgi/pecl/zip/zip_stream.c?r1=1.11&r2=1.12&diff_format=u Index: pecl/zip/zip_stream.c diff -u pecl/zip/zip_stream.c:1.11 pecl/zip/zip_stream.c:1.12 --- pecl/zip/zip_stream.c:1.11 Sun Nov 12 00:42:21 2006 +++ pecl/zip/zip_stream.c Thu Nov 16 00:19:21 2006 @@ -1,4 +1,4 @@ -/* $Id: zip_stream.c,v 1.11 2006/11/12 00:42:21 nlopess Exp $ */ +/* $Id: zip_stream.c,v 1.12 2006/11/16 00:19:21 pajoye Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" #endif @@ -7,9 +7,10 @@ #ifdef ZEND_ENGINE_2 #include "lib/zip.h" -#include "ext/standard/php_string.h" + #include "php_streams.h" #include "ext/standard/file.h" +#include "ext/standard/php_string.h" #include "fopen_wrappers.h" #include "ext/standard/url.h" http://cvs.php.net/viewvc.cgi/pecl/zip/lib/zip_close.c?r1=1.11&r2=1.12&diff_format=u Index: pecl/zip/lib/zip_close.c diff -u pecl/zip/lib/zip_close.c:1.11 pecl/zip/lib/zip_close.c:1.12 --- pecl/zip/lib/zip_close.c:1.11 Sat Aug 12 17:04:39 2006 +++ pecl/zip/lib/zip_close.c Thu Nov 16 00:19:21 2006 @@ -247,7 +247,7 @@ chmod(za->zn, 0666&~mask); _zip_free(za); - + free(temp); return 0; } @@ -548,6 +548,9 @@ free(temp); return NULL; } +#ifdef PHP_WIN32 + _setmode(_fileno(tfp), _O_BINARY ); +#endif *outp = tfp; return temp; http://cvs.php.net/viewvc.cgi/pecl/zip/lib/zip_open.c?r1=1.5&r2=1.6&diff_format=u Index: pecl/zip/lib/zip_open.c diff -u pecl/zip/lib/zip_open.c:1.5 pecl/zip/lib/zip_open.c:1.6 --- pecl/zip/lib/zip_open.c:1.5 Sun Aug 13 20:19:19 2006 +++ pecl/zip/lib/zip_open.c Thu Nov 16 00:19:21 2006 @@ -100,7 +100,6 @@ return NULL; } - /* ZIP_CREATE gets ignored if file exists and not ZIP_EXCL, just like open() */ if ((fp=fopen(fn, "rb")) == NULL) { @@ -108,6 +107,10 @@ return NULL; } +#ifdef PHP_WIN32 + _setmode(_fileno(fp), _O_BINARY ); +#endif + clearerr(fp); fseek(fp, 0, SEEK_END); len = ftell(fp); http://cvs.php.net/viewvc.cgi/pecl/zip/lib/zip_source_file.c?r1=1.1&r2=1.2&diff_format=u Index: pecl/zip/lib/zip_source_file.c diff -u pecl/zip/lib/zip_source_file.c:1.1 pecl/zip/lib/zip_source_file.c:1.2 --- pecl/zip/lib/zip_source_file.c:1.1 Sat Jan 14 01:45:34 2006 +++ pecl/zip/lib/zip_source_file.c Thu Nov 16 00:19:21 2006 @@ -62,6 +62,10 @@ return NULL; } +#ifdef PHP_WIN32 + _setmode(_fileno(fp), _O_BINARY ); +#endif + if ((zs=zip_source_filep(za, fp, start, len)) == NULL) { fclose(fp); return NULL; http://cvs.php.net/viewvc.cgi/pecl/zip/lib/zip_stat_index.c?r1=1.3&r2=1.4&diff_format=u Index: pecl/zip/lib/zip_stat_index.c diff -u pecl/zip/lib/zip_stat_index.c:1.3 pecl/zip/lib/zip_stat_index.c:1.4 --- pecl/zip/lib/zip_stat_index.c:1.3 Wed Nov 1 22:51:36 2006 +++ pecl/zip/lib/zip_stat_index.c Thu Nov 16 00:19:21 2006 @@ -67,7 +67,7 @@ _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return -1; } - + st->crc = za->cdir->entry[index].crc; st->size = za->cdir->entry[index].uncomp_size; st->mtime = za->cdir->entry[index].last_mod; http://cvs.php.net/viewvc.cgi/pecl/zip/lib/zipint.h?r1=1.5&r2=1.6&diff_format=u Index: pecl/zip/lib/zipint.h diff -u pecl/zip/lib/zipint.h:1.5 pecl/zip/lib/zipint.h:1.6 --- pecl/zip/lib/zipint.h:1.5 Sun Jul 9 02:01:26 2006 +++ pecl/zip/lib/zipint.h Thu Nov 16 00:19:21 2006 @@ -199,6 +199,7 @@ void _zip_entry_init(struct zip *, int); struct zip_entry *_zip_entry_new(struct zip *); +void _zip_error_clear(struct zip_error *); void _zip_error_copy(struct zip_error *, struct zip_error *); void _zip_error_fini(struct zip_error *); void _zip_error_get(struct zip_error *, int *, int *); http://cvs.php.net/viewvc.cgi/pecl/zip/tests/oo_namelocate.phpt?r1=1.5&r2=1.6&diff_format=u Index: pecl/zip/tests/oo_namelocate.phpt diff -u pecl/zip/tests/oo_namelocate.phpt:1.5 pecl/zip/tests/oo_namelocate.phpt:1.6 --- pecl/zip/tests/oo_namelocate.phpt:1.5 Mon Oct 2 14:42:09 2006 +++ pecl/zip/tests/oo_namelocate.phpt Thu Nov 16 00:19:21 2006 @@ -2,7 +2,7 @@ Locate entries by name --SKIPIF-- <?php -/* $Id: oo_namelocate.phpt,v 1.5 2006/10/02 14:42:09 bjori Exp $ */ +/* $Id: oo_namelocate.phpt,v 1.6 2006/11/16 00:19:21 pajoye Exp $ */ if(!extension_loaded('zip')) die('skip'); ?> --FILE-- @@ -31,6 +31,7 @@ exit('failed'); } + var_dump($zip->locateName('entry1.txt')); var_dump($zip->locateName('eNtry2.txt')); var_dump($zip->locateName('eNtry2.txt', ZIPARCHIVE::FL_NOCASE));