diff options
Diffstat (limited to 'ext/zip')
60 files changed, 379 insertions, 230 deletions
diff --git a/ext/zip/Makefile.frag b/ext/zip/Makefile.frag new file mode 100644 index 000000000..b3781e3e7 --- /dev/null +++ b/ext/zip/Makefile.frag @@ -0,0 +1,28 @@ +phpincludedir=$(prefix)/include/php + +ZIP_HEADER_FILES= \ + zip.h \ + zipint.h \ + zip_alias.h \ + zipint_alias.h + +install-zip-headers: + @echo "Installing ZIP headers: $(INSTALL_ROOT)$(phpincludedir)/ext/zip/lib" + @$(mkinstalldirs) $(INSTALL_ROOT)$(phpincludedir)/ext/zip/lib + @for f in $(ZIP_HEADER_FILES); do \ + if test -f "$(top_srcdir)/lib/$$f"; then \ + $(INSTALL_DATA) $(top_srcdir)/lib/$$f $(INSTALL_ROOT)$(phpincludedir)/ext/zip/lib; \ + elif test -f "$(top_builddir)/lib/$$f"; then \ + $(INSTALL_DATA) $(top_builddir)/lib/$$f $(INSTALL_ROOT)$(phpincludedir)/ext/zip/lib; \ + elif test -f "$(top_srcdir)/ext/zip/lib/$$f"; then \ + $(INSTALL_DATA) $(top_srcdir)/ext/zip/lib/$$f $(INSTALL_ROOT)$(phpincludedir)/ext/zip/lib; \ + elif test -f "$(top_builddir)/ext/zip/lib/$$f"; then \ + $(INSTALL_DATA) $(top_builddir)/ext/zip/lib/$$f $(INSTALL_ROOT)$(phpincludedir)/ext/zip/lib; \ + else \ + echo "hmmm"; \ + fi \ + done; + +# mini hack +install: $(all_targets) $(install_targets) install-zip-headers + diff --git a/ext/zip/config.m4 b/ext/zip/config.m4 index c54eaac82..f31f260d9 100644 --- a/ext/zip/config.m4 +++ b/ext/zip/config.m4 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.8.2.3 2007/07/03 17:25:35 sniper Exp $ +dnl $Id: config.m4,v 1.8.2.4 2008/01/18 00:31:23 cellog Exp $ dnl PHP_ARG_ENABLE(zip, for zip archive read/writesupport, @@ -66,4 +66,12 @@ if test "$PHP_ZIP" != "no"; then PHP_NEW_EXTENSION(zip, php_zip.c zip_stream.c $PHP_ZIP_SOURCES, $ext_shared) PHP_ADD_BUILD_DIR($ext_builddir/lib, 1) PHP_SUBST(ZIP_SHARED_LIBADD) + ifdef([PHP_INSTALL_HEADERS], + [ + dnl Sadly, this is a complete NOP for pecl extensions + PHP_INSTALL_HEADERS(ext/zip/lib, [lib/zip.h lib/zipint.h lib/zip_alias.h lib/zipint_alias.h]) + ]) + + dnl so we always include the known-good working hack. + PHP_ADD_MAKEFILE_FRAGMENT fi diff --git a/ext/zip/config.w32 b/ext/zip/config.w32 index a68e0505a..f0bc4c6db 100644 --- a/ext/zip/config.w32 +++ b/ext/zip/config.w32 @@ -1,4 +1,4 @@ -// $Id: config.w32,v 1.1.2.1 2006/11/03 16:46:18 pajoye Exp $ +// $Id: config.w32,v 1.1.2.4 2008/01/14 03:19:41 cellog Exp $ // vim:ft=javascript ARG_ENABLE("zip", "ZIP support", "no"); @@ -31,6 +31,7 @@ if (PHP_ZIP != "no") { AC_DEFINE('HAVE_ZLIB', 1); AC_DEFINE('HAVE_ZIP', 1); + ADD_FLAG("CFLAGS_ZIP", "/D PHP_ZIP_EXPORTS "); } else { WARNING("zip not enabled; libraries and headers not found"); } diff --git a/ext/zip/lib/zip.h b/ext/zip/lib/zip.h index de115d38a..04ffb1471 100644 --- a/ext/zip/lib/zip.h +++ b/ext/zip/lib/zip.h @@ -5,7 +5,7 @@ $NiH: zip.h,v 1.57 2006/04/24 14:04:19 dillo Exp $ zip.h -- exported declarations. - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at <nih@giga.or.at> @@ -37,16 +37,24 @@ */ - -#ifdef __cplusplus -extern "C" { +#include "main/php.h" +/* #defines that rename all zip_ functions and structs */ +#include "zip_alias.h" +#ifdef PHP_WIN32 +#include "zip_win32.h" +# ifdef PHP_ZIP_EXPORTS +# define PHPZIPAPI __declspec(dllexport) +# else +# define PHPZIPAPI +# endif +#else +#define PHPZIPAPI #endif - +BEGIN_EXTERN_C() #include <sys/types.h> #include <stdio.h> #include <time.h> -#include "zip_win32.h" /* flags for zip_open */ @@ -162,49 +170,46 @@ struct zip_source; -int zip_add(struct zip *, const char *, struct zip_source *); -int zip_add_dir(struct zip *, const char *); -int zip_close(struct zip *); -int zip_delete(struct zip *, int); -void zip_error_clear(struct zip *); -void zip_error_get(struct zip *, int *, int *); -int zip_error_get_sys_type(int); -int zip_error_to_str(char *, size_t, int, int); -int zip_fclose(struct zip_file *); -void zip_file_error_clear(struct zip_file *); -void zip_file_error_get(struct zip_file *, int *, int *); -const char *zip_file_strerror(struct zip_file *); -struct zip_file *zip_fopen(struct zip *, const char *, int); -struct zip_file *zip_fopen_index(struct zip *, int, int); -ssize_t zip_fread(struct zip_file *, void *, size_t); -const char *zip_get_archive_comment(struct zip *, int *, int); -const char *zip_get_file_comment(struct zip *, int, int *, int); -const char *zip_get_name(struct zip *, int, int); -int zip_get_num_files(struct zip *); -int zip_name_locate(struct zip *, const char *, int); -struct zip *zip_open(const char *, int, int *); -int zip_rename(struct zip *, int, const char *); -int zip_replace(struct zip *, int, struct zip_source *); -int zip_set_archive_comment(struct zip *, const char *, int); -int zip_set_file_comment(struct zip *, int, const char *, int); -struct zip_source *zip_source_buffer(struct zip *, const void *, off_t, int); -struct zip_source *zip_source_file(struct zip *, const char *, off_t, off_t); -struct zip_source *zip_source_filep(struct zip *, FILE *, off_t, off_t); -void zip_source_free(struct zip_source *); -struct zip_source *zip_source_function(struct zip *, +PHPZIPAPI int zip_add(struct zip *, const char *, struct zip_source *); +PHPZIPAPI int zip_add_dir(struct zip *, const char *); +PHPZIPAPI int zip_close(struct zip *); +PHPZIPAPI int zip_delete(struct zip *, int); +PHPZIPAPI void zip_error_clear(struct zip *); +PHPZIPAPI void zip_error_get(struct zip *, int *, int *); +PHPZIPAPI int zip_error_get_sys_type(int); +PHPZIPAPI int zip_error_to_str(char *, size_t, int, int); +PHPZIPAPI int zip_fclose(struct zip_file *); +PHPZIPAPI void zip_file_error_clear(struct zip_file *); +PHPZIPAPI void zip_file_error_get(struct zip_file *, int *, int *); +PHPZIPAPI const char *zip_file_strerror(struct zip_file *); +PHPZIPAPI struct zip_file *zip_fopen(struct zip *, const char *, int); +PHPZIPAPI struct zip_file *zip_fopen_index(struct zip *, int, int); +PHPZIPAPI ssize_t zip_fread(struct zip_file *, void *, size_t); +PHPZIPAPI const char *zip_get_archive_comment(struct zip *, int *, int); +PHPZIPAPI const char *zip_get_file_comment(struct zip *, int, int *, int); +PHPZIPAPI const char *zip_get_name(struct zip *, int, int); +PHPZIPAPI int zip_get_num_files(struct zip *); +PHPZIPAPI int zip_name_locate(struct zip *, const char *, int); +PHPZIPAPI struct zip *zip_open(const char *, int, int *); +PHPZIPAPI int zip_rename(struct zip *, int, const char *); +PHPZIPAPI int zip_replace(struct zip *, int, struct zip_source *); +PHPZIPAPI int zip_set_archive_comment(struct zip *, const char *, int); +PHPZIPAPI int zip_set_file_comment(struct zip *, int, const char *, int); +PHPZIPAPI struct zip_source *zip_source_buffer(struct zip *, const void *, off_t, int); +PHPZIPAPI struct zip_source *zip_source_file(struct zip *, const char *, off_t, off_t); +PHPZIPAPI struct zip_source *zip_source_filep(struct zip *, FILE *, off_t, off_t); +PHPZIPAPI void zip_source_free(struct zip_source *); +PHPZIPAPI struct zip_source *zip_source_function(struct zip *, zip_source_callback, void *); -struct zip_source *zip_source_zip(struct zip *, struct zip *, int, int, +PHPZIPAPI struct zip_source *zip_source_zip(struct zip *, struct zip *, int, int, off_t, off_t); -int zip_stat(struct zip *, const char *, int, struct zip_stat *); -int zip_stat_index(struct zip *, int, int, struct zip_stat *); -void zip_stat_init(struct zip_stat *); -const char *zip_strerror(struct zip *); -int zip_unchange(struct zip *, int); -int zip_unchange_all(struct zip *); -int zip_unchange_archive(struct zip *); - -#ifdef __cplusplus -} -#endif - +PHPZIPAPI int zip_stat(struct zip *, const char *, int, struct zip_stat *); +PHPZIPAPI int zip_stat_index(struct zip *, int, int, struct zip_stat *); +PHPZIPAPI void zip_stat_init(struct zip_stat *); +PHPZIPAPI const char *zip_strerror(struct zip *); +PHPZIPAPI int zip_unchange(struct zip *, int); +PHPZIPAPI int zip_unchange_all(struct zip *); +PHPZIPAPI int zip_unchange_archive(struct zip *); + +END_EXTERN_C(); #endif /* _HAD_ZIP_H */ diff --git a/ext/zip/lib/zip_add.c b/ext/zip/lib/zip_add.c index 535d6e468..70d1162f7 100644 --- a/ext/zip/lib/zip_add.c +++ b/ext/zip/lib/zip_add.c @@ -40,7 +40,7 @@ -int +PHPZIPAPI int zip_add(struct zip *za, const char *name, struct zip_source *source) { if (name == NULL || source == NULL) { diff --git a/ext/zip/lib/zip_add_dir.c b/ext/zip/lib/zip_add_dir.c index 957aaf1d2..d4da559ec 100644 --- a/ext/zip/lib/zip_add_dir.c +++ b/ext/zip/lib/zip_add_dir.c @@ -2,7 +2,7 @@ $NiH: zip_add_dir.c,v 1.1 2006/10/03 12:23:13 dillo Exp $ zip_add_dir.c -- add directory - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at <nih@giga.or.at> @@ -43,7 +43,7 @@ -int +PHPZIPAPI int zip_add_dir(struct zip *za, const char *name) { int len, ret; diff --git a/ext/zip/lib/zip_alias.h b/ext/zip/lib/zip_alias.h new file mode 100644 index 000000000..27a7b45df --- /dev/null +++ b/ext/zip/lib/zip_alias.h @@ -0,0 +1,45 @@ + +#define zip_source_cmd php_ziplib__zip_source_cmd +#define zip_source_callback php_ziplib__zip_source_callback +#define zip_stat php_ziplib__zip_stat +#define zip php_ziplib__zip +#define zip_file php_ziplib__zip_file +#define zip_source php_ziplib__zip_source +#define zip_add php_ziplib__zip_add +#define zip_add_dir php_ziplib__zip_add_dir +#define zip_close php_ziplib__zip_close +#define zip_delete php_ziplib__zip_delete +#define zip_error_clear php_ziplib__zip_error_clear +#define zip_error_get php_ziplib__zip_error_get +#define zip_error_get_sys_type php_ziplib__zip_error_get_sys_type +#define zip_error_to_str php_ziplib__zip_error_to_str +#define zip_fclose php_ziplib__zip_fclose +#define zip_file_error_clear php_ziplib__zip_fille_error_clear +#define zip_file_error_get php_ziplib__zip_file_error_get +#define zip_file_strerror php_ziplib__zip_file_strerror +#define zip_fopen php_ziplib__zip_fopen +#define zip_fopen_index php_ziplib__zip_fopen_index +#define zip_fread php_ziplib__zip_fread +#define zip_get_archive_comment php_ziplib__zip_get_archive_comment +#define zip_get_file_comment php_ziplib__zip_get_file_comment +#define zip_get_name php_ziplib__zip_get_name +#define zip_get_num_files php_ziplib__zip_get_num_files +#define zip_name_locate php_ziplib__zip_name_locate +#define zip_open php_ziplib__zip_open +#define zip_rename php_ziplib__zip_rename +#define zip_replace php_ziplib__zip_replace +#define zip_set_archive_comment php_ziplib__zip_set_archive_comment +#define zip_set_file_comment php_ziplib__zip_set_file_comment +#define zip_source_buffer php_ziplib__zip_source_buffer +#define zip_source_file php_ziplib__zip_source_file +#define zip_source_filep php_ziplib__zip_source_filep +#define zip_source_free php_ziplib__zip_source_free +#define zip_source_function php_ziplib__zip_source_function +#define zip_source_zip php_ziplib__zip_source_zip +#define zip_stat php_ziplib__zip_stat +#define zip_stat_index php_ziplib__zip_stat_index +#define zip_stat_init php_ziplib__zip_stat_init +#define zip_strerror php_ziplib__zip_strerror +#define zip_unchange php_ziplib__zip_unchange +#define zip_unchange_all php_ziplib__zip_unchange_all +#define zip_unchange_archive php_ziplib__zip_unchange_archive diff --git a/ext/zip/lib/zip_close.c b/ext/zip/lib/zip_close.c index e701321a8..11ba8e223 100644 --- a/ext/zip/lib/zip_close.c +++ b/ext/zip/lib/zip_close.c @@ -56,7 +56,7 @@ static int _zip_cdir_set_comment(struct zip_cdir *, struct zip *); static int _zip_changed(struct zip *, int *); static char *_zip_create_temp_output(struct zip *, FILE **); -int +PHPZIPAPI int zip_close(struct zip *za) { int survivors; diff --git a/ext/zip/lib/zip_delete.c b/ext/zip/lib/zip_delete.c index 7244e612f..eb5055b68 100644 --- a/ext/zip/lib/zip_delete.c +++ b/ext/zip/lib/zip_delete.c @@ -40,7 +40,7 @@ -int +PHPZIPAPI int zip_delete(struct zip *za, int idx) { if (idx < 0 || idx >= za->nentry) { diff --git a/ext/zip/lib/zip_dirent.c b/ext/zip/lib/zip_dirent.c index 8423ad534..f796f8d66 100644 --- a/ext/zip/lib/zip_dirent.c +++ b/ext/zip/lib/zip_dirent.c @@ -56,7 +56,7 @@ static void _zip_write4(unsigned int, FILE *); -void +PHPZIPAPI void _zip_cdir_free(struct zip_cdir *cd) { int i; @@ -73,7 +73,7 @@ _zip_cdir_free(struct zip_cdir *cd) -struct zip_cdir * +PHPZIPAPI struct zip_cdir * _zip_cdir_new(int nentry, struct zip_error *error) { struct zip_cdir *cd; @@ -102,7 +102,7 @@ _zip_cdir_new(int nentry, struct zip_error *error) -int +PHPZIPAPI int _zip_cdir_write(struct zip_cdir *cd, FILE *fp, struct zip_error *error) { int i; @@ -136,7 +136,7 @@ _zip_cdir_write(struct zip_cdir *cd, FILE *fp, struct zip_error *error) -void +PHPZIPAPI void _zip_dirent_finalize(struct zip_dirent *zde) { free(zde->filename); @@ -149,7 +149,7 @@ _zip_dirent_finalize(struct zip_dirent *zde) -void +PHPZIPAPI void _zip_dirent_init(struct zip_dirent *de) { de->version_madeby = 0; @@ -188,7 +188,7 @@ _zip_dirent_init(struct zip_dirent *de) returned. */ -int +PHPZIPAPI int _zip_dirent_read(struct zip_dirent *zde, FILE *fp, unsigned char **bufp, unsigned int left, int localp, struct zip_error *error) @@ -333,7 +333,7 @@ _zip_dirent_read(struct zip_dirent *zde, FILE *fp, returned. */ -int +PHPZIPAPI int _zip_dirent_write(struct zip_dirent *zde, FILE *fp, int localp, struct zip_error *error) { @@ -409,7 +409,7 @@ _zip_d2u_time(int dtime, int ddate) -unsigned short +PHPZIPAPI unsigned short _zip_read2(unsigned char **a) { unsigned short ret; @@ -422,7 +422,7 @@ _zip_read2(unsigned char **a) -unsigned int +PHPZIPAPI unsigned int _zip_read4(unsigned char **a) { unsigned int ret; diff --git a/ext/zip/lib/zip_entry_free.c b/ext/zip/lib/zip_entry_free.c index 48443cefd..1bab313ed 100644 --- a/ext/zip/lib/zip_entry_free.c +++ b/ext/zip/lib/zip_entry_free.c @@ -42,7 +42,7 @@ -void +PHPZIPAPI void _zip_entry_free(struct zip_entry *ze) { free(ze->ch_filename); diff --git a/ext/zip/lib/zip_entry_new.c b/ext/zip/lib/zip_entry_new.c index 390b72ad7..67e13fd84 100644 --- a/ext/zip/lib/zip_entry_new.c +++ b/ext/zip/lib/zip_entry_new.c @@ -42,7 +42,7 @@ -struct zip_entry * +PHPZIPAPI struct zip_entry * _zip_entry_new(struct zip *za) { struct zip_entry *ze; diff --git a/ext/zip/lib/zip_error.c b/ext/zip/lib/zip_error.c index aec1638de..4816b73ae 100644 --- a/ext/zip/lib/zip_error.c +++ b/ext/zip/lib/zip_error.c @@ -2,7 +2,7 @@ $NiH: zip_error.c,v 1.7 2005/06/09 19:57:09 dillo Exp $ zip_error.c -- struct zip_error helper functions - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at <nih@giga.or.at> @@ -42,7 +42,7 @@ -void +PHPZIPAPI void _zip_error_clear(struct zip_error *err) { err->zip_err = ZIP_ER_OK; @@ -51,7 +51,7 @@ _zip_error_clear(struct zip_error *err) -void +PHPZIPAPI void _zip_error_copy(struct zip_error *dst, struct zip_error *src) { dst->zip_err = src->zip_err; @@ -60,7 +60,7 @@ _zip_error_copy(struct zip_error *dst, struct zip_error *src) -void +PHPZIPAPI void _zip_error_fini(struct zip_error *err) { free(err->str); @@ -69,7 +69,7 @@ _zip_error_fini(struct zip_error *err) -void +PHPZIPAPI void _zip_error_get(struct zip_error *err, int *zep, int *sep) { if (zep) @@ -84,7 +84,7 @@ _zip_error_get(struct zip_error *err, int *zep, int *sep) -void +PHPZIPAPI void _zip_error_init(struct zip_error *err) { err->zip_err = ZIP_ER_OK; @@ -94,7 +94,7 @@ _zip_error_init(struct zip_error *err) -void +PHPZIPAPI void _zip_error_set(struct zip_error *err, int ze, int se) { if (err) { diff --git a/ext/zip/lib/zip_error_clear.c b/ext/zip/lib/zip_error_clear.c index e3c81eb31..8a76f4440 100644 --- a/ext/zip/lib/zip_error_clear.c +++ b/ext/zip/lib/zip_error_clear.c @@ -2,7 +2,7 @@ $NiH: zip_error_clear.c,v 1.1 2006/10/04 15:21:09 dillo Exp $ zip_error_clear.c -- clear zip error - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at <nih@giga.or.at> @@ -40,7 +40,7 @@ -void +PHPZIPAPI void zip_error_clear(struct zip *za) { _zip_error_clear(&za->error); diff --git a/ext/zip/lib/zip_error_get.c b/ext/zip/lib/zip_error_get.c index 712575a86..888b54569 100644 --- a/ext/zip/lib/zip_error_get.c +++ b/ext/zip/lib/zip_error_get.c @@ -40,7 +40,7 @@ -void +PHPZIPAPI void zip_error_get(struct zip *za, int *zep, int *sep) { _zip_error_get(&za->error, zep, sep); diff --git a/ext/zip/lib/zip_error_get_sys_type.c b/ext/zip/lib/zip_error_get_sys_type.c index 613ec9432..bfe642383 100644 --- a/ext/zip/lib/zip_error_get_sys_type.c +++ b/ext/zip/lib/zip_error_get_sys_type.c @@ -40,7 +40,7 @@ -int +PHPZIPAPI int zip_error_get_sys_type(int ze) { if (ze < 0 || ze >= _zip_nerr_str) diff --git a/ext/zip/lib/zip_error_strerror.c b/ext/zip/lib/zip_error_strerror.c index e6eee081d..06e98c76d 100644 --- a/ext/zip/lib/zip_error_strerror.c +++ b/ext/zip/lib/zip_error_strerror.c @@ -45,7 +45,7 @@ -const char * +PHPZIPAPI const char * _zip_error_strerror(struct zip_error *err) { const char *zs, *ss; diff --git a/ext/zip/lib/zip_error_to_str.c b/ext/zip/lib/zip_error_to_str.c index e56619225..665803472 100644 --- a/ext/zip/lib/zip_error_to_str.c +++ b/ext/zip/lib/zip_error_to_str.c @@ -45,7 +45,7 @@ -int +PHPZIPAPI int zip_error_to_str(char *buf, size_t len, int ze, int se) { const char *zs, *ss; diff --git a/ext/zip/lib/zip_fclose.c b/ext/zip/lib/zip_fclose.c index c0105a929..91f30b7bb 100644 --- a/ext/zip/lib/zip_fclose.c +++ b/ext/zip/lib/zip_fclose.c @@ -42,7 +42,7 @@ -int +PHPZIPAPI int zip_fclose(struct zip_file *zf) { int i, ret; diff --git a/ext/zip/lib/zip_file_error_clear.c b/ext/zip/lib/zip_file_error_clear.c index 86ed68f27..dca33b35f 100644 --- a/ext/zip/lib/zip_file_error_clear.c +++ b/ext/zip/lib/zip_file_error_clear.c @@ -2,7 +2,7 @@ $NiH: zip_file_error_clear.c,v 1.4 2006/10/04 18:37:54 wiz Exp $ zip_file_error_clear.c -- clear zip file error - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at <nih@giga.or.at> @@ -40,7 +40,7 @@ -void +PHPZIPAPI void zip_file_error_clear(struct zip_file *zf) { _zip_error_clear(&zf->error); diff --git a/ext/zip/lib/zip_file_error_get.c b/ext/zip/lib/zip_file_error_get.c index 2ab3a73a4..05516703c 100644 --- a/ext/zip/lib/zip_file_error_get.c +++ b/ext/zip/lib/zip_file_error_get.c @@ -40,7 +40,7 @@ -void +PHPZIPAPI void zip_file_error_get(struct zip_file *zf, int *zep, int *sep) { _zip_error_get(&zf->error, zep, sep); diff --git a/ext/zip/lib/zip_file_get_offset.c b/ext/zip/lib/zip_file_get_offset.c index 8bcc64934..493004023 100644 --- a/ext/zip/lib/zip_file_get_offset.c +++ b/ext/zip/lib/zip_file_get_offset.c @@ -56,7 +56,7 @@ On error, fills in za->error and returns 0. */ -unsigned int +PHPZIPAPI unsigned int _zip_file_get_offset(struct zip *za, int idx) { struct zip_dirent de; diff --git a/ext/zip/lib/zip_file_strerror.c b/ext/zip/lib/zip_file_strerror.c index aaff18999..2cc79c133 100644 --- a/ext/zip/lib/zip_file_strerror.c +++ b/ext/zip/lib/zip_file_strerror.c @@ -40,7 +40,7 @@ -const char * +PHPZIPAPI const char * zip_file_strerror(struct zip_file *zf) { return _zip_error_strerror(&zf->error); diff --git a/ext/zip/lib/zip_fopen.c b/ext/zip/lib/zip_fopen.c index 850a8d835..c05ad45bd 100644 --- a/ext/zip/lib/zip_fopen.c +++ b/ext/zip/lib/zip_fopen.c @@ -40,7 +40,7 @@ -struct zip_file * +PHPZIPAPI struct zip_file * zip_fopen(struct zip *za, const char *fname, int flags) { int idx; diff --git a/ext/zip/lib/zip_fopen_index.c b/ext/zip/lib/zip_fopen_index.c index 5da9230b2..105cefe73 100644 --- a/ext/zip/lib/zip_fopen_index.c +++ b/ext/zip/lib/zip_fopen_index.c @@ -46,7 +46,7 @@ static struct zip_file *_zip_file_new(struct zip *za); -struct zip_file * +PHPZIPAPI struct zip_file * zip_fopen_index(struct zip *za, int fileno, int flags) { int len, ret; @@ -141,7 +141,7 @@ zip_fopen_index(struct zip *za, int fileno, int flags) -int +PHPZIPAPI int _zip_file_fillbuf(void *buf, size_t buflen, struct zip_file *zf) { int i, j; diff --git a/ext/zip/lib/zip_fread.c b/ext/zip/lib/zip_fread.c index aeb64c90f..064d2b97f 100644 --- a/ext/zip/lib/zip_fread.c +++ b/ext/zip/lib/zip_fread.c @@ -40,7 +40,7 @@ -ssize_t +PHPZIPAPI ssize_t zip_fread(struct zip_file *zf, void *outbuf, size_t toread) { int ret; diff --git a/ext/zip/lib/zip_free.c b/ext/zip/lib/zip_free.c index c78697d25..534c58eb0 100644 --- a/ext/zip/lib/zip_free.c +++ b/ext/zip/lib/zip_free.c @@ -45,7 +45,7 @@ frees the space allocated to a zipfile struct, and closes the corresponding file. */ -void +PHPZIPAPI void _zip_free(struct zip *za) { int i; diff --git a/ext/zip/lib/zip_get_archive_comment.c b/ext/zip/lib/zip_get_archive_comment.c index 7844c5e19..c23597c09 100644 --- a/ext/zip/lib/zip_get_archive_comment.c +++ b/ext/zip/lib/zip_get_archive_comment.c @@ -40,7 +40,7 @@ -const char * +PHPZIPAPI const char * zip_get_archive_comment(struct zip *za, int *lenp, int flags) { if ((flags & ZIP_FL_UNCHANGED) diff --git a/ext/zip/lib/zip_get_file_comment.c b/ext/zip/lib/zip_get_file_comment.c index 79a5c236b..476ac7da0 100644 --- a/ext/zip/lib/zip_get_file_comment.c +++ b/ext/zip/lib/zip_get_file_comment.c @@ -40,7 +40,7 @@ -const char * +PHPZIPAPI const char * zip_get_file_comment(struct zip *za, int idx, int *lenp, int flags) { if (idx < 0 || idx >= za->nentry) { diff --git a/ext/zip/lib/zip_get_name.c b/ext/zip/lib/zip_get_name.c index c45dd0333..c2cae2518 100644 --- a/ext/zip/lib/zip_get_name.c +++ b/ext/zip/lib/zip_get_name.c @@ -40,7 +40,7 @@ -const char * +PHPZIPAPI const char * zip_get_name(struct zip *za, int idx, int flags) { return _zip_get_name(za, idx, flags, &za->error); @@ -48,7 +48,7 @@ zip_get_name(struct zip *za, int idx, int flags) -const char * +PHPZIPAPI const char * _zip_get_name(struct zip *za, int idx, int flags, struct zip_error *error) { if (idx < 0 || idx >= za->nentry) { diff --git a/ext/zip/lib/zip_get_num_files.c b/ext/zip/lib/zip_get_num_files.c index 0cc81edb0..05a54fcb6 100644 --- a/ext/zip/lib/zip_get_num_files.c +++ b/ext/zip/lib/zip_get_num_files.c @@ -40,7 +40,7 @@ -int +PHPZIPAPI int zip_get_num_files(struct zip *za) { if (za == NULL) diff --git a/ext/zip/lib/zip_memdup.c b/ext/zip/lib/zip_memdup.c index c4ecf4a69..ebb7426dd 100644 --- a/ext/zip/lib/zip_memdup.c +++ b/ext/zip/lib/zip_memdup.c @@ -41,7 +41,7 @@ -void * +PHPZIPAPI void * _zip_memdup(const void *mem, size_t len, struct zip_error *error) { void *ret; diff --git a/ext/zip/lib/zip_name_locate.c b/ext/zip/lib/zip_name_locate.c index a2fce2d03..108db4f60 100644 --- a/ext/zip/lib/zip_name_locate.c +++ b/ext/zip/lib/zip_name_locate.c @@ -42,7 +42,7 @@ -int +PHPZIPAPI int zip_name_locate(struct zip *za, const char *fname, int flags) { return _zip_name_locate(za, fname, flags, &za->error); @@ -50,7 +50,7 @@ zip_name_locate(struct zip *za, const char *fname, int flags) -int +PHPZIPAPI int _zip_name_locate(struct zip *za, const char *fname, int flags, struct zip_error *error) { @@ -62,8 +62,11 @@ _zip_name_locate(struct zip *za, const char *fname, int flags, _zip_error_set(error, ZIP_ER_INVAL, 0); return -1; } - - cmp = (flags & ZIP_FL_NOCASE) ? strcasecmp : strcmp; +#ifdef PHP_WIN32 + cmp = (flags & ZIP_FL_NOCASE) ? stricmp : strcmp; +#else + cmp = (flags & ZIP_FL_NOCASE) ? strcasecmp : strcmp; +#endif n = (flags & ZIP_FL_UNCHANGED) ? za->cdir->nentry : za->nentry; for (i=0; i<n; i++) { diff --git a/ext/zip/lib/zip_new.c b/ext/zip/lib/zip_new.c index 660183a15..378513b6c 100644 --- a/ext/zip/lib/zip_new.c +++ b/ext/zip/lib/zip_new.c @@ -45,7 +45,7 @@ creates a new zipfile struct, and sets the contents to zero; returns the new struct. */ -struct zip * +PHPZIPAPI struct zip * _zip_new(struct zip_error *error) { struct zip *za; diff --git a/ext/zip/lib/zip_open.c b/ext/zip/lib/zip_open.c index 60526e8c9..711dcb1ca 100644 --- a/ext/zip/lib/zip_open.c +++ b/ext/zip/lib/zip_open.c @@ -2,7 +2,7 @@ $NiH: zip_open.c,v 1.38 2006/05/04 00:01:26 dillo Exp $ zip_open.c -- open zip archive - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at <nih@giga.or.at> @@ -58,7 +58,7 @@ static struct zip_cdir *_zip_readcdir(FILE *, unsigned char *, unsigned char *, -struct zip * +PHPZIPAPI struct zip * zip_open(const char *fn, int flags, int *zep) { FILE *fp; diff --git a/ext/zip/lib/zip_rename.c b/ext/zip/lib/zip_rename.c index f35291893..8141dc46a 100644 --- a/ext/zip/lib/zip_rename.c +++ b/ext/zip/lib/zip_rename.c @@ -40,7 +40,7 @@ -int +PHPZIPAPI int zip_rename(struct zip *za, int idx, const char *name) { if (idx >= za->nentry || idx < 0) { diff --git a/ext/zip/lib/zip_replace.c b/ext/zip/lib/zip_replace.c index ae78e62b8..12db005f2 100644 --- a/ext/zip/lib/zip_replace.c +++ b/ext/zip/lib/zip_replace.c @@ -40,7 +40,7 @@ -int +PHPZIPAPI int zip_replace(struct zip *za, int idx, struct zip_source *source) { if (idx < 0 || idx >= za->nentry || source == NULL) { @@ -57,7 +57,7 @@ zip_replace(struct zip *za, int idx, struct zip_source *source) -int +PHPZIPAPI int _zip_replace(struct zip *za, int idx, const char *name, struct zip_source *source) { diff --git a/ext/zip/lib/zip_set_archive_comment.c b/ext/zip/lib/zip_set_archive_comment.c index b0929e56b..7649a80de 100644 --- a/ext/zip/lib/zip_set_archive_comment.c +++ b/ext/zip/lib/zip_set_archive_comment.c @@ -42,7 +42,7 @@ -int +PHPZIPAPI int zip_set_archive_comment(struct zip *za, const char *comment, int len) { char *tmpcom; diff --git a/ext/zip/lib/zip_set_file_comment.c b/ext/zip/lib/zip_set_file_comment.c index cbf71db5c..5454aa21d 100644 --- a/ext/zip/lib/zip_set_file_comment.c +++ b/ext/zip/lib/zip_set_file_comment.c @@ -42,7 +42,7 @@ -int +PHPZIPAPI int zip_set_file_comment(struct zip *za, int idx, const char *comment, int len) { char *tmpcom; diff --git a/ext/zip/lib/zip_set_name.c b/ext/zip/lib/zip_set_name.c index 46dca5646..8a401faac 100644 --- a/ext/zip/lib/zip_set_name.c +++ b/ext/zip/lib/zip_set_name.c @@ -42,7 +42,7 @@ -int +PHPZIPAPI int _zip_set_name(struct zip *za, int idx, const char *name) { char *s; diff --git a/ext/zip/lib/zip_source_buffer.c b/ext/zip/lib/zip_source_buffer.c index a01f18d3f..95875b74c 100644 --- a/ext/zip/lib/zip_source_buffer.c +++ b/ext/zip/lib/zip_source_buffer.c @@ -2,7 +2,7 @@ $NiH: zip_source_buffer.c,v 1.8 2006/04/23 14:50:49 wiz Exp $ zip_source_buffer.c -- create zip data source from buffer - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at <nih@giga.or.at> @@ -52,7 +52,7 @@ static ssize_t read_data(void *state, void *data, size_t len, -struct zip_source * +PHPZIPAPI struct zip_source * zip_source_buffer(struct zip *za, const void *data, off_t len, int freep) { struct read_data *f; diff --git a/ext/zip/lib/zip_source_file.c b/ext/zip/lib/zip_source_file.c index d635da342..486e1900d 100644 --- a/ext/zip/lib/zip_source_file.c +++ b/ext/zip/lib/zip_source_file.c @@ -43,7 +43,7 @@ -struct zip_source * +PHPZIPAPI struct zip_source * zip_source_file(struct zip *za, const char *fname, off_t start, off_t len) { struct zip_source *zs; diff --git a/ext/zip/lib/zip_source_filep.c b/ext/zip/lib/zip_source_filep.c index efc702686..8a3304265 100644 --- a/ext/zip/lib/zip_source_filep.c +++ b/ext/zip/lib/zip_source_filep.c @@ -2,7 +2,7 @@ $NiH: zip_source_filep.c,v 1.6 2005/06/09 19:57:10 dillo Exp $ zip_source_filep.c -- create data source from FILE * - Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at <nih@giga.or.at> @@ -57,7 +57,7 @@ static ssize_t read_file(void *state, void *data, size_t len, -struct zip_source * +PHPZIPAPI struct zip_source * zip_source_filep(struct zip *za, FILE *file, off_t start, off_t len) { struct read_file *f; diff --git a/ext/zip/lib/zip_source_free.c b/ext/zip/lib/zip_source_free.c index 33e36eaf4..707309c91 100644 --- a/ext/zip/lib/zip_source_free.c +++ b/ext/zip/lib/zip_source_free.c @@ -42,7 +42,7 @@ -void +PHPZIPAPI void zip_source_free(struct zip_source *source) { if (source == NULL) diff --git a/ext/zip/lib/zip_source_function.c b/ext/zip/lib/zip_source_function.c index 4f01a43c5..4ab110924 100644 --- a/ext/zip/lib/zip_source_function.c +++ b/ext/zip/lib/zip_source_function.c @@ -42,7 +42,7 @@ -struct zip_source * +PHPZIPAPI struct zip_source * zip_source_function(struct zip *za, zip_source_callback zcb, void *ud) { struct zip_source *zs; diff --git a/ext/zip/lib/zip_source_zip.c b/ext/zip/lib/zip_source_zip.c index a31fd2787..75e656402 100644 --- a/ext/zip/lib/zip_source_zip.c +++ b/ext/zip/lib/zip_source_zip.c @@ -52,7 +52,7 @@ static ssize_t read_zip(void *st, void *data, size_t len, -struct zip_source * +PHPZIPAPI struct zip_source * zip_source_zip(struct zip *za, struct zip *srcza, int srcidx, int flags, off_t start, off_t len) { diff --git a/ext/zip/lib/zip_stat.c b/ext/zip/lib/zip_stat.c index bea153d15..7c6cbf00d 100644 --- a/ext/zip/lib/zip_stat.c +++ b/ext/zip/lib/zip_stat.c @@ -40,7 +40,7 @@ -int +PHPZIPAPI int zip_stat(struct zip *za, const char *fname, int flags, struct zip_stat *st) { int idx; diff --git a/ext/zip/lib/zip_stat_index.c b/ext/zip/lib/zip_stat_index.c index bab79a74b..cf55565ef 100644 --- a/ext/zip/lib/zip_stat_index.c +++ b/ext/zip/lib/zip_stat_index.c @@ -40,7 +40,7 @@ -int +PHPZIPAPI int zip_stat_index(struct zip *za, int index, int flags, struct zip_stat *st) { const char *name; diff --git a/ext/zip/lib/zip_stat_init.c b/ext/zip/lib/zip_stat_init.c index 7ab0f4da7..e9c056dfc 100644 --- a/ext/zip/lib/zip_stat_init.c +++ b/ext/zip/lib/zip_stat_init.c @@ -39,7 +39,7 @@ -void +PHPZIPAPI void zip_stat_init(struct zip_stat *st) { st->name = NULL; diff --git a/ext/zip/lib/zip_strerror.c b/ext/zip/lib/zip_strerror.c index 83e298506..f3e5aa9fe 100644 --- a/ext/zip/lib/zip_strerror.c +++ b/ext/zip/lib/zip_strerror.c @@ -40,7 +40,7 @@ -const char * +PHPZIPAPI const char * zip_strerror(struct zip *za) { return _zip_error_strerror(&za->error); diff --git a/ext/zip/lib/zip_unchange.c b/ext/zip/lib/zip_unchange.c index 34e7f2d36..80070e7a3 100644 --- a/ext/zip/lib/zip_unchange.c +++ b/ext/zip/lib/zip_unchange.c @@ -41,7 +41,7 @@ -int +PHPZIPAPI int zip_unchange(struct zip *za, int idx) { return _zip_unchange(za, idx, 0); @@ -49,7 +49,7 @@ zip_unchange(struct zip *za, int idx) -int +PHPZIPAPI int _zip_unchange(struct zip *za, int idx, int allow_duplicates) { int i; diff --git a/ext/zip/lib/zip_unchange_all.c b/ext/zip/lib/zip_unchange_all.c index f1e27da04..2d4459c82 100644 --- a/ext/zip/lib/zip_unchange_all.c +++ b/ext/zip/lib/zip_unchange_all.c @@ -41,7 +41,7 @@ -int +PHPZIPAPI int zip_unchange_all(struct zip *za) { int ret, i; diff --git a/ext/zip/lib/zip_unchange_archive.c b/ext/zip/lib/zip_unchange_archive.c index 7418aaf6a..6c2bc6dcb 100644 --- a/ext/zip/lib/zip_unchange_archive.c +++ b/ext/zip/lib/zip_unchange_archive.c @@ -41,7 +41,7 @@ -int +PHPZIPAPI int zip_unchange_archive(struct zip *za) { free(za->ch_comment); diff --git a/ext/zip/lib/zip_unchange_data.c b/ext/zip/lib/zip_unchange_data.c index 252676926..dfa2ea545 100644 --- a/ext/zip/lib/zip_unchange_data.c +++ b/ext/zip/lib/zip_unchange_data.c @@ -39,7 +39,7 @@ #include "zipint.h" -void +PHPZIPAPI void _zip_unchange_data(struct zip_entry *ze) { if (ze->source) { diff --git a/ext/zip/lib/zip_win32.h b/ext/zip/lib/zip_win32.h index a33347ba0..ea3860d60 100644 --- a/ext/zip/lib/zip_win32.h +++ b/ext/zip/lib/zip_win32.h @@ -1,6 +1,3 @@ - -#ifdef _MSC_VER - #define _POSIX_ #include <windows.h> #include <io.h> @@ -12,9 +9,6 @@ #ifndef mode_t # define mode_t int #endif -#ifndef strcasecmp -# define strcasecmp stricmp -#endif #ifndef snprintf # define snprintf _snprintf #endif @@ -26,4 +20,3 @@ # define fseeko fseek #endif */ -#endif diff --git a/ext/zip/lib/zipint.h b/ext/zip/lib/zipint.h index ebf2743f9..33632aca4 100644 --- a/ext/zip/lib/zipint.h +++ b/ext/zip/lib/zipint.h @@ -39,6 +39,10 @@ #include <zlib.h> #include "zip.h" +/* #defines that rename all zip_ functions and structs */ +#include "zipint_alias.h" + +BEGIN_EXTERN_C() #ifndef HAVE_FSEEKO #define fseeko(s, o, w) (fseek((s), (long int)(o), (w))) #endif @@ -185,42 +189,43 @@ extern const int _zip_err_type[]; -void _zip_cdir_free(struct zip_cdir *); -struct zip_cdir *_zip_cdir_new(int, struct zip_error *); -int _zip_cdir_write(struct zip_cdir *, FILE *, struct zip_error *); +PHPZIPAPI void _zip_cdir_free(struct zip_cdir *); +PHPZIPAPI struct zip_cdir *_zip_cdir_new(int, struct zip_error *); +PHPZIPAPI int _zip_cdir_write(struct zip_cdir *, FILE *, struct zip_error *); -void _zip_dirent_finalize(struct zip_dirent *); -void _zip_dirent_init(struct zip_dirent *); -int _zip_dirent_read(struct zip_dirent *, FILE *, +PHPZIPAPI void _zip_dirent_finalize(struct zip_dirent *); +PHPZIPAPI void _zip_dirent_init(struct zip_dirent *); +PHPZIPAPI int _zip_dirent_read(struct zip_dirent *, FILE *, unsigned char **, unsigned int, int, struct zip_error *); -int _zip_dirent_write(struct zip_dirent *, FILE *, int, struct zip_error *); - -void _zip_entry_free(struct zip_entry *); -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 *); -void _zip_error_init(struct zip_error *); -void _zip_error_set(struct zip_error *, int, int); -const char *_zip_error_strerror(struct zip_error *); - -int _zip_file_fillbuf(void *, size_t, struct zip_file *); -unsigned int _zip_file_get_offset(struct zip *, int); - -void _zip_free(struct zip *); -const char *_zip_get_name(struct zip *, int, int, struct zip_error *); -int _zip_local_header_read(struct zip *, int); -void *_zip_memdup(const void *, size_t, struct zip_error *); -int _zip_name_locate(struct zip *, const char *, int, struct zip_error *); -struct zip *_zip_new(struct zip_error *); -unsigned short _zip_read2(unsigned char **); -unsigned int _zip_read4(unsigned char **); -int _zip_replace(struct zip *, int, const char *, struct zip_source *); -int _zip_set_name(struct zip *, int, const char *); -int _zip_unchange(struct zip *, int, int); -void _zip_unchange_data(struct zip_entry *); - +PHPZIPAPI int _zip_dirent_write(struct zip_dirent *, FILE *, int, struct zip_error *); + +PHPZIPAPI void _zip_entry_free(struct zip_entry *); +PHPZIPAPI void _zip_entry_init(struct zip *, int); +PHPZIPAPI struct zip_entry *_zip_entry_new(struct zip *); + +PHPZIPAPI void _zip_error_clear(struct zip_error *); +PHPZIPAPI void _zip_error_copy(struct zip_error *, struct zip_error *); +PHPZIPAPI void _zip_error_fini(struct zip_error *); +PHPZIPAPI void _zip_error_get(struct zip_error *, int *, int *); +PHPZIPAPI void _zip_error_init(struct zip_error *); +PHPZIPAPI void _zip_error_set(struct zip_error *, int, int); +PHPZIPAPI const char *_zip_error_strerror(struct zip_error *); + +PHPZIPAPI int _zip_file_fillbuf(void *, size_t, struct zip_file *); +PHPZIPAPI unsigned int _zip_file_get_offset(struct zip *, int); + +PHPZIPAPI void _zip_free(struct zip *); +PHPZIPAPI const char *_zip_get_name(struct zip *, int, int, struct zip_error *); +PHPZIPAPI int _zip_local_header_read(struct zip *, int); +PHPZIPAPI void *_zip_memdup(const void *, size_t, struct zip_error *); +PHPZIPAPI int _zip_name_locate(struct zip *, const char *, int, struct zip_error *); +PHPZIPAPI struct zip *_zip_new(struct zip_error *); +PHPZIPAPI unsigned short _zip_read2(unsigned char **); +PHPZIPAPI unsigned int _zip_read4(unsigned char **); +PHPZIPAPI int _zip_replace(struct zip *, int, const char *, struct zip_source *); +PHPZIPAPI int _zip_set_name(struct zip *, int, const char *); +PHPZIPAPI int _zip_unchange(struct zip *, int, int); +PHPZIPAPI void _zip_unchange_data(struct zip_entry *); + +END_EXTERN_C(); #endif /* zipint.h */ diff --git a/ext/zip/lib/zipint_alias.h b/ext/zip/lib/zipint_alias.h new file mode 100644 index 000000000..e8541b36e --- /dev/null +++ b/ext/zip/lib/zipint_alias.h @@ -0,0 +1,49 @@ + +/* state of change of a file in zip archive */ +#define zip_state php_ziplib__zip_state +#define zip_error php_ziplib__zip_error +#define zip_dirent php_ziplib__zip_dirent +#define zip_cdir php_ziplib__zip_cdir +#define zip_source php_ziplib__zip_source +#define zip_entry php_ziplib__zip_entry + +#define _zip_err_str php_ziplib___zip_err_str +#define _zip_nerr_str php_ziplib___zip_nerr_str +#define _zip_err_type php_ziplib___zip_err_type + +#define _zip_cdir_free php_ziplib___zip_cdir_free +#define _zip_cdir_new php_ziplib___zip_cdir_new +#define _zip_cdir_write php_ziplib___zip_cdir_write + +#define _zip_dirent_finalize php_ziplib___zip_dirent_finalize +#define _zip_dirent_init php_ziplib___zip_dirent_init +#define _zip_dirent_read php_ziplib___zip_dirent_read +#define _zip_dirent_write php_ziplib___zip_dirent_write + +#define _zip_entry_free php_ziplib___zip_entry_free +#define _zip_entry_init php_ziplib___zip_entry_init +#define _zip_entry_new php_ziplib___zip_entry_new + +#define _zip_error_clear php_ziplib___zip_error_clear +#define _zip_error_copy php_ziplib___zip_error_copy +#define _zip_error_fini php_ziplib___zip_error_fini +#define _zip_error_get php_ziplib___zip_error_get +#define _zip_error_init php_ziplib___zip_error_init +#define _zip_error_set php_ziplib___zip_error_set +#define _zip_error_strerror php_ziplib___zip_error_strerror + +#define _zip_file_fillbuf php_ziplib___zip_file_fillbuf +#define _zip_file_get_offset php_ziplib___zip_file_get_offset + +#define _zip_free php_ziplib___zip_free +#define _zip_get_name php_ziplib___zip_get_name +#define _zip_local_header_read php_ziplib___zip_local_header_read +#define _zip_memdup php_ziplib___zip_memdup +#define _zip_name_locate php_ziplib___zip_name_locate +#define _zip_new php_ziplib___zip_new +#define _zip_read2 php_ziplib___zip_read2 +#define _zip_read4 php_ziplib___zip_read4 +#define _zip_replace php_ziplib___zip_replace +#define _zip_set_name php_ziplib___zip_set_name +#define _zip_unchange php_ziplib___zip_unchange +#define _zip_unchange_data php_ziplib___zip_unchange_data diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index 6f27fe950..b066a211c 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2007 The PHP Group | + | Copyright (c) 1997-2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_zip.c,v 1.1.2.38 2007/08/06 22:02:32 bjori Exp $ */ +/* $Id: php_zip.c,v 1.1.2.43 2008/01/18 00:51:38 pajoye Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -31,16 +31,17 @@ #include "lib/zip.h" #include "lib/zipint.h" -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); +/* zip_open is a macro for renaming libzip zipopen, so we need to use PHP_NAMED_FUNCTION */ +static PHP_NAMED_FUNCTION(zif_zip_open); +static PHP_NAMED_FUNCTION(zif_zip_read); +static PHP_NAMED_FUNCTION(zif_zip_close); +static PHP_NAMED_FUNCTION(zif_zip_entry_read); +static PHP_NAMED_FUNCTION(zif_zip_entry_filesize); +static PHP_NAMED_FUNCTION(zif_zip_entry_name); +static PHP_NAMED_FUNCTION(zif_zip_entry_compressedsize); +static PHP_NAMED_FUNCTION(zif_zip_entry_compressionmethod); +static PHP_NAMED_FUNCTION(zif_zip_entry_open); +static PHP_NAMED_FUNCTION(zif_zip_entry_close); /* {{{ Resource le */ static int le_zip_dir; @@ -273,9 +274,9 @@ static char * php_zipobj_get_zip_comment(struct zip *za, int *len TSRMLS_DC) /* /* {{{ zend_function_entry */ static zend_function_entry zip_functions[] = { - PHP_FE(zip_open, NULL) - PHP_FE(zip_close, NULL) - PHP_FE(zip_read, NULL) + ZEND_RAW_FENTRY("zip_open", zif_zip_open, NULL, 0) + ZEND_RAW_FENTRY("zip_close", zif_zip_close, NULL, 0) + ZEND_RAW_FENTRY("zip_read", zif_zip_read, NULL, 0) PHP_FE(zip_entry_open, NULL) PHP_FE(zip_entry_close, NULL) PHP_FE(zip_entry_read, NULL) @@ -634,6 +635,8 @@ static void php_zip_free_entry(zend_rsrc_list_entry *rsrc TSRMLS_DC) /* }}}*/ +/* reset macro */ +#undef zip /* {{{ function prototypes */ static PHP_MINIT_FUNCTION(zip); static PHP_MSHUTDOWN_FUNCTION(zip); @@ -651,7 +654,7 @@ zend_module_entry zip_module_entry = { NULL, NULL, PHP_MINFO(zip), - "1.4.0", + "2.0.0", STANDARD_MODULE_PROPERTIES }; /* }}} */ @@ -659,10 +662,12 @@ zend_module_entry zip_module_entry = { #ifdef COMPILE_DL_ZIP ZEND_GET_MODULE(zip) #endif +/* set macro */ +#define zip php_ziplib__zip /* {{{ proto resource zip_open(string filename) Create new zip using source uri for output */ -static PHP_FUNCTION(zip_open) +static PHP_NAMED_FUNCTION(zif_zip_open) { char *filename; int filename_len; @@ -704,7 +709,7 @@ static PHP_FUNCTION(zip_open) /* {{{ proto void zip_close(resource zip) Close a Zip archive */ -static PHP_FUNCTION(zip_close) +static PHP_NAMED_FUNCTION(zif_zip_close) { zval * zip; zip_rsrc *z_rsrc = NULL; @@ -721,7 +726,7 @@ static PHP_FUNCTION(zip_close) /* {{{ proto resource zip_read(resource zip) Returns the next file in the archive */ -static PHP_FUNCTION(zip_read) +static PHP_NAMED_FUNCTION(zif_zip_read) { zval *zip_dp; zip_read_rsrc *zr_rsrc; @@ -765,7 +770,7 @@ static PHP_FUNCTION(zip_read) /* {{{ 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 */ -static PHP_FUNCTION(zip_entry_open) +static PHP_NAMED_FUNCTION(zif_zip_entry_open) { zval * zip; zval * zip_entry; @@ -792,7 +797,7 @@ static PHP_FUNCTION(zip_entry_open) /* {{{ proto void zip_entry_close(resource zip_ent) Close a zip entry */ /* another dummy function to fit in the old api*/ -static PHP_FUNCTION(zip_entry_close) +static PHP_NAMED_FUNCTION(zif_zip_entry_close) { zval * zip_entry; zip_read_rsrc * zr_rsrc; @@ -809,7 +814,7 @@ static PHP_FUNCTION(zip_entry_close) /* {{{ proto mixed zip_entry_read(resource zip_entry [, int len]) Read from an open directory entry */ -static PHP_FUNCTION(zip_entry_read) +static PHP_NAMED_FUNCTION(zif_zip_entry_read) { zval * zip_entry; long len = 0; @@ -909,7 +914,7 @@ static void php_zip_entry_get_info(INTERNAL_FUNCTION_PARAMETERS, int opt) /* {{{ /* {{{ proto string zip_entry_name(resource zip_entry) Return the name given a ZZip entry */ -static PHP_FUNCTION(zip_entry_name) +static PHP_NAMED_FUNCTION(zif_zip_entry_name) { php_zip_entry_get_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); } @@ -917,7 +922,7 @@ static PHP_FUNCTION(zip_entry_name) /* {{{ proto int zip_entry_compressedsize(resource zip_entry) Return the compressed size of a ZZip entry */ -static PHP_FUNCTION(zip_entry_compressedsize) +static PHP_NAMED_FUNCTION(zif_zip_entry_compressedsize) { php_zip_entry_get_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); } @@ -925,7 +930,7 @@ static PHP_FUNCTION(zip_entry_compressedsize) /* {{{ proto int zip_entry_filesize(resource zip_entry) Return the actual filesize of a ZZip entry */ -static PHP_FUNCTION(zip_entry_filesize) +static PHP_NAMED_FUNCTION(zif_zip_entry_filesize) { php_zip_entry_get_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, 2); } @@ -933,13 +938,13 @@ static PHP_FUNCTION(zip_entry_filesize) /* {{{ proto string zip_entry_compressionmethod(resource zip_entry) Return a string containing the compression method used on a particular entry */ -static PHP_FUNCTION(zip_entry_compressionmethod) +static PHP_NAMED_FUNCTION(zif_zip_entry_compressionmethod) { php_zip_entry_get_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, 3); } /* }}} */ -/* {{{ proto mixed open(string source [, int flags]) +/* {{{ proto mixed ZipArchive::open(string source [, int flags]) Create new zip using source uri for output, return TRUE on success or the error code */ static ZIPARCHIVE_METHOD(open) { @@ -997,7 +1002,7 @@ static ZIPARCHIVE_METHOD(open) } /* }}} */ -/* {{{ proto bool close() +/* {{{ proto bool ZipArchive::close() close the zip archive */ static ZIPARCHIVE_METHOD(close) { @@ -1026,7 +1031,7 @@ static ZIPARCHIVE_METHOD(close) } /* }}} */ -/* {{{ proto bool createEmptyDir(string dirname) U +/* {{{ proto bool ZipArchive::createEmptyDir(string dirname) Returns the index of the entry named filename in the archive */ static ZIPARCHIVE_METHOD(addEmptyDir) { @@ -1085,7 +1090,7 @@ static ZIPARCHIVE_METHOD(addEmptyDir) } /* }}} */ -/* {{{ proto bool addFile(string filepath[, string entryname[, int start [, int length]]]) +/* {{{ proto bool ZipArchive::addFile(string filepath[, string entryname[, int start [, int length]]]) Add a file in a Zip archive using its path and the name to use. */ static ZIPARCHIVE_METHOD(addFile) { @@ -1157,7 +1162,7 @@ static ZIPARCHIVE_METHOD(addFile) } /* }}} */ -/* {{{ proto bool addFromString(string name, string content) +/* {{{ proto bool ZipArchive::addFromString(string name, string content) Add a file using content and the entry name */ static ZIPARCHIVE_METHOD(addFromString) { @@ -1222,7 +1227,7 @@ static ZIPARCHIVE_METHOD(addFromString) } /* }}} */ -/* {{{ proto array statName(string filename[, int flags]) +/* {{{ proto array ZipArchive::statName(string filename[, int flags]) Returns the information about a the zip entry filename */ static ZIPARCHIVE_METHOD(statName) { @@ -1250,7 +1255,7 @@ static ZIPARCHIVE_METHOD(statName) } /* }}} */ -/* {{{ proto resource statIndex(int index[, int flags]) +/* {{{ proto resource ZipArchive::statIndex(int index[, int flags]) Returns the zip entry informations using its index */ static ZIPARCHIVE_METHOD(statIndex) { @@ -1278,7 +1283,7 @@ static ZIPARCHIVE_METHOD(statIndex) } /* }}} */ -/* {{{ proto int locateName(string filename[, int flags]) +/* {{{ proto int ZipArchive::locateName(string filename[, int flags]) Returns the index of the entry named filename in the archive */ static ZIPARCHIVE_METHOD(locateName) { @@ -1318,7 +1323,7 @@ static ZIPARCHIVE_METHOD(locateName) } /* }}} */ -/* {{{ proto string getNameIndex(int index [, int flags]) +/* {{{ proto string ZipArchive::getNameIndex(int index [, int flags]) Returns the name of the file at position index */ static ZIPARCHIVE_METHOD(getNameIndex) { @@ -1348,7 +1353,7 @@ static ZIPARCHIVE_METHOD(getNameIndex) } /* }}} */ -/* {{{ proto bool setArchiveComment(string name, string comment) +/* {{{ proto bool ZipArchive::setArchiveComment(string name, string comment) Set or remove (NULL/'') the comment of the archive */ static ZIPARCHIVE_METHOD(setArchiveComment) { @@ -1374,7 +1379,7 @@ static ZIPARCHIVE_METHOD(setArchiveComment) } /* }}} */ -/* {{{ proto string getArchiveComment() +/* {{{ proto string ZipArchive::getArchiveComment() Returns the comment of an entry using its index */ static ZIPARCHIVE_METHOD(getArchiveComment) { @@ -1399,7 +1404,7 @@ static ZIPARCHIVE_METHOD(getArchiveComment) } /* }}} */ -/* {{{ proto bool setCommentName(string name, string comment) +/* {{{ proto bool ZipArchive::setCommentName(string name, string comment) Set or remove (NULL/'') the comment of an entry using its Name */ static ZIPARCHIVE_METHOD(setCommentName) { @@ -1432,7 +1437,7 @@ static ZIPARCHIVE_METHOD(setCommentName) } /* }}} */ -/* {{{ proto bool setCommentIndex(int index, string comment) +/* {{{ proto bool ZipArchive::setCommentIndex(int index, string comment) Set or remove (NULL/'') the comment of an entry using its index */ static ZIPARCHIVE_METHOD(setCommentIndex) { @@ -1459,7 +1464,7 @@ static ZIPARCHIVE_METHOD(setCommentIndex) } /* }}} */ -/* {{{ proto string getCommentName(string name) +/* {{{ proto string ZipArchive::getCommentName(string name) Returns the comment of an entry using its name */ static ZIPARCHIVE_METHOD(getCommentName) { @@ -1496,7 +1501,7 @@ static ZIPARCHIVE_METHOD(getCommentName) } /* }}} */ -/* {{{ proto string getCommentIndex(int index) +/* {{{ proto string ZipArchive::getCommentIndex(int index) Returns the comment of an entry using its index */ static ZIPARCHIVE_METHOD(getCommentIndex) { @@ -1524,7 +1529,7 @@ static ZIPARCHIVE_METHOD(getCommentIndex) } /* }}} */ -/* {{{ proto bool deleteIndex(int index) +/* {{{ proto bool ZipArchive::deleteIndex(int index) Delete a file using its index */ static ZIPARCHIVE_METHOD(deleteIndex) { @@ -1554,7 +1559,7 @@ static ZIPARCHIVE_METHOD(deleteIndex) } /* }}} */ -/* {{{ proto bool deleteName(string name) +/* {{{ proto bool ZipArchive::deleteName(string name) Delete a file using its index */ static ZIPARCHIVE_METHOD(deleteName) { @@ -1585,7 +1590,7 @@ static ZIPARCHIVE_METHOD(deleteName) } /* }}} */ -/* {{{ proto bool renameIndex(int index, string new_name) +/* {{{ proto bool ZipArchive::renameIndex(int index, string new_name) Rename an entry selected by its index to new_name */ static ZIPARCHIVE_METHOD(renameIndex) { @@ -1621,7 +1626,7 @@ static ZIPARCHIVE_METHOD(renameIndex) } /* }}} */ -/* {{{ proto bool renameName(string name, string new_name) +/* {{{ proto bool ZipArchive::renameName(string name, string new_name) Rename an entry selected by its name to new_name */ static ZIPARCHIVE_METHOD(renameName) { @@ -1655,7 +1660,7 @@ static ZIPARCHIVE_METHOD(renameName) } /* }}} */ -/* {{{ proto bool unchangeIndex(int index) +/* {{{ proto bool ZipArchive::unchangeIndex(int index) Changes to the file at position index are reverted */ static ZIPARCHIVE_METHOD(unchangeIndex) { @@ -1685,7 +1690,7 @@ static ZIPARCHIVE_METHOD(unchangeIndex) } /* }}} */ -/* {{{ proto bool unchangeName(string name) +/* {{{ proto bool ZipArchive::unchangeName(string name) Changes to the file named 'name' are reverted */ static ZIPARCHIVE_METHOD(unchangeName) { @@ -1719,7 +1724,7 @@ static ZIPARCHIVE_METHOD(unchangeName) } /* }}} */ -/* {{{ proto bool unchangeAll() +/* {{{ proto bool ZipArchive::unchangeAll() All changes to files and global information in archive are reverted */ static ZIPARCHIVE_METHOD(unchangeAll) { @@ -1740,7 +1745,7 @@ static ZIPARCHIVE_METHOD(unchangeAll) } /* }}} */ -/* {{{ proto bool unchangeAll() +/* {{{ proto bool ZipArchive::unchangeAll() Revert all global changes to the archive archive. For now, this only reverts archive comment changes. */ static ZIPARCHIVE_METHOD(unchangeArchive) { @@ -1761,7 +1766,7 @@ static ZIPARCHIVE_METHOD(unchangeArchive) } /* }}} */ -/* {{{ array bool extractTo(string pathto[, mixed files]) +/* {{{ proto bool ZipArchive::extractTo(string pathto[, mixed files]) Extract one or more file from a zip archive */ /* TODO: * - allow index or array of indeces @@ -1918,7 +1923,7 @@ static void php_zip_get_from(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */ } /* }}} */ -/* {{{ proto string getFromName(string entryname[, int len [, int flags]]) +/* {{{ proto string ZipArchive::getFromName(string entryname[, int len [, int flags]]) get the contents of an entry using its name */ static ZIPARCHIVE_METHOD(getFromName) { @@ -1926,7 +1931,7 @@ static ZIPARCHIVE_METHOD(getFromName) } /* }}} */ -/* {{{ proto string getFromIndex(string entryname[, int len [, int flags]]) +/* {{{ proto string ZipArchive::getFromIndex(string entryname[, int len [, int flags]]) get the contents of an entry using its index */ static ZIPARCHIVE_METHOD(getFromIndex) { @@ -1934,7 +1939,7 @@ static ZIPARCHIVE_METHOD(getFromIndex) } /* }}} */ -/* {{{ proto resource getStream(string entryname) +/* {{{ proto resource ZipArchive::getStream(string entryname) get a stream for an entry using its name */ static ZIPARCHIVE_METHOD(getStream) { @@ -2004,7 +2009,9 @@ static zend_function_entry zip_class_functions[] = { /* }}} */ /* {{{ PHP_MINIT_FUNCTION */ +#undef zip static PHP_MINIT_FUNCTION(zip) +#define zip php_ziplib__zip { zend_class_entry ce; @@ -2085,7 +2092,9 @@ static PHP_MINIT_FUNCTION(zip) /* {{{ PHP_MSHUTDOWN_FUNCTION */ +#undef zip static PHP_MSHUTDOWN_FUNCTION(zip) +#define zip php_ziplib__zip { zend_hash_destroy(&zip_prop_handlers); php_unregister_url_stream_wrapper("zip" TSRMLS_CC); @@ -2096,14 +2105,15 @@ static PHP_MSHUTDOWN_FUNCTION(zip) /* {{{ PHP_MINFO_FUNCTION */ +#undef 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.1.2.38 2007/08/06 22:02:32 bjori Exp $"); - php_info_print_table_row(2, "Zip version", "2.0.0"); - php_info_print_table_row(2, "Libzip version", "0.7.1"); + php_info_print_table_row(2, "Extension Version","$Id: php_zip.c,v 1.1.2.43 2008/01/18 00:51:38 pajoye Exp $"); + php_info_print_table_row(2, "Zip version", PHP_ZIP_VERSION_STRING); + php_info_print_table_row(2, "Libzip version", "0.8.0-compatible"); php_info_print_table_end(); } diff --git a/ext/zip/php_zip.h b/ext/zip/php_zip.h index 498bdc919..6712b5291 100644 --- a/ext/zip/php_zip.h +++ b/ext/zip/php_zip.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2007 The PHP Group | + | Copyright (c) 1997-2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_zip.h,v 1.10.2.3 2007/03/14 11:08:57 pajoye Exp $ */ +/* $Id: php_zip.h,v 1.10.2.5 2008/01/18 00:51:38 pajoye Exp $ */ #ifndef PHP_ZIP_H #define PHP_ZIP_H @@ -30,6 +30,8 @@ extern zend_module_entry zip_module_entry; #include "lib/zip.h" +#define PHP_ZIP_VERSION_STRING "1.8.11" + /* {{{ OPENBASEDIR_CHECKPATH(filename) */ #if (PHP_MAJOR_VERSION < 6) #define OPENBASEDIR_CHECKPATH(filename) \ diff --git a/ext/zip/tests/oo_properties.phpt b/ext/zip/tests/oo_properties.phpt index dc4498a87..f7d126696 100644 --- a/ext/zip/tests/oo_properties.phpt +++ b/ext/zip/tests/oo_properties.phpt @@ -2,7 +2,7 @@ ziparchive::properties isset()/empty() checks --SKIPIF-- <?php -/* $Id: oo_properties.phpt,v 1.1.2.4 2007/08/13 12:46:40 tony2001 Exp $ */ +/* $Id: oo_properties.phpt,v 1.1.2.5 2007/11/19 11:12:36 tony2001 Exp $ */ if(!extension_loaded('zip')) die('skip'); ?> --FILE-- @@ -41,7 +41,7 @@ zip->numFiles (4): empty(): 0 isset(): 1 -Notice: Undefined property: ZipArchive::$bogus in %s on line %d +Notice: Undefined property: ZipArchive::$bogus in %s on line %d zip->bogus (0): empty(): 1 isset(): 0 |
