Files
harbour-core/harbour/external/minizip/minizip.dif
Viktor Szakats ed16ce5c67 2010-06-14 20:45 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* external/minizip/minizip.dif
  * external/minizip/ioapi.h
    + Update for MS-DOS from Tamas Tevesz.

  - contrib/hbqt/qth/QSyntaxHighlighter.qth
    - Deleted to try to fix the SVN update breakage caused by 
      deleting a file and readding it in the same commit on a 
      Windows machine.

  * config/qnx/libs.mk
    + Added x11 libs. QNX supports it, though not the ancient 
      release I have.
2010-06-14 18:45:50 +00:00

492 lines
13 KiB
Plaintext

diff -urN minizip.orig/crypt.h minizip/crypt.h
--- minizip.orig/crypt.h 2009-10-25 22:49:58.000000000 +0100
+++ minizip/crypt.h 2010-06-10 20:03:37.090218606 +0200
@@ -38,6 +38,8 @@
* unpredictable manner on 16-bit systems; not a problem
* with any known compiler so far, though */
+ (void) pcrc_32_tab;
+
temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2;
return (int)(((temp * (temp ^ 1)) >> 8) & 0xff);
}
diff -urN minizip.orig/ioapi.c minizip/ioapi.c
--- minizip.orig/ioapi.c 2010-01-04 10:31:24.000000000 +0100
+++ minizip/ioapi.c 2010-06-10 20:03:37.090218606 +0200
@@ -15,6 +15,7 @@
#endif
#include "ioapi.h"
+#include "hbapifs.h"
voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode)
{
@@ -84,6 +85,9 @@
{
FILE* file = NULL;
const char* mode_fopen = NULL;
+
+ (void) opaque;
+
if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
mode_fopen = "rb";
else
@@ -94,7 +98,7 @@
mode_fopen = "wb";
if ((filename!=NULL) && (mode_fopen != NULL))
- file = fopen(filename, mode_fopen);
+ file = hb_fopen(filename, mode_fopen);
return file;
}
@@ -102,6 +106,9 @@
{
FILE* file = NULL;
const char* mode_fopen = NULL;
+
+ (void) opaque;
+
if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
mode_fopen = "rb";
else
@@ -120,6 +127,9 @@
static uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void* buf, uLong size)
{
uLong ret;
+
+ (void) opaque;
+
ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream);
return ret;
}
@@ -127,6 +137,9 @@
static uLong ZCALLBACK fwrite_file_func (voidpf opaque, voidpf stream, const void* buf, uLong size)
{
uLong ret;
+
+ (void) opaque;
+
ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream);
return ret;
}
@@ -134,6 +147,9 @@
static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream)
{
long ret;
+
+ (void) opaque;
+
ret = ftell((FILE *)stream);
return ret;
}
@@ -142,14 +158,20 @@
static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream)
{
ZPOS64_T ret;
+
+ (void) opaque;
+
ret = ftello64((FILE *)stream);
return ret;
}
static long ZCALLBACK fseek_file_func (voidpf opaque, voidpf stream, uLong offset, int origin)
{
- int fseek_origin=0;
+ int fseek_origin;
long ret;
+
+ (void) opaque;
+
switch (origin)
{
case ZLIB_FILEFUNC_SEEK_CUR :
@@ -171,8 +193,11 @@
static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)
{
- int fseek_origin=0;
+ int fseek_origin;
long ret;
+
+ (void) opaque;
+
switch (origin)
{
case ZLIB_FILEFUNC_SEEK_CUR :
@@ -198,6 +223,9 @@
static int ZCALLBACK fclose_file_func (voidpf opaque, voidpf stream)
{
int ret;
+
+ (void) opaque;
+
ret = fclose((FILE *)stream);
return ret;
}
@@ -205,12 +233,14 @@
static int ZCALLBACK ferror_file_func (voidpf opaque, voidpf stream)
{
int ret;
+
+ (void) opaque;
+
ret = ferror((FILE *)stream);
return ret;
}
-void fill_fopen_filefunc (pzlib_filefunc_def)
- zlib_filefunc_def* pzlib_filefunc_def;
+void fill_fopen_filefunc (zlib_filefunc_def* pzlib_filefunc_def)
{
pzlib_filefunc_def->zopen_file = fopen_file_func;
pzlib_filefunc_def->zread_file = fread_file_func;
diff -urN minizip.orig/ioapi.h minizip/ioapi.h
--- minizip.orig/ioapi.h 2010-02-15 04:59:40.000000000 +0100
+++ minizip/ioapi.h 2010-06-14 20:35:11.840218016 +0200
@@ -21,29 +21,39 @@
#ifndef _ZLIBIOAPI64_H
#define _ZLIBIOAPI64_H
-#if (!defined(_WIN32)) && (!defined(WIN32))
-
- // 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
+#if !(defined(_WIN32) || defined(WIN32)) && \
+ !(defined(__MSDOS__) || defined(MSDOS)) && \
+ !(defined(OS_2) || defined(__OS2__) || defined(OS2)) && \
+ !defined(__WATCOMC__)
+
+ /* 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 <stdio.h>
#include <stdlib.h>
#include "zlib.h"
+#include "hbsetup.h"
+
+#if defined( __BORLANDC__ ) || \
+ defined( __WATCOMC__ ) || \
+ defined( __MINGW32CE__ ) || \
+ defined( HB_OS_BSD ) || \
+ defined( HB_OS_DARWIN ) || \
+ defined( HB_OS_HAIKU ) || \
+ defined( HB_OS_DOS )
+# define USE_FILE32API
+#endif
+
#if defined(USE_FILE32API)
#define fopen64 fopen
#define ftello64 ftell
diff -urN minizip.orig/unzip.c minizip/unzip.c
--- minizip.orig/unzip.c 2010-02-15 04:59:40.000000000 +0100
+++ minizip/unzip.c 2010-06-10 20:04:53.082307519 +0200
@@ -68,13 +68,17 @@
#include <stdlib.h>
#include <string.h>
+/*
#ifndef NOUNCRYPT
#define NOUNCRYPT
#endif
+*/
#include "zlib.h"
#include "unzip.h"
+#include "hbapi.h" /* for hb_xgrab()/hb_xfree() */
+
#ifdef STDC
# include <stddef.h>
# include <string.h>
@@ -109,10 +113,10 @@
#endif
#ifndef ALLOC
-# define ALLOC(size) (malloc(size))
+# define ALLOC(size) hb_xgrab(size)
#endif
#ifndef TRYFREE
-# define TRYFREE(p) {if (p) free(p);}
+# define TRYFREE(p) do {if (p) hb_xfree(p);} while( 0 )
#endif
#define SIZECENTRALDIRITEM (0x2e)
@@ -1090,19 +1094,14 @@
if (lSeek!=0)
{
- if (ZSEEK64(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
- lSeek=0;
- else
+ if (ZSEEK64(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)!=0)
err=UNZ_ERRNO;
}
if ((file_info.size_file_comment>0) && (commentBufferSize>0))
if (ZREAD64(s->z_filefunc, s->filestream,szComment,uSizeRead)!=uSizeRead)
err=UNZ_ERRNO;
- lSeek+=file_info.size_file_comment - uSizeRead;
}
- else
- lSeek+=file_info.size_file_comment;
if ((err==UNZ_OK) && (pfile_info!=NULL))
@@ -1177,7 +1176,7 @@
*/
extern int ZEXPORT unzGoToFirstFile (unzFile file)
{
- int err=UNZ_OK;
+ int err;
unz64_s* s;
if (file==NULL)
return UNZ_PARAMERROR;
@@ -1472,7 +1471,7 @@
extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
int* level, int raw, const char* password)
{
- int err=UNZ_OK;
+ int err;
uInt iSizeVar;
unz64_s* s;
file_in_zip64_read_info_s* pfile_in_zip_read_info;
@@ -1529,6 +1528,7 @@
}
}
+#if 0
if ((s->cur_file_info.compression_method!=0) &&
/* #ifdef HAVE_BZIP2 */
(s->cur_file_info.compression_method!=Z_BZIP2ED) &&
@@ -1536,6 +1536,7 @@
(s->cur_file_info.compression_method!=Z_DEFLATED))
err=UNZ_BADZIPFILE;
+#endif
pfile_in_zip_read_info->crc32_wait=s->cur_file_info.crc;
pfile_in_zip_read_info->crc32=0;
diff -urN minizip.orig/zip.c minizip/zip.c
--- minizip.orig/zip.c 2010-02-15 04:59:40.000000000 +0100
+++ minizip/zip.c 2010-06-10 20:05:03.170219908 +0200
@@ -29,16 +29,20 @@
#include "zlib.h"
#include "zip.h"
+#include "hbapi.h" /* for hb_xgrab()/hb_xfree() */
+
#ifdef STDC
# include <stddef.h>
# include <string.h>
# include <stdlib.h>
#endif
+/*
#ifdef NO_ERRNO_H
extern int errno;
#else
# include <errno.h>
#endif
+*/
#ifndef local
@@ -47,7 +51,16 @@
/* compile with -Dlocal if your debugger can't find static symbols */
#ifndef VERSIONMADEBY
-# define VERSIONMADEBY (0x0) /* platform depedent */
+
+# include "hbdefs.h"
+
+# if defined( HB_OS_UNIX )
+# define VERSIONMADEBY_HI 0x03 /* it's necessary for file attributes in unzip */
+# else
+# define VERSIONMADEBY_HI 0x00
+# endif
+
+# define VERSIONMADEBY (0x14|(VERSIONMADEBY_HI<<8)) /* platform depedent */
#endif
#ifndef Z_BUFSIZE
@@ -59,10 +72,10 @@
#endif
#ifndef ALLOC
-# define ALLOC(size) (malloc(size))
+# define ALLOC(size) hb_xgrab(size)
#endif
#ifndef TRYFREE
-# define TRYFREE(p) {if (p) free(p);}
+# define TRYFREE(p) do {if (p) hb_xfree(p);} while( 0 )
#endif
/*
@@ -186,6 +199,12 @@
#include "crypt.h"
#endif
+/* Forward definitions */
+local linkedlist_datablock_internal* allocate_new_datablock( void );
+local void free_datablock( linkedlist_datablock_internal* ldi );
+local void init_linkedlist( linkedlist_data* ll );
+local int add_data_in_datablock( linkedlist_data* ll, const void* buf, uLong len );
+
local linkedlist_datablock_internal* allocate_new_datablock()
{
linkedlist_datablock_internal* ldi;
@@ -1034,10 +1053,10 @@
// Remember position of Zip64 extended info for the local file header. (needed when we update size after done with file)
zi->ci.pos_zip64extrainfo = ZTELL64(zi->z_filefunc,zi->filestream);
- err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (short)HeaderID,2);
- err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (short)DataSize,2);
+ zip64local_putValue(&zi->z_filefunc, zi->filestream, (short)HeaderID,2);
+ zip64local_putValue(&zi->z_filefunc, zi->filestream, (short)DataSize,2);
- err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)UncompressedSize,8);
+ zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)UncompressedSize,8);
err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)CompressedSize,8);
}
@@ -1064,7 +1083,7 @@
uInt size_filename;
uInt size_comment;
uInt i;
- int err = ZIP_OK;
+ int err;
# ifdef NOCRYPT
if (password != NULL)
@@ -1369,7 +1388,7 @@
uInt i;
int t;
for (i=0;i<zi->ci.pos_in_buffered_data;i++)
- zi->ci.buffered_data[i] = zencode(zi->ci.keys, zi->ci.pcrc_32_tab, zi->ci.buffered_data[i],t);
+ zi->ci.buffered_data[i] = (Byte) zencode(zi->ci.keys, zi->ci.pcrc_32_tab, zi->ci.buffered_data[i],t);
#endif
}
@@ -1470,12 +1489,13 @@
{
uLong uTotalOutBefore = zi->ci.stream.total_out;
err=deflate(&zi->ci.stream, Z_NO_FLUSH);
+/*
if(uTotalOutBefore > zi->ci.stream.total_out)
{
int bBreak = 0;
bBreak++;
}
-
+*/
zi->ci.pos_in_buffered_data += (uInt)(zi->ci.stream.total_out - uTotalOutBefore) ;
}
else
@@ -1533,8 +1553,7 @@
uLong uTotalOutBefore;
if (zi->ci.stream.avail_out == 0)
{
- if (zip64FlushWriteBuffer(zi) == ZIP_ERRNO)
- err = ZIP_ERRNO;
+ zip64FlushWriteBuffer(zi);
zi->ci.stream.avail_out = (uInt)Z_BUFSIZE;
zi->ci.stream.next_out = zi->ci.buffered_data;
}
@@ -1648,7 +1667,7 @@
if(datasize > 0)
{
- char* p = NULL;
+ char* p;
if((uLong)(datasize + 4) > zi->ci.size_centralExtraFree)
{
@@ -1679,7 +1698,9 @@
if(zi->ci.pos_local_header >= 0xffffffff)
{
zip64local_putValue_inmemory(p, zi->ci.pos_local_header, 8);
+/*
p += 8;
+*/
}
// Update how much extra free space we got in the memory buffer
@@ -1696,7 +1717,7 @@
if (err==ZIP_OK)
err = add_data_in_datablock(&zi->central_dir, zi->ci.central_header, (uLong)zi->ci.size_centralheader);
- free(zi->ci.central_header);
+ TRYFREE(zi->ci.central_header);
if (err==ZIP_OK)
{
@@ -1751,7 +1772,7 @@
int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eocd_pos_inzip)
{
- int err = ZIP_OK;
+ int err;
ZPOS64_T pos = zip64eocd_pos_inzip - zi->add_position_when_writting_offset;
err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)ZIP64ENDLOCHEADERMAGIC,4);
@@ -1773,7 +1794,7 @@
int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
{
- int err = ZIP_OK;
+ int err;
uLong Zip64DataSize = 44;
@@ -1812,7 +1833,7 @@
}
int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
{
- int err = ZIP_OK;
+ int err;
/*signature*/
err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)ENDHEADERMAGIC,4);
@@ -1860,7 +1881,7 @@
int Write_GlobalComment(zip64_internal* zi, const char* global_comment)
{
- int err = ZIP_OK;
+ int err;
uInt size_global_comment = 0;
if(global_comment != NULL)
@@ -1954,7 +1975,7 @@
short header;
short dataSize;
- int retVal = ZIP_OK;
+ int retVal;
if(pData == NULL || *dataLen < 4)
return ZIP_PARAMERROR;