From aaeafe0dd0942639b3b6bc355375057fe97b513e Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Fri, 17 Feb 2023 14:19:17 +0100 Subject: [PATCH] polygon: fix sign-compare warnings --- csrc/u8g2_polygon.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/csrc/u8g2_polygon.c b/csrc/u8g2_polygon.c index bc1f14ab..060cf49f 100644 --- a/csrc/u8g2_polygon.c +++ b/csrc/u8g2_polygon.c @@ -216,17 +216,17 @@ 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); } @@ -234,11 +234,11 @@ static void pg_hline(pg_struct *pg, u8g2_t *u8g2) { 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); }