Fixed definitions of limits and some casting issues.

This commit is contained in:
Nathan Moinvaziri 2018-11-23 08:37:19 -08:00
parent 4c642fc296
commit 6ac5fe69d0
3 changed files with 5 additions and 5 deletions

6
mz.h
View File

@ -186,7 +186,7 @@ typedef unsigned long long uint64_t;
# define INT16_MAX 32767
#endif
#ifndef INT32_MAX
# define INT32_MAX 2147483647
# define INT32_MAX 2147483647L
#endif
#ifndef INT64_MAX
# define INT64_MAX 9223372036854775807LL
@ -195,10 +195,10 @@ typedef unsigned long long uint64_t;
# define UINT16_MAX 65535U
#endif
#ifndef UINT32_MAX
# define UINT32_MAX 4294967295U
# define UINT32_MAX 4294967295UL
#endif
#ifndef UINT64_MAX
# define UINT64_MAX 18446744073709551615LL
# define UINT64_MAX 18446744073709551615ULL
#endif
/***************************************************************************/

View File

@ -216,7 +216,7 @@ int32_t mz_stream_pkcrypt_read(void *stream, void *buf, int32_t size)
int32_t i = 0;
if (bytes_to_read > (int32_t)(pkcrypt->max_total_in - pkcrypt->total_in))
if ((int64_t)bytes_to_read > (pkcrypt->max_total_in - pkcrypt->total_in))
bytes_to_read = (int32_t)(pkcrypt->max_total_in - pkcrypt->total_in);
read = mz_stream_read(pkcrypt->stream.base, buf, bytes_to_read);

View File

@ -215,7 +215,7 @@ int32_t mz_stream_wzaes_read(void *stream, void *buf, int32_t size)
int32_t read = 0;
max_total_in = wzaes->max_total_in - MZ_AES_FOOTER_SIZE;
if (bytes_to_read > (int32_t)(max_total_in - wzaes->total_in))
if ((int64_t)bytes_to_read > (max_total_in - wzaes->total_in))
bytes_to_read = (int32_t)(max_total_in - wzaes->total_in);
read = mz_stream_read(wzaes->stream.base, buf, bytes_to_read);