libzip: repository: e07a002dd8ca

Navigation

Views: changesets, files, tags, branches

Formats: changeset, raw, files

Download: bz2 zip gz

changeset 1218:e07a002dd8ca

Define PRId64 and PRIu64 when missing. Include config.h before using feature macros. Include unistd.h for getopt()
author Dieter Baron <dillo@nih.at>
date Fri, 31 Aug 2012 18:18:36 +0200
parents 8b2900ca6c7e
children fd6134107791
files regress/fread.c regress/modify.c regress/name_locate.c regress/set_compression.c regress/stat_index.c regress/tryopen.c src/Makefile.am src/compat.h src/zipcmp.c src/zipmerge.c xcode/libzip.xcodeproj/project.pbxproj
diffstat 11 files changed, 87 insertions(+), 3 deletions(-) [+]
line diff
     1.1 --- a/regress/fread.c	Thu Aug 30 17:57:45 2012 +0200
     1.2 +++ b/regress/fread.c	Fri Aug 31 18:18:36 2012 +0200
     1.3 @@ -32,10 +32,14 @@
     1.4  */
     1.5  
     1.6  
     1.7 +#include "config.h"
     1.8  
     1.9  #include <errno.h>
    1.10  #include <stdio.h>
    1.11  #include <stdlib.h>
    1.12 +#ifdef HAVE_UNISTD_H
    1.13 +#include <unistd.h>
    1.14 +#endif
    1.15  
    1.16  #ifndef HAVE_GETOPT
    1.17  #include "getopt.h"
     2.1 --- a/regress/modify.c	Thu Aug 30 17:57:45 2012 +0200
     2.2 +++ b/regress/modify.c	Fri Aug 31 18:18:36 2012 +0200
     2.3 @@ -32,10 +32,14 @@
     2.4  */
     2.5  
     2.6  
     2.7 +#include "config.h"
     2.8  
     2.9  #include <errno.h>
    2.10  #include <stdlib.h>
    2.11  #include <string.h>
    2.12 +#ifdef HAVE_UNISTD_H
    2.13 +#include <unistd.h>
    2.14 +#endif
    2.15  
    2.16  #ifndef HAVE_GETOPT
    2.17  #include "getopt.h"
     3.1 --- a/regress/name_locate.c	Thu Aug 30 17:57:45 2012 +0200
     3.2 +++ b/regress/name_locate.c	Fri Aug 31 18:18:36 2012 +0200
     3.3 @@ -39,6 +39,8 @@
     3.4  
     3.5  #include "zip.h"
     3.6  
     3.7 +#include "compat.h"
     3.8 +
     3.9  int find_fail(struct zip *, const char *, int, int);
    3.10  int find_success(struct zip *, const char *, int);
    3.11  
     4.1 --- a/regress/set_compression.c	Thu Aug 30 17:57:45 2012 +0200
     4.2 +++ b/regress/set_compression.c	Fri Aug 31 18:18:36 2012 +0200
     4.3 @@ -40,6 +40,8 @@
     4.4  
     4.5  #include "zipint.h"
     4.6  
     4.7 +#include "compat.h"
     4.8 +
     4.9  const char *prg;
    4.10  
    4.11  int
     5.1 --- a/regress/stat_index.c	Thu Aug 30 17:57:45 2012 +0200
     5.2 +++ b/regress/stat_index.c	Fri Aug 31 18:18:36 2012 +0200
     5.3 @@ -32,17 +32,22 @@
     5.4  */
     5.5  
     5.6  
     5.7 +#include "config.h"
     5.8  
     5.9  #include <errno.h>
    5.10  #include <stdlib.h>
    5.11 +#ifdef HAVE_UNISTD_H
    5.12 +#include <unistd.h>
    5.13 +#endif
    5.14 +#include <time.h>
    5.15  
    5.16 -#include <time.h>
    5.17  
    5.18  #ifndef HAVE_GETOPT
    5.19  #include "getopt.h"
    5.20  #endif
    5.21  
    5.22  #include "zip.h"
    5.23 +#include "compat.h"
    5.24  
    5.25  const char *prg;
    5.26  
     6.1 --- a/regress/tryopen.c	Thu Aug 30 17:57:45 2012 +0200
     6.2 +++ b/regress/tryopen.c	Fri Aug 31 18:18:36 2012 +0200
     6.3 @@ -32,15 +32,21 @@
     6.4  */
     6.5  
     6.6  
     6.7 +#include "config.h"
     6.8  
     6.9  #include <errno.h>
    6.10  #include <stdio.h>
    6.11  #include <stdlib.h>
    6.12 +#ifdef HAVE_UNISTD_H
    6.13 +#include <unistd.h>
    6.14 +#endif
    6.15 +
    6.16  #ifndef HAVE_GETOPT
    6.17  #include "getopt.h"
    6.18  #endif
    6.19  
    6.20  #include "zip.h"
    6.21 +#include "compat.h"
    6.22  
    6.23  const char *usage = "usage: %s [-cent] file\n";
    6.24  
     7.1 --- a/src/Makefile.am	Thu Aug 30 17:57:45 2012 +0200
     7.2 +++ b/src/Makefile.am	Fri Aug 31 18:18:36 2012 +0200
     7.3 @@ -7,4 +7,4 @@
     7.4  ziptorrent_CPPFLAGS=-I${top_srcdir}/lib -I../lib
     7.5  ziptorrent_LDADD=${top_builddir}/lib/libzip.la
     7.6  
     7.7 -EXTRA_DIST=	CMakeLists.txt getopt.c getopt.h
     7.8 +EXTRA_DIST=	CMakeLists.txt getopt.c getopt.h compat.h
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/src/compat.h	Fri Aug 31 18:18:36 2012 +0200
     8.3 @@ -0,0 +1,57 @@
     8.4 +#ifndef HAD_COMPAT_H
     8.5 +#define HAD_COMPAT_H
     8.6 +
     8.7 +/*
     8.8 +  compat.h -- compatibility defines
     8.9 +  Copyright (C) 2012 Dieter Baron and Thomas Klausner
    8.10 +
    8.11 +  This file is part of libzip, a library to manipulate ZIP archives.
    8.12 +  The authors can be contacted at <libzip@nih.at>
    8.13 +
    8.14 +  Redistribution and use in source and binary forms, with or without
    8.15 +  modification, are permitted provided that the following conditions
    8.16 +  are met:
    8.17 +  1. Redistributions of source code must retain the above copyright
    8.18 +     notice, this list of conditions and the following disclaimer.
    8.19 +  2. Redistributions in binary form must reproduce the above copyright
    8.20 +     notice, this list of conditions and the following disclaimer in
    8.21 +     the documentation and/or other materials provided with the
    8.22 +     distribution.
    8.23 +  3. The names of the authors may not be used to endorse or promote
    8.24 +     products derived from this software without specific prior
    8.25 +     written permission.
    8.26 + 
    8.27 +  THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
    8.28 +  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    8.29 +  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    8.30 +  ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
    8.31 +  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    8.32 +  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
    8.33 +  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    8.34 +  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
    8.35 +  IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
    8.36 +  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
    8.37 +  IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    8.38 +*/
    8.39 +
    8.40 +#ifndef _HAD_ZIP_H
    8.41 +#error zip.h has to be included first
    8.42 +#endif
    8.43 +
    8.44 +#ifndef PRId64
    8.45 +#ifdef _MSC_VER
    8.46 +#define PRId64 "I64d"
    8.47 +#else
    8.48 +#define PRId64 "lld"
    8.49 +#endif
    8.50 +#endif
    8.51 +
    8.52 +#ifndef PRIu64
    8.53 +#ifdef _MSC_VER
    8.54 +#define PRIu64 "I64u"
    8.55 +#else
    8.56 +#define PRIu64 "llu"
    8.57 +#endif
    8.58 +#endif
    8.59 +
    8.60 +#endif
     9.1 --- a/src/zipcmp.c	Thu Aug 30 17:57:45 2012 +0200
     9.2 +++ b/src/zipcmp.c	Fri Aug 31 18:18:36 2012 +0200
     9.3 @@ -53,6 +53,7 @@
     9.4  
     9.5  #include "zip.h"
     9.6  #include "zipint.h"
     9.7 +#include "compat.h"
     9.8  
     9.9  struct ef {
    9.10      const char *name;
    10.1 --- a/src/zipmerge.c	Thu Aug 30 17:57:45 2012 +0200
    10.2 +++ b/src/zipmerge.c	Fri Aug 31 18:18:36 2012 +0200
    10.3 @@ -50,7 +50,7 @@
    10.4  #endif
    10.5  
    10.6  #include "zip.h"
    10.7 -
    10.8 +#include "compat.h"
    10.9  
   10.10  
   10.11  char *prg;
    11.1 --- a/xcode/libzip.xcodeproj/project.pbxproj	Thu Aug 30 17:57:45 2012 +0200
    11.2 +++ b/xcode/libzip.xcodeproj/project.pbxproj	Fri Aug 31 18:18:36 2012 +0200
    11.3 @@ -749,6 +749,7 @@
    11.4  		4B28AA2515BAD4E200D0C17D /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = README; path = ../README; sourceTree = "<group>"; };
    11.5  		4B28AA2615BAD4E200D0C17D /* THANKS */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = THANKS; path = ../THANKS; sourceTree = "<group>"; };
    11.6  		4B28AA2715BAD4E200D0C17D /* TODO */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = TODO; path = ../TODO; sourceTree = "<group>"; };
    11.7 +		4B6B06E115F119AE008C2CBE /* compat.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = compat.h; path = ../src/compat.h; sourceTree = "<group>"; };
    11.8  		4BACD57615BC2AEF00920691 /* add_from_buffer.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = add_from_buffer.c; path = ../regress/add_from_buffer.c; sourceTree = "<group>"; };
    11.9  		4BACD57715BC2AEF00920691 /* add_from_filep.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = add_from_filep.c; path = ../regress/add_from_filep.c; sourceTree = "<group>"; };
   11.10  		4BACD57A15BC2AEF00920691 /* fopen_unchanged.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = fopen_unchanged.c; path = ../regress/fopen_unchanged.c; sourceTree = "<group>"; };
   11.11 @@ -1031,6 +1032,7 @@
   11.12  		4B01D72015B2F54C002D5007 /* src */ = {
   11.13  			isa = PBXGroup;
   11.14  			children = (
   11.15 +				4B6B06E115F119AE008C2CBE /* compat.h */,
   11.16  				4B01D72115B2F572002D5007 /* zipcmp.c */,
   11.17  				4B01D72215B2F572002D5007 /* zipmerge.c */,
   11.18  				4B01D72315B2F572002D5007 /* ziptorrent.c */,
   11.19 @@ -2939,6 +2941,7 @@
   11.20  				4B54447B15C977A20067BA33 /* Release */,
   11.21  			);
   11.22  			defaultConfigurationIsVisible = 0;
   11.23 +			defaultConfigurationName = Release;
   11.24  		};
   11.25  		4BACD59015BC2CEA00920691 /* Build configuration list for PBXNativeTarget "modify" */ = {
   11.26  			isa = XCConfigurationList;