Skip to content

polygon: fix sign-compare warnings #2101

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

Merged
merged 1 commit into from
Feb 26, 2023
Merged

Conversation

benpicco
Copy link
Contributor

Fix warnings such as

/home/benpicco/dev/RIOT-BHT/build/pkg/u8g2/csrc/u8g2_polygon.c: In function ‘pg_hline’:
/home/benpicco/dev/RIOT-BHT/build/pkg/u8g2/csrc/u8g2_polygon.c:219:10: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
   if ( y >= u8g2_GetDisplayHeight(u8g2) )  // does not work for 256x64 display???
          ^
/home/benpicco/dev/RIOT-BHT/build/pkg/u8g2/csrc/u8g2_polygon.c:225:13: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     if ( x1 >= u8g2_GetDisplayWidth(u8g2) )
             ^
/home/benpicco/dev/RIOT-BHT/build/pkg/u8g2/csrc/u8g2_polygon.c:229:13: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     if ( x2 >= u8g2_GetDisplayWidth(u8g2) )
             ^
/home/benpicco/dev/RIOT-BHT/build/pkg/u8g2/csrc/u8g2_polygon.c:237:13: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     if ( x2 >= u8g2_GetDisplayWidth(u8g2) )
             ^
/home/benpicco/dev/RIOT-BHT/build/pkg/u8g2/csrc/u8g2_polygon.c:241:13: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     if ( x1 >= u8g2_GetDisplayWidth(u8g2) )
             ^
cc1: all warnings being treated as errors

@olikraus
Copy link
Owner

Instead of casting to "int", we probably should convert to "pg_word_t".
I would accept the PR if conversion happens to "pg_word_t". Thanks.

@benpicco
Copy link
Contributor Author

Sure!

@olikraus olikraus added this to the 2.34 milestone Feb 26, 2023
@olikraus olikraus merged commit 3d41860 into olikraus:master Feb 26, 2023
@olikraus
Copy link
Owner

Thanks

@benpicco benpicco deleted the sign-compare branch February 26, 2023 17:45
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