|
@@ -62,7 +62,6 @@ ZPOS64_T call_ztell64(const zlib_filefunc64_32_def* pfilefunc, voidpf filestream
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-static voidpf ZCALLBACK fopen_file_func OF((voidpf opaque, const char* 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));
|
|
@@ -70,24 +69,6 @@ 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)
|
|
|
-{
|
|
|
- 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 = fopen(filename, mode_fopen);
|
|
|
- return file;
|
|
|
-}
|
|
|
-
|
|
|
static voidpf ZCALLBACK fopen64_file_func(voidpf opaque, const void* filename, int mode)
|
|
|
{
|
|
|
FILE* file = NULL;
|
|
@@ -121,14 +102,6 @@ static uLong ZCALLBACK fwrite_file_func(voidpf opaque, voidpf stream, const void
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-static long ZCALLBACK ftell_file_func(voidpf opaque, voidpf stream)
|
|
|
-{
|
|
|
- long ret;
|
|
|
- ret = ftell((FILE *)stream);
|
|
|
- return ret;
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
static ZPOS64_T ZCALLBACK ftell64_file_func(voidpf opaque, voidpf stream)
|
|
|
{
|
|
|
ZPOS64_T ret;
|
|
@@ -136,29 +109,6 @@ static ZPOS64_T ZCALLBACK ftell64_file_func(voidpf opaque, voidpf stream)
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-static long ZCALLBACK fseek_file_func(voidpf opaque, voidpf stream, uLong offset, int origin)
|
|
|
-{
|
|
|
- int fseek_origin = 0;
|
|
|
- long ret;
|
|
|
- switch (origin)
|
|
|
- {
|
|
|
- case ZLIB_FILEFUNC_SEEK_CUR:
|
|
|
- fseek_origin = SEEK_CUR;
|
|
|
- break;
|
|
|
- case ZLIB_FILEFUNC_SEEK_END:
|
|
|
- fseek_origin = SEEK_END;
|
|
|
- break;
|
|
|
- case ZLIB_FILEFUNC_SEEK_SET:
|
|
|
- fseek_origin = SEEK_SET;
|
|
|
- break;
|
|
|
- default: return -1;
|
|
|
- }
|
|
|
- ret = 0;
|
|
|
- if (fseek((FILE *)stream, offset, fseek_origin) != 0)
|
|
|
- ret = -1;
|
|
|
- return ret;
|
|
|
-}
|
|
|
-
|
|
|
static long ZCALLBACK fseek64_file_func(voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)
|
|
|
{
|
|
|
int fseek_origin = 0;
|