[gnome-shell] st: Add default case to switch statements
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] st: Add default case to switch statements
- Date: Wed, 23 Sep 2015 19:56:59 +0000 (UTC)
commit f5e7530fc70f27fbe4cce4e2b9da292721debb76
Author: Florian Müllner <fmuellner gnome org>
Date: Tue Sep 22 18:47:25 2015 +0200
st: Add default case to switch statements
src/st/st-scroll-bar.c | 4 ++++
src/st/st-scroll-view.c | 18 ++++++++++++++++++
src/st/st-theme-node-drawing.c | 15 +++++++++++++++
src/st/st-theme-node.c | 10 ++++++++++
src/st/st-theme.c | 3 +++
src/st/test-theme.c | 4 ++--
6 files changed, 52 insertions(+), 2 deletions(-)
---
diff --git a/src/st/st-scroll-bar.c b/src/st/st-scroll-bar.c
index b84ecd1..050c6e7 100644
--- a/src/st/st-scroll-bar.c
+++ b/src/st/st-scroll-bar.c
@@ -450,6 +450,7 @@ adjust_with_direction (StAdjustment *adj,
delta = 1.0;
break;
case CLUTTER_SCROLL_SMOOTH:
+ default:
g_assert_not_reached ();
break;
}
@@ -485,6 +486,9 @@ st_scroll_bar_scroll_event (ClutterActor *actor,
case CLUTTER_SCROLL_RIGHT:
adjust_with_direction (priv->adjustment, event->direction);
break;
+ default:
+ g_return_val_if_reached (FALSE);
+ break;
}
return TRUE;
diff --git a/src/st/st-scroll-view.c b/src/st/st-scroll-view.c
index cab16c2..302f6a7 100644
--- a/src/st/st-scroll-view.c
+++ b/src/st/st-scroll-view.c
@@ -378,6 +378,9 @@ st_scroll_view_get_preferred_width (ClutterActor *actor,
* but that's not cleanly defined at the moment */
min_width = 0;
break;
+ default:
+ g_warn_if_reached();
+ break;
}
switch (priv->vscrollbar_policy)
@@ -396,6 +399,9 @@ st_scroll_view_get_preferred_width (ClutterActor *actor,
*/
account_for_vscrollbar = !priv->overlay_scrollbars;
break;
+ default:
+ g_warn_if_reached();
+ break;
}
if (account_for_vscrollbar)
@@ -452,6 +458,9 @@ st_scroll_view_get_preferred_height (ClutterActor *actor,
/* We've requested space for the scrollbar, subtract it back out */
for_width -= sb_width;
break;
+ default:
+ g_warn_if_reached();
+ break;
}
switch (priv->hscrollbar_policy)
@@ -470,6 +479,9 @@ st_scroll_view_get_preferred_height (ClutterActor *actor,
*/
account_for_hscrollbar = !priv->overlay_scrollbars;
break;
+ default:
+ g_warn_if_reached();
+ break;
}
clutter_actor_get_preferred_height (priv->child, for_width,
@@ -489,6 +501,9 @@ st_scroll_view_get_preferred_height (ClutterActor *actor,
* but that's not cleanly defined at the moment */
min_height = 0;
break;
+ default:
+ g_warn_if_reached();
+ break;
}
if (account_for_hscrollbar)
@@ -759,6 +774,9 @@ st_scroll_view_scroll_event (ClutterActor *self,
case CLUTTER_SCROLL_RIGHT:
adjust_with_direction (priv->hadjustment, event->direction);
break;
+ default:
+ g_warn_if_reached();
+ break;
}
return TRUE;
diff --git a/src/st/st-theme-node-drawing.c b/src/st/st-theme-node-drawing.c
index cb2eb87..75fc53f 100644
--- a/src/st/st-theme-node-drawing.c
+++ b/src/st/st-theme-node-drawing.c
@@ -335,6 +335,9 @@ st_theme_node_get_corner_border_widths (StThemeNode *node,
if (border_width_2)
*border_width_2 = node->border_width[ST_SIDE_LEFT];
break;
+ default:
+ g_assert_not_reached();
+ break;
}
}
@@ -381,6 +384,9 @@ st_theme_node_lookup_corner (StThemeNode *node,
over (&node->border_color[ST_SIDE_BOTTOM], &corner.color, &corner.border_color_1);
over (&node->border_color[ST_SIDE_LEFT], &corner.color, &corner.border_color_2);
break;
+ default:
+ g_assert_not_reached();
+ break;
}
if (corner.color.alpha == 0 &&
@@ -433,6 +439,9 @@ get_background_scale (StThemeNode *node,
else if (node->background_size_h > -1)
*scale_w = node->background_size_h / background_image_height;
break;
+ default:
+ g_assert_not_reached();
+ break;
}
if (*scale_h < 0.0)
*scale_h = *scale_w;
@@ -1720,6 +1729,9 @@ st_theme_node_paint_borders (StThemeNodePaintState *state,
max_width_radius[ST_CORNER_BOTTOMLEFT], height,
0, 0.5, 0.5, 1);
break;
+ default:
+ g_assert_not_reached();
+ break;
}
}
}
@@ -1814,6 +1826,9 @@ st_theme_node_paint_borders (StThemeNodePaintState *state,
verts[7] = height - border_width[ST_SIDE_BOTTOM];
}
break;
+ default:
+ g_assert_not_reached();
+ break;
}
cogl_rectangles (verts, n_rects);
}
diff --git a/src/st/st-theme-node.c b/src/st/st-theme-node.c
index d71466c..acafeb3 100644
--- a/src/st/st-theme-node.c
+++ b/src/st/st-theme-node.c
@@ -594,6 +594,9 @@ get_color_from_rgba_term (CRTerm *term,
case 3:
a = value;
break;
+ default:
+ g_assert_not_reached();
+ break;
}
arg = arg->next;
@@ -1102,6 +1105,7 @@ get_length_from_term (StThemeNode *node,
case NUM_FREQ_KHZ:
case NUM_UNKNOWN_TYPE:
case NB_NUM_TYPE:
+ default:
g_warning ("Ignoring invalid type of number of length property");
return VALUE_NOT_FOUND;
}
@@ -3250,6 +3254,9 @@ parse_shadow_property (StThemeNode *node,
"not allowed");
*spread = value;
break;
+ default:
+ g_warning ("Ignoring excess values in shadow definition");
+ break;
}
continue;
}
@@ -3626,6 +3633,9 @@ st_theme_node_get_icon_colors (StThemeNode *node)
case SUCCESS:
node->icon_colors->success = color;
break;
+ default:
+ g_assert_not_reached();
+ break;
}
}
}
diff --git a/src/st/st-theme.c b/src/st/st-theme.c
index 9ad40f7..ad0a4ff 100644
--- a/src/st/st-theme.c
+++ b/src/st/st-theme.c
@@ -615,6 +615,9 @@ additional_selector_matches_style (StTheme *a_this,
if (!pseudo_class_add_sel_matches_style (a_this, cur_add_sel, a_node))
return FALSE;
break;
+ default:
+ g_warning ("Unhandled selector type %d", cur_add_sel->type);
+ return FALSE;
}
}
diff --git a/src/st/test-theme.c b/src/st/test-theme.c
index 37844e9..c02a2bf 100644
--- a/src/st/test-theme.c
+++ b/src/st/test-theme.c
@@ -152,9 +152,9 @@ side_to_string (StSide side)
return "bottom";
case ST_SIDE_LEFT:
return "left";
+ default:
+ return "<unknown>";
}
-
- return "<unknown>";
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]