Skip to content

Commit

Permalink
Fix gcc-11 warnings: signed/unsigned integer comparison, unused varia…
Browse files Browse the repository at this point in the history
…bles (AcademySoftwareFoundation#1463)

* Fix gcc-11 warnings: signed/unsigned integer comparision, unused variables

Signed-off-by: Cary Phillips <[email protected]>

* declare loop variable i as unsigned int

Signed-off-by: Cary Phillips <[email protected]>

* uncomment-out failable_free

Signed-off-by: Cary Phillips <[email protected]>

* add commented-out assignment of failable_free as TODO

Signed-off-by: Cary Phillips <[email protected]>

---------

Signed-off-by: Cary Phillips <[email protected]>
  • Loading branch information
cary-ilm committed Jul 25, 2023
1 parent e0dce07 commit 97745e6
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/lib/OpenEXR/ImfIDManifestAttribute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ IMF_EXPORT void
IDManifestAttribute::readValueFrom (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &is, int size, int version)
{

if (size<4)
if (size < static_cast<int>(sizeof (uint64_t)))
{
throw IEX_NAMESPACE::InputExc("Invalid size field reading idmanifest attribute");
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/OpenEXRCoreTest/compression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ static int compare_files (const char *fn, const char *fn2)
{
if (memcmp (buf1, buf2, nr1) != 0)
{
for ( size_t b = 0; b < nr1; ++b )
for ( ssize_t b = 0; b < nr1; ++b )
{
if (buf1[b] != buf2[b])
{
Expand Down
6 changes: 6 additions & 0 deletions src/test/OpenEXRCoreTest/general_attr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ createDummyFile (const char* test)
cinit.write_fn = dummy_write;
cinit.alloc_fn = failable_malloc;

// TODO: adding failable_malloc currently causes
// OpenEXRCore.testAttrChlists and OpenEXRCore.testAttrLists to
// fail. commented out until we've investigated.

// cinit.free_fn = failable_free;

EXRCORE_TEST_RVAL (
exr_start_write (&f, test, EXR_WRITE_FILE_DIRECTLY, &cinit));
EXRCORE_TEST_RVAL (exr_add_part (f, "dummy", EXR_STORAGE_SCANLINE, NULL));
Expand Down
4 changes: 1 addition & 3 deletions src/test/OpenEXRCoreTest/performance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@ read_pixels_raw (MultiPartInputFile* f)
auto& dw = head.dataWindow ();
int64_t w = dw.max.x - dw.min.x + 1;
int64_t h = dw.max.y - dw.min.y + 1;
int linesread;
uint64_t ret = 0;

if (w <= 0) return ret;
Expand All @@ -288,8 +287,7 @@ read_pixels_raw (MultiPartInputFile* f)
if (head.lineOrder () != DECREASING_Y)
{
std::vector<char> rawBuf;
const char* outPtr;
InputPart part{ *f, 0 };
InputPart part{*f, 0};
const ChannelList& chans = head.channels ();
int layercount = 0;
int bpp = 0;
Expand Down
1 change: 0 additions & 1 deletion src/test/OpenEXRCoreTest/read.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ testReadMeta (const std::string& tempdir)
exr_context_initializer_t cinit = EXR_DEFAULT_CONTEXT_INITIALIZER;
cinit.error_handler_fn = &err_cb;
exr_attribute_t* newattr;
const exr_attribute_t* attr;

EXRCORE_TEST_RVAL (exr_test_file_header (fn.c_str (), &cinit));
EXRCORE_TEST_RVAL (exr_start_read (&f, fn.c_str (), &cinit));
Expand Down
1 change: 0 additions & 1 deletion src/test/OpenEXRCoreTest/write.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1232,7 +1232,6 @@ testWriteTiles (const std::string& tempdir)
EXRCORE_TEST (partcnt == outpartcnt);

exr_attr_box2i_t dw;
int curchunk = 0;
int ty, tx;
void* cmem = NULL;
size_t cmemsize = 0;
Expand Down
5 changes: 2 additions & 3 deletions src/test/OpenEXRTest/testDwaLookups.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,9 @@ testNoop()
{
printf("test dwaCompressorNoOp[] \n");

for (int i=0; i<65536; ++i)
for (unsigned int i = 0; i < 65536; ++i)
{
unsigned short src = (unsigned short)i;
assert (src == OPENEXR_IMF_INTERNAL_NAMESPACE::dwaCompressorNoOp[i]);
assert (i == OPENEXR_IMF_INTERNAL_NAMESPACE::dwaCompressorNoOp[i]);
}
}

Expand Down

0 comments on commit 97745e6

Please sign in to comment.