Skip to content

Commit

Permalink
Fix "Comparison result always 0" warnings with OpenWatcom
Browse files Browse the repository at this point in the history
  • Loading branch information
ccawley2011 committed Jul 20, 2021
1 parent 4634763 commit f542e6d
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion examples/example3.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ int main(int argc, char *argv[])
file_loc = ftell(pInfile);
fseek(pInfile, 0, SEEK_SET);

if ((file_loc < 0) || (file_loc > INT_MAX))
if ((file_loc < 0) || ((mz_uint64)file_loc > INT_MAX))
{
// This is not a limitation of miniz or tinfl, but this example.
printf("File is too large to be processed by this example.\n");
Expand Down
2 changes: 1 addition & 1 deletion examples/example4.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ int main(int argc, char *argv[])
file_loc = ftell(pInfile);
fseek(pInfile, 0, SEEK_SET);

if ((file_loc < 0) || (file_loc > INT_MAX))
if ((file_loc < 0) || ((mz_uint64)file_loc > INT_MAX))
{
// This is not a limitation of miniz or tinfl, but this example.
printf("File is too large to be processed by this example.\n");
Expand Down
2 changes: 1 addition & 1 deletion examples/example5.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ int main(int argc, char *argv[])
file_loc = ftell(pInfile);
fseek(pInfile, 0, SEEK_SET);

if ((file_loc < 0) || (file_loc > INT_MAX))
if ((file_loc < 0) || ((mz_uint64)file_loc > INT_MAX))
{
// This is not a limitation of miniz or tinfl, but this example.
printf("File is too large to be processed by this example.\n");
Expand Down
4 changes: 2 additions & 2 deletions miniz.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ int mz_compress2(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char
memset(&stream, 0, sizeof(stream));

/* In case mz_ulong is 64-bits (argh I hate longs). */
if ((source_len | *pDest_len) > 0xFFFFFFFFU)
if ((mz_uint64)(source_len | *pDest_len) > 0xFFFFFFFFU)
return MZ_PARAM_ERROR;

stream.next_in = pSource;
Expand Down Expand Up @@ -559,7 +559,7 @@ int mz_uncompress2(unsigned char *pDest, mz_ulong *pDest_len, const unsigned cha
memset(&stream, 0, sizeof(stream));

/* In case mz_ulong is 64-bits (argh I hate longs). */
if ((*pSource_len | *pDest_len) > 0xFFFFFFFFU)
if ((mz_uint64)(*pSource_len | *pDest_len) > 0xFFFFFFFFU)
return MZ_PARAM_ERROR;

stream.next_in = pSource;
Expand Down
4 changes: 2 additions & 2 deletions miniz_zip.c
Original file line number Diff line number Diff line change
Expand Up @@ -3194,7 +3194,7 @@ mz_bool mz_zip_writer_add_mem_ex_v2(mz_zip_archive *pZip, const char *pArchive_n
pState->m_zip64 = MZ_TRUE;
/*return mz_zip_set_error(pZip, MZ_ZIP_TOO_MANY_FILES); */
}
if ((buf_size > 0xFFFFFFFF) || (uncomp_size > 0xFFFFFFFF))
if (((mz_uint64)buf_size > 0xFFFFFFFF) || (uncomp_size > 0xFFFFFFFF))
{
pState->m_zip64 = MZ_TRUE;
/*return mz_zip_set_error(pZip, MZ_ZIP_ARCHIVE_TOO_LARGE); */
Expand Down Expand Up @@ -4299,7 +4299,7 @@ mz_bool mz_zip_writer_finalize_archive(mz_zip_archive *pZip)

if (pState->m_zip64)
{
if ((pZip->m_total_files > MZ_UINT32_MAX) || (pState->m_central_dir.m_size >= MZ_UINT32_MAX))
if (((mz_uint64)pZip->m_total_files > MZ_UINT32_MAX) || (pState->m_central_dir.m_size >= MZ_UINT32_MAX))
return mz_zip_set_error(pZip, MZ_ZIP_TOO_MANY_FILES);
}
else
Expand Down

0 comments on commit f542e6d

Please sign in to comment.