From 2b947be3b77aec127d36c9e6f99a57eadaa68bcc Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Thu, 27 Oct 2016 15:26:37 +0900 Subject: [PATCH] Imported Upstream version 1.1.3 Change-Id: I018ec6ff8bbe7057c350b2a67fe7afd2f92e5cf4 Signed-off-by: DongHun Kwak --- CMakeLists.txt | 2 +- Makefile.am | 7 +- Makefile.in | 11 +- NEWS => NEWS.md | 62 +++++++---- README.md | 39 +++++++ TODO.md | 168 ++++++++++++++++++++++++++++++ configure | 55 ++++++++-- configure.ac | 9 +- lib/Makefile.am | 14 ++- lib/Makefile.in | 81 ++++++++++++--- lib/compat.h | 181 +++++++++++++++++++++++++++++++++ lib/zip_dirent.c | 1 + lib/zip_source_file.c | 4 + lib/zipint.h | 120 +--------------------- regress/NiHTest.pm | 18 +++- regress/malloc.c | 4 + src/Makefile.am | 2 +- src/Makefile.in | 2 +- src/compat.h | 61 ----------- src/zipcmp.c | 2 - xcode/libzip.xcodeproj/project.pbxproj | 6 +- 21 files changed, 607 insertions(+), 242 deletions(-) rename NEWS => NEWS.md (81%) create mode 100644 README.md create mode 100644 TODO.md create mode 100644 lib/compat.h delete mode 100644 src/compat.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e20bce..d5a23fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,7 @@ SET(PACKAGE "libzip") SET(PACKAGE_NAME ${PACKAGE}) SET(PACKAGE_VERSION_MAJOR "1") SET(PACKAGE_VERSION_MINOR "1") -SET(PACKAGE_VERSION_PATCH "2") +SET(PACKAGE_VERSION_PATCH "3") #SET(VERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}") SET(VERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}.${PACKAGE_VERSION_PATCH}") SET(PACKAGE_VERSION ${VERSION}) diff --git a/Makefile.am b/Makefile.am index 09da711..3caa26f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -9,12 +9,15 @@ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libzip.pc EXTRA_DIST= API-CHANGES \ - LICENSE \ CMakeLists.txt \ + LICENSE \ + NEWS.md \ + README.md \ + TODO.md \ cmake-config.h.in \ cmake-zipconf.h.in \ - libzip.pc.in \ libzip-uninstalled.pc.in \ + libzip.pc.in \ m4 dist-hook: diff --git a/Makefile.in b/Makefile.in index 1a33b3d..0911e38 100644 --- a/Makefile.in +++ b/Makefile.in @@ -192,8 +192,8 @@ CSCOPE = cscope DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(srcdir)/libzip-uninstalled.pc.in $(srcdir)/libzip.pc.in \ - AUTHORS INSTALL NEWS THANKS compile config.guess config.sub \ - depcomp install-sh ltmain.sh missing + AUTHORS INSTALL THANKS compile config.guess config.sub depcomp \ + install-sh ltmain.sh missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) @@ -362,12 +362,15 @@ SUBDIRS = lib man src regress examples pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libzip.pc EXTRA_DIST = API-CHANGES \ - LICENSE \ CMakeLists.txt \ + LICENSE \ + NEWS.md \ + README.md \ + TODO.md \ cmake-config.h.in \ cmake-zipconf.h.in \ - libzip.pc.in \ libzip-uninstalled.pc.in \ + libzip.pc.in \ m4 all: config.h diff --git a/NEWS b/NEWS.md similarity index 81% rename from NEWS rename to NEWS.md index 3a3ee2e..c915ce6 100644 --- a/NEWS +++ b/NEWS.md @@ -1,13 +1,21 @@ -1.1.2 [2016/02/19] +1.1.3 [2016-05-28] +================== + +* Fix build on Windows when using autoconf. + +1.1.2 [2016-02-19] +================== * Improve support for 3MF files -1.1.1 [2016/02/07] +1.1.1 [2016-02-07] +================== * Build fixes for Linux * Fix some warnings reported by PVS-Studio -1.1 [2016/01/26] +1.1 [2016-01-26] +================ * ziptool(1): command line tool to modify zip archives * Speedups for archives with many entries @@ -18,11 +26,13 @@ * Portability fixes * Documentation improvements -1.0.1 [2015/05/04] +1.0.1 [2015-05-04] +================== * Build fixes for Windows. -1.0 [2015/05/03] +1.0 [2015-05-03] +================ * Implemented an I/O abstraction layer. * Added support for native Windows API for files. @@ -33,19 +43,22 @@ * CVE-2015-2331 was fixed. * Addressed all Coverity CIDs. -0.11.2 [2013/12/19] +0.11.2 [2013-12-19] +=================== * Support querying/setting operating system and external attributes. * For newly added files, set operating system to UNIX, permissions to 0666 (0777 for directories). * Fix bug when writing zip archives containing files bigger than 4GB. -0.11.1 [2013/04/27] +0.11.1 [2013-04-27] +=================== * Fix bugs in zip_set_file_compression(). * Include Xcode build infrastructure. -0.11 [2013/03/23] +0.11 [2013-03-23] +================= * Added Zip64 support (large file support) * Added UTF-8 support for file names, file comments, and archive comments @@ -59,12 +72,14 @@ * More changes for Windows support * Additional test cases -0.10.1 [2012/03/20] +0.10.1 [2012-03-20] +=================== * Fixed CVE-2012-1162 * Fixed CVE-2012-1163 -0.10 [2010/03/18] +0.10 [2010-03-18] +================= * Added zip_get_num_entries(), deprecated zip_get_num_files(). * Better windows support. @@ -76,23 +91,27 @@ * Fixed CVE-2011-0421 (no security implications though) * More documentation. -0.9.3 [2010/02/01] +0.9.3 [2010-02-01] +================== * Include m4/ directory in distribution; some packagers need it. -0.9.2 [2010/01/31] +0.9.2 [2010-01-31] +================== * Avoid passing uninitialized data to deflate(). * Fix memory leak when closing zip archives. -0.9.1 [2010/01/24] +0.9.1 [2010-01-24] +================== * Fix infinite loop on reading some broken files. * Optimization in time conversion (don't call localtime()). * Clear data descriptor flag in central directory, fixing Open Office files. * Allow more than 64k entries. -0.9 [2008/07/25] +0.9 [2008-07-25] +================== * on Windows, explictly set dllimport/dllexport * remove erroneous references to GPL @@ -101,7 +120,8 @@ * zip_source_zip: add flag to force recompression * zip_sorce_file: only keep file open while reading from it -0.8 [2007/06/06] +0.8 [2007-06-06] +================== * fix for zip archives larger than 2GiB * fix zip_error_strerror to include libzip error string @@ -109,11 +129,13 @@ * new functions: zip_add_dir, zip_error_clear, zip_file_error_clear * add basic support for building with CMake (incomplete) -0.7.1 [2006/05/18] +0.7.1 [2006-05-18] +================== * bugfix for zip_close -0.7 [2006/05/06] +0.7 [2006-05-06] +================ * struct zip_stat increased for future encryption support * zip_add return value changed (now returns new index of added file) @@ -122,11 +144,13 @@ New functions: zip_get_archive_comment, zip_get_file_comment, zip_set_archive_comment, zip_set_file_comment, zip_unchange_archive -0.6.1 [2005/07/14] +0.6.1 [2005-07-14] +================== * various bug fixes -0.6 [2005/06/09] +0.6 [2005-06-09] +================ * first standalone release * changed license to three-clause BSD diff --git a/README.md b/README.md new file mode 100644 index 0000000..cc527f5 --- /dev/null +++ b/README.md @@ -0,0 +1,39 @@ +This is libzip, a C library for reading, creating, and modifying zip +archives. Files can be added from data buffers, files, or compressed +data copied directly from other zip archives. Changes made without +closing the archive can be reverted. The API is documented by man +pages. + +For more information, take a look at the included man pages. You can +start with [libzip(3)](http://nih.at/libzip/libzip.html), which lists +all others. Example source code is in the `src/` subdirectory. + +If you have developed an application using libzip, you can find out +about API changes and how to adapt your code for them in the included +file `API-CHANGES`. + +For generic installation instructions, see file `INSTALL`, which +describes the approach using autoconf; alternatively, you can +use cmake to build. + +Additionally, you'll need zlib (at least version 1.1.2). It comes +with most operating systems nowadays, or you can get it at +> http://www.zlib.net/ + +When using a static Windows library, you need to define `ZIP_STATIC` +when compiling packages using libzip. + +If you make a binary distribution, please include a pointer to the +distribution site: +> http://www.nih.at/libzip/ + +The latest version can always be found there. + +There is a mailing list for developers using libzip. You can +subscribe to it by sending a mail with the subject "subscribe +libzip-discuss" to minimalist at nih.at. List mail should be sent +to libzip-discuss at nih.at. Use this for bug reports or questions. + +If you want to reach the authors in private, use . + +![Travis Build Status](https://api.travis-ci.org/nih-at/libzip.svg?branch=master) diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..3fe55e1 --- /dev/null +++ b/TODO.md @@ -0,0 +1,168 @@ +# API Plans + +## Encryption + +````c +struct zip *zip_open_encrypted(const char *path, int flags, const char *password, int *errorp); +int zip_set_encryption(struct zip *archive, zip_uint64_t idx, zip_uint16_t method, const char *password); +void zip_set_archive_encryption(struct zip *archive, zip_uint16_t method, const char *password); +```` + +## Prefixes + +For example for adding extractors for self-extracting zip archives. +````c +zip_set_archive_prefix(struct zip *za, const zip_uint8_t *data, zip_uint64_t length); +const zip_uint8_t *zip_get_archive_prefix(struct zip *za, zip_uint64_t *lengthp); +```` + +## Progress Callback + +Register callback; will be called from `zip_close()` after each file has been processed. + +````c +typedef void (*zip_progress_callback_t)(double); +void zip_register_progress_callback(zip_t *, zip_progress_callback_t); +```` + +# API Issues + +* `zip_get_archive_comment` has `int *lenp` argument. Cleaner would be `zip_uint32_t *`. + rename and fix. which other functions for naming consistency? +* rename remaining `zip_XXX_{file,archive}_*` to `zip_{file,archive}_XXX_*`? +* compression/crypt implementations: how to set error code on failure +* compression/crypt error messages a la `ZIP_ER_ZLIB` (no detailed info passing) +* check arguments for every entry point into libzip + +# Features + +* support setting extra fields from zip_source + * introduce layers of extra fields: + * original + * from zip_source + * manually set + * when querying extra fields, search all of them in reverse order + * add whiteout (deleted) flag + * allow invalid data flag, used when computing extra field size before writing data + * new command `ZIP_SOURCE_EXTRA_FIELDS` + * no support for multiple copies of same extra field +* delete all extra fields during `zip_replace()` +* function to copy file from one archive to another +* set `O_CLOEXEC` flag after fopen and mkstemp +* add append-only mode writing file to disk incrementally to keep memory usage low +* `zip_file_set_mtime()`: support InfoZIP time stamps + +* support streaming output (creating new archive to e.g. stdout) +* add functions to: + * read/set ASCII file flag? (more general options?) +* `zip_commit()` (to finish changes without closing archive) +* add custom compression function support +* `zip_fseek()` +* `zip_source_zip()`: allow rewinding +* zipcmp: add option for file content comparison +* zipcmp: compare bit flags if paranoid +* zipcmp: compare external attributes/opsys if paranoid +* zipcmp: compare last_mod if paranoid (or with separate flag?) +* consistency + . for stored files, test compressed = uncompressed + . data descriptor + . local headers come before central dir + +* support for old compression methods????? + +# Bugs + +* support InfoZIP encryption header extension (copy data descriptor for encrypted files) +* ensure that nentries is small enough not to cause overflow (size_t for entry, uint64 for CD on disk) +* fix OpenSUSE i686 regression failures +* check for limits imposed by format (central dir size, file size, extra fields, ...) +* `_zip_u2d_time()`: handle `localtime(3)` failure +* POSIX: `zip_open()`: check whether file can be created and fail if not +* fix inconsistent usage of valid flags (not checked in many places) +* `cdr == NULL` -> `ER_NOENT` vs. `idx > cdir->nentry` -> `ER_INVAL` inconsistent (still there?) + + +# Cleanup + +* use bool +* use `ZIP_SOURCE_SUPPORTS_{READABLE,SEEKABLE,WRITABLE}` +* use `zip_source_seek_compute_offset()` +* move compat refs from `zipint.h` to own file, and include that in `zipint.h` and `src` +* get rid of `zip_get_{compression,encryption}_implementation()` +* use `zip_*int*_t` internally + +# Analysis + +* pass through coverity + +# Infrastructure + +* create CMakefile.txt man page linking from links file + +# Test Case Issues + +* unchange on added file +* test seek in `zip_source_crc()` +* test cases for `set_extra*`, `delete_extra*`, `*extra_field*` +* test cases for in memory archives + * add + * delete + * delete all + * modify +* use gcov output to increase test coverage +* merge most tools into ziptool +* add test case to change values for newly added files (name, compression method, comment, mtime, . . .) +* `zip_open()` file less than `EOCDLEN` bytes long +* test calls against old API +* run regression tests also from CMake framework +* rename file to dir/ and vice versa (fails) +* fix comment test to be newline insensitive +* check if http://bugs.python.org/issue20078 provides ideas for new tests + +* (add, replace) + * add to empty zip + * add to existing zip + * add w/ existing file name [E] + * replace ok + * replace w/ illegal index [E] + * replace w/ deleted name [E] + * unchange added/replaced file +* (close) + * copy zip file + * open copy + * rename, delete, replace, add w/ new name, add w/ deleted name + * close + * zipcmp copy expected + * remove copy +* (error_get) +* (error_get_sys_type) +* (error_to_str) +* (extra_fields) +* (file_error_get) +* (file_strerror) +* (replace) +* (source_buffer) +* (source_file) +* (source_filep) +* (source_free) +* (source_function) +* (source_zip) +* (strerror) +* (unchange) +* (unchange_all) +* open(ZIP_RDONLY) +* I/O abstraction layer + * zip_open_from_source +* read two zip entries interleaved + +# Unsorted + +* `zip_source_file()`: don't allow write if start/len specify a part of the file +* script to check if all exported symbols are marked with `ZIP_EXTERN`, add to make distcheck + +* re-implement fix for OS X sandboxing (`zip_archive_set_tempdir()`). + +* document: `zip_source_write()`: length can't be > `ZIP_INT64_MAX` +* document: `ZIP_SOURCE_CLOSE` implementation can't return error +* keep error codes in man pages in sync +* document error codes in new man pages diff --git a/configure b/configure index f9e6ba9..d784df7 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for libzip 1.1.2. +# Generated by GNU Autoconf 2.69 for libzip 1.1.3. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='libzip' PACKAGE_TARNAME='libzip' -PACKAGE_VERSION='1.1.2' -PACKAGE_STRING='libzip 1.1.2' +PACKAGE_VERSION='1.1.3' +PACKAGE_STRING='libzip 1.1.3' PACKAGE_BUGREPORT='libzip@nih.at' PACKAGE_URL='' @@ -638,6 +638,8 @@ LTLIBOBJS HAVE_VISIBILITY CFLAG_VISIBILITY MANFMT +WIN32_HOST_FALSE +WIN32_HOST_TRUE LIBOBJS CPP OTOOL64 @@ -1316,7 +1318,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libzip 1.1.2 to adapt to many kinds of systems. +\`configure' configures libzip 1.1.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1386,7 +1388,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libzip 1.1.2:";; + short | recursive ) echo "Configuration of libzip 1.1.3:";; esac cat <<\_ACEOF @@ -1493,7 +1495,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libzip configure 1.1.2 +libzip configure 1.1.3 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2202,7 +2204,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libzip $as_me 1.1.2, which was +It was created by libzip $as_me 1.1.3, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3069,7 +3071,7 @@ fi # Define the identity of the package. PACKAGE='libzip' - VERSION='1.1.2' + VERSION='1.1.3' cat >>confdefs.h <<_ACEOF @@ -12156,6 +12158,35 @@ $as_echo "#define HAVE___PROGNAME 1" >>confdefs.h fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are building for a Win32 host" >&5 +$as_echo_n "checking whether we are building for a Win32 host... " >&6; } +if ${ac_cv_win32_host+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef _WIN32 + choke me + #endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_win32_host=no +else + ac_cv_win32_host=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_win32_host" >&5 +$as_echo "$ac_cv_win32_host" >&6; } + if test "x$ac_cv_win32_host" = "xyes"; then + WIN32_HOST_TRUE= + WIN32_HOST_FALSE='#' +else + WIN32_HOST_TRUE='#' + WIN32_HOST_FALSE= +fi + for ac_header in fts.h stdbool.h strings.h unistd.h do : @@ -12760,6 +12791,10 @@ if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${WIN32_HOST_TRUE}" && test -z "${WIN32_HOST_FALSE}"; then + as_fn_error $? "conditional \"WIN32_HOST\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 @@ -13157,7 +13192,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libzip $as_me 1.1.2, which was +This file was extended by libzip $as_me 1.1.3, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -13223,7 +13258,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libzip config.status 1.1.2 +libzip config.status 1.1.3 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index deb0e87..0a8920a 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_PREREQ([2.60]) -AC_INIT([libzip],[1.1.2],[libzip@nih.at]) +AC_INIT([libzip],[1.1.3],[libzip@nih.at]) AC_CONFIG_SRCDIR([lib/zip_add.c]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR([m4]) @@ -65,6 +65,13 @@ if test "x$ac_cv_libc_defines___progname" = "xyes" ; then AC_DEFINE([HAVE___PROGNAME], [1], [Define if libc defines __progname]) fi +AC_CACHE_CHECK([whether we are building for a Win32 host], [ac_cv_win32_host], + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifdef _WIN32 + choke me + #endif + ]])], + [ac_cv_win32_host=no], [ac_cv_win32_host=yes])) +AM_CONDITIONAL([WIN32_HOST], [test "x$ac_cv_win32_host" = "xyes"]) AC_CHECK_HEADERS([fts.h stdbool.h strings.h unistd.h]) diff --git a/lib/Makefile.am b/lib/Makefile.am index 8cd2e6e..bc9cb03 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -10,7 +10,19 @@ nodist_libinclude_HEADERS = zipconf.h libzip_la_LDFLAGS=-no-undefined -version-info 4:0:0 libzip_la_LIBADD=@LTLIBOBJS@ +if WIN32_HOST +IO_SOURCES=\ + zip_source_win32a.c \ + zip_source_win32handle.c \ + zip_source_win32utf8.c \ + zip_source_win32w.c +else +IO_SOURCES=\ + zip_source_file.c +endif + libzip_la_SOURCES=\ + ${IO_SOURCES} \ zip_add.c \ zip_add_dir.c \ zip_add_entry.c \ @@ -80,7 +92,6 @@ libzip_la_SOURCES=\ zip_source_crc.c \ zip_source_deflate.c \ zip_source_error.c \ - zip_source_file.c \ zip_source_filep.c \ zip_source_free.c \ zip_source_function.c \ @@ -116,6 +127,7 @@ BUILT_SOURCES=zipconf.h CLEANFILES= ${BUILT_SOURCES} EXTRA_DIST= CMakeLists.txt \ + compat.h \ make_zip_err_str.sh \ make_zipconf.sh \ zip_source_win32a.c \ diff --git a/lib/Makefile.in b/lib/Makefile.in index 941f77e..e8ec221 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -134,14 +134,57 @@ am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" \ "$(DESTDIR)$(libincludedir)" LTLIBRARIES = $(lib_LTLIBRARIES) libzip_la_DEPENDENCIES = @LTLIBOBJS@ -am_libzip_la_OBJECTS = zip_add.lo zip_add_dir.lo zip_add_entry.lo \ - zip_buffer.lo zip_close.lo zip_delete.lo zip_dir_add.lo \ - zip_dirent.lo zip_discard.lo zip_entry.lo zip_err_str.lo \ - zip_error.lo zip_error_clear.lo zip_error_get.lo \ - zip_error_get_sys_type.lo zip_error_strerror.lo \ - zip_error_to_str.lo zip_extra_field.lo zip_extra_field_api.lo \ - zip_fclose.lo zip_fdopen.lo zip_file_add.lo \ - zip_file_error_clear.lo zip_file_error_get.lo \ +am__libzip_la_SOURCES_DIST = zip_source_file.c zip_source_win32a.c \ + zip_source_win32handle.c zip_source_win32utf8.c \ + zip_source_win32w.c zip_add.c zip_add_dir.c zip_add_entry.c \ + zip_buffer.c zip_close.c zip_delete.c zip_dir_add.c \ + zip_dirent.c zip_discard.c zip_entry.c zip_err_str.c \ + zip_error.c zip_error_clear.c zip_error_get.c \ + zip_error_get_sys_type.c zip_error_strerror.c \ + zip_error_to_str.c zip_extra_field.c zip_extra_field_api.c \ + zip_fclose.c zip_fdopen.c zip_file_add.c \ + zip_file_error_clear.c zip_file_error_get.c \ + zip_file_get_comment.c zip_file_get_external_attributes.c \ + zip_file_get_offset.c zip_file_rename.c zip_file_replace.c \ + zip_file_set_comment.c zip_file_set_external_attributes.c \ + zip_file_set_mtime.c zip_file_strerror.c zip_filerange_crc.c \ + zip_fopen.c zip_fopen_encrypted.c zip_fopen_index.c \ + zip_fopen_index_encrypted.c zip_fread.c \ + zip_get_archive_comment.c zip_get_archive_flag.c \ + zip_get_compression_implementation.c \ + zip_get_encryption_implementation.c zip_get_file_comment.c \ + zip_get_num_entries.c zip_get_num_files.c zip_get_name.c \ + zip_hash.c zip_io_util.c zip_memdup.c zip_name_locate.c \ + zip_new.c zip_open.c zip_rename.c zip_replace.c \ + zip_set_archive_comment.c zip_set_archive_flag.c \ + zip_set_default_password.c zip_set_file_comment.c \ + zip_set_file_compression.c zip_set_name.c \ + zip_source_begin_write.c zip_source_buffer.c zip_source_call.c \ + zip_source_close.c zip_source_commit_write.c zip_source_crc.c \ + zip_source_deflate.c zip_source_error.c zip_source_filep.c \ + zip_source_free.c zip_source_function.c \ + zip_source_is_deleted.c zip_source_layered.c zip_source_open.c \ + zip_source_pkware.c zip_source_read.c zip_source_remove.c \ + zip_source_rollback_write.c zip_source_seek.c \ + zip_source_seek_write.c zip_source_stat.c \ + zip_source_supports.c zip_source_tell.c \ + zip_source_tell_write.c zip_source_window.c zip_source_write.c \ + zip_source_zip.c zip_source_zip_new.c zip_stat.c \ + zip_stat_index.c zip_stat_init.c zip_strerror.c zip_string.c \ + zip_unchange.c zip_unchange_all.c zip_unchange_archive.c \ + zip_unchange_data.c zip_utf-8.c +@WIN32_HOST_FALSE@am__objects_1 = zip_source_file.lo +@WIN32_HOST_TRUE@am__objects_1 = zip_source_win32a.lo \ +@WIN32_HOST_TRUE@ zip_source_win32handle.lo \ +@WIN32_HOST_TRUE@ zip_source_win32utf8.lo zip_source_win32w.lo +am_libzip_la_OBJECTS = $(am__objects_1) zip_add.lo zip_add_dir.lo \ + zip_add_entry.lo zip_buffer.lo zip_close.lo zip_delete.lo \ + zip_dir_add.lo zip_dirent.lo zip_discard.lo zip_entry.lo \ + zip_err_str.lo zip_error.lo zip_error_clear.lo \ + zip_error_get.lo zip_error_get_sys_type.lo \ + zip_error_strerror.lo zip_error_to_str.lo zip_extra_field.lo \ + zip_extra_field_api.lo zip_fclose.lo zip_fdopen.lo \ + zip_file_add.lo zip_file_error_clear.lo zip_file_error_get.lo \ zip_file_get_comment.lo zip_file_get_external_attributes.lo \ zip_file_get_offset.lo zip_file_rename.lo zip_file_replace.lo \ zip_file_set_comment.lo zip_file_set_external_attributes.lo \ @@ -160,8 +203,8 @@ am_libzip_la_OBJECTS = zip_add.lo zip_add_dir.lo zip_add_entry.lo \ zip_source_begin_write.lo zip_source_buffer.lo \ zip_source_call.lo zip_source_close.lo \ zip_source_commit_write.lo zip_source_crc.lo \ - zip_source_deflate.lo zip_source_error.lo zip_source_file.lo \ - zip_source_filep.lo zip_source_free.lo zip_source_function.lo \ + zip_source_deflate.lo zip_source_error.lo zip_source_filep.lo \ + zip_source_free.lo zip_source_function.lo \ zip_source_is_deleted.lo zip_source_layered.lo \ zip_source_open.lo zip_source_pkware.lo zip_source_read.lo \ zip_source_remove.lo zip_source_rollback_write.lo \ @@ -215,7 +258,7 @@ am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libzip_la_SOURCES) -DIST_SOURCES = $(libzip_la_SOURCES) +DIST_SOURCES = $(am__libzip_la_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -373,7 +416,17 @@ nodist_libinclude_HEADERS = zipconf.h # also update CMakeLists.txt when changing version libzip_la_LDFLAGS = -no-undefined -version-info 4:0:0 libzip_la_LIBADD = @LTLIBOBJS@ +@WIN32_HOST_FALSE@IO_SOURCES = \ +@WIN32_HOST_FALSE@ zip_source_file.c + +@WIN32_HOST_TRUE@IO_SOURCES = \ +@WIN32_HOST_TRUE@ zip_source_win32a.c \ +@WIN32_HOST_TRUE@ zip_source_win32handle.c \ +@WIN32_HOST_TRUE@ zip_source_win32utf8.c \ +@WIN32_HOST_TRUE@ zip_source_win32w.c + libzip_la_SOURCES = \ + ${IO_SOURCES} \ zip_add.c \ zip_add_dir.c \ zip_add_entry.c \ @@ -443,7 +496,6 @@ libzip_la_SOURCES = \ zip_source_crc.c \ zip_source_deflate.c \ zip_source_error.c \ - zip_source_file.c \ zip_source_filep.c \ zip_source_free.c \ zip_source_function.c \ @@ -478,6 +530,7 @@ libzip_la_SOURCES = \ BUILT_SOURCES = zipconf.h CLEANFILES = ${BUILT_SOURCES} EXTRA_DIST = CMakeLists.txt \ + compat.h \ make_zip_err_str.sh \ make_zipconf.sh \ zip_source_win32a.c \ @@ -652,6 +705,10 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_source_supports.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_source_tell.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_source_tell_write.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_source_win32a.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_source_win32handle.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_source_win32utf8.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_source_win32w.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_source_window.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_source_write.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zip_source_zip.Plo@am__quote@ diff --git a/lib/compat.h b/lib/compat.h new file mode 100644 index 0000000..4cc6703 --- /dev/null +++ b/lib/compat.h @@ -0,0 +1,181 @@ +#ifndef _HAD_LIBZIP_COMPAT_H +#define _HAD_LIBZIP_COMPAT_H + +/* + compat.h -- compatibility defines. + Copyright (C) 1999-2016 Dieter Baron and Thomas Klausner + + This file is part of libzip, a library to manipulate ZIP archives. + The authors can be contacted at + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* to have *_MAX definitions for all types when compiling with g++ */ +#define __STDC_LIMIT_MACROS + +#ifdef _WIN32 +#define ZIP_EXTERN __declspec(dllexport) +/* for dup(), close(), etc. */ +#include +#endif + +#ifdef HAVE_STDBOOL_H +#include +#else +typedef char bool; +#define true 1 +#define false 0 +#endif + +#include + +/* at least MinGW does not provide EOPNOTSUPP, see + * http://sourceforge.net/p/mingw/bugs/263/ + */ +#ifndef EOPNOTSUPP +#define EOPNOTSUPP EINVAL +#endif + +/* at least MinGW does not provide EOVERFLOW, see + * http://sourceforge.net/p/mingw/bugs/242/ + */ +#ifndef EOVERFLOW +#define EOVERFLOW EFBIG +#endif + +#ifdef _WIN32 +#if defined(HAVE__CLOSE) +#define close _close +#endif +#if defined(HAVE__DUP) +#define dup _dup +#endif +/* crashes reported when using fdopen instead of _fdopen on Windows/Visual Studio 10/Win64 */ +#if defined(HAVE__FDOPEN) +#define fdopen _fdopen +#endif +#if !defined(HAVE_FILENO) && defined(HAVE__FILENO) +#define fileno _fileno +#endif +/* Windows' open() doesn't understand Unix permissions */ +#if defined(HAVE__OPEN) +#define open(a, b, c) _open((a), (b)) +#endif +#if defined(HAVE__SNPRINTF) +#define snprintf _snprintf +#endif +#if defined(HAVE__STRDUP) +#if !defined(HAVE_STRDUP) || defined(_WIN32) +#undef strdup +#define strdup _strdup +#endif +#endif +#if !defined(HAVE__SETMODE) && defined(HAVE_SETMODE) +#define _setmode setmode +#endif +#endif + +#ifndef HAVE_FSEEKO +#define fseeko(s, o, w) (fseek((s), (long int)(o), (w))) +#endif + +#ifndef HAVE_FTELLO +#define ftello(s) ((long)ftell((s))) +#endif + +#ifndef HAVE_MKSTEMP +int _zip_mkstemp(char *); +#define mkstemp _zip_mkstemp +#endif + +#if !defined(HAVE_STRCASECMP) +#if defined(HAVE__STRICMP) +#define strcasecmp _stricmp +#elif defined(HAVE_STRICMP) +#define strcasecmp stricmp +#endif +#endif + +#if SIZEOF_OFF_T == 8 +#define ZIP_OFF_MAX ZIP_INT64_MAX +#define ZIP_OFF_MIN ZIP_INT64_MIN +#elif SIZEOF_OFF_T == 4 +#define ZIP_OFF_MAX ZIP_INT32_MAX +#define ZIP_OFF_MIN ZIP_INT32_MIN +#elif SIZEOF_OFF_T == 2 +#define ZIP_OFF_MAX ZIP_INT16_MAX +#define ZIP_OFF_MIN ZIP_INT16_MIN +#else +#error unsupported size of off_t +#endif + +#if defined(HAVE_FTELLO) && defined(HAVE_FSEEKO) +#define ZIP_FSEEK_MAX ZIP_OFF_MAX +#define ZIP_FSEEK_MIN ZIP_OFF_MIN +#else +#include +#define ZIP_FSEEK_MAX LONG_MAX +#define ZIP_FSEEK_MIN LONG_MIN +#endif + +#ifndef SIZE_MAX +#if SIZEOF_SIZE_T == 8 +#define SIZE_MAX ZIP_INT64_MAX +#elif SIZEOF_SIZE_T == 4 +#define SIZE_MAX ZIP_INT32_MAX +#elif SIZEOF_SIZE_T == 2 +#define SIZE_MAX ZIP_INT16_MAX +#else +#error unsupported size of size_t +#endif +#endif + +#ifndef PRId64 +#ifdef _MSC_VER +#define PRId64 "I64d" +#else +#define PRId64 "lld" +#endif +#endif + +#ifndef PRIu64 +#ifdef _MSC_VER +#define PRIu64 "I64u" +#else +#define PRIu64 "llu" +#endif +#endif + +#ifndef S_ISDIR +#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) +#endif + +#endif /* compat.h */ diff --git a/lib/zip_dirent.c b/lib/zip_dirent.c index 630b6a4..74f8988 100644 --- a/lib/zip_dirent.c +++ b/lib/zip_dirent.c @@ -37,6 +37,7 @@ #include #include #include +#include #include "zipint.h" diff --git a/lib/zip_source_file.c b/lib/zip_source_file.c index b3cd7ab..8678c1a 100644 --- a/lib/zip_source_file.c +++ b/lib/zip_source_file.c @@ -36,6 +36,10 @@ #include "zipint.h" +#ifdef _WIN32 +#error This file is incompatible with Windows, use zip_source_win32utf8.c instead. +#error Something probably went wrong with configure/cmake. +#endif ZIP_EXTERN zip_source_t * zip_source_file(zip_t *za, const char *fname, zip_uint64_t start, zip_int64_t len) diff --git a/lib/zipint.h b/lib/zipint.h index 40f75c4..6939d73 100644 --- a/lib/zipint.h +++ b/lib/zipint.h @@ -38,134 +38,16 @@ #include "config.h" #endif -/* to have *_MAX definitions for all types when compiling with g++ */ -#define __STDC_LIMIT_MACROS +#include "compat.h" #include -#ifdef _WIN32 -#define ZIP_EXTERN __declspec(dllexport) -/* for dup(), close(), etc. */ -#include -#endif - #ifndef _ZIP_COMPILING_DEPRECATED #define ZIP_DISABLE_DEPRECATED #endif #include "zip.h" -#ifdef HAVE_STDBOOL_H -#include -#else -typedef char bool; -#define true 1 -#define false 0 -#endif - -#include - -/* at least MinGW does not provide EOPNOTSUPP, see - * http://sourceforge.net/p/mingw/bugs/263/ - */ -#ifndef EOPNOTSUPP -#define EOPNOTSUPP EINVAL -#endif - -/* at least MinGW does not provide EOVERFLOW, see - * http://sourceforge.net/p/mingw/bugs/242/ - */ -#ifndef EOVERFLOW -#define EOVERFLOW EFBIG -#endif - -#ifdef _WIN32 -#if defined(HAVE__CLOSE) -#define close _close -#endif -#if defined(HAVE__DUP) -#define dup _dup -#endif -/* crashes reported when using fdopen instead of _fdopen on Windows/Visual Studio 10/Win64 */ -#if defined(HAVE__FDOPEN) -#define fdopen _fdopen -#endif -#if !defined(HAVE_FILENO) && defined(HAVE__FILENO) -#define fileno _fileno -#endif -/* Windows' open() doesn't understand Unix permissions */ -#if defined(HAVE__OPEN) -#define open(a, b, c) _open((a), (b)) -#endif -#if defined(HAVE__SNPRINTF) -#define snprintf _snprintf -#endif -#if defined(HAVE__STRDUP) -#if !defined(HAVE_STRDUP) || defined(_WIN32) -#undef strdup -#define strdup _strdup -#endif -#endif -#if !defined(HAVE__SETMODE) && defined(HAVE_SETMODE) -#define _setmode setmode -#endif -#endif - -#ifndef HAVE_FSEEKO -#define fseeko(s, o, w) (fseek((s), (long int)(o), (w))) -#endif - -#ifndef HAVE_FTELLO -#define ftello(s) ((long)ftell((s))) -#endif - -#ifndef HAVE_MKSTEMP -int _zip_mkstemp(char *); -#define mkstemp _zip_mkstemp -#endif - -#if !defined(HAVE_STRCASECMP) -#if defined(HAVE__STRICMP) -#define strcasecmp _stricmp -#elif defined(HAVE_STRICMP) -#define strcasecmp stricmp -#endif -#endif - -#if SIZEOF_OFF_T == 8 -#define ZIP_OFF_MAX ZIP_INT64_MAX -#define ZIP_OFF_MIN ZIP_INT64_MIN -#elif SIZEOF_OFF_T == 4 -#define ZIP_OFF_MAX ZIP_INT32_MAX -#define ZIP_OFF_MIN ZIP_INT32_MIN -#elif SIZEOF_OFF_T == 2 -#define ZIP_OFF_MAX ZIP_INT16_MAX -#define ZIP_OFF_MIN ZIP_INT16_MIN -#else -#error unsupported size of off_t -#endif - -#if defined(HAVE_FTELLO) && defined(HAVE_FSEEKO) -#define ZIP_FSEEK_MAX ZIP_OFF_MAX -#define ZIP_FSEEK_MIN ZIP_OFF_MIN -#else -#include -#define ZIP_FSEEK_MAX LONG_MAX -#define ZIP_FSEEK_MIN LONG_MIN -#endif - -#ifndef SIZE_MAX -#if SIZEOF_SIZE_T == 8 -#define SIZE_MAX ZIP_INT64_MAX -#elif SIZEOF_SIZE_T == 4 -#define SIZE_MAX ZIP_INT32_MAX -#elif SIZEOF_SIZE_T == 2 -#define SIZE_MAX ZIP_INT16_MAX -#else -#error unsupported size of size_t -#endif -#endif - #define CENTRAL_MAGIC "PK\1\2" #define LOCAL_MAGIC "PK\3\4" #define EOCD_MAGIC "PK\5\6" diff --git a/regress/NiHTest.pm b/regress/NiHTest.pm index ee85e1d..e8b1db7 100644 --- a/regress/NiHTest.pm +++ b/regress/NiHTest.pm @@ -313,7 +313,7 @@ sub runtest { my @failed = (); - if ($self->{exit_status} != $self->{test}->{return} // 0) { + if ($self->{exit_status} != ($self->{test}->{return} // 0)) { push @failed, 'exit status'; if ($self->{verbose}) { print "Unexpected exit status:\n"; @@ -902,10 +902,10 @@ sub run_hook { return $ok; } -sub backslash_decode { +sub args_decode { - my ($str) = @_; + my ($str, $srcdir) = @_; if ($str =~ m/\\/) { $str =~ s/\\a/\a/gi; @@ -920,6 +920,14 @@ sub backslash_decode { $str =~ s/\\(.)/$1/g; } + if ($srcdir !~ m,^/,) { + $srcdir = "../$srcdir"; + } + + if ($str =~ m/^\$srcdir(.*)/) { + $str = "$srcdir$1"; + } + return $str; } @@ -930,7 +938,7 @@ sub run_program { my ($stdin, $stdout, $stderr); $stderr = gensym; - my @cmd = ('../' . $self->{test}->{program}, map ({ backslash_decode($_); } @{$self->{test}->{args}})); + my @cmd = ('../' . $self->{test}->{program}, map ({ args_decode($_, $self->{srcdir}); } @{$self->{test}->{args}})); ### TODO: catch errors? @@ -986,7 +994,7 @@ sub run_program { sub pipein_win32() { my ($self) = @_; - my $cmd = "$self->{test}->{pipein}| ..\\$self->{test}->{program} " . join(' ', map ({ backslash_decode($_); } @{$self->{test}->{args}})); + my $cmd = "$self->{test}->{pipein}| ..\\$self->{test}->{program} " . join(' ', map ({ args_decode($_, $self->{srcdir}); } @{$self->{test}->{args}})); my ($success, $error_message, $full_buf, $stdout_buf, $stderr_buf) = IPC::Cmd::run(command => $cmd); if (!$success) { ### TODO: catch errors? diff --git a/regress/malloc.c b/regress/malloc.c index 04faf28..f82f566 100644 --- a/regress/malloc.c +++ b/regress/malloc.c @@ -41,6 +41,10 @@ #include "config.h" +#if !defined(RTLD_NEXT) +#define RTLD_NEXT RTLD_DEFAULT +#endif + #if defined(HAVE___PROGNAME) extern char *__progname; #endif diff --git a/src/Makefile.am b/src/Makefile.am index cd6f5e7..fa5ba2f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -7,4 +7,4 @@ ziptool_SOURCES= source_hole.c ziptool.c AM_CPPFLAGS=-I${top_srcdir}/lib -I../lib LDADD=${top_builddir}/lib/libzip.la -EXTRA_DIST= CMakeLists.txt getopt.c getopt.h compat.h +EXTRA_DIST= CMakeLists.txt getopt.c getopt.h diff --git a/src/Makefile.in b/src/Makefile.in index 798e7cd..e640b34 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -309,7 +309,7 @@ hole_SOURCES = hole.c source_hole.c ziptool_SOURCES = source_hole.c ziptool.c AM_CPPFLAGS = -I${top_srcdir}/lib -I../lib LDADD = ${top_builddir}/lib/libzip.la -EXTRA_DIST = CMakeLists.txt getopt.c getopt.h compat.h +EXTRA_DIST = CMakeLists.txt getopt.c getopt.h all: all-am .SUFFIXES: diff --git a/src/compat.h b/src/compat.h deleted file mode 100644 index 0c703ed..0000000 --- a/src/compat.h +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef HAD_COMPAT_H -#define HAD_COMPAT_H - -/* - compat.h -- compatibility defines - Copyright (C) 2012-2014 Dieter Baron and Thomas Klausner - - This file is part of libzip, a library to manipulate ZIP archives. - The authors can be contacted at - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - 3. The names of the authors may not be used to endorse or promote - products derived from this software without specific prior - written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#ifndef _HAD_ZIP_H -#error zip.h has to be included first -#endif - -#ifndef PRId64 -#ifdef _MSC_VER -#define PRId64 "I64d" -#else -#define PRId64 "lld" -#endif -#endif - -#ifndef PRIu64 -#ifdef _MSC_VER -#define PRIu64 "I64u" -#else -#define PRIu64 "llu" -#endif -#endif - -#ifndef S_ISDIR -#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) -#endif - -#endif diff --git a/src/zipcmp.c b/src/zipcmp.c index 0457a86..cf9b572 100644 --- a/src/zipcmp.c +++ b/src/zipcmp.c @@ -54,8 +54,6 @@ #include "getopt.h" #endif -/* include zipint.h for Windows compatibility */ -#include "zipint.h" #include "zip.h" #include "compat.h" diff --git a/xcode/libzip.xcodeproj/project.pbxproj b/xcode/libzip.xcodeproj/project.pbxproj index 1b2d8c5..c8c7baf 100644 --- a/xcode/libzip.xcodeproj/project.pbxproj +++ b/xcode/libzip.xcodeproj/project.pbxproj @@ -57,7 +57,7 @@ 4BCF6A791C3BDDF900F036E9 /* PBXTargetDependency */, ); name = examples; - productName = "examples"; + productName = examples; }; 4BDC72A115B1B6EA00236D3C /* Build iOS Framework */ = { isa = PBXAggregateTarget; @@ -631,7 +631,6 @@ 4B28AA2515BAD4E200D0C17D /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = ""; }; 4B28AA2615BAD4E200D0C17D /* THANKS */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = THANKS; sourceTree = ""; }; 4B28AA2715BAD4E200D0C17D /* TODO */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = TODO; sourceTree = ""; }; - 4B6B06E115F119AE008C2CBE /* compat.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = compat.h; sourceTree = ""; }; 4B82CED319915F360097BC18 /* zip_file_set_mtime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_file_set_mtime.c; sourceTree = ""; }; 4B97204D188EBE85002FAFAD /* zip_file_get_external_attributes.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_file_get_external_attributes.c; sourceTree = ""; }; 4B97204E188EBE85002FAFAD /* zip_file_set_external_attributes.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_file_set_external_attributes.c; sourceTree = ""; }; @@ -689,6 +688,7 @@ 4BCF3035199ABDDA0064207B /* zip_source_tell_write.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip_source_tell_write.c; sourceTree = ""; }; 4BD155CE191CD28D0046F012 /* NiHTest.pm */ = {isa = PBXFileReference; indentWidth = 4; lastKnownFileType = text.script.perl; path = NiHTest.pm; sourceTree = ""; tabWidth = 4; usesTabs = 1; }; 4BD155CF191CD28D0046F012 /* runtest.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = runtest.in; sourceTree = ""; }; + 4BD25DA51CF58790005A9EC4 /* compat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = compat.h; sourceTree = ""; }; 4BD35E411A33366200256CB7 /* add_dir.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = add_dir.test; sourceTree = ""; }; 4BD35E421A33366200256CB7 /* add_from_buffer.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = add_from_buffer.test; sourceTree = ""; }; 4BD35E431A33366200256CB7 /* add_from_file_duplicate.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = add_from_file_duplicate.test; sourceTree = ""; }; @@ -990,7 +990,6 @@ 4B01D72015B2F54C002D5007 /* src */ = { isa = PBXGroup; children = ( - 4B6B06E115F119AE008C2CBE /* compat.h */, 4B01D72115B2F572002D5007 /* zipcmp.c */, 4B01D72215B2F572002D5007 /* zipmerge.c */, 4BD6CB5E19E71B3B00710654 /* hole.c */, @@ -1279,6 +1278,7 @@ isa = PBXGroup; children = ( 4BDC72A015B1B56400236D3C /* config.h */, + 4BD25DA51CF58790005A9EC4 /* compat.h */, 4BDC729E15B1B4E900236D3C /* zipconf.h */, 4BDC729815B1B2A600236D3C /* zip.h */, 4BDC729915B1B2A600236D3C /* zipint.h */, -- 2.7.4