Windows port:
-Reorganization MSVS projects and add required libraries.
This commit is contained in:
parent
e0581144d9
commit
9c231a2246
|
@ -0,0 +1,332 @@
|
|||
/* zconf.h -- configuration of the zlib compression library
|
||||
* Copyright (C) 1995-2005 Jean-loup Gailly.
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
/* @(#) $Id: zconf.h,v 1.1 2008-08-03 18:36:12 mtabachenko Exp $ */
|
||||
|
||||
#ifndef ZCONF_H
|
||||
#define ZCONF_H
|
||||
|
||||
/*
|
||||
* If you *really* need a unique prefix for all types and library functions,
|
||||
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
|
||||
*/
|
||||
#ifdef Z_PREFIX
|
||||
# define deflateInit_ z_deflateInit_
|
||||
# define deflate z_deflate
|
||||
# define deflateEnd z_deflateEnd
|
||||
# define inflateInit_ z_inflateInit_
|
||||
# define inflate z_inflate
|
||||
# define inflateEnd z_inflateEnd
|
||||
# define deflateInit2_ z_deflateInit2_
|
||||
# define deflateSetDictionary z_deflateSetDictionary
|
||||
# define deflateCopy z_deflateCopy
|
||||
# define deflateReset z_deflateReset
|
||||
# define deflateParams z_deflateParams
|
||||
# define deflateBound z_deflateBound
|
||||
# define deflatePrime z_deflatePrime
|
||||
# define inflateInit2_ z_inflateInit2_
|
||||
# define inflateSetDictionary z_inflateSetDictionary
|
||||
# define inflateSync z_inflateSync
|
||||
# define inflateSyncPoint z_inflateSyncPoint
|
||||
# define inflateCopy z_inflateCopy
|
||||
# define inflateReset z_inflateReset
|
||||
# define inflateBack z_inflateBack
|
||||
# define inflateBackEnd z_inflateBackEnd
|
||||
# define compress z_compress
|
||||
# define compress2 z_compress2
|
||||
# define compressBound z_compressBound
|
||||
# define uncompress z_uncompress
|
||||
# define adler32 z_adler32
|
||||
# define crc32 z_crc32
|
||||
# define get_crc_table z_get_crc_table
|
||||
# define zError z_zError
|
||||
|
||||
# define alloc_func z_alloc_func
|
||||
# define free_func z_free_func
|
||||
# define in_func z_in_func
|
||||
# define out_func z_out_func
|
||||
# define Byte z_Byte
|
||||
# define uInt z_uInt
|
||||
# define uLong z_uLong
|
||||
# define Bytef z_Bytef
|
||||
# define charf z_charf
|
||||
# define intf z_intf
|
||||
# define uIntf z_uIntf
|
||||
# define uLongf z_uLongf
|
||||
# define voidpf z_voidpf
|
||||
# define voidp z_voidp
|
||||
#endif
|
||||
|
||||
#if defined(__MSDOS__) && !defined(MSDOS)
|
||||
# define MSDOS
|
||||
#endif
|
||||
#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
|
||||
# define OS2
|
||||
#endif
|
||||
#if defined(_WINDOWS) && !defined(WINDOWS)
|
||||
# define WINDOWS
|
||||
#endif
|
||||
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
|
||||
# ifndef WIN32
|
||||
# define WIN32
|
||||
# endif
|
||||
#endif
|
||||
#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
|
||||
# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
|
||||
# ifndef SYS16BIT
|
||||
# define SYS16BIT
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Compile with -DMAXSEG_64K if the alloc function cannot allocate more
|
||||
* than 64k bytes at a time (needed on systems with 16-bit int).
|
||||
*/
|
||||
#ifdef SYS16BIT
|
||||
# define MAXSEG_64K
|
||||
#endif
|
||||
#ifdef MSDOS
|
||||
# define UNALIGNED_OK
|
||||
#endif
|
||||
|
||||
#ifdef __STDC_VERSION__
|
||||
# ifndef STDC
|
||||
# define STDC
|
||||
# endif
|
||||
# if __STDC_VERSION__ >= 199901L
|
||||
# ifndef STDC99
|
||||
# define STDC99
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
|
||||
# define STDC
|
||||
#endif
|
||||
#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
|
||||
# define STDC
|
||||
#endif
|
||||
#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
|
||||
# define STDC
|
||||
#endif
|
||||
#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
|
||||
# define STDC
|
||||
#endif
|
||||
|
||||
#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
|
||||
# define STDC
|
||||
#endif
|
||||
|
||||
#ifndef STDC
|
||||
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
|
||||
# define const /* note: need a more gentle solution here */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Some Mac compilers merge all .h files incorrectly: */
|
||||
#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
|
||||
# define NO_DUMMY_DECL
|
||||
#endif
|
||||
|
||||
/* Maximum value for memLevel in deflateInit2 */
|
||||
#ifndef MAX_MEM_LEVEL
|
||||
# ifdef MAXSEG_64K
|
||||
# define MAX_MEM_LEVEL 8
|
||||
# else
|
||||
# define MAX_MEM_LEVEL 9
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Maximum value for windowBits in deflateInit2 and inflateInit2.
|
||||
* WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
|
||||
* created by gzip. (Files created by minigzip can still be extracted by
|
||||
* gzip.)
|
||||
*/
|
||||
#ifndef MAX_WBITS
|
||||
# define MAX_WBITS 15 /* 32K LZ77 window */
|
||||
#endif
|
||||
|
||||
/* The memory requirements for deflate are (in bytes):
|
||||
(1 << (windowBits+2)) + (1 << (memLevel+9))
|
||||
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
|
||||
plus a few kilobytes for small objects. For example, if you want to reduce
|
||||
the default memory requirements from 256K to 128K, compile with
|
||||
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
|
||||
Of course this will generally degrade compression (there's no free lunch).
|
||||
|
||||
The memory requirements for inflate are (in bytes) 1 << windowBits
|
||||
that is, 32K for windowBits=15 (default value) plus a few kilobytes
|
||||
for small objects.
|
||||
*/
|
||||
|
||||
/* Type declarations */
|
||||
|
||||
#ifndef OF /* function prototypes */
|
||||
# ifdef STDC
|
||||
# define OF(args) args
|
||||
# else
|
||||
# define OF(args) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* The following definitions for FAR are needed only for MSDOS mixed
|
||||
* model programming (small or medium model with some far allocations).
|
||||
* This was tested only with MSC; for other MSDOS compilers you may have
|
||||
* to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
|
||||
* just define FAR to be empty.
|
||||
*/
|
||||
#ifdef SYS16BIT
|
||||
# if defined(M_I86SM) || defined(M_I86MM)
|
||||
/* MSC small or medium model */
|
||||
# define SMALL_MEDIUM
|
||||
# ifdef _MSC_VER
|
||||
# define FAR _far
|
||||
# else
|
||||
# define FAR far
|
||||
# endif
|
||||
# endif
|
||||
# if (defined(__SMALL__) || defined(__MEDIUM__))
|
||||
/* Turbo C small or medium model */
|
||||
# define SMALL_MEDIUM
|
||||
# ifdef __BORLANDC__
|
||||
# define FAR _far
|
||||
# else
|
||||
# define FAR far
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(WINDOWS) || defined(WIN32)
|
||||
/* If building or using zlib as a DLL, define ZLIB_DLL.
|
||||
* This is not mandatory, but it offers a little performance increase.
|
||||
*/
|
||||
# ifdef ZLIB_DLL
|
||||
# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
|
||||
# ifdef ZLIB_INTERNAL
|
||||
# define ZEXTERN extern __declspec(dllexport)
|
||||
# else
|
||||
# define ZEXTERN extern __declspec(dllimport)
|
||||
# endif
|
||||
# endif
|
||||
# endif /* ZLIB_DLL */
|
||||
/* If building or using zlib with the WINAPI/WINAPIV calling convention,
|
||||
* define ZLIB_WINAPI.
|
||||
* Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
|
||||
*/
|
||||
# ifdef ZLIB_WINAPI
|
||||
# ifdef FAR
|
||||
# undef FAR
|
||||
# endif
|
||||
# include <windows.h>
|
||||
/* No need for _export, use ZLIB.DEF instead. */
|
||||
/* For complete Windows compatibility, use WINAPI, not __stdcall. */
|
||||
# define ZEXPORT WINAPI
|
||||
# ifdef WIN32
|
||||
# define ZEXPORTVA WINAPIV
|
||||
# else
|
||||
# define ZEXPORTVA FAR CDECL
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined (__BEOS__)
|
||||
# ifdef ZLIB_DLL
|
||||
# ifdef ZLIB_INTERNAL
|
||||
# define ZEXPORT __declspec(dllexport)
|
||||
# define ZEXPORTVA __declspec(dllexport)
|
||||
# else
|
||||
# define ZEXPORT __declspec(dllimport)
|
||||
# define ZEXPORTVA __declspec(dllimport)
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef ZEXTERN
|
||||
# define ZEXTERN extern
|
||||
#endif
|
||||
#ifndef ZEXPORT
|
||||
# define ZEXPORT
|
||||
#endif
|
||||
#ifndef ZEXPORTVA
|
||||
# define ZEXPORTVA
|
||||
#endif
|
||||
|
||||
#ifndef FAR
|
||||
# define FAR
|
||||
#endif
|
||||
|
||||
#if !defined(__MACTYPES__)
|
||||
typedef unsigned char Byte; /* 8 bits */
|
||||
#endif
|
||||
typedef unsigned int uInt; /* 16 bits or more */
|
||||
typedef unsigned long uLong; /* 32 bits or more */
|
||||
|
||||
#ifdef SMALL_MEDIUM
|
||||
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
|
||||
# define Bytef Byte FAR
|
||||
#else
|
||||
typedef Byte FAR Bytef;
|
||||
#endif
|
||||
typedef char FAR charf;
|
||||
typedef int FAR intf;
|
||||
typedef uInt FAR uIntf;
|
||||
typedef uLong FAR uLongf;
|
||||
|
||||
#ifdef STDC
|
||||
typedef void const *voidpc;
|
||||
typedef void FAR *voidpf;
|
||||
typedef void *voidp;
|
||||
#else
|
||||
typedef Byte const *voidpc;
|
||||
typedef Byte FAR *voidpf;
|
||||
typedef Byte *voidp;
|
||||
#endif
|
||||
|
||||
#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */
|
||||
# include <sys/types.h> /* for off_t */
|
||||
# include <unistd.h> /* for SEEK_* and off_t */
|
||||
# ifdef VMS
|
||||
# include <unixio.h> /* for off_t */
|
||||
# endif
|
||||
# define z_off_t off_t
|
||||
#endif
|
||||
#ifndef SEEK_SET
|
||||
# define SEEK_SET 0 /* Seek from beginning of file. */
|
||||
# define SEEK_CUR 1 /* Seek from current position. */
|
||||
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
|
||||
#endif
|
||||
#ifndef z_off_t
|
||||
# define z_off_t long
|
||||
#endif
|
||||
|
||||
#if defined(__OS400__)
|
||||
# define NO_vsnprintf
|
||||
#endif
|
||||
|
||||
#if defined(__MVS__)
|
||||
# define NO_vsnprintf
|
||||
# ifdef FAR
|
||||
# undef FAR
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* MVS linker does not support external names larger than 8 bytes */
|
||||
#if defined(__MVS__)
|
||||
# pragma map(deflateInit_,"DEIN")
|
||||
# pragma map(deflateInit2_,"DEIN2")
|
||||
# pragma map(deflateEnd,"DEEND")
|
||||
# pragma map(deflateBound,"DEBND")
|
||||
# pragma map(inflateInit_,"ININ")
|
||||
# pragma map(inflateInit2_,"ININ2")
|
||||
# pragma map(inflateEnd,"INEND")
|
||||
# pragma map(inflateSync,"INSY")
|
||||
# pragma map(inflateSetDictionary,"INSEDI")
|
||||
# pragma map(compressBound,"CMBND")
|
||||
# pragma map(inflate_table,"INTABL")
|
||||
# pragma map(inflate_fast,"INFA")
|
||||
# pragma map(inflate_copyright,"INCOPY")
|
||||
#endif
|
||||
|
||||
#endif /* ZCONF_H */
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,269 @@
|
|||
/* zutil.h -- internal interface and configuration of the compression library
|
||||
* Copyright (C) 1995-2005 Jean-loup Gailly.
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
/* WARNING: this file should *not* be used by applications. It is
|
||||
part of the implementation of the compression library and is
|
||||
subject to change. Applications should only use zlib.h.
|
||||
*/
|
||||
|
||||
/* @(#) $Id: zutil.h,v 1.1 2008-08-03 18:36:13 mtabachenko Exp $ */
|
||||
|
||||
#ifndef ZUTIL_H
|
||||
#define ZUTIL_H
|
||||
|
||||
#define ZLIB_INTERNAL
|
||||
#include "zlib.h"
|
||||
|
||||
#ifdef STDC
|
||||
# ifndef _WIN32_WCE
|
||||
# include <stddef.h>
|
||||
# endif
|
||||
# include <string.h>
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
#ifdef NO_ERRNO_H
|
||||
# ifdef _WIN32_WCE
|
||||
/* The Microsoft C Run-Time Library for Windows CE doesn't have
|
||||
* errno. We define it as a global variable to simplify porting.
|
||||
* Its value is always 0 and should not be used. We rename it to
|
||||
* avoid conflict with other libraries that use the same workaround.
|
||||
*/
|
||||
# define errno z_errno
|
||||
# endif
|
||||
extern int errno;
|
||||
#else
|
||||
# ifndef _WIN32_WCE
|
||||
# include <errno.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef local
|
||||
# define local static
|
||||
#endif
|
||||
/* compile with -Dlocal if your debugger can't find static symbols */
|
||||
|
||||
typedef unsigned char uch;
|
||||
typedef uch FAR uchf;
|
||||
typedef unsigned short ush;
|
||||
typedef ush FAR ushf;
|
||||
typedef unsigned long ulg;
|
||||
|
||||
extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
||||
/* (size given to avoid silly warnings with Visual C++) */
|
||||
|
||||
#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
|
||||
|
||||
#define ERR_RETURN(strm,err) \
|
||||
return (strm->msg = (char*)ERR_MSG(err), (err))
|
||||
/* To be used only when the state is known to be valid */
|
||||
|
||||
/* common constants */
|
||||
|
||||
#ifndef DEF_WBITS
|
||||
# define DEF_WBITS MAX_WBITS
|
||||
#endif
|
||||
/* default windowBits for decompression. MAX_WBITS is for compression only */
|
||||
|
||||
#if MAX_MEM_LEVEL >= 8
|
||||
# define DEF_MEM_LEVEL 8
|
||||
#else
|
||||
# define DEF_MEM_LEVEL MAX_MEM_LEVEL
|
||||
#endif
|
||||
/* default memLevel */
|
||||
|
||||
#define STORED_BLOCK 0
|
||||
#define STATIC_TREES 1
|
||||
#define DYN_TREES 2
|
||||
/* The three kinds of block type */
|
||||
|
||||
#define MIN_MATCH 3
|
||||
#define MAX_MATCH 258
|
||||
/* The minimum and maximum match lengths */
|
||||
|
||||
#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
|
||||
|
||||
/* target dependencies */
|
||||
|
||||
#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))
|
||||
# define OS_CODE 0x00
|
||||
# if defined(__TURBOC__) || defined(__BORLANDC__)
|
||||
# if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
|
||||
/* Allow compilation with ANSI keywords only enabled */
|
||||
void _Cdecl farfree( void *block );
|
||||
void *_Cdecl farmalloc( unsigned long nbytes );
|
||||
# else
|
||||
# include <alloc.h>
|
||||
# endif
|
||||
# else /* MSC or DJGPP */
|
||||
# include <malloc.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef AMIGA
|
||||
# define OS_CODE 0x01
|
||||
#endif
|
||||
|
||||
#if defined(VAXC) || defined(VMS)
|
||||
# define OS_CODE 0x02
|
||||
# define F_OPEN(name, mode) \
|
||||
fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
|
||||
#endif
|
||||
|
||||
#if defined(ATARI) || defined(atarist)
|
||||
# define OS_CODE 0x05
|
||||
#endif
|
||||
|
||||
#ifdef OS2
|
||||
# define OS_CODE 0x06
|
||||
# ifdef M_I86
|
||||
#include <malloc.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(MACOS) || defined(TARGET_OS_MAC)
|
||||
# define OS_CODE 0x07
|
||||
# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
|
||||
# include <unix.h> /* for fdopen */
|
||||
# else
|
||||
# ifndef fdopen
|
||||
# define fdopen(fd,mode) NULL /* No fdopen() */
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef TOPS20
|
||||
# define OS_CODE 0x0a
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
# ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */
|
||||
# define OS_CODE 0x0b
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __50SERIES /* Prime/PRIMOS */
|
||||
# define OS_CODE 0x0f
|
||||
#endif
|
||||
|
||||
#if defined(_BEOS_) || defined(RISCOS)
|
||||
# define fdopen(fd,mode) NULL /* No fdopen() */
|
||||
#endif
|
||||
|
||||
#if (defined(_MSC_VER) && (_MSC_VER > 600))
|
||||
# if defined(_WIN32_WCE)
|
||||
# define fdopen(fd,mode) NULL /* No fdopen() */
|
||||
# ifndef _PTRDIFF_T_DEFINED
|
||||
typedef int ptrdiff_t;
|
||||
# define _PTRDIFF_T_DEFINED
|
||||
# endif
|
||||
# else
|
||||
# define fdopen(fd,type) _fdopen(fd,type)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* common defaults */
|
||||
|
||||
#ifndef OS_CODE
|
||||
# define OS_CODE 0x03 /* assume Unix */
|
||||
#endif
|
||||
|
||||
#ifndef F_OPEN
|
||||
# define F_OPEN(name, mode) fopen((name), (mode))
|
||||
#endif
|
||||
|
||||
/* functions */
|
||||
|
||||
#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550)
|
||||
# ifndef HAVE_VSNPRINTF
|
||||
# define HAVE_VSNPRINTF
|
||||
# endif
|
||||
#endif
|
||||
#if defined(__CYGWIN__)
|
||||
# ifndef HAVE_VSNPRINTF
|
||||
# define HAVE_VSNPRINTF
|
||||
# endif
|
||||
#endif
|
||||
#ifndef HAVE_VSNPRINTF
|
||||
# ifdef MSDOS
|
||||
/* vsnprintf may exist on some MS-DOS compilers (DJGPP?),
|
||||
but for now we just assume it doesn't. */
|
||||
# define NO_vsnprintf
|
||||
# endif
|
||||
# ifdef __TURBOC__
|
||||
# define NO_vsnprintf
|
||||
# endif
|
||||
# ifdef WIN32
|
||||
/* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
|
||||
# if !defined(vsnprintf) && !defined(NO_vsnprintf)
|
||||
# define vsnprintf _vsnprintf
|
||||
# endif
|
||||
# endif
|
||||
# ifdef __SASC
|
||||
# define NO_vsnprintf
|
||||
# endif
|
||||
#endif
|
||||
#ifdef VMS
|
||||
# define NO_vsnprintf
|
||||
#endif
|
||||
|
||||
#if defined(pyr)
|
||||
# define NO_MEMCPY
|
||||
#endif
|
||||
#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
|
||||
/* Use our own functions for small and medium model with MSC <= 5.0.
|
||||
* You may have to use the same strategy for Borland C (untested).
|
||||
* The __SC__ check is for Symantec.
|
||||
*/
|
||||
# define NO_MEMCPY
|
||||
#endif
|
||||
#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
|
||||
# define HAVE_MEMCPY
|
||||
#endif
|
||||
#ifdef HAVE_MEMCPY
|
||||
# ifdef SMALL_MEDIUM /* MSDOS small or medium model */
|
||||
# define zmemcpy _fmemcpy
|
||||
# define zmemcmp _fmemcmp
|
||||
# define zmemzero(dest, len) _fmemset(dest, 0, len)
|
||||
# else
|
||||
# define zmemcpy memcpy
|
||||
# define zmemcmp memcmp
|
||||
# define zmemzero(dest, len) memset(dest, 0, len)
|
||||
# endif
|
||||
#else
|
||||
extern void zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
|
||||
extern int zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
|
||||
extern void zmemzero OF((Bytef* dest, uInt len));
|
||||
#endif
|
||||
|
||||
/* Diagnostic functions */
|
||||
#ifdef DEBUG
|
||||
# include <stdio.h>
|
||||
extern int z_verbose;
|
||||
extern void z_error OF((char *m));
|
||||
# define Assert(cond,msg) {if(!(cond)) z_error(msg);}
|
||||
# define Trace(x) {if (z_verbose>=0) fprintf x ;}
|
||||
# define Tracev(x) {if (z_verbose>0) fprintf x ;}
|
||||
# define Tracevv(x) {if (z_verbose>1) fprintf x ;}
|
||||
# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
|
||||
# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
|
||||
#else
|
||||
# define Assert(cond,msg)
|
||||
# define Trace(x)
|
||||
# define Tracev(x)
|
||||
# define Tracevv(x)
|
||||
# define Tracec(c,x)
|
||||
# define Tracecv(c,x)
|
||||
#endif
|
||||
|
||||
|
||||
voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
|
||||
void zcfree OF((voidpf opaque, voidpf ptr));
|
||||
|
||||
#define ZALLOC(strm, items, size) \
|
||||
(*((strm)->zalloc))((strm)->opaque, (items), (size))
|
||||
#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
|
||||
#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
|
||||
|
||||
#endif /* ZUTIL_H */
|
|
@ -0,0 +1,211 @@
|
|||
#ifndef _ZZIP__MSVC_H
|
||||
#define _ZZIP__MSVC_H 1
|
||||
|
||||
/* zzip/_msvc.h. Generated automatically at end of configure. */
|
||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define to 1 if you have the <byteswap.h> header file. */
|
||||
/* #undef ZZIP_HAVE_BYTESWAP_H */
|
||||
|
||||
/* Define to 1 if you have the <direct.h> header file. */
|
||||
#ifndef ZZIP_HAVE_DIRECT_H
|
||||
#define ZZIP_HAVE_DIRECT_H 1
|
||||
#endif
|
||||
|
||||
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
|
||||
*/
|
||||
/* #undef ZZIP_HAVE_DIRENT_H */
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
/* #undef ZZIP_HAVE_DLFCN_H */
|
||||
|
||||
/* Define to 1 if you have the <fnmatch.h> header file. */
|
||||
/* #undef ZZIP_HAVE_FNMATCH_H */
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
/* #undef ZZIP_HAVE_INTTYPES_H */
|
||||
|
||||
/* Define to 1 if you have the <io.h> header file. */
|
||||
#ifndef ZZIP_HAVE_IO_H
|
||||
#define ZZIP_HAVE_IO_H 1
|
||||
#endif
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#ifndef ZZIP_HAVE_MEMORY_H
|
||||
#define ZZIP_HAVE_MEMORY_H 1
|
||||
#endif
|
||||
|
||||
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
|
||||
/* #undef ZZIP_HAVE_NDIR_H */
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
/* #undef ZZIP_HAVE_STDINT_H */
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#ifndef ZZIP_HAVE_STDLIB_H
|
||||
#define ZZIP_HAVE_STDLIB_H 1
|
||||
#endif
|
||||
|
||||
/* Define to 1 if you have the `strcasecmp' function. */
|
||||
/* #undef ZZIP_HAVE_STRCASECMP */
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
/* #undef ZZIP_HAVE_STRINGS_H */
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#ifndef ZZIP_HAVE_STRING_H
|
||||
#define ZZIP_HAVE_STRING_H 1
|
||||
#endif
|
||||
|
||||
/* Define to 1 if you have the `strndup' function. */
|
||||
/* #undef ZZIP_HAVE_STRNDUP */
|
||||
|
||||
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
|
||||
*/
|
||||
/* #undef ZZIP_HAVE_SYS_DIR_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/int_types.h> header file. */
|
||||
/* #undef ZZIP_HAVE_SYS_INT_TYPES_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/mman.h> header file. */
|
||||
/* #undef ZZIP_HAVE_SYS_MMAN_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
|
||||
*/
|
||||
/* #undef ZZIP_HAVE_SYS_NDIR_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/param.h> header file. */
|
||||
/* #undef ZZIP_HAVE_SYS_PARAM_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#ifndef ZZIP_HAVE_SYS_STAT_H
|
||||
#define ZZIP_HAVE_SYS_STAT_H 1
|
||||
#endif
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#ifndef ZZIP_HAVE_SYS_TYPES_H
|
||||
#define ZZIP_HAVE_SYS_TYPES_H 1
|
||||
#endif
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
/* #undef ZZIP_HAVE_UNISTD_H */
|
||||
|
||||
/* Define to 1 if you have the <winbase.h> header file. */
|
||||
#ifndef ZZIP_HAVE_WINBASE_H
|
||||
#define ZZIP_HAVE_WINBASE_H 1 /* hmm, is that win32 ? */
|
||||
#endif
|
||||
|
||||
/* Define to 1 if you have the <windows.h> header file. */
|
||||
#ifndef ZZIP_HAVE_WINDOWS_H
|
||||
#define ZZIP_HAVE_WINDOWS_H 1 /* yes, this is windows */
|
||||
#endif
|
||||
|
||||
/* Define to 1 if you have the <winnt.h> header file. */
|
||||
#ifndef ZZIP_HAVE_WINNT_H
|
||||
#define ZZIP_HAVE_WINNT_H 1 /* is that always true? */
|
||||
#endif
|
||||
|
||||
/* Define to 1 if you have the <zlib.h> header file. */
|
||||
#ifndef ZZIP_HAVE_ZLIB_H
|
||||
#define ZZIP_HAVE_ZLIB_H 1 /* you do have it, right? */
|
||||
#endif
|
||||
|
||||
/* whether the system defaults to 32bit off_t but can do 64bit when requested
|
||||
*/
|
||||
/* #undef ZZIP_LARGEFILE_SENSITIVE */
|
||||
|
||||
/* Name of package */
|
||||
#ifndef ZZIP_PACKAGE
|
||||
#define ZZIP_PACKAGE "zziplib-msvc" /* yes, make it known */
|
||||
#endif
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
/* #undef ZZIP_PACKAGE_BUGREPORT */
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
/* #undef ZZIP_PACKAGE_NAME */
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
/* #undef ZZIP_PACKAGE_STRING */
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
/* #undef ZZIP_PACKAGE_TARNAME */
|
||||
|
||||
/* Define to the version of this package. */
|
||||
/* #undef ZZIP_PACKAGE_VERSION */
|
||||
|
||||
/* The number of bytes in type int */
|
||||
#ifndef ZZIP_SIZEOF_INT
|
||||
#define ZZIP_SIZEOF_INT 4
|
||||
#endif
|
||||
|
||||
/* The number of bytes in type long */
|
||||
#ifndef ZZIP_SIZEOF_LONG
|
||||
#define ZZIP_SIZEOF_LONG 4
|
||||
#endif
|
||||
|
||||
/* The number of bytes in type short */
|
||||
#ifndef ZZIP_SIZEOF_SHORT
|
||||
#define ZZIP_SIZEOF_SHORT 2
|
||||
#endif
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#ifndef ZZIP_STDC_HEADERS
|
||||
#define ZZIP_STDC_HEADERS 1
|
||||
#endif
|
||||
|
||||
/* Version number of package */
|
||||
#ifndef ZZIP_VERSION
|
||||
#define ZZIP_VERSION "0.13.x"
|
||||
#endif
|
||||
|
||||
/* Define to 1 if your processor stores words with the most significant byte
|
||||
first (like Motorola and SPARC, unlike Intel and VAX). */
|
||||
/* #undef ZZIP_WORDS_BIGENDIAN */
|
||||
|
||||
/* Number of bits in a file offset, on hosts where this is settable. */
|
||||
/* #undef ZZIP__FILE_OFFSET_BITS */
|
||||
|
||||
/* Define for large files, on AIX-style hosts. */
|
||||
/* #undef ZZIP__LARGE_FILES */
|
||||
|
||||
/* Define to `long long' if <sys/types.h> does not define. */
|
||||
/* #undef ZZIP___int64 */
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
/* #undef _zzip_const */
|
||||
|
||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
||||
#ifndef __cplusplus
|
||||
#ifndef _zzip_inline
|
||||
#define _zzip_inline __inline
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Define to `_zzip_off_t' if <sys/types.h> does not define. */
|
||||
#ifndef _zzip_off64_t
|
||||
#define _zzip_off64_t __int64
|
||||
#endif
|
||||
|
||||
/* Define to `long' if <sys/types.h> does not define. */
|
||||
#ifndef _zzip_off_t
|
||||
#define _zzip_off_t long
|
||||
#endif
|
||||
|
||||
/* Define to equivalent of C99 restrict keyword, or to nothing if this is not
|
||||
supported. Do not define if restrict is supported directly. */
|
||||
#ifndef _zzip_restrict
|
||||
#define _zzip_restrict
|
||||
#endif
|
||||
|
||||
/* Define to `unsigned' if <sys/types.h> does not define. */
|
||||
/* #undef _zzip_size_t */
|
||||
|
||||
/* Define to `int' if <sys/types.h> does not define. */
|
||||
#ifndef _zzip_ssize_t
|
||||
#define _zzip_ssize_t int
|
||||
#endif
|
||||
|
||||
/* once: _ZZIP__MSVC_H */
|
||||
#endif
|
|
@ -0,0 +1,540 @@
|
|||
/*
|
||||
|
||||
* Here we postprocess autoconf generated prefix-config.h entries.
|
||||
|
||||
* This is generally for things like "off_t" which is left undefined
|
||||
|
||||
* in plain config.h if the host system does already have it but we do
|
||||
|
||||
* need the prefix variant - so we add here a #define _zzip_off_t off_t
|
||||
|
||||
*
|
||||
|
||||
* This file is supposed to only carry '#define's.
|
||||
|
||||
* See <zzip/types.h> for definitions that might be seen by the compiler.
|
||||
|
||||
*
|
||||
|
||||
* Author:
|
||||
|
||||
* Guido Draheim <guidod@gmx.de>
|
||||
|
||||
*
|
||||
|
||||
* Copyright (c) 2001,2002,2003,2004 Guido Draheim
|
||||
|
||||
* All rights reserved,
|
||||
|
||||
* use under the restrictions of the
|
||||
|
||||
* Lesser GNU General Public License
|
||||
|
||||
* or alternatively the restrictions
|
||||
|
||||
* of the Mozilla Public License 1.1
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _ZZIP_CONF_H
|
||||
|
||||
#define _ZZIP_CONF_H 1
|
||||
|
||||
|
||||
|
||||
#if !defined ZZIP_OMIT_CONFIG_H
|
||||
|
||||
# if defined _MSC_VER || defined __BORLANDC__ || defined __WATCOMC__
|
||||
|
||||
# include <zzip/_msvc.h>
|
||||
|
||||
# elif defined ZZIP_1_H
|
||||
|
||||
# include "zzip-1.h"
|
||||
|
||||
# elif defined ZZIP_2_H
|
||||
|
||||
# include "zzip-2.h"
|
||||
|
||||
# elif defined ZZIP_3_H
|
||||
|
||||
# include "zzip-3.h"
|
||||
|
||||
# elif defined ZZIP_4_H
|
||||
|
||||
# include "zzip-4.h"
|
||||
|
||||
# elif defined ZZIP_5_H
|
||||
|
||||
# include "zzip-5.h"
|
||||
|
||||
# else /* autoconf generated */
|
||||
|
||||
# include <zzip/_config.h>
|
||||
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* especially win32 platforms do not declare off_t so far - see zzip-msvc.h */
|
||||
|
||||
#ifndef _zzip_off_t
|
||||
|
||||
#ifdef ZZIP_off_t
|
||||
|
||||
#define _zzip_off_t ZZIP_off_t
|
||||
|
||||
#else
|
||||
|
||||
#define _zzip_off_t off_t
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifndef _zzip_off64_t
|
||||
|
||||
#ifdef ZZIP_off64_t
|
||||
|
||||
#define _zzip_off64_t ZZIP_off64_t
|
||||
|
||||
#else
|
||||
|
||||
#define _zzip_off64_t off64_t
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* currently unused, all current zziplib-users do have ansi-C94 compilers. */
|
||||
|
||||
#ifndef _zzip_const
|
||||
|
||||
#ifdef ZZIP_const
|
||||
|
||||
#define _zzip_const ZZIP_const
|
||||
|
||||
#else
|
||||
|
||||
#define _zzip_const const
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef _zzip_inline
|
||||
|
||||
#ifdef ZZIP_inline
|
||||
|
||||
#define _zzip_inline ZZIP_inline
|
||||
|
||||
#else
|
||||
|
||||
#define _zzip_inline inline
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef _zzip_restrict
|
||||
|
||||
#ifdef ZZIP_restrict
|
||||
|
||||
#define _zzip_restrict ZZIP_restrict
|
||||
|
||||
#else
|
||||
|
||||
#define _zzip_restrict restrict
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if defined __linux__ && __GNUC__+0 >= 4
|
||||
|
||||
#define zzip__new__ __attribute__((malloc))
|
||||
|
||||
#elif defined __linux__ && __GNUC__+0 >= 3 && __GNUC_MINOR_+0 >= 3
|
||||
|
||||
#define zzip__new__ __attribute__((malloc))
|
||||
|
||||
#else
|
||||
|
||||
#define zzip__new__
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifndef _zzip_size_t
|
||||
|
||||
#ifdef ZZIP_size_t
|
||||
|
||||
#define _zzip_size_t ZZIP_size_t
|
||||
|
||||
#else
|
||||
|
||||
#define _zzip_size_t size_t
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef _zzip_ssize_t
|
||||
|
||||
#ifdef ZZIP_ssize_t
|
||||
|
||||
#define _zzip_ssize_t ZZIP_ssize_t
|
||||
|
||||
#else
|
||||
|
||||
#define _zzip_ssize_t ssize_t
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef _zzip___int64
|
||||
|
||||
#ifdef ZZIP___int64
|
||||
|
||||
#define _zzip___int64 ZZIP___int64
|
||||
|
||||
#else
|
||||
|
||||
#define _zzip___int64 long long
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* whether this library shall use a 64bit off_t largefile variant in 64on32: */
|
||||
|
||||
/* (some exported names must be renamed to avoid bad calls after linking) */
|
||||
|
||||
#if defined ZZIP_LARGEFILE_SENSITIVE
|
||||
|
||||
# if _FILE_OFFSET_BITS+0 == 64
|
||||
|
||||
# define ZZIP_LARGEFILE_RENAME
|
||||
|
||||
# elif defined _LARGE_FILES /* used on older AIX to get at 64bit off_t */
|
||||
|
||||
# define ZZIP_LARGEFILE_RENAME
|
||||
|
||||
# elif defined _ZZIP_LARGEFILE /* or simply use this one for zzip64 runs */
|
||||
|
||||
# define ZZIP_LARGEFILE_RENAME
|
||||
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* if the environment did not setup these for 64bit off_t largefile... */
|
||||
|
||||
#ifdef ZZIP_LARGEFILE_RENAME
|
||||
|
||||
# ifndef _FILE_OFFSET_BITS
|
||||
|
||||
# ifdef ZZIP__FILE_OFFSET_BITS /* == 64 */
|
||||
|
||||
# define _FILE_OFFSET_BITS ZZIP__FILE_OFFSET_BITS
|
||||
|
||||
# endif
|
||||
|
||||
# endif
|
||||
|
||||
# ifndef _LARGE_FILES
|
||||
|
||||
# ifdef ZZIP__LARGE_FILES /* == 1 */
|
||||
|
||||
# define _LARGE_FILES ZZIP__LARGE_FILES
|
||||
|
||||
# endif
|
||||
|
||||
# endif
|
||||
|
||||
# ifndef _LARGEFILE_SOURCE
|
||||
|
||||
# ifdef ZZIP__LARGEFILE_SOURCE /* == 1 */
|
||||
|
||||
# define _LARGEFILE_SOURCE ZZIP__LARGEFILE_SOURCE
|
||||
|
||||
# endif
|
||||
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
|
||||
|
||||
/* mingw32msvc errno : would be in winsock.h */
|
||||
|
||||
#ifndef EREMOTE
|
||||
|
||||
#define EREMOTE ESPIPE
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifndef ELOOP
|
||||
|
||||
#if defined EILSEQ
|
||||
|
||||
#define ELOOP EILSEQ
|
||||
|
||||
#else
|
||||
|
||||
#define ELOOP ENOEXEC
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if defined __WATCOMC__
|
||||
|
||||
#undef _zzip_inline
|
||||
|
||||
#define _zzip_inline static
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if defined _MSC_VER || defined __WATCOMC__
|
||||
|
||||
#include <io.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
# if !__STDC__
|
||||
|
||||
# ifndef _zzip_lseek
|
||||
|
||||
# define _zzip_lseek _lseek
|
||||
|
||||
# endif
|
||||
|
||||
# ifndef _zzip_read
|
||||
|
||||
# define _zzip_read _read
|
||||
|
||||
# endif
|
||||
|
||||
# ifndef _zzip_write
|
||||
|
||||
# define _zzip_write _write
|
||||
|
||||
# endif
|
||||
|
||||
# if 0
|
||||
|
||||
# ifndef _zzip_stat
|
||||
|
||||
# define _zzip_stat _stat
|
||||
|
||||
# endif
|
||||
|
||||
# endif
|
||||
|
||||
# endif /* !__STDC__ */
|
||||
|
||||
#endif
|
||||
|
||||
/*MSVC*/
|
||||
|
||||
|
||||
|
||||
#if defined _MSC_VER || defined __WATCOMC__
|
||||
|
||||
# ifndef strcasecmp
|
||||
|
||||
# define strcasecmp _stricmp
|
||||
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
# ifndef _zzip_lseek
|
||||
|
||||
# define _zzip_lseek lseek
|
||||
|
||||
# endif
|
||||
|
||||
|
||||
|
||||
# ifndef _zzip_read
|
||||
|
||||
# define _zzip_read read
|
||||
|
||||
# endif
|
||||
|
||||
|
||||
|
||||
# ifndef _zzip_write
|
||||
|
||||
# define _zzip_write write
|
||||
|
||||
# endif
|
||||
|
||||
|
||||
|
||||
# if 0
|
||||
|
||||
# ifndef _zzip_stat
|
||||
|
||||
# define _zzip_stat stat
|
||||
|
||||
# endif
|
||||
|
||||
# endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if defined __GNUC__ || defined __attribute__
|
||||
|
||||
#define __zzip_attribute__(X) __attribute__(X)
|
||||
|
||||
#else
|
||||
|
||||
#define __zzip_attribute__(X)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if defined ZZIP_EXPORTS || defined ZZIPLIB_EXPORTS
|
||||
|
||||
# undef ZZIP_DLL
|
||||
|
||||
#define ZZIP_DLL 1
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* based on zconf.h : */
|
||||
|
||||
/* compile with -DZZIP_DLL for Windows DLL support */
|
||||
|
||||
#if defined ZZIP_DLL
|
||||
|
||||
# if defined _WINDOWS || defined WINDOWS || defined _WIN32
|
||||
|
||||
/*# include <windows.h>*/
|
||||
|
||||
# endif
|
||||
|
||||
# if !defined _zzip_export && defined _MSC_VER && (defined WIN32 || defined _WIN32)
|
||||
|
||||
# define _zzip_export __declspec(dllexport) /*WINAPI*/
|
||||
|
||||
# endif
|
||||
|
||||
# if !defined _zzip_export && defined __BORLANDC__
|
||||
|
||||
# if __BORLANDC__ >= 0x0500 && defined WIN32
|
||||
|
||||
# include <windows.h>
|
||||
|
||||
# define _zzip_export __declspec(dllexport) /*WINAPI*/
|
||||
|
||||
# else
|
||||
|
||||
# if defined _Windows && defined __DLL__
|
||||
|
||||
# define _zzip_export _export
|
||||
|
||||
# endif
|
||||
|
||||
# endif
|
||||
|
||||
# endif
|
||||
|
||||
# if !defined _zzip_export && defined __GNUC__
|
||||
|
||||
# if defined __declspec
|
||||
|
||||
# define _zzip_export extern __declspec(dllexport)
|
||||
|
||||
# else
|
||||
|
||||
# define _zzip_export extern
|
||||
|
||||
# endif
|
||||
|
||||
# endif
|
||||
|
||||
# if !defined _zzip_export && defined __BEOS__
|
||||
|
||||
# define _zzip_export extern __declspec(export)
|
||||
|
||||
# endif
|
||||
|
||||
# if !defined _zzip_export && defined __WATCOMC__
|
||||
|
||||
# define _zzip_export extern __declspec(dllexport)
|
||||
|
||||
# define ZEXPORT __syscall
|
||||
|
||||
# define ZEXTERN extern
|
||||
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if !defined _zzip_export
|
||||
|
||||
# if defined __GNUC__ /* || !defined HAVE_LIBZZIP */
|
||||
|
||||
# define _zzip_export extern
|
||||
|
||||
# elif defined __declspec || (defined _MSC_VER && defined ZZIP_DLL)
|
||||
|
||||
# define _zzip_export extern __declspec(dllimport)
|
||||
|
||||
# else
|
||||
|
||||
# define _zzip_export extern
|
||||
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* unlike in <zzip/conf.h> we are allowed to make up typedefs here,
|
||||
* while over there only #defines are allowed
|
||||
*
|
||||
* Author:
|
||||
* Guido Draheim <guidod@gmx.de>
|
||||
*
|
||||
* Copyright (c) 2003,2004 Guido Draheim
|
||||
* All rights reserved,
|
||||
* usage allowed under the restrictions of the
|
||||
* Lesser GNU General Public License
|
||||
* or alternatively the restrictions
|
||||
* of the Mozilla Public License 1.1
|
||||
*
|
||||
* This file is usually the first to define some real symbols. If you do
|
||||
* see some errors here then it is most likely the includepath is wrong
|
||||
* or some includeheader is missing / unreadable on your system.
|
||||
* (a) we include local headers with a "zzip/" prefix just to be sure
|
||||
* to not actually get the wrong one. Consider to add `-I..` somewhere
|
||||
* and especially VC/IDE users (who make up their own workspace files)
|
||||
* should include the root source directory of this project.
|
||||
* (b) size_t and ssize_t are sometimes found be `configure` but they are
|
||||
* not in the usual places (ANSI C = stddef.h; UNIX = sys/types.h), so
|
||||
* be sure to look for them and add the respective header as an #include.
|
||||
*/
|
||||
|
||||
#ifndef _ZZIP_TYPES_H_
|
||||
#define _ZZIP_TYPES_H_
|
||||
|
||||
#include <zzip/conf.h>
|
||||
#include <fcntl.h>
|
||||
#include <stddef.h> /* size_t and friends */
|
||||
#ifdef ZZIP_HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h> /* bsd (mac) has size_t here */
|
||||
#endif
|
||||
/* msvc6 has neither ssize_t (we assume "int") nor off_t (assume "long") */
|
||||
|
||||
typedef unsigned char zzip_byte_t; // especially zlib decoding data
|
||||
|
||||
typedef _zzip_off64_t zzip_off64_t;
|
||||
typedef _zzip_off_t zzip_off_t;
|
||||
typedef _zzip_size_t zzip_size_t; /* Some error here? */
|
||||
typedef _zzip_ssize_t zzip_ssize_t; /* See notes above! */
|
||||
|
||||
/* in <zzip/format.h> */
|
||||
typedef struct zzip_disk64_trailer ZZIP_DISK64_TRAILER;
|
||||
typedef struct zzip_disk_trailer ZZIP_DISK_TRAILER;
|
||||
typedef struct zzip_file_trailer ZZIP_FILE_TRAILER;
|
||||
typedef struct zzip_root_dirent ZZIP_ROOT_DIRENT;
|
||||
typedef struct zzip_file_header ZZIP_FILE_HEADER;
|
||||
typedef struct zzip_disk_entry ZZIP_DISK_ENTRY;
|
||||
typedef struct zzip_extra_block ZZIP_EXTRA_BLOCK;
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,268 @@
|
|||
/*
|
||||
* Author:
|
||||
* Guido Draheim <guidod@gmx.de>
|
||||
* Tomi Ollila <Tomi.Ollila@iki.fi>
|
||||
*
|
||||
* Copyright (c) 1999,2000,2001,2002,2003,2004 Guido Draheim
|
||||
* All rights reserved,
|
||||
* usage allowed under the restrictions of the
|
||||
* Lesser GNU General Public License
|
||||
* or alternatively the restrictions
|
||||
* of the Mozilla Public License 1.1
|
||||
*
|
||||
* if you see "unknown symbol" errors, check first that `-I ..` is part of
|
||||
* your compiler options - a special hint to VC/IDE users who tend to make up
|
||||
* their own workspace files. All includes look like #include <zzip|*.h>, so
|
||||
* you need to add an include path to the dir containing (!!) the ./zzip/ dir
|
||||
*/
|
||||
|
||||
#ifndef _ZZIP_ZZIP_H /* zziplib.h */
|
||||
#define _ZZIP_ZZIP_H
|
||||
|
||||
#include <zzip/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* the zzip_error_t is also used to pass back ZLIB errors... */
|
||||
#define ZZIP_ERROR -4096
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ZZIP_NO_ERROR = 0, /* no error, may be used if user sets it. */
|
||||
ZZIP_OUTOFMEM = ZZIP_ERROR-20, /* out of memory */
|
||||
ZZIP_DIR_OPEN = ZZIP_ERROR-21, /* failed to open zipfile, see errno for details */
|
||||
ZZIP_DIR_STAT = ZZIP_ERROR-22, /* failed to fstat zipfile, see errno for details */
|
||||
ZZIP_DIR_SEEK = ZZIP_ERROR-23, /* failed to lseek zipfile, see errno for details */
|
||||
ZZIP_DIR_READ = ZZIP_ERROR-24, /* failed to read zipfile, see errno for details */
|
||||
ZZIP_DIR_TOO_SHORT = ZZIP_ERROR-25,
|
||||
ZZIP_DIR_EDH_MISSING = ZZIP_ERROR-26,
|
||||
ZZIP_DIRSIZE = ZZIP_ERROR-27,
|
||||
ZZIP_ENOENT = ZZIP_ERROR-28,
|
||||
ZZIP_UNSUPP_COMPR = ZZIP_ERROR-29,
|
||||
ZZIP_CORRUPTED = ZZIP_ERROR-31,
|
||||
ZZIP_UNDEF = ZZIP_ERROR-32,
|
||||
ZZIP_DIR_LARGEFILE = ZZIP_ERROR-33
|
||||
} zzip_error_t;
|
||||
|
||||
/*
|
||||
* zzip_open flags.
|
||||
*/
|
||||
#define ZZIP_CASEINSENSITIVE O_APPEND /* do not use anymore. use CASLESS */
|
||||
#define ZZIP_IGNOREPATH O_TRUNC /* do not use anymore. use NOPATHS */
|
||||
#define ZZIP_EXTRAFLAGS (ZZIP_CASEINSENSITIVE|ZZIP_IGNOREPATH)
|
||||
|
||||
/* zzip_open_ext_io o_modes flags : new style. use these from now on! */
|
||||
#define ZZIP_CASELESS (1<<12) /* ignore filename case inside zips */
|
||||
#define ZZIP_NOPATHS (1<<13) /* ignore subdir paths, just filename*/
|
||||
#define ZZIP_PREFERZIP (1<<14) /* try first zipped file, then real*/
|
||||
#define ZZIP_ONLYZIP (1<<16) /* try _only_ zipped file, skip real*/
|
||||
#define ZZIP_FACTORY (1<<17) /* old file handle is not closed */
|
||||
#define ZZIP_ALLOWREAL (1<<18) /* real files use default_io (magic) */
|
||||
#define ZZIP_THREADED (1<<19) /* try to be safe for multithreading */
|
||||
|
||||
/*
|
||||
* zzip largefile renames
|
||||
*/
|
||||
#ifdef ZZIP_LARGEFILE_RENAME
|
||||
#define zzip_telldir zzip_telldir64
|
||||
#define zzip_seekdir zzip_seekdir64
|
||||
#endif
|
||||
|
||||
/*
|
||||
* zzip typedefs
|
||||
*/
|
||||
/* zzip_strings_t ext[] = { ".zip", ".jar", ".pk3", 0 } */
|
||||
typedef char _zzip_const * _zzip_const zzip_strings_t;
|
||||
typedef char _zzip_const zzip_char_t;
|
||||
typedef struct zzip_dir ZZIP_DIR;
|
||||
typedef struct zzip_file ZZIP_FILE;
|
||||
typedef struct zzip_dirent ZZIP_DIRENT;
|
||||
typedef struct zzip_dirent ZZIP_STAT;
|
||||
|
||||
struct zzip_dirent
|
||||
{
|
||||
int d_compr; /* compression method */
|
||||
int d_csize; /* compressed size */
|
||||
int st_size; /* file size / decompressed size */
|
||||
char * d_name; /* file name / strdupped name */
|
||||
};
|
||||
|
||||
/*
|
||||
* Getting error strings
|
||||
* zzip/err.c
|
||||
*/
|
||||
_zzip_export /* error in _opendir : */
|
||||
zzip_char_t* zzip_strerror(int errcode);
|
||||
_zzip_export /* error in other functions : */
|
||||
zzip_char_t* zzip_strerror_of(ZZIP_DIR * dir);
|
||||
_zzip_export /* error mapped to errno.h defines : */
|
||||
int zzip_errno(int errcode);
|
||||
|
||||
|
||||
/*
|
||||
* Functions to grab information from ZZIP_DIR/ZZIP_FILE structure
|
||||
* (if ever needed)
|
||||
* zzip/info.c
|
||||
*/
|
||||
_zzip_export
|
||||
int zzip_error(ZZIP_DIR * dir);
|
||||
_zzip_export
|
||||
void zzip_seterror(ZZIP_DIR * dir, int errcode);
|
||||
_zzip_export
|
||||
zzip_char_t* zzip_compr_str(int compr);
|
||||
|
||||
_zzip_export
|
||||
ZZIP_DIR * zzip_dirhandle(ZZIP_FILE * fp);
|
||||
_zzip_export
|
||||
int zzip_dirfd(ZZIP_DIR * dir);
|
||||
_zzip_export
|
||||
int zzip_dir_real(ZZIP_DIR * dir);
|
||||
_zzip_export
|
||||
int zzip_file_real(ZZIP_FILE * fp);
|
||||
_zzip_export
|
||||
void* zzip_realdir(ZZIP_DIR * dir);
|
||||
_zzip_export
|
||||
int zzip_realfd(ZZIP_FILE * fp);
|
||||
|
||||
/*
|
||||
* zip handle management
|
||||
* zzip/zip.c
|
||||
*/
|
||||
_zzip_export
|
||||
ZZIP_DIR * zzip_dir_alloc(zzip_strings_t* fileext);
|
||||
_zzip_export
|
||||
int zzip_dir_free(ZZIP_DIR *);
|
||||
|
||||
/*
|
||||
* Opening/closing a zip archive
|
||||
* zzip-zip.c
|
||||
*/
|
||||
_zzip_export
|
||||
ZZIP_DIR * zzip_dir_fdopen(int fd, zzip_error_t * errcode_p);
|
||||
_zzip_export
|
||||
ZZIP_DIR * zzip_dir_open(zzip_char_t* filename, zzip_error_t * errcode_p);
|
||||
_zzip_export
|
||||
int zzip_dir_close(ZZIP_DIR * dir);
|
||||
_zzip_export
|
||||
int zzip_dir_read(ZZIP_DIR * dir, ZZIP_DIRENT * dirent);
|
||||
|
||||
|
||||
/*
|
||||
* Scanning files in zip archive
|
||||
* zzip/dir.c
|
||||
* zzip/zip.c
|
||||
*/
|
||||
_zzip_export
|
||||
ZZIP_DIR * zzip_opendir(zzip_char_t* filename);
|
||||
_zzip_export
|
||||
int zzip_closedir(ZZIP_DIR * dir);
|
||||
_zzip_export
|
||||
ZZIP_DIRENT * zzip_readdir(ZZIP_DIR * dir);
|
||||
_zzip_export
|
||||
void zzip_rewinddir(ZZIP_DIR * dir);
|
||||
_zzip_export
|
||||
zzip_off_t zzip_telldir(ZZIP_DIR * dir);
|
||||
_zzip_export
|
||||
void zzip_seekdir(ZZIP_DIR * dir, zzip_off_t offset);
|
||||
|
||||
/*
|
||||
* 'opening', 'closing' and reading invidual files in zip archive.
|
||||
* zzip/file.c
|
||||
*/
|
||||
_zzip_export
|
||||
ZZIP_FILE * zzip_file_open(ZZIP_DIR * dir, zzip_char_t* name, int flags);
|
||||
_zzip_export
|
||||
int zzip_file_close(ZZIP_FILE * fp);
|
||||
_zzip_export
|
||||
zzip_ssize_t zzip_file_read(ZZIP_FILE * fp, void* buf, zzip_size_t len);
|
||||
|
||||
_zzip_export
|
||||
ZZIP_FILE * zzip_open(zzip_char_t* name, int flags);
|
||||
_zzip_export
|
||||
int zzip_close(ZZIP_FILE * fp);
|
||||
_zzip_export
|
||||
zzip_ssize_t zzip_read(ZZIP_FILE * fp, void * buf, zzip_size_t len);
|
||||
|
||||
/*
|
||||
* the stdc variant to open/read/close files. - Take note of the freopen()
|
||||
* call as it may reuse an existing preparsed copy of a zip central directory
|
||||
*/
|
||||
_zzip_export
|
||||
ZZIP_FILE* zzip_freopen(zzip_char_t* name, zzip_char_t* mode, ZZIP_FILE*);
|
||||
_zzip_export
|
||||
ZZIP_FILE* zzip_fopen(zzip_char_t* name, zzip_char_t* mode);
|
||||
_zzip_export
|
||||
zzip_size_t zzip_fread(void *ptr, zzip_size_t size, zzip_size_t nmemb,
|
||||
ZZIP_FILE * file);
|
||||
_zzip_export
|
||||
int zzip_fclose(ZZIP_FILE * fp);
|
||||
|
||||
/*
|
||||
* seek and tell functions
|
||||
*/
|
||||
_zzip_export
|
||||
int zzip_rewind(ZZIP_FILE *fp);
|
||||
_zzip_export
|
||||
zzip_off_t zzip_seek(ZZIP_FILE * fp, zzip_off_t offset, int whence);
|
||||
_zzip_export
|
||||
zzip_off_t zzip_tell(ZZIP_FILE * fp);
|
||||
|
||||
/*
|
||||
* reading info of a single file
|
||||
* zzip/stat.c
|
||||
*/
|
||||
_zzip_export
|
||||
int zzip_dir_stat(ZZIP_DIR * dir, zzip_char_t* name,
|
||||
ZZIP_STAT * zs, int flags);
|
||||
_zzip_export
|
||||
int zzip_file_stat(ZZIP_FILE * fp, ZZIP_STAT * zs);
|
||||
_zzip_export
|
||||
int zzip_fstat(ZZIP_FILE * fp, ZZIP_STAT * zs);
|
||||
|
||||
#ifdef ZZIP_LARGEFILE_RENAME
|
||||
#define zzip_open_shared_io zzip_open_shared_io64
|
||||
#define zzip_open_ext_io zzip_open_ext_io64
|
||||
#define zzip_opendir_ext_io zzip_opendir_ext_io64
|
||||
#define zzip_dir_open_ext_io zzip_dir_open_ext_io64
|
||||
#define zzip_plugin_io_t zzip_plugin_io64_t
|
||||
#endif
|
||||
|
||||
/*
|
||||
* all ext_io functions can be called with a default of ext/io == zero/zero
|
||||
* which will default to a ".zip" extension and posix io of the system.
|
||||
*/
|
||||
typedef union _zzip_plugin_io _zzip_const * zzip_plugin_io_t;
|
||||
|
||||
_zzip_export
|
||||
ZZIP_FILE * zzip_open_shared_io(ZZIP_FILE* stream,
|
||||
zzip_char_t* name, int o_flags, int o_modes,
|
||||
zzip_strings_t* ext, zzip_plugin_io_t io);
|
||||
|
||||
_zzip_export
|
||||
ZZIP_FILE * zzip_open_ext_io(zzip_char_t* name, int o_flags, int o_modes,
|
||||
zzip_strings_t* ext, zzip_plugin_io_t io);
|
||||
|
||||
_zzip_export
|
||||
ZZIP_DIR * zzip_opendir_ext_io(zzip_char_t* name, int o_modes,
|
||||
zzip_strings_t* ext, zzip_plugin_io_t io);
|
||||
|
||||
_zzip_export
|
||||
ZZIP_DIR * zzip_dir_open_ext_io(zzip_char_t* filename,
|
||||
zzip_error_t* errcode_p,
|
||||
zzip_strings_t* ext, zzip_plugin_io_t io);
|
||||
|
||||
/* zzip_file_open_ext_io => zzip_dir_open_ext_io + zzip_file_open */
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif /* _ZZIPLIB_H */
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* c-file-style: "stroustrup"
|
||||
* End:
|
||||
*/
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue