summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2019-04-10 21:46:24 +0200
committerZenWalker <[email protected]>2019-04-10 22:52:34 +0200
commit7c290c6bb60c65b3b0a336d0595490f9e0f7b3f2 (patch)
tree8b530ec7caf7263eff3307409ab1a46eeaac3777
parentde7e25bc2544d45ff27b08377996787bb44039ae (diff)
downloadcaja-7c290c6bb60c65b3b0a336d0595490f9e0f7b3f2.tar.bz2
caja-7c290c6bb60c65b3b0a336d0595490f9e0f7b3f2.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
-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;