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 sign-compare and maybe-unitialized issues #14

Closed
lockbox opened this issue Oct 8, 2023 · 1 comment · Fixed by #15
Closed

fix sign-compare and maybe-unitialized issues #14

lockbox opened this issue Oct 8, 2023 · 1 comment · Fixed by #15

Comments

@lockbox
Copy link
Contributor

lockbox commented Oct 8, 2023

there's currently some compiler warnings, should be an easy fix to remove them

[build] /home/lockbox/p/hardwarehacking-wg/badge-sdk/lib/pico-ssd1306/ssd1306.c: In function 'ssd1306_bmp_show_image_with_offset':
[build] /home/lockbox/p/hardwarehacking-wg/badge-sdk/lib/pico-ssd1306/ssd1306.c:274:46: error: comparison of integer expressions of different signedness: 'uint32_t' {aka 'long unsigned int'} and 'int' [-Werror=sign-compare]
[build]   274 |     for(uint32_t y=biHeight>0?biHeight-1:0; y!=border; y+=step) {
[build]       |                                              ^~
[build] /home/lockbox/p/hardwarehacking-wg/badge-sdk/lib/pico-ssd1306/ssd1306.c:275:28: error: comparison of integer expressions of different signedness: 'uint32_t' {aka 'long unsigned int'} and 'int32_t' {aka 'const long int'} [-Werror=sign-compare]
[build]   275 |         for(uint32_t x=0; x<biWidth; ++x) {
[build]       |                            ^
[build] /home/lockbox/p/hardwarehacking-wg/badge-sdk/lib/pico-ssd1306/ssd1306.c:276:47: error: 'color_val' may be used uninitialized in this function [-Werror=maybe-uninitialized]
[build]   276 |             if(((img_data[x>>3]>>(7-(x&7)))&1)==color_val)
[build]       |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
[build] cc1: all warnings being treated as errors
@daschr
Copy link
Owner

daschr commented Oct 11, 2023

I've also noticed a mistake at the border calculation. I forgot to negate the height when its negative. df5bf00 fixes it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants