Skip to content

Conversation

@cmb69
Copy link
Member

@cmb69 cmb69 commented Feb 3, 2025

These warnings are about conversion from size_t to a smaller type[1], and in this case because gdIOCtx works with int lengths. Two of these warnings are harmless, and we resolve them by using size_t in the first place, and adding a cast (plus an assertion), respectively.

The others actually hint at potential issues when reading image data with more than INT_MAX bytes; we catch that upfront, and throw a ValueError and a warning, respectively.

[1] https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4267

These warnings are about conversion from `size_t` to a smaller type[1],
and in this case because `gdIOCtx` works with `int` lengths.  Two of
these warnings are harmless, and we resolve them by using `size_t` in
the first place, and adding a cast (plus an assertion), respectively.

The others actually hint at potential issues when reading image data
with more than `INT_MAX` bytes; we catch that upfront, and throw a
`ValueError` and a warning, respectively.

[1] <https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4267>
@cmb69 cmb69 marked this pull request as ready for review February 3, 2025 15:48
@cmb69 cmb69 requested a review from devnexen as a code owner February 3, 2025 15:48
Copy link
Member

@devnexen devnexen left a comment

Choose a reason for hiding this comment

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

LGTM

@cmb69 cmb69 merged commit c1f7b87 into php:master Feb 3, 2025
9 checks passed
@cmb69 cmb69 deleted the cmb/gd.c-c4267 branch February 3, 2025 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants