aboutsummaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi.dcr@tutanota.com>2024-01-27 13:41:14 +0100
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2024-01-27 17:38:12 +0100
commitdaf6f84ccdf817f7088aa527b4b37c2cca91c052 (patch)
treef2676fd88c5c87bc7731fc9a92ecad898ee0d689 /src/gui
parentda33e4668b23d3280f96d2ec0df68a829a0ef2d5 (diff)
downloadjancity-daf6f84ccdf817f7088aa527b4b37c2cca91c052.tar.gz
gfx: Add return value to *_sort functions
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/src/bar.c22
-rw-r--r--src/gui/src/button_sprite.c9
-rw-r--r--src/gui/src/button_type1.c8
-rw-r--r--src/gui/src/line_edit.c24
-rw-r--r--src/gui/src/rounded_rect.c14
5 files changed, 64 insertions, 13 deletions
diff --git a/src/gui/src/bar.c b/src/gui/src/bar.c
index 25446e0..bd38cd6 100644
--- a/src/gui/src/bar.c
+++ b/src/gui/src/bar.c
@@ -15,8 +15,13 @@ static int render_topleft(const struct gui_bar *const b, const short x,
s->x = x;
s->y = y;
- sprite_sort(s);
- return 0;
+
+ const int ret = sprite_sort(s);
+
+ if (ret)
+ fprintf(stderr, "%s: sprite_sort failed\n", __func__);
+
+ return ret;
}
static int render_topright(const struct gui_bar *const b, const short x,
@@ -29,7 +34,12 @@ static int render_topright(const struct gui_bar *const b, const short x,
s->x = x + b->w - s->w;
s->y = y;
- sprite_sort(s);
+
+ const int ret = sprite_sort(s);
+
+ if (ret)
+ fprintf(stderr, "%s: sprite_sort failed\n", __func__);
+
return 0;
}
@@ -66,7 +76,11 @@ static int render_topmid(const struct gui_bar *const b, const short x,
else
m->w = mid_w;
- sprite_sort(m);
+ if (sprite_sort(m))
+ {
+ fprintf(stderr, "%s: sprite_sort failed\n", __func__);
+ return -1;
+ }
}
return 0;
diff --git a/src/gui/src/button_sprite.c b/src/gui/src/button_sprite.c
index 5bdc1b0..c98bdea 100644
--- a/src/gui/src/button_sprite.c
+++ b/src/gui/src/button_sprite.c
@@ -13,8 +13,13 @@ int gui_button_render_sprite(const struct gui_button *const b)
return -1;
gui_coords(&b->common, &s->x, &s->y);
- sprite_sort(s);
- return 0;
+
+ const int ret = sprite_sort(s);
+
+ if (ret)
+ fprintf(stderr, "%s: sprite_sort failed\n", __func__);
+
+ return ret;
}
void gui_button_get_dim_sprite(const struct gui_button *const b,
diff --git a/src/gui/src/button_type1.c b/src/gui/src/button_type1.c
index f07f2f3..da59d8b 100644
--- a/src/gui/src/button_type1.c
+++ b/src/gui/src/button_type1.c
@@ -19,7 +19,13 @@ static int render_left(const struct gui_button *const b,
s->x = *x;
s->y = y;
- sprite_sort(s);
+
+ if (sprite_sort(s))
+ {
+ fprintf(stderr, "%s: sprite_sort failed\n", __func__);
+ return -1;
+ }
+
*x = s->x + s->w;
return 0;
}
diff --git a/src/gui/src/line_edit.c b/src/gui/src/line_edit.c
index df52fd0..a7d56c8 100644
--- a/src/gui/src/line_edit.c
+++ b/src/gui/src/line_edit.c
@@ -26,7 +26,13 @@ static int render_left(const struct gui_line_edit *const l,
s->x = *x;
s->y = y;
- sprite_sort(s);
+
+ if (sprite_sort(s))
+ {
+ fprintf(stderr, "%s: sprite_sort failed\n", __func__);
+ return -1;
+ }
+
*x = s->x + s->w;
return 0;
}
@@ -66,7 +72,12 @@ static int render_mid(const struct gui_line_edit *const l,
else
m->w = mid_w;
- sprite_sort(m);
+ if (sprite_sort(m))
+ {
+ fprintf(stderr, "%s: sprite_sort failed\n", __func__);
+ return -1;
+ }
+
*x += m->w;
}
}
@@ -85,8 +96,13 @@ static int render_right(const short x, const short y)
s->x = x;
s->y = y;
- sprite_sort(s);
- return 0;
+
+ const int ret = sprite_sort(s);
+
+ if (ret)
+ fprintf(stderr, "%s: sprite_sort failed\n", __func__);
+
+ return ret;
}
static int render(const struct gui_common *const g)
diff --git a/src/gui/src/rounded_rect.c b/src/gui/src/rounded_rect.c
index b60a05a..4ae3780 100644
--- a/src/gui/src/rounded_rect.c
+++ b/src/gui/src/rounded_rect.c
@@ -19,7 +19,12 @@ static int render_top(const struct gui_rounded_rect *const r,
left->x = x;
left->y = y;
- sprite_sort(left);
+
+ if (sprite_sort(left))
+ {
+ fprintf(stderr, "%s: sprite_sort failed\n", __func__);
+ return -1;
+ }
}
{
@@ -33,7 +38,12 @@ static int render_top(const struct gui_rounded_rect *const r,
right->x = x + r->w - ref->w;
right->y = y;
- sprite_sort(right);
+
+ if (sprite_sort(right))
+ {
+ fprintf(stderr, "%s: sprite_sort failed\n", __func__);
+ return -1;
+ }
}
return 0;