ftello64 -> ftell and fopen64 -> fopen (to make Mac OSX happy)

disable some warning (no idea why weak_link is there)
This commit is contained in:
Erwin Coumans
2014-02-04 14:52:57 -08:00
parent 2a87706114
commit db188990fc
2 changed files with 17 additions and 5 deletions

View File

@@ -98,6 +98,7 @@ static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, in
return file; return file;
} }
static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename, int mode) static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename, int mode)
{ {
FILE* file = NULL; FILE* file = NULL;
@@ -112,11 +113,15 @@ static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename,
mode_fopen = "wb"; mode_fopen = "wb";
if ((filename!=NULL) && (mode_fopen != NULL)) if ((filename!=NULL) && (mode_fopen != NULL))
file = fopen64((const char*)filename, mode_fopen); // file = fopen64((const char*)filename, mode_fopen);
file = fopen((const char*)filename, mode_fopen);
return file; return file;
} }
static uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void* buf, uLong size) static uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void* buf, uLong size)
{ {
uLong ret; uLong ret;
@@ -142,7 +147,9 @@ static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream)
static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream) static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream)
{ {
ZPOS64_T ret; ZPOS64_T ret;
ret = ftello64((FILE *)stream); ret = ftell((FILE *)stream);
// ret = ftello64((FILE *)stream);
return ret; return ret;
} }
@@ -188,7 +195,9 @@ static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T
} }
ret = 0; ret = 0;
if(fseeko64((FILE *)stream, offset, fseek_origin) != 0) if(fseek((FILE *)stream, offset, fseek_origin) != 0)
// if(fseeko64((FILE *)stream, offset, fseek_origin) != 0)
ret = -1; ret = -1;
return ret; return ret;
@@ -222,6 +231,7 @@ void fill_fopen_filefunc (pzlib_filefunc_def)
pzlib_filefunc_def->opaque = NULL; pzlib_filefunc_def->opaque = NULL;
} }
void fill_fopen64_filefunc (zlib_filefunc64_def* pzlib_filefunc_def) void fill_fopen64_filefunc (zlib_filefunc64_def* pzlib_filefunc_def)
{ {
pzlib_filefunc_def->zopen64_file = fopen64_file_func; pzlib_filefunc_def->zopen64_file = fopen64_file_func;
@@ -233,3 +243,4 @@ void fill_fopen64_filefunc (zlib_filefunc64_def* pzlib_filefunc_def)
pzlib_filefunc_def->zerror_file = ferror_file_func; pzlib_filefunc_def->zerror_file = ferror_file_func;
pzlib_filefunc_def->opaque = NULL; pzlib_filefunc_def->opaque = NULL;
} }

View File

@@ -72,8 +72,9 @@ extern "C" {
#define CL_API_CALL #define CL_API_CALL
#define CL_CALLBACK #define CL_CALLBACK
#endif #endif
//disabled the APPLE thing, don't know why it is there, is just causes tons of warnings
#ifdef __APPLE__ #ifdef __APPLE1__
#define CL_EXTENSION_WEAK_LINK __attribute__((weak_import)) #define CL_EXTENSION_WEAK_LINK __attribute__((weak_import))
#define CL_API_SUFFIX__VERSION_1_0 AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER #define CL_API_SUFFIX__VERSION_1_0 AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
#define CL_EXT_SUFFIX__VERSION_1_0 CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER #define CL_EXT_SUFFIX__VERSION_1_0 CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER