diff --git a/Source/3rd Party/zlib/contrib/minizip/crypt.h b/Source/3rd Party/zlib/contrib/minizip/crypt.h index 9a1d5b69a..02db6531a 100644 --- a/Source/3rd Party/zlib/contrib/minizip/crypt.h +++ b/Source/3rd Party/zlib/contrib/minizip/crypt.h @@ -32,14 +32,14 @@ /*********************************************************************** * Return the next byte in the pseudo-random sequence */ -static int decrypt_byte(unsigned long* pkeys) +static Byte decrypt_byte(unsigned long* pkeys) { unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an * unpredictable manner on 16-bit systems; not a problem * with any known compiler so far, though */ temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2; - return (int)(((temp * (temp ^ 1)) >> 8) & 0xff); + return (Byte)(((temp * (temp ^ 1)) >> 8) & 0xFF); } /*********************************************************************** @@ -95,8 +95,8 @@ static int crypthead(const char* passwd, /* password string */ unsigned long crcForCrypting) { int n; /* index in random header */ - int t; /* temporary */ - int c; /* random byte */ + Byte t; /* temporary */ + Byte c; /* random byte */ unsigned char header[RAND_HEAD_LEN-2]; /* random header */ static unsigned calls = 0; /* ensure different random header each time */ @@ -114,17 +114,17 @@ static int crypthead(const char* passwd, /* password string */ init_keys(passwd, pkeys, pcrc_32_tab); for (n = 0; n < RAND_HEAD_LEN-2; n++) { - c = (rand() >> 7) & 0xff; - header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t); + c = (Byte)((rand() >> 7) & 0xFF); + header[n] = zencode(pkeys, pcrc_32_tab, c, t); } /* Encrypt random header (last two bytes is high word of crc) */ init_keys(passwd, pkeys, pcrc_32_tab); for (n = 0; n < RAND_HEAD_LEN-2; n++) { - buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t); + buf[n] = zencode(pkeys, pcrc_32_tab, header[n], t); } - buf[n++] = (unsigned char)zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t); - buf[n++] = (unsigned char)zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 24) & 0xff, t); + buf[n++] = zencode(pkeys, pcrc_32_tab, (crcForCrypting >> 16) & 0xFF, t); + buf[n++] = zencode(pkeys, pcrc_32_tab, (crcForCrypting >> 24) & 0xFF, t); return n; } diff --git a/Source/3rd Party/zlib/contrib/minizip/zip.c b/Source/3rd Party/zlib/contrib/minizip/zip.c index 63ad73cae..68a4b2b48 100644 --- a/Source/3rd Party/zlib/contrib/minizip/zip.c +++ b/Source/3rd Party/zlib/contrib/minizip/zip.c @@ -1368,8 +1368,9 @@ local int zip64FlushWriteBuffer(zip64_internal* zi) { #ifndef NOCRYPT uInt i; - int t; - for (i=0;ici.pos_in_buffered_data;i++) + Byte t; + + for (i = 0; i < zi->ci.pos_in_buffered_data; i++) zi->ci.buffered_data[i] = zencode(zi->ci.keys, zi->ci.pcrc_32_tab, zi->ci.buffered_data[i],t); #endif }