Fixed use of 64 bit I/O APIs
This commit is contained in:
+14
-3
@@ -16,6 +16,17 @@
|
||||
|
||||
#include "ioapi.h"
|
||||
|
||||
#if defined(__APPLE__) || defined(IOAPI_NO_64)
|
||||
// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
|
||||
#define FOPEN64(filename, mode) fopen(filename, mode)
|
||||
#define FTELLO64(stream) ftello(stream)
|
||||
#define FSEEKO64(stream, offset, origin) fseeko(stream, offset, origin)
|
||||
#else
|
||||
#define FOPEN64(filename, mode) fopen64(filename, mode)
|
||||
#define FTELLO64(stream) ftello64(stream)
|
||||
#define FSEEKO64(stream, offset, origin) fseeko64(stream, offset, origin)
|
||||
#endif
|
||||
|
||||
voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode)
|
||||
{
|
||||
if (pfilefunc->zfile_func64.zopen64_file != NULL)
|
||||
@@ -112,7 +123,7 @@ static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename,
|
||||
mode_fopen = "wb";
|
||||
|
||||
if ((filename!=NULL) && (mode_fopen != NULL))
|
||||
file = fopen64((const char*)filename, mode_fopen);
|
||||
file = FOPEN64((const char*)filename, mode_fopen);
|
||||
return file;
|
||||
}
|
||||
|
||||
@@ -142,7 +153,7 @@ static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream)
|
||||
static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream)
|
||||
{
|
||||
ZPOS64_T ret;
|
||||
ret = ftello64((FILE *)stream);
|
||||
ret = FTELLO64((FILE *)stream);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
+1
-5
@@ -21,7 +21,7 @@
|
||||
#ifndef _ZLIBIOAPI64_H
|
||||
#define _ZLIBIOAPI64_H
|
||||
|
||||
#if (!defined(_WIN32)) && (!defined(WIN32))
|
||||
#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__))
|
||||
|
||||
// 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.
|
||||
@@ -44,10 +44,6 @@
|
||||
#include <stdlib.h>
|
||||
#include "zlib.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
# define USE_FILE32API
|
||||
#endif
|
||||
|
||||
#if defined(USE_FILE32API)
|
||||
#define fopen64 fopen
|
||||
#define ftello64 ftell
|
||||
|
||||
Reference in New Issue
Block a user