From 7e8c968bba72160a1f670ffd016cb9ca3ed9fc80 Mon Sep 17 00:00:00 2001 From: James Addison Date: Fri, 17 Nov 2023 15:23:04 +0000 Subject: Manually re-apply diff: ioapi.c --- src/minizip/ioapi.c | 11 ++++++++++- src/minizip/ioapi.c.diff | 40 +++++++++++----------------------------- 2 files changed, 21 insertions(+), 30 deletions(-) diff --git a/src/minizip/ioapi.c b/src/minizip/ioapi.c index 782d324..3a594b8 100644 --- a/src/minizip/ioapi.c +++ b/src/minizip/ioapi.c @@ -14,7 +14,7 @@ #define _CRT_SECURE_NO_WARNINGS #endif -#if defined(__APPLE__) || defined(IOAPI_NO_64) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64) +#if defined(__APPLE__) || defined(__ANDROID__) || defined(IOAPI_NO_64) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_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 FOPEN_FUNC(filename, mode) fopen(filename, mode) #define FTELLO_FUNC(stream) ftello(stream) @@ -68,6 +68,7 @@ void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filef p_filefunc64_32->zopen32_file = p_filefunc32->zopen_file; p_filefunc64_32->zfile_func64.zread_file = p_filefunc32->zread_file; p_filefunc64_32->zfile_func64.zwrite_file = p_filefunc32->zwrite_file; + p_filefunc64_32->zfile_func64.zflush_file = p_filefunc32->zflush_file; p_filefunc64_32->zfile_func64.ztell64_file = NULL; p_filefunc64_32->zfile_func64.zseek64_file = NULL; p_filefunc64_32->zfile_func64.zclose_file = p_filefunc32->zclose_file; @@ -193,6 +194,12 @@ static long ZCALLBACK fseek64_file_func(voidpf opaque, voidpf stream, ZPOS64_T o return ret; } +static int ZCALLBACK fflush_file_func (voidpf opaque, voidpf stream) +{ + int ret; + ret = fflush((FILE *)stream); + return ret; +} static int ZCALLBACK fclose_file_func(voidpf opaque, voidpf stream) { int ret; @@ -214,6 +221,7 @@ void fill_fopen_filefunc(zlib_filefunc_def* pzlib_filefunc_def) { pzlib_filefunc_def->zwrite_file = fwrite_file_func; pzlib_filefunc_def->ztell_file = ftell_file_func; pzlib_filefunc_def->zseek_file = fseek_file_func; + pzlib_filefunc_def->zflush_file = fflush_file_func; pzlib_filefunc_def->zclose_file = fclose_file_func; pzlib_filefunc_def->zerror_file = ferror_file_func; pzlib_filefunc_def->opaque = NULL; @@ -225,6 +233,7 @@ void fill_fopen64_filefunc(zlib_filefunc64_def* pzlib_filefunc_def) { 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->zflush_file = fflush_file_func; pzlib_filefunc_def->zclose_file = fclose_file_func; pzlib_filefunc_def->zerror_file = ferror_file_func; pzlib_filefunc_def->opaque = NULL; diff --git a/src/minizip/ioapi.c.diff b/src/minizip/ioapi.c.diff index c42c349..ba93c23 100644 --- a/src/minizip/ioapi.c.diff +++ b/src/minizip/ioapi.c.diff @@ -1,32 +1,23 @@ ---- ioapi.c.orig 2014-06-10 18:55:32.778807408 +0200 -+++ ioapi.c 2014-06-22 12:22:06.606696274 +0200 +--- ioapi.c.orig 2023-11-17 16:21:50.355864777 +0000 ++++ ioapi.c 2023-11-17 16:21:50.355864777 +0000 @@ -14,7 +14,7 @@ #define _CRT_SECURE_NO_WARNINGS #endif --#if defined(__APPLE__) || defined(IOAPI_NO_64) -+#if defined(__APPLE__) || defined(__ANDROID__) || defined(IOAPI_NO_64) +-#if defined(__APPLE__) || defined(IOAPI_NO_64) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64) ++#if defined(__APPLE__) || defined(__ANDROID__) || defined(IOAPI_NO_64) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_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 FOPEN_FUNC(filename, mode) fopen(filename, mode) #define FTELLO_FUNC(stream) ftello(stream) -@@ -73,6 +73,7 @@ - p_filefunc64_32->zfile_func64.zerror_file = p_filefunc32->zerror_file; +@@ -68,6 +68,7 @@ + p_filefunc64_32->zopen32_file = p_filefunc32->zopen_file; p_filefunc64_32->zfile_func64.zread_file = p_filefunc32->zread_file; p_filefunc64_32->zfile_func64.zwrite_file = p_filefunc32->zwrite_file; + p_filefunc64_32->zfile_func64.zflush_file = p_filefunc32->zflush_file; p_filefunc64_32->zfile_func64.ztell64_file = NULL; p_filefunc64_32->zfile_func64.zseek64_file = NULL; p_filefunc64_32->zfile_func64.zclose_file = p_filefunc32->zclose_file; -@@ -89,6 +90,8 @@ - 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)); - static long ZCALLBACK fseek64_file_func OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)); -+static int ZCALLBACK fflush_file_func OF((voidpf opaque, voidpf stream)); -+ - static int ZCALLBACK fclose_file_func OF((voidpf opaque, voidpf stream)); - static int ZCALLBACK ferror_file_func OF((voidpf opaque, voidpf stream)); - -@@ -206,6 +209,12 @@ +@@ -193,6 +194,12 @@ return ret; } @@ -37,18 +28,9 @@ + return ret; +} - static int ZCALLBACK fclose_file_func (voidpf opaque, voidpf stream) - { -@@ -221,14 +230,14 @@ - 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; + static int ZCALLBACK fclose_file_func(voidpf opaque, voidpf stream) { + int ret; +@@ -214,6 +221,7 @@ pzlib_filefunc_def->zwrite_file = fwrite_file_func; pzlib_filefunc_def->ztell_file = ftell_file_func; pzlib_filefunc_def->zseek_file = fseek_file_func; @@ -56,7 +38,7 @@ pzlib_filefunc_def->zclose_file = fclose_file_func; pzlib_filefunc_def->zerror_file = ferror_file_func; pzlib_filefunc_def->opaque = NULL; -@@ -241,6 +250,7 @@ +@@ -225,6 +233,7 @@ pzlib_filefunc_def->zwrite_file = fwrite_file_func; pzlib_filefunc_def->ztell64_file = ftell64_file_func; pzlib_filefunc_def->zseek64_file = fseek64_file_func; -- cgit v1.2.3