summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbuj <[email protected]>2022-02-01 11:07:36 +0100
committerraveit65 <[email protected]>2022-03-11 19:04:52 +0100
commit0e517d0fe102296e4b44253c1673cb767b5f444c (patch)
treed70eba21e08659fd348c1b0b355a2b55c4552218
parent5e8097475ba237bc0bc71ad78a7cbdf2d71f7b87 (diff)
downloadmarco-0e517d0fe102296e4b44253c1673cb767b5f444c.tar.bz2
marco-0e517d0fe102296e4b44253c1673cb767b5f444c.tar.xz
boxes: fix build warning -Wstring-conversion
-rw-r--r--src/core/boxes.c55
1 files changed, 27 insertions, 28 deletions
diff --git a/src/core/boxes.c b/src/core/boxes.c
index a9006ede..9ef8d94d 100644
--- a/src/core/boxes.c
+++ b/src/core/boxes.c
@@ -1334,9 +1334,10 @@ get_disjoint_strut_rect_list_in_region (const GSList *old_struts,
gint
meta_rectangle_edge_cmp_ignore_type (gconstpointer a, gconstpointer b)
{
- const MetaEdge *a_edge_rect = (gconstpointer) a;
- const MetaEdge *b_edge_rect = (gconstpointer) b;
- int a_compare, b_compare;
+ const MetaEdge *a_edge_rect = a;
+ const MetaEdge *b_edge_rect = b;
+ int a_compare = 0;
+ int b_compare = 0;
/* Edges must be both vertical or both horizontal, or it doesn't make
* sense to compare them.
@@ -1344,33 +1345,31 @@ meta_rectangle_edge_cmp_ignore_type (gconstpointer a, gconstpointer b)
g_assert ((a_edge_rect->rect.width == 0 && b_edge_rect->rect.width == 0) ||
(a_edge_rect->rect.height == 0 && b_edge_rect->rect.height == 0));
- a_compare = b_compare = 0; /* gcc-3.4.2 sucks at figuring initialized'ness */
-
- if (a_edge_rect->side_type == META_SIDE_LEFT ||
- a_edge_rect->side_type == META_SIDE_RIGHT)
- {
- a_compare = a_edge_rect->rect.x;
- b_compare = b_edge_rect->rect.x;
- if (a_compare == b_compare)
- {
- a_compare = a_edge_rect->rect.y;
- b_compare = b_edge_rect->rect.y;
- }
- }
- else if (a_edge_rect->side_type == META_SIDE_TOP ||
- a_edge_rect->side_type == META_SIDE_BOTTOM)
+ switch (a_edge_rect->side_type)
{
- a_compare = a_edge_rect->rect.y;
- b_compare = b_edge_rect->rect.y;
- if (a_compare == b_compare)
- {
- a_compare = a_edge_rect->rect.x;
- b_compare = b_edge_rect->rect.x;
- }
+ case META_SIDE_LEFT:
+ case META_SIDE_RIGHT:
+ a_compare = a_edge_rect->rect.x;
+ b_compare = b_edge_rect->rect.x;
+ if (a_compare == b_compare)
+ {
+ a_compare = a_edge_rect->rect.y;
+ b_compare = b_edge_rect->rect.y;
+ }
+ break;
+ case META_SIDE_TOP:
+ case META_SIDE_BOTTOM:
+ a_compare = a_edge_rect->rect.y;
+ b_compare = b_edge_rect->rect.y;
+ if (a_compare == b_compare)
+ {
+ a_compare = a_edge_rect->rect.x;
+ b_compare = b_edge_rect->rect.x;
+ }
+ break;
+ default:
+ g_assert_not_reached ();
}
- else
- g_assert ("Some idiot wanted to sort sides of different types.\n");
-
return a_compare - b_compare; /* positive value denotes a > b ... */
}