Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix gcc-11 warnings: signed/unsigned integer comparison, unused variables #1463

Merged
merged 4 commits into from
Jul 4, 2023

Conversation

cary-ilm
Copy link
Member

No description provided.

…ables

Signed-off-by: Cary Phillips <cary@ilm.com>
@cary-ilm
Copy link
Member Author

@kdt3rd, @meshula, @peterhillman, @lgritz, these seem fairly benign, but I'd still like some other eyes on it, can someone look it over?

Comment on lines 229 to 231
for (int i = 0; i < 65536; ++i)
{
unsigned short src = (unsigned short) i;
assert (src == OPENEXR_IMF_INTERNAL_NAMESPACE::dwaCompressorNoOp[i]);
assert ((unsigned short) i == OPENEXR_IMF_INTERNAL_NAMESPACE::dwaCompressorNoOp[i]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably just make the loop

for (unsigned short i = 0; ...)

then there's no casting at all

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Contributor

@meshula meshula left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think failable_free was meant to be assigned ~ could we try that? Hopefully it doesn't introduce a new error.

@@ -53,12 +53,12 @@ failable_malloc (size_t bytes)
return malloc (bytes);
}

static void
failable_free (void* p)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

down below we assign failable_alloc within cinit.
I'm pretty sure the intent was failable_free be correspondingly assigned within cinit as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding the assignment to free_fn:

static exr_context_t
createDummyFile (const char* test)
{
    exr_context_t             f     = NULL;
    exr_context_initializer_t cinit = EXR_DEFAULT_CONTEXT_INITIALIZER;

    // we won't actually write to this and so don't need a proper
    // stream but need a writable context to test with.
    cinit.write_fn = dummy_write;
    cinit.alloc_fn = failable_malloc;
    cinit.free_fn = failable_free;

causes OpenEXRCore.testAttrChlists and OpenEXRCore.testAttrLists to fail, so something needs some further attention. I'll leave the free function in for now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha, can we add

// adding failable_malloc currently causes OpenEXRCore.testAttrChlists and OpenEXRCore.testAttrLists to fail.
// commented out until we've investigated.
//cinit.free_fn = failable_free;

With that I think we're good to land this

Signed-off-by: Cary Phillips <cary@ilm.com>
Signed-off-by: Cary Phillips <cary@ilm.com>
Signed-off-by: Cary Phillips <cary@ilm.com>
@cary-ilm cary-ilm merged commit 2c9bf6f into AcademySoftwareFoundation:main Jul 4, 2023
cary-ilm added a commit to cary-ilm/openexr that referenced this pull request Jul 25, 2023
…bles (AcademySoftwareFoundation#1463)

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

Signed-off-by: Cary Phillips <cary@ilm.com>

* declare loop variable i as unsigned int

Signed-off-by: Cary Phillips <cary@ilm.com>

* uncomment-out failable_free

Signed-off-by: Cary Phillips <cary@ilm.com>

* add commented-out assignment of failable_free as TODO

Signed-off-by: Cary Phillips <cary@ilm.com>

---------

Signed-off-by: Cary Phillips <cary@ilm.com>
cary-ilm added a commit that referenced this pull request Jul 31, 2023
…bles (#1463)

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

Signed-off-by: Cary Phillips <cary@ilm.com>

* declare loop variable i as unsigned int

Signed-off-by: Cary Phillips <cary@ilm.com>

* uncomment-out failable_free

Signed-off-by: Cary Phillips <cary@ilm.com>

* add commented-out assignment of failable_free as TODO

Signed-off-by: Cary Phillips <cary@ilm.com>

---------

Signed-off-by: Cary Phillips <cary@ilm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants