From 7bb2ea4ae502ace95703bb71fc4f9e18febaf765 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Mon, 12 Apr 2010 19:11:35 +0000 Subject: [PATCH] 2010-04-12 21:11 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * 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 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 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. --- harbour/ChangeLog | 44 ++++++++++++++++++++++++++++++ harbour/contrib/hbmzip/hbmzip.c | 4 +-- harbour/contrib/hbmzip/ioapi.c | 3 +- harbour/contrib/hbmzip/ioapi.h | 29 +++++++++----------- harbour/external/libhpdf/hpdfcfg.h | 2 +- harbour/external/zlib/Makefile | 1 - harbour/external/zlib/deflate.c | 2 +- harbour/external/zlib/gzguts.h | 12 ++++++-- harbour/external/zlib/gzread.c | 16 +++++------ harbour/external/zlib/zconf.h | 2 -- harbour/external/zlib/zutil.h | 3 +- 11 files changed, 81 insertions(+), 37 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 24c64aad1b..7759003b7c 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,50 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-04-12 21:11 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * 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 + 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 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. + 2010-04-12 11:08 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * utils/hbmk2/hbmk2.prg + Added feature to allow -inc mode when using harbour compiler diff --git a/harbour/contrib/hbmzip/hbmzip.c b/harbour/contrib/hbmzip/hbmzip.c index a64644267a..82b71b5501 100644 --- a/harbour/contrib/hbmzip/hbmzip.c +++ b/harbour/contrib/hbmzip/hbmzip.c @@ -102,7 +102,7 @@ static const HB_GC_FUNCS s_gcZipFileFuncs = }; -static gzFile hb_zipfileParam( int iParam ) +static zipFile hb_zipfileParam( int iParam ) { zipFile* phZip = ( zipFile* ) hb_parptrGC( &s_gcZipFileFuncs, iParam ); @@ -132,7 +132,7 @@ static const HB_GC_FUNCS s_gcUnZipFileFuncs = }; -static gzFile hb_unzipfileParam( int iParam ) +static unzFile hb_unzipfileParam( int iParam ) { unzFile* phUnzip = ( unzFile* ) hb_parptrGC( &s_gcUnZipFileFuncs, iParam ); diff --git a/harbour/contrib/hbmzip/ioapi.c b/harbour/contrib/hbmzip/ioapi.c index 5b097dddcc..044cfbc48f 100644 --- a/harbour/contrib/hbmzip/ioapi.c +++ b/harbour/contrib/hbmzip/ioapi.c @@ -14,9 +14,8 @@ #define _CRT_SECURE_NO_WARNINGS #endif -#include "hbapifs.h" - #include "ioapi.h" +#include "hbapifs.h" voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode) { diff --git a/harbour/contrib/hbmzip/ioapi.h b/harbour/contrib/hbmzip/ioapi.h index 7011232028..a43fd09339 100644 --- a/harbour/contrib/hbmzip/ioapi.h +++ b/harbour/contrib/hbmzip/ioapi.h @@ -21,23 +21,20 @@ #ifndef _ZLIBIOAPI64_H #define _ZLIBIOAPI64_H -#if (!defined(_WIN32)) && (!defined(WIN32)) +#if !(defined(_WIN32) || defined(WIN32)) && \ + !(defined(__MSDOS__) || defined(MSDOS)) && \ + !(defined(OS_2) || defined(__OS2__) || defined(OS2)) - // Linux needs this to support file operation on files larger then 4+GB - // But might need better if/def to select just the platforms that needs them. - - #ifndef __USE_FILE_OFFSET64 - #define __USE_FILE_OFFSET64 - #endif - #ifndef __USE_LARGEFILE64 - #define __USE_LARGEFILE64 - #endif - #ifndef _LARGEFILE64_SOURCE - #define _LARGEFILE64_SOURCE - #endif - #ifndef _FILE_OFFSET_BIT - #define _FILE_OFFSET_BIT 64 - #endif + /* Linux needs this to support file operation on files larger then 4+GB + * on 32bit platforms + * But might need better if/def to select just the platforms that needs them. + */ + #ifndef _LARGEFILE64_SOURCE + #define _LARGEFILE64_SOURCE + #endif + #ifndef _FILE_OFFSET_BIT + #define _FILE_OFFSET_BIT 64 + #endif #endif #include diff --git a/harbour/external/libhpdf/hpdfcfg.h b/harbour/external/libhpdf/hpdfcfg.h index d4526cdf1a..2c7469b031 100644 --- a/harbour/external/libhpdf/hpdfcfg.h +++ b/harbour/external/libhpdf/hpdfcfg.h @@ -34,7 +34,7 @@ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 +#undef HAVE_UNISTD_H /* define pi */ #ifndef M_PI diff --git a/harbour/external/zlib/Makefile b/harbour/external/zlib/Makefile index fb7ceac074..24354c1c53 100644 --- a/harbour/external/zlib/Makefile +++ b/harbour/external/zlib/Makefile @@ -8,7 +8,6 @@ include $(TOP)$(ROOT)config/global.mk LIBNAME := hbzlib -HB_BUILD_WARN := no HB_BUILD_MODE := c C_SOURCES := \ diff --git a/harbour/external/zlib/deflate.c b/harbour/external/zlib/deflate.c index 0884cf391a..7ad245f667 100644 --- a/harbour/external/zlib/deflate.c +++ b/harbour/external/zlib/deflate.c @@ -1748,7 +1748,7 @@ local block_state deflate_rle(s, flush) int flush; { int bflush; /* set if current block must be flushed */ - uInt prev; /* byte at distance one to match */ + Byte prev; /* byte at distance one to match */ Bytef *scan, *strend; /* scan goes up to strend for length of run */ for (;;) { diff --git a/harbour/external/zlib/gzguts.h b/harbour/external/zlib/gzguts.h index 0e7ed4330a..6a19db4730 100644 --- a/harbour/external/zlib/gzguts.h +++ b/harbour/external/zlib/gzguts.h @@ -27,9 +27,15 @@ # define NO_GZCOMPRESS #endif -#ifdef _MSC_VER -# include -# define vsnprintf _vsnprintf +#if defined(MSDOS) || defined(OS2) || defined(WINDOWS) || defined(WIN32) +# ifndef _WINCE +# include +# if defined(_MSC_VER) && !defined(__XCC__) +# define vsnprintf _vsnprintf +# endif +# endif +#else +# include #endif #ifndef local diff --git a/harbour/external/zlib/gzread.c b/harbour/external/zlib/gzread.c index 434ef023e0..90354404ef 100644 --- a/harbour/external/zlib/gzread.c +++ b/harbour/external/zlib/gzread.c @@ -166,12 +166,12 @@ local int gz_head(state) gz_error(state, Z_DATA_ERROR, "unknown header flags set"); return -1; } - NEXT(); /* modification time */ - NEXT(); - NEXT(); - NEXT(); - NEXT(); /* extra flags */ - NEXT(); /* operating system */ + (void) NEXT(); /* modification time */ + (void) NEXT(); + (void) NEXT(); + (void) NEXT(); + (void) NEXT(); /* extra flags */ + (void) NEXT(); /* operating system */ if (flags & 4) { /* extra field */ len = (unsigned)NEXT(); len += (unsigned)NEXT() << 8; @@ -186,8 +186,8 @@ local int gz_head(state) while (NEXT() > 0) ; if (flags & 2) { /* header crc */ - NEXT(); - NEXT(); + (void) NEXT(); + (void) NEXT(); } /* an unexpected end of file is not checked for here -- it will be noticed on the first request for uncompressed data */ diff --git a/harbour/external/zlib/zconf.h b/harbour/external/zlib/zconf.h index 995f9eed7a..dad365a60c 100644 --- a/harbour/external/zlib/zconf.h +++ b/harbour/external/zlib/zconf.h @@ -371,11 +371,9 @@ typedef uLong FAR uLongf; typedef Byte *voidp; #endif -#if 0 #ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */ # define Z_HAVE_UNISTD_H #endif -#endif #ifdef Z_HAVE_UNISTD_H # include /* for off_t */ diff --git a/harbour/external/zlib/zutil.h b/harbour/external/zlib/zutil.h index 311398a5f4..0697b4156a 100644 --- a/harbour/external/zlib/zutil.h +++ b/harbour/external/zlib/zutil.h @@ -217,7 +217,8 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ # ifdef WIN32 /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ # if !defined(vsnprintf) && !defined(NO_vsnprintf) -# if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 ) +# if !defined(_MSC_VER) || \ + ( defined(_MSC_VER) && _MSC_VER < 1500 && !defined(__XCC__) ) # define vsnprintf _vsnprintf # endif # endif