--- mztools.c.orig 2012-01-21 20:58:45.000000000 +0100 +++ mztools.c 2014-05-24 13:27:22.516230485 +0200 @@ -10,6 +10,7 @@ #include #include "zlib.h" #include "unzip.h" +#include "mztools.h" #define READ_8(adr) ((unsigned char)*(adr)) #define READ_16(adr) ( READ_8(adr) | (READ_8(adr+1) << 8) ) @@ -27,12 +28,9 @@ WRITE_16((unsigned char*)(buff) + 2, (n) >> 16); \ } while(0) -extern int ZEXPORT unzRepair(file, fileOut, fileOutTmp, nRecovered, bytesRecovered) -const char* file; -const char* fileOut; -const char* fileOutTmp; -uLong* nRecovered; -uLong* bytesRecovered; +int ZEXPORT unzRepair(const char* file, const char* fileOut, + const char* fileOutTmp, uLong* nRecovered, + uLong* bytesRecovered) { int err = Z_OK; FILE* fpZip = fopen(file, "rb"); @@ -147,8 +145,8 @@ /* Central directory entry */ { char header[46]; - char* comment = ""; - int comsize = (int) strlen(comment); + const char* comment = ""; + const size_t comsize = strlen(comment); WRITE_32(header, 0x02014b50); WRITE_16(header + 4, version); WRITE_16(header + 6, version); @@ -195,7 +193,7 @@ /* Comment field */ if (comsize > 0) { - if ((int)fwrite(comment, 1, comsize, fpOutCD) == comsize) { + if (fwrite(comment, 1, comsize, fpOutCD) == comsize) { offsetCD += comsize; } else { err = Z_ERRNO; @@ -222,8 +220,8 @@ { int entriesZip = entries; char header[22]; - char* comment = ""; // "ZIP File recovered by zlib/minizip/mztools"; - int comsize = (int) strlen(comment); + const char* comment = ""; // "ZIP File recovered by zlib/minizip/mztools"; + const size_t comsize = strlen(comment); if (entriesZip > 0xffff) { entriesZip = 0xffff; } @@ -241,7 +239,7 @@ /* Comment field */ if (comsize > 0) { - if ((int)fwrite(comment, 1, comsize, fpOutCD) != comsize) { + if (fwrite(comment, 1, comsize, fpOutCD) != comsize) { err = Z_ERRNO; } }