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 @@
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);
......
......@@ -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;
......
......@@ -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;
......
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