Skip to content

Commit

Permalink
Merge pull request #2101 from benpicco/sign-compare
Browse files Browse the repository at this point in the history
polygon: fix sign-compare warnings
  • Loading branch information
olikraus authored Feb 26, 2023
2 parents b92f9e5 + aaeafe0 commit 3d41860
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions csrc/u8g2_polygon.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,29 +216,29 @@ static void pg_hline(pg_struct *pg, u8g2_t *u8g2)

if ( y < 0 )
return;
if ( y >= u8g2_GetDisplayHeight(u8g2) ) // does not work for 256x64 display???
if ( y >= (pg_word_t)u8g2_GetDisplayHeight(u8g2) ) // does not work for 256x64 display???
return;
if ( x1 < x2 )
{
if ( x2 < 0 )
return;
if ( x1 >= u8g2_GetDisplayWidth(u8g2) )
if ( x1 >= (pg_word_t)u8g2_GetDisplayWidth(u8g2) )
return;
if ( x1 < 0 )
x1 = 0;
if ( x2 >= u8g2_GetDisplayWidth(u8g2) )
if ( x2 >= (pg_word_t)u8g2_GetDisplayWidth(u8g2) )
x2 = u8g2_GetDisplayWidth(u8g2);
u8g2_DrawHLine(u8g2, x1, y, x2 - x1);
}
else
{
if ( x1 < 0 )
return;
if ( x2 >= u8g2_GetDisplayWidth(u8g2) )
if ( x2 >= (pg_word_t)u8g2_GetDisplayWidth(u8g2) )
return;
if ( x2 < 0 )
x1 = 0;
if ( x1 >= u8g2_GetDisplayWidth(u8g2) )
if ( x1 >= (pg_word_t)u8g2_GetDisplayWidth(u8g2) )
x1 = u8g2_GetDisplayWidth(u8g2);
u8g2_DrawHLine(u8g2, x2, y, x1 - x2);
}
Expand Down

0 comments on commit 3d41860

Please sign in to comment.