Skip to content
Snippets Groups Projects
Commit 309d1292 authored by rahix's avatar rahix
Browse files

chore(gfx): Fix all sign-compare warnings


Signed-off-by: default avatarRahix <rahix@rahix.de>
parent e6ae34ca
No related branches found
No related tags found
No related merge requests found
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
void fb_clear_to_color(struct framebuffer *fb, Color c) void fb_clear_to_color(struct framebuffer *fb, Color c)
{ {
for (int y = 0; y < fb->height; y++) { for (size_t y = 0; y < fb->height; y++) {
for (int x = 0; x < fb->width; x++) for (size_t x = 0; x < fb->width; x++)
fb_setpixel(fb, x, y, c); fb_setpixel(fb, x, y, c);
} }
} }
...@@ -77,7 +77,7 @@ void *fb_pixel(struct framebuffer *fb, int x, int y) ...@@ -77,7 +77,7 @@ void *fb_pixel(struct framebuffer *fb, int x, int y)
if (xo < 0 || yo < 0) if (xo < 0 || yo < 0)
return NULL; return NULL;
if (xo >= fb->width || yo >= fb->height) if (xo >= (int)fb->width || yo >= (int)fb->height)
return NULL; return NULL;
const size_t bpp = fb_bytes_per_pixel(fb); const size_t bpp = fb_bytes_per_pixel(fb);
......
...@@ -17,7 +17,7 @@ void gfx_setpixel(struct gfx_region *r, int x, int y, Color c) ...@@ -17,7 +17,7 @@ void gfx_setpixel(struct gfx_region *r, int x, int y, Color c)
{ {
if (x < 0 || y < 0) if (x < 0 || y < 0)
return; return;
if (x >= r->width || y >= r->height) if ((size_t)x >= r->width || (size_t)y >= r->height)
return; return;
fb_setpixel(r->fb, r->x + x, r->y + y, c); fb_setpixel(r->fb, r->x + x, r->y + y, c);
...@@ -90,7 +90,7 @@ void gfx_puts( ...@@ -90,7 +90,7 @@ void gfx_puts(
while (*str) { while (*str) {
// if the current position plus the width of the next character // if the current position plus the width of the next character
// would bring us outside of the display ... // 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 // ... we move down a line before printing the character
x = 0; x = 0;
y += font->Height; y += font->Height;
...@@ -350,7 +350,7 @@ static void gfx_copy_region_rle_mono( ...@@ -350,7 +350,7 @@ static void gfx_copy_region_rle_mono(
Color white = gfx_color(reg, WHITE); Color white = gfx_color(reg, WHITE);
Color black = gfx_color(reg, BLACK); 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; Color color = (data[i] & 0x80) ? white : black;
uint8_t length = data[i] & 0x7f; uint8_t length = data[i] & 0x7f;
......
...@@ -41,7 +41,7 @@ static void scrollup(struct txt_buffer *tm) ...@@ -41,7 +41,7 @@ static void scrollup(struct txt_buffer *tm)
for (int row = 0; row < last_row; row++) for (int row = 0; row < last_row; row++)
memcpy(&tm->text[row][0], &tm->text[row + 1][0], line_size); 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]; struct txt_glyph *g = &tm->text[last_row][col];
g->ch = ' '; g->ch = ' ';
g->fg_color = tm->fg_color; g->fg_color = tm->fg_color;
...@@ -63,7 +63,7 @@ static inline void advance_cursor(struct txt_buffer *tm) ...@@ -63,7 +63,7 @@ static inline void advance_cursor(struct txt_buffer *tm)
const int last_row = height_(tm) - 1; const int last_row = height_(tm) - 1;
tm->cursor_column++; tm->cursor_column++;
if (tm->cursor_column >= width_(tm)) { if (tm->cursor_column >= (int)width_(tm)) {
tm->cursor_column = 0; tm->cursor_column = 0;
tm->cursor_row++; tm->cursor_row++;
if (tm->cursor_row > last_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) ...@@ -226,9 +226,9 @@ void txt_set_cursor(struct txt_buffer *tm, int x, int y, int draw_cursor)
{ {
tm->draw_cursor = draw_cursor; tm->draw_cursor = draw_cursor;
if (x < 0 || x >= width_(tm)) if (x < 0 || x >= (int)width_(tm))
return; return;
if (y < 0 || y >= height_(tm)) if (y < 0 || y >= (int)height_(tm))
return; return;
tm->cursor_column = x; tm->cursor_column = x;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment