diff --git a/lib/gfx/framebuffer.c b/lib/gfx/framebuffer.c index 672e956a3467999a9d8c232acb3510f4711786cb..6c8dc3aac453214494b1758a6771a0ff3959ee8f 100644 --- a/lib/gfx/framebuffer.c +++ b/lib/gfx/framebuffer.c @@ -2,8 +2,8 @@ void fb_clear_to_color(struct framebuffer *fb, Color c) { - for (int y = 0; y < fb->height; y++) { - for (int x = 0; x < fb->width; x++) + for (size_t y = 0; y < fb->height; y++) { + for (size_t x = 0; x < fb->width; x++) fb_setpixel(fb, x, y, c); } } @@ -77,7 +77,7 @@ void *fb_pixel(struct framebuffer *fb, int x, int y) if (xo < 0 || yo < 0) return NULL; - if (xo >= fb->width || yo >= fb->height) + if (xo >= (int)fb->width || yo >= (int)fb->height) return NULL; const size_t bpp = fb_bytes_per_pixel(fb); diff --git a/lib/gfx/gfx.c b/lib/gfx/gfx.c index c076a8343e39b8fef7d2f29beb825f06ba17d007..886ecdeeb99b6054ca718d05342438ade33eb25e 100644 --- a/lib/gfx/gfx.c +++ b/lib/gfx/gfx.c @@ -17,7 +17,7 @@ void gfx_setpixel(struct gfx_region *r, int x, int y, Color c) { if (x < 0 || y < 0) return; - if (x >= r->width || y >= r->height) + if ((size_t)x >= r->width || (size_t)y >= r->height) return; fb_setpixel(r->fb, r->x + x, r->y + y, c); @@ -90,7 +90,7 @@ void gfx_puts( while (*str) { // if the current position plus the width of the next character // would bring us outside of the display ... - if ((x + font->Width) > r->width) { + if ((x + font->Width) > (int)r->width) { // ... we move down a line before printing the character x = 0; y += font->Height; @@ -350,7 +350,7 @@ static void gfx_copy_region_rle_mono( Color white = gfx_color(reg, WHITE); Color black = gfx_color(reg, BLACK); - for (int i = 0; i < size; i++) { + for (size_t i = 0; i < size; i++) { Color color = (data[i] & 0x80) ? white : black; uint8_t length = data[i] & 0x7f; diff --git a/lib/gfx/textbuffer.c b/lib/gfx/textbuffer.c index c52e68292a93efa87827c1a523a3d2d2cff73273..6034f2357f3c891befee082ccebdfcf82100b4ff 100644 --- a/lib/gfx/textbuffer.c +++ b/lib/gfx/textbuffer.c @@ -41,7 +41,7 @@ static void scrollup(struct txt_buffer *tm) for (int row = 0; row < last_row; row++) memcpy(&tm->text[row][0], &tm->text[row + 1][0], line_size); - for (int col = 0; col < width_(tm); col++) { + for (size_t col = 0; col < width_(tm); col++) { struct txt_glyph *g = &tm->text[last_row][col]; g->ch = ' '; g->fg_color = tm->fg_color; @@ -63,7 +63,7 @@ static inline void advance_cursor(struct txt_buffer *tm) const int last_row = height_(tm) - 1; tm->cursor_column++; - if (tm->cursor_column >= width_(tm)) { + if (tm->cursor_column >= (int)width_(tm)) { tm->cursor_column = 0; tm->cursor_row++; if (tm->cursor_row > last_row) @@ -226,9 +226,9 @@ void txt_set_cursor(struct txt_buffer *tm, int x, int y, int draw_cursor) { tm->draw_cursor = draw_cursor; - if (x < 0 || x >= width_(tm)) + if (x < 0 || x >= (int)width_(tm)) return; - if (y < 0 || y >= height_(tm)) + if (y < 0 || y >= (int)height_(tm)) return; tm->cursor_column = x;