* harbour/external/zlib/deflate.c
* harbour/external/zlib/gzread.c
* pacified warnings
* harbour/external/zlib/zutil.h
! fixed to compile with XCC
* harbour/external/zlib/zconf.h
! removed wrongly added #if 0 / #endif
* harbour/external/zlib/gzguts.h
! added missing header files to fix _ALL_ builds
* harbour/external/zlib/Makefile
* reenabled warnings - it's very danger to pacify warnings in such way
what recent ZLIB update clearly shows - it was seriously broken in all
builds due to missing header files with valid function declarations
but the problem was fully hidden because C++ mode and warnings were
disabled so no problem was reported at compile time.
Please also remember that many of Windows compilers does not fully
support pure ANSI C function declaration so this new library may
not work as expected.
* harbour/external/libhpdf/hpdfcfg.h
! removed setting for all platforms HAVE_UNISTD_H
this file was generated by autoconf on platform which has <unistd.h>
but we cannot leave it because it will break all code which uses
standard autoconf settings like HAVE_UNISTD_H and is compiled
on platform where <unistd.h> is not available
* harbour/contrib/hbmzip/ioapi.c
! fixed to include ioapi.h before any other header files - it uses
some feature macros which have to be set before including standard
C files
* harbour/contrib/hbmzip/ioapi.h
! removed from feature set macros setting of internal __USE_* ones
! do not set _LARGEFILE64_SOURCE in DOS and OS2 - macro with the same
name is used by new ZLIB 1.2.4 for explicit 64 bit gzip API.
* harbour/contrib/hbmzip/hbmzip.c
! fixed old typos in type of return value in hb_zipfileParam() and
hb_unzipfileParam()
NOTE: I haven't tested if this new mzip/zlib 64 bit file IO support
works. It's even possible that previously working code in 64 bit
platforms (except Win64 on all other 64 bit platforms 'long' is
64bit integer) stopped to work so please make real tests.
139 lines
4.5 KiB
C
139 lines
4.5 KiB
C
/* gzguts.h -- zlib internal header definitions for gz* operations
|
|
* Copyright (C) 2004, 2005, 2010 Mark Adler
|
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
|
*/
|
|
|
|
#ifdef _LARGEFILE64_SOURCE
|
|
# ifndef _LARGEFILE_SOURCE
|
|
# define _LARGEFILE_SOURCE
|
|
# endif
|
|
# ifdef _FILE_OFFSET_BITS
|
|
# undef _FILE_OFFSET_BITS
|
|
# endif
|
|
#endif
|
|
|
|
#define ZLIB_INTERNAL
|
|
|
|
#include <stdio.h>
|
|
#include "zlib.h"
|
|
#ifdef STDC
|
|
# include <string.h>
|
|
# include <stdlib.h>
|
|
# include <limits.h>
|
|
#endif
|
|
#include <fcntl.h>
|
|
|
|
#ifdef NO_DEFLATE /* for compatibility with old definition */
|
|
# define NO_GZCOMPRESS
|
|
#endif
|
|
|
|
#if defined(MSDOS) || defined(OS2) || defined(WINDOWS) || defined(WIN32)
|
|
# ifndef _WINCE
|
|
# include <io.h>
|
|
# if defined(_MSC_VER) && !defined(__XCC__)
|
|
# define vsnprintf _vsnprintf
|
|
# endif
|
|
# endif
|
|
#else
|
|
# include <unistd.h>
|
|
#endif
|
|
|
|
#ifndef local
|
|
# define local static
|
|
#endif
|
|
/* compile with -Dlocal if your debugger can't find static symbols */
|
|
|
|
/* gz* functions always use library allocation functions */
|
|
#ifndef STDC
|
|
extern voidp malloc OF((uInt size));
|
|
extern void free OF((voidpf ptr));
|
|
#endif
|
|
|
|
/* get errno and strerror definition */
|
|
#if defined UNDER_CE && defined NO_ERRNO_H
|
|
# include <windows.h>
|
|
# define zstrerror() gz_strwinerror((DWORD)GetLastError())
|
|
#else
|
|
# ifdef STDC
|
|
# include <errno.h>
|
|
# define zstrerror() strerror(errno)
|
|
# else
|
|
# define zstrerror() "stdio error (consult errno)"
|
|
# endif
|
|
#endif
|
|
|
|
/* MVS fdopen() */
|
|
#ifdef __MVS__
|
|
#pragma map (fdopen , "\174\174FDOPEN")
|
|
FILE *fdopen(int, const char *);
|
|
#endif
|
|
|
|
#ifdef _LARGEFILE64_SOURCE
|
|
# define z_off64_t off64_t
|
|
#else
|
|
# define z_off64_t z_off_t
|
|
#endif
|
|
|
|
/* default i/o buffer size -- double this for output when reading */
|
|
#define GZBUFSIZE 8192
|
|
|
|
/* gzip modes, also provide a little integrity check on the passed structure */
|
|
#define GZ_NONE 0
|
|
#define GZ_READ 7247
|
|
#define GZ_WRITE 31153
|
|
#define GZ_APPEND 1 /* mode set to GZ_WRITE after the file is opened */
|
|
|
|
/* values for gz_state how */
|
|
#define LOOK 0 /* look for a gzip header */
|
|
#define COPY 1 /* copy input directly */
|
|
#define GZIP 2 /* decompress a gzip stream */
|
|
|
|
/* internal gzip file state data structure */
|
|
typedef struct {
|
|
/* used for both reading and writing */
|
|
int mode; /* see gzip modes above */
|
|
int fd; /* file descriptor */
|
|
char *path; /* path or fd for error messages */
|
|
z_off64_t pos; /* current position in uncompressed data */
|
|
unsigned size; /* buffer size, zero if not allocated yet */
|
|
unsigned want; /* requested buffer size, default is GZBUFSIZE */
|
|
unsigned char *in; /* input buffer */
|
|
unsigned char *out; /* output buffer (double-sized when reading) */
|
|
unsigned char *next; /* next output data to deliver or write */
|
|
/* just for reading */
|
|
unsigned have; /* amount of output data unused at next */
|
|
int eof; /* true if end of input file reached */
|
|
z_off64_t start; /* where the gzip data started, for rewinding */
|
|
z_off64_t raw; /* where the raw data started, for seeking */
|
|
int how; /* 0: get header, 1: copy, 2: decompress */
|
|
int direct; /* true if last read direct, false if gzip */
|
|
/* just for writing */
|
|
int level; /* compression level */
|
|
int strategy; /* compression strategy */
|
|
/* seek request */
|
|
z_off64_t skip; /* amount to skip (already rewound if backwards) */
|
|
int seek; /* true if seek request pending */
|
|
/* error information */
|
|
int err; /* error code */
|
|
char *msg; /* error message */
|
|
/* zlib inflate or deflate stream */
|
|
z_stream strm; /* stream structure in-place (not a pointer) */
|
|
} gz_state;
|
|
typedef gz_state FAR *gz_statep;
|
|
|
|
/* shared functions */
|
|
ZEXTERN void ZEXPORT gz_error OF((gz_statep, int, const char *));
|
|
#if defined UNDER_CE && defined NO_ERRNO_H
|
|
ZEXTERN char ZEXPORT *gz_strwinerror OF((DWORD error));
|
|
#endif
|
|
|
|
/* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t
|
|
value -- needed when comparing unsigned to z_off64_t, which is signed
|
|
(possible z_off64_t types off_t, off64_t, and long are all signed) */
|
|
#ifdef INT_MAX
|
|
# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX)
|
|
#else
|
|
ZEXTERN unsigned ZEXPORT gz_intmax OF((void));
|
|
# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax())
|
|
#endif
|