Revert "fix Mac OSX build (and remove 'weak link' warning)"

This reverts commit 146bbefc03.
This commit is contained in:
Erwin Coumans 2014-02-04 14:44:16 -08:00
parent 146bbefc03
commit 2a87706114
4 changed files with 35 additions and 7 deletions

View File

@ -98,6 +98,23 @@ static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, in
return file;
}
static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename, int mode)
{
FILE* file = NULL;
const char* mode_fopen = NULL;
if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
mode_fopen = "rb";
else
if (mode & ZLIB_FILEFUNC_MODE_EXISTING)
mode_fopen = "r+b";
else
if (mode & ZLIB_FILEFUNC_MODE_CREATE)
mode_fopen = "wb";
if ((filename!=NULL) && (mode_fopen != NULL))
file = fopen64((const char*)filename, mode_fopen);
return file;
}
static uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void* buf, uLong size)
@ -205,3 +222,14 @@ void fill_fopen_filefunc (pzlib_filefunc_def)
pzlib_filefunc_def->opaque = NULL;
}
void fill_fopen64_filefunc (zlib_filefunc64_def* pzlib_filefunc_def)
{
pzlib_filefunc_def->zopen64_file = fopen64_file_func;
pzlib_filefunc_def->zread_file = fread_file_func;
pzlib_filefunc_def->zwrite_file = fwrite_file_func;
pzlib_filefunc_def->ztell64_file = ftell64_file_func;
pzlib_filefunc_def->zseek64_file = fseek64_file_func;
pzlib_filefunc_def->zclose_file = fclose_file_func;
pzlib_filefunc_def->zerror_file = ferror_file_func;
pzlib_filefunc_def->opaque = NULL;
}

View File

@ -605,9 +605,9 @@ local unzFile unzOpenInternal (const void *path,
us.z_filefunc.zseek32_file = NULL;
us.z_filefunc.ztell32_file = NULL;
// if (pzlib_filefunc64_32_def==NULL)
// fill_fopen64_filefunc(&us.z_filefunc.zfile_func64);
//else
if (pzlib_filefunc64_32_def==NULL)
fill_fopen64_filefunc(&us.z_filefunc.zfile_func64);
else
us.z_filefunc = *pzlib_filefunc64_32_def;
us.is64bitOpenFunction = is64bitOpenFunction;

View File

@ -854,9 +854,9 @@ extern zipFile ZEXPORT zipOpen3 (const void *pathname, int append, zipcharpc* gl
ziinit.z_filefunc.zseek32_file = NULL;
ziinit.z_filefunc.ztell32_file = NULL;
// if (pzlib_filefunc64_32_def==NULL)
// fill_fopen64_filefunc(&ziinit.z_filefunc.zfile_func64);
// else
if (pzlib_filefunc64_32_def==NULL)
fill_fopen64_filefunc(&ziinit.z_filefunc.zfile_func64);
else
ziinit.z_filefunc = *pzlib_filefunc64_32_def;
ziinit.filestream = ZOPEN64(ziinit.z_filefunc,

View File

@ -73,7 +73,7 @@ extern "C" {
#define CL_CALLBACK
#endif
#ifdef __APPLE1__
#ifdef __APPLE__
#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_EXT_SUFFIX__VERSION_1_0 CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER