summaryrefslogtreecommitdiff
path: root/libcaja-private/caja-icon-canvas-item.c
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2019-04-10 21:46:24 +0200
committerraveit65 <[email protected]>2022-07-19 23:18:37 +0200
commitd0034595d42dc8db1abff7dd8c29d0b5c2dbc299 (patch)
treed287a1f974531563f30278e465e52c46c3a3202c /libcaja-private/caja-icon-canvas-item.c
parent9089dd7acc02a75438f230f8346867607eaf492b (diff)
downloadcaja-d0034595d42dc8db1abff7dd8c29d0b5c2dbc299.tar.bz2
caja-d0034595d42dc8db1abff7dd8c29d0b5c2dbc299.tar.xz
caja-icon-canvas-item: avoid 'cppcheck' warning
Fixes 'cppcheck' warning: [libcaja-private/caja-icon-canvas-item.c:850]: (error) Uninitialized variable: real_text_height
Diffstat (limited to 'libcaja-private/caja-icon-canvas-item.c')
-rw-r--r--libcaja-private/caja-icon-canvas-item.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/libcaja-private/caja-icon-canvas-item.c b/libcaja-private/caja-icon-canvas-item.c
index 155fa788..1a35fda7 100644
--- a/libcaja-private/caja-icon-canvas-item.c
+++ b/libcaja-private/caja-icon-canvas-item.c
@@ -830,21 +830,20 @@ compute_text_rectangle (const CajaIconCanvasItem *item,
text_rectangle.y0 = icon_rectangle.y1;
text_rectangle.x1 = text_rectangle.x0 + text_width;
- if (usage == BOUNDS_USAGE_FOR_LAYOUT)
+ switch (usage)
{
- real_text_height = text_height_for_layout;
- }
- else if (usage == BOUNDS_USAGE_FOR_ENTIRE_ITEM)
- {
- real_text_height = text_height_for_entire_text;
- }
- else if (usage == BOUNDS_USAGE_FOR_DISPLAY)
- {
- real_text_height = text_height;
- }
- else
- {
- g_assert_not_reached ();
+ case BOUNDS_USAGE_FOR_LAYOUT:
+ real_text_height = text_height_for_layout;
+ break;
+ case BOUNDS_USAGE_FOR_ENTIRE_ITEM:
+ real_text_height = text_height_for_entire_text;
+ break;
+ case BOUNDS_USAGE_FOR_DISPLAY:
+ real_text_height = text_height;
+ break;
+ default:
+ g_assert_not_reached ();
+ break;
}
text_rectangle.y1 = text_rectangle.y0 + real_text_height + LABEL_OFFSET / pixels_per_unit;