Avert minizip warnings for MSVC.
This commit is contained in:
parent
d201f04c72
commit
0f51fb4933
@ -89,7 +89,7 @@ static voidpf win32_build_iowin(HANDLE hFile) {
|
||||
}
|
||||
|
||||
voidpf ZCALLBACK win32_open64_file_func(voidpf opaque, const void* filename, int mode) {
|
||||
const char* mode_fopen = NULL;
|
||||
(void)opaque;
|
||||
DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
|
||||
HANDLE hFile = NULL;
|
||||
|
||||
@ -117,7 +117,7 @@ voidpf ZCALLBACK win32_open64_file_func(voidpf opaque, const void* filename, int
|
||||
|
||||
|
||||
voidpf ZCALLBACK win32_open64_file_funcA(voidpf opaque, const void* filename, int mode) {
|
||||
const char* mode_fopen = NULL;
|
||||
(void)opaque;
|
||||
DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
|
||||
HANDLE hFile = NULL;
|
||||
|
||||
@ -140,7 +140,7 @@ voidpf ZCALLBACK win32_open64_file_funcA(voidpf opaque, const void* filename, in
|
||||
|
||||
|
||||
voidpf ZCALLBACK win32_open64_file_funcW(voidpf opaque, const void* filename, int mode) {
|
||||
const char* mode_fopen = NULL;
|
||||
(void)opaque;
|
||||
DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
|
||||
HANDLE hFile = NULL;
|
||||
|
||||
@ -159,7 +159,7 @@ voidpf ZCALLBACK win32_open64_file_funcW(voidpf opaque, const void* filename, in
|
||||
|
||||
|
||||
voidpf ZCALLBACK win32_open_file_func(voidpf opaque, const char* filename, int mode) {
|
||||
const char* mode_fopen = NULL;
|
||||
(void)opaque;
|
||||
DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
|
||||
HANDLE hFile = NULL;
|
||||
|
||||
@ -187,6 +187,7 @@ voidpf ZCALLBACK win32_open_file_func(voidpf opaque, const char* filename, int m
|
||||
|
||||
|
||||
uLong ZCALLBACK win32_read_file_func(voidpf opaque, voidpf stream, void* buf,uLong size) {
|
||||
(void)opaque;
|
||||
uLong ret=0;
|
||||
HANDLE hFile = NULL;
|
||||
if (stream!=NULL)
|
||||
@ -208,6 +209,7 @@ uLong ZCALLBACK win32_read_file_func(voidpf opaque, voidpf stream, void* buf,uLo
|
||||
|
||||
|
||||
uLong ZCALLBACK win32_write_file_func(voidpf opaque, voidpf stream, const void* buf, uLong size) {
|
||||
(void)opaque;
|
||||
uLong ret=0;
|
||||
HANDLE hFile = NULL;
|
||||
if (stream!=NULL)
|
||||
@ -247,6 +249,7 @@ static BOOL MySetFilePointerEx(HANDLE hFile, LARGE_INTEGER pos, LARGE_INTEGER *n
|
||||
}
|
||||
|
||||
long ZCALLBACK win32_tell_file_func(voidpf opaque, voidpf stream) {
|
||||
(void)opaque;
|
||||
long ret=-1;
|
||||
HANDLE hFile = NULL;
|
||||
if (stream!=NULL)
|
||||
@ -269,6 +272,7 @@ long ZCALLBACK win32_tell_file_func(voidpf opaque, voidpf stream) {
|
||||
}
|
||||
|
||||
ZPOS64_T ZCALLBACK win32_tell64_file_func(voidpf opaque, voidpf stream) {
|
||||
(void)opaque;
|
||||
ZPOS64_T ret= (ZPOS64_T)-1;
|
||||
HANDLE hFile = NULL;
|
||||
if (stream!=NULL)
|
||||
@ -293,6 +297,7 @@ ZPOS64_T ZCALLBACK win32_tell64_file_func(voidpf opaque, voidpf stream) {
|
||||
|
||||
|
||||
long ZCALLBACK win32_seek_file_func(voidpf opaque, voidpf stream, uLong offset, int origin) {
|
||||
(void)opaque;
|
||||
DWORD dwMoveMethod=0xFFFFFFFF;
|
||||
HANDLE hFile = NULL;
|
||||
|
||||
@ -330,6 +335,7 @@ long ZCALLBACK win32_seek_file_func(voidpf opaque, voidpf stream, uLong offset,
|
||||
}
|
||||
|
||||
long ZCALLBACK win32_seek64_file_func(voidpf opaque, voidpf stream, ZPOS64_T offset, int origin) {
|
||||
(void)opaque;
|
||||
DWORD dwMoveMethod=0xFFFFFFFF;
|
||||
HANDLE hFile = NULL;
|
||||
long ret=-1;
|
||||
@ -368,6 +374,7 @@ long ZCALLBACK win32_seek64_file_func(voidpf opaque, voidpf stream, ZPOS64_T off
|
||||
}
|
||||
|
||||
int ZCALLBACK win32_close_file_func(voidpf opaque, voidpf stream) {
|
||||
(void)opaque;
|
||||
int ret=-1;
|
||||
|
||||
if (stream!=NULL)
|
||||
@ -385,6 +392,7 @@ int ZCALLBACK win32_close_file_func(voidpf opaque, voidpf stream) {
|
||||
}
|
||||
|
||||
int ZCALLBACK win32_error_file_func(voidpf opaque, voidpf stream) {
|
||||
(void)opaque;
|
||||
int ret=-1;
|
||||
if (stream!=NULL)
|
||||
{
|
||||
|
@ -39,6 +39,9 @@
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef _CRT_SECURE_NO_WARNINGS
|
||||
# define _CRT_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -83,6 +86,7 @@
|
||||
tmu_date : the SAME new date at the tm_unz format */
|
||||
static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_date) {
|
||||
#ifdef _WIN32
|
||||
(void)tmu_date;
|
||||
HANDLE hFile;
|
||||
FILETIME ftm,ftLocal,ftCreate,ftLastAcc,ftLastWrite;
|
||||
|
||||
|
@ -41,6 +41,9 @@
|
||||
|
||||
|
||||
|
||||
#ifndef _CRT_SECURE_NO_WARNINGS
|
||||
# define _CRT_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -74,6 +77,7 @@
|
||||
/* f: name of file to get info on, tmzip: return value: access,
|
||||
modification and creation times, dt: dostime */
|
||||
static int filetime(const char *f, tm_zip *tmzip, uLong *dt) {
|
||||
(void)tmzip;
|
||||
int ret = 0;
|
||||
{
|
||||
FILETIME ftLocal;
|
||||
@ -190,7 +194,7 @@ static int getFileCrc(const char* filenameinzip, void* buf, unsigned long size_b
|
||||
do
|
||||
{
|
||||
err = ZIP_OK;
|
||||
size_read = fread(buf,1,size_buf,fin);
|
||||
size_read = (unsigned long)fread(buf,1,size_buf,fin);
|
||||
if (size_read < size_buf)
|
||||
if (feof(fin)==0)
|
||||
{
|
||||
@ -242,7 +246,7 @@ int main(int argc, char *argv[]) {
|
||||
char filename_try[MAXFILENAME+16];
|
||||
int zipok;
|
||||
int err=0;
|
||||
size_t size_buf=0;
|
||||
unsigned long size_buf=0;
|
||||
void* buf=NULL;
|
||||
const char* password=NULL;
|
||||
|
||||
@ -304,7 +308,7 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
else
|
||||
{
|
||||
int i,len;
|
||||
int len;
|
||||
int dot_found=0;
|
||||
|
||||
zipok = 1 ;
|
||||
|
@ -5,6 +5,9 @@
|
||||
*/
|
||||
|
||||
/* Code */
|
||||
#ifndef _CRT_SECURE_NO_WARNINGS
|
||||
# define _CRT_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -140,28 +143,28 @@ extern int ZEXPORT unzRepair(const char* file, const char* fileOut, const char*
|
||||
|
||||
/* Central directory entry */
|
||||
{
|
||||
char header[46];
|
||||
char central[46];
|
||||
char* comment = "";
|
||||
int comsize = (int) strlen(comment);
|
||||
WRITE_32(header, 0x02014b50);
|
||||
WRITE_16(header + 4, version);
|
||||
WRITE_16(header + 6, version);
|
||||
WRITE_16(header + 8, gpflag);
|
||||
WRITE_16(header + 10, method);
|
||||
WRITE_16(header + 12, filetime);
|
||||
WRITE_16(header + 14, filedate);
|
||||
WRITE_32(header + 16, crc);
|
||||
WRITE_32(header + 20, cpsize);
|
||||
WRITE_32(header + 24, uncpsize);
|
||||
WRITE_16(header + 28, fnsize);
|
||||
WRITE_16(header + 30, extsize);
|
||||
WRITE_16(header + 32, comsize);
|
||||
WRITE_16(header + 34, 0); /* disk # */
|
||||
WRITE_16(header + 36, 0); /* int attrb */
|
||||
WRITE_32(header + 38, 0); /* ext attrb */
|
||||
WRITE_32(header + 42, currentOffset);
|
||||
WRITE_32(central, 0x02014b50);
|
||||
WRITE_16(central + 4, version);
|
||||
WRITE_16(central + 6, version);
|
||||
WRITE_16(central + 8, gpflag);
|
||||
WRITE_16(central + 10, method);
|
||||
WRITE_16(central + 12, filetime);
|
||||
WRITE_16(central + 14, filedate);
|
||||
WRITE_32(central + 16, crc);
|
||||
WRITE_32(central + 20, cpsize);
|
||||
WRITE_32(central + 24, uncpsize);
|
||||
WRITE_16(central + 28, fnsize);
|
||||
WRITE_16(central + 30, extsize);
|
||||
WRITE_16(central + 32, comsize);
|
||||
WRITE_16(central + 34, 0); /* disk # */
|
||||
WRITE_16(central + 36, 0); /* int attrb */
|
||||
WRITE_32(central + 38, 0); /* ext attrb */
|
||||
WRITE_32(central + 42, currentOffset);
|
||||
/* Header */
|
||||
if (fwrite(header, 1, 46, fpOutCD) == 46) {
|
||||
if (fwrite(central, 1, 46, fpOutCD) == 46) {
|
||||
offsetCD += 46;
|
||||
|
||||
/* Filename */
|
||||
@ -215,23 +218,23 @@ extern int ZEXPORT unzRepair(const char* file, const char* fileOut, const char*
|
||||
/* Final central directory */
|
||||
{
|
||||
int entriesZip = entries;
|
||||
char header[22];
|
||||
char end[22];
|
||||
char* comment = ""; // "ZIP File recovered by zlib/minizip/mztools";
|
||||
int comsize = (int) strlen(comment);
|
||||
if (entriesZip > 0xffff) {
|
||||
entriesZip = 0xffff;
|
||||
}
|
||||
WRITE_32(header, 0x06054b50);
|
||||
WRITE_16(header + 4, 0); /* disk # */
|
||||
WRITE_16(header + 6, 0); /* disk # */
|
||||
WRITE_16(header + 8, entriesZip); /* hack */
|
||||
WRITE_16(header + 10, entriesZip); /* hack */
|
||||
WRITE_32(header + 12, offsetCD); /* size of CD */
|
||||
WRITE_32(header + 16, offset); /* offset to CD */
|
||||
WRITE_16(header + 20, comsize); /* comment */
|
||||
WRITE_32(end, 0x06054b50);
|
||||
WRITE_16(end + 4, 0); /* disk # */
|
||||
WRITE_16(end + 6, 0); /* disk # */
|
||||
WRITE_16(end + 8, entriesZip); /* hack */
|
||||
WRITE_16(end + 10, entriesZip); /* hack */
|
||||
WRITE_32(end + 12, offsetCD); /* size of CD */
|
||||
WRITE_32(end + 16, offset); /* offset to CD */
|
||||
WRITE_16(end + 20, comsize); /* comment */
|
||||
|
||||
/* Header */
|
||||
if (fwrite(header, 1, 22, fpOutCD) == 22) {
|
||||
if (fwrite(end, 1, 22, fpOutCD) == 22) {
|
||||
|
||||
/* Comment field */
|
||||
if (comsize > 0) {
|
||||
|
@ -1609,7 +1609,7 @@ extern int ZEXPORT unzReadCurrentFile(unzFile file, voidp buf, unsigned len) {
|
||||
uInt i;
|
||||
for(i=0;i<uReadThis;i++)
|
||||
pfile_in_zip_read_info->read_buffer[i] =
|
||||
zdecode(s->keys,s->pcrc_32_tab,
|
||||
(char)zdecode(s->keys,s->pcrc_32_tab,
|
||||
pfile_in_zip_read_info->read_buffer[i]);
|
||||
}
|
||||
# endif
|
||||
|
Loading…
Reference in New Issue
Block a user