diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2013-02-25 13:20:54 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2013-02-25 13:20:54 +0000 |
commit | 1a7dc2ed567b99a7193e526ad80d50d1e01c59cd (patch) | |
tree | 15ebf48d2b61b2dff79e8021109e71b46041f109 /plugins/FTPFileYM/src | |
parent | 6c123a632af944aca0f7df7d46421cb1751ac4c5 (diff) |
zlib now linked dinamicaly
git-svn-id: http://svn.miranda-ng.org/main/trunk@3766 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/FTPFileYM/src')
-rw-r--r-- | plugins/FTPFileYM/src/job_packer.cpp | 4 | ||||
-rw-r--r-- | plugins/FTPFileYM/src/zip/ioapi.c | 51 | ||||
-rw-r--r-- | plugins/FTPFileYM/src/zip/ioapi.h | 5 | ||||
-rw-r--r-- | plugins/FTPFileYM/src/zip/zconf.h | 30 | ||||
-rw-r--r-- | plugins/FTPFileYM/src/zip/zlib.h | 44 |
5 files changed, 82 insertions, 52 deletions
diff --git a/plugins/FTPFileYM/src/job_packer.cpp b/plugins/FTPFileYM/src/job_packer.cpp index 2e81e57c89..51fa387860 100644 --- a/plugins/FTPFileYM/src/job_packer.cpp +++ b/plugins/FTPFileYM/src/job_packer.cpp @@ -141,9 +141,7 @@ int PackerJob::createZipFile() {
int result = ZIP_ERRNO;
- char *filePath = mir_t2a(this->stzFilePath);
- zipFile zf = zipOpen2(filePath, 0, NULL, NULL);
- FREE(filePath);
+ zipFile zf = zipOpen2_64(this->stzFilePath, 0, NULL, NULL);
if (zf != NULL)
{
diff --git a/plugins/FTPFileYM/src/zip/ioapi.c b/plugins/FTPFileYM/src/zip/ioapi.c index 49958f61ff..4219ed1f24 100644 --- a/plugins/FTPFileYM/src/zip/ioapi.c +++ b/plugins/FTPFileYM/src/zip/ioapi.c @@ -10,7 +10,7 @@ */ -#if (defined(_WIN32)) +#if (defined(_WIN32) && !defined(_CRT_SECURE_NO_WARNINGS)) #define _CRT_SECURE_NO_WARNINGS #endif @@ -22,7 +22,7 @@ voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,const void*filename return (*(pfilefunc->zfile_func64.zopen64_file)) (pfilefunc->zfile_func64.opaque,filename,mode); else { - return (*(pfilefunc->zopen32_file))(pfilefunc->zfile_func64.opaque,(const char*)filename,mode); + return (*(pfilefunc->zopen32_file))(pfilefunc->zfile_func64.opaque,(const TCHAR*)filename,mode); } } @@ -32,11 +32,22 @@ long call_zseek64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZP return (*(pfilefunc->zfile_func64.zseek64_file)) (pfilefunc->zfile_func64.opaque,filestream,offset,origin); else { - uLong offsetTruncated = (uLong)offset; - if (offsetTruncated != offset) - return -1; - else - return (*(pfilefunc->zseek32_file))(pfilefunc->zfile_func64.opaque,filestream,offsetTruncated,origin); + if (origin == ZLIB_FILEFUNC_SEEK_SET) + { + uLong offsetTruncated = (uLong)offset; + if (offsetTruncated != offset) + return -1; + else + return (*(pfilefunc->zseek32_file))(pfilefunc->zfile_func64.opaque,filestream,offsetTruncated,origin); + } + else + { + long offsetTruncated = (long)(__int64)offset; + if (offsetTruncated != (__int64)offset) + return -1; + else + return (*(pfilefunc->zseek32_file))(pfilefunc->zfile_func64.opaque,filestream,offsetTruncated,origin); + } } } @@ -72,7 +83,7 @@ void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filef -static voidpf ZCALLBACK fopen_file_func OF((voidpf opaque, const char* filename, int mode)); +static voidpf ZCALLBACK fopen_file_func OF((voidpf opaque, const TCHAR* filename, int mode)); static uLong ZCALLBACK fread_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size)); static uLong ZCALLBACK fwrite_file_func OF((voidpf opaque, voidpf stream, const void* buf,uLong size)); static ZPOS64_T ZCALLBACK ftell64_file_func OF((voidpf opaque, voidpf stream)); @@ -80,39 +91,39 @@ static long ZCALLBACK fseek64_file_func OF((voidpf opaque, voidpf stream, ZPO static int ZCALLBACK fclose_file_func OF((voidpf opaque, voidpf stream)); static int ZCALLBACK ferror_file_func OF((voidpf opaque, voidpf stream)); -static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, int mode) +static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const TCHAR* filename, int mode) { FILE* file = NULL; - const char* mode_fopen = NULL; + const TCHAR* mode_fopen = NULL; if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ) - mode_fopen = "rb"; + mode_fopen = _T("rb"); else if (mode & ZLIB_FILEFUNC_MODE_EXISTING) - mode_fopen = "r+b"; + mode_fopen = _T("r+b"); else if (mode & ZLIB_FILEFUNC_MODE_CREATE) - mode_fopen = "wb"; + mode_fopen = _T("wb"); if ((filename!=NULL) && (mode_fopen != NULL)) - file = fopen(filename, mode_fopen); + file = _tfopen(filename, mode_fopen); return file; } static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename, int mode) { FILE* file = NULL; - const char* mode_fopen = NULL; + const TCHAR* mode_fopen = NULL; if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ) - mode_fopen = "rb"; + mode_fopen = _T("rb"); else if (mode & ZLIB_FILEFUNC_MODE_EXISTING) - mode_fopen = "r+b"; + mode_fopen = _T("r+b"); else if (mode & ZLIB_FILEFUNC_MODE_CREATE) - mode_fopen = "wb"; + mode_fopen = _T("wb"); if ((filename!=NULL) && (mode_fopen != NULL)) - file = fopen64((const char*)filename, mode_fopen); + file = _tfopen((const TCHAR*)filename, mode_fopen); return file; } @@ -188,7 +199,7 @@ static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T } ret = 0; - if(fseeko64((FILE *)stream, offset, fseek_origin) != 0) + if (fseeko64((FILE *)stream, offset, fseek_origin) != 0) ret = -1; return ret; diff --git a/plugins/FTPFileYM/src/zip/ioapi.h b/plugins/FTPFileYM/src/zip/ioapi.h index 8309c4cf8f..3fc4d0324b 100644 --- a/plugins/FTPFileYM/src/zip/ioapi.h +++ b/plugins/FTPFileYM/src/zip/ioapi.h @@ -40,6 +40,7 @@ #endif #endif +#include <tchar.h> #include <stdio.h> #include <stdlib.h> #include "zlib.h" @@ -56,7 +57,7 @@ #define fseeko64 _fseeki64 #else // old MSC #define ftello64 ftell - #define fseeko64 fseek + #define fseeko64(a, b, c) fseek(a, (long)b, c) #endif #endif #endif @@ -124,7 +125,7 @@ extern "C" { -typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode)); +typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const TCHAR* filename, int mode)); typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size)); typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size)); typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream)); diff --git a/plugins/FTPFileYM/src/zip/zconf.h b/plugins/FTPFileYM/src/zip/zconf.h index 58880245c1..02ce56c431 100644 --- a/plugins/FTPFileYM/src/zip/zconf.h +++ b/plugins/FTPFileYM/src/zip/zconf.h @@ -315,10 +315,6 @@ # endif #endif -#ifdef HAVE_VISIBILITY_PRAGMA -# define ZEXTERN __attribute__((visibility ("default"))) extern -#endif - #ifndef ZEXTERN # define ZEXTERN extern #endif @@ -364,8 +360,21 @@ typedef uLong FAR uLongf; # define Z_HAVE_UNISTD_H #endif -#ifdef Z_HAVE_UNISTD_H +#ifdef STDC # include <sys/types.h> /* for off_t */ +#endif + +/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and + * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even + * though the former does not conform to the LFS document), but considering + * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as + * equivalently requesting no 64-bit operations + */ +#if -_LARGEFILE64_SOURCE - -1 == 1 +# undef _LARGEFILE64_SOURCE +#endif + +#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) # include <unistd.h> /* for SEEK_* and off_t */ # ifdef VMS # include <unixio.h> /* for off_t */ @@ -375,19 +384,22 @@ typedef uLong FAR uLongf; # endif #endif -#ifdef _LARGEFILE64_SOURCE -# include <sys/types.h> -#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(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 +# define z_off64_t off64_t +#else +# define z_off64_t z_off_t +#endif + #if defined(__OS400__) # define NO_vsnprintf #endif diff --git a/plugins/FTPFileYM/src/zip/zlib.h b/plugins/FTPFileYM/src/zip/zlib.h index f5785be7e0..bfbba83e8e 100644 --- a/plugins/FTPFileYM/src/zip/zlib.h +++ b/plugins/FTPFileYM/src/zip/zlib.h @@ -1,5 +1,5 @@ /* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.2.4, Mar 14th, 2010 + version 1.2.5, April 19th, 2010 Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler @@ -37,11 +37,11 @@ extern "C" { #endif -#define ZLIB_VERSION "1.2.4" -#define ZLIB_VERNUM 0x1240 +#define ZLIB_VERSION "1.2.5" +#define ZLIB_VERNUM 0x1250 #define ZLIB_VER_MAJOR 1 #define ZLIB_VER_MINOR 2 -#define ZLIB_VER_REVISION 4 +#define ZLIB_VER_REVISION 5 #define ZLIB_VER_SUBREVISION 0 /* @@ -1556,29 +1556,35 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, inflateBackInit_((strm), (windowBits), (window), \ ZLIB_VERSION, sizeof(z_stream)) -#ifdef _LARGEFILE64_SOURCE +/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or + * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if + * both are true, the application gets the *64 functions, and the regular + * functions are changed to 64 bits) -- in case these are set on systems + * without large file support, _LFS64_LARGEFILE must also be true + */ +#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); - ZEXTERN off64_t ZEXPORT gzseek64 OF((gzFile, off64_t, int)); - ZEXTERN off64_t ZEXPORT gztell64 OF((gzFile)); - ZEXTERN off64_t ZEXPORT gzoffset64 OF((gzFile)); - ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, off64_t)); - ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, off64_t)); + ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); + ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); + ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); + ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t)); + ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); #endif -#if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS == 64 +#if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFILE-0 # define gzopen gzopen64 # define gzseek gzseek64 # define gztell gztell64 # define gzoffset gzoffset64 # define adler32_combine adler32_combine64 # define crc32_combine crc32_combine64 -# ifndef _LARGEFILE64_SOURCE +# ifdef _LARGEFILE64_SOURCE ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); - ZEXTERN off_t ZEXPORT gzseek64 OF((gzFile, off_t, int)); - ZEXTERN off_t ZEXPORT gztell64 OF((gzFile)); - ZEXTERN off_t ZEXPORT gzoffset64 OF((gzFile)); - ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, off_t)); - ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, off_t)); + ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int)); + ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile)); + ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile)); + ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); # endif #else ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *)); @@ -1589,10 +1595,12 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); #endif +/* hack for buggy compilers */ #if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) - struct internal_state {int dummy;}; /* hack for buggy compilers */ + struct internal_state {int dummy;}; #endif +/* undocumented functions */ ZEXTERN const char * ZEXPORT zError OF((int)); ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); |