StThemeNode: suppress compiler warnings and fix minor bugs
Aggressive compiler flags can cause the compiler to be smart enough to inline functions and detect variables not being set on certain code paths but not smart enough to understand the overall logic; add some extra initializations to suppress the warnings. Fix several minor bugs in the logic found when double checking the logic before adding the initializations. Based on a patch by Marc-Antoine Perennou <Marc-Antoine@Perennou.com>. https://bugzilla.gnome.org/show_bug.cgi?id=634225
This commit is contained in:
parent
71685a3b48
commit
1fce237538
@ -718,7 +718,7 @@ get_length_from_term (StThemeNode *node,
|
|||||||
if (term->type != TERM_NUMBER)
|
if (term->type != TERM_NUMBER)
|
||||||
{
|
{
|
||||||
g_warning ("Ignoring length property that isn't a number");
|
g_warning ("Ignoring length property that isn't a number");
|
||||||
return FALSE;
|
return VALUE_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
num = term->content.num;
|
num = term->content.num;
|
||||||
@ -859,7 +859,7 @@ get_length_from_term_int (StThemeNode *node,
|
|||||||
GetFromTermResult result;
|
GetFromTermResult result;
|
||||||
|
|
||||||
result = get_length_from_term (node, term, use_parent_font, &value);
|
result = get_length_from_term (node, term, use_parent_font, &value);
|
||||||
if (result != VALUE_NOT_FOUND)
|
if (result == VALUE_FOUND)
|
||||||
*length = (int) (0.5 + value);
|
*length = (int) (0.5 + value);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -1053,7 +1053,7 @@ do_border_property (StThemeNode *node,
|
|||||||
StSide side = (StSide)-1;
|
StSide side = (StSide)-1;
|
||||||
ClutterColor color;
|
ClutterColor color;
|
||||||
gboolean color_set = FALSE;
|
gboolean color_set = FALSE;
|
||||||
int width;
|
int width = 0; /* suppress warning */
|
||||||
gboolean width_set = FALSE;
|
gboolean width_set = FALSE;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
@ -1098,7 +1098,8 @@ do_border_property (StThemeNode *node,
|
|||||||
const char *ident = term->content.str->stryng->str;
|
const char *ident = term->content.str->stryng->str;
|
||||||
if (strcmp (ident, "none") == 0 || strcmp (ident, "hidden") == 0)
|
if (strcmp (ident, "none") == 0 || strcmp (ident, "hidden") == 0)
|
||||||
{
|
{
|
||||||
width = 0.;
|
width = 0;
|
||||||
|
width_set = TRUE;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (strcmp (ident, "solid") == 0)
|
else if (strcmp (ident, "solid") == 0)
|
||||||
@ -1185,7 +1186,7 @@ do_outline_property (StThemeNode *node,
|
|||||||
const char *property_name = decl->property->stryng->str + 7; /* Skip 'outline' */
|
const char *property_name = decl->property->stryng->str + 7; /* Skip 'outline' */
|
||||||
ClutterColor color;
|
ClutterColor color;
|
||||||
gboolean color_set = FALSE;
|
gboolean color_set = FALSE;
|
||||||
int width;
|
int width = 0; /* suppress warning */
|
||||||
gboolean width_set = FALSE;
|
gboolean width_set = FALSE;
|
||||||
|
|
||||||
if (strcmp (property_name, "") == 0)
|
if (strcmp (property_name, "") == 0)
|
||||||
@ -1202,7 +1203,8 @@ do_outline_property (StThemeNode *node,
|
|||||||
const char *ident = term->content.str->stryng->str;
|
const char *ident = term->content.str->stryng->str;
|
||||||
if (strcmp (ident, "none") == 0 || strcmp (ident, "hidden") == 0)
|
if (strcmp (ident, "none") == 0 || strcmp (ident, "hidden") == 0)
|
||||||
{
|
{
|
||||||
width = 0.;
|
width = 0;
|
||||||
|
width_set = TRUE;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (strcmp (ident, "solid") == 0)
|
else if (strcmp (ident, "solid") == 0)
|
||||||
@ -2234,17 +2236,19 @@ font_variant_from_term (CRTerm *term,
|
|||||||
const PangoFontDescription *
|
const PangoFontDescription *
|
||||||
st_theme_node_get_font (StThemeNode *node)
|
st_theme_node_get_font (StThemeNode *node)
|
||||||
{
|
{
|
||||||
PangoStyle font_style;
|
/* Initialized despite _set flags to suppress compiler warnings */
|
||||||
|
PangoStyle font_style = PANGO_STYLE_NORMAL;
|
||||||
gboolean font_style_set = FALSE;
|
gboolean font_style_set = FALSE;
|
||||||
PangoVariant variant;
|
PangoVariant variant = PANGO_VARIANT_NORMAL;
|
||||||
gboolean variant_set = FALSE;
|
gboolean variant_set = FALSE;
|
||||||
PangoWeight weight;
|
PangoWeight weight = PANGO_WEIGHT_NORMAL;
|
||||||
gboolean weight_absolute;
|
gboolean weight_absolute = TRUE;
|
||||||
gboolean weight_set = FALSE;
|
gboolean weight_set = FALSE;
|
||||||
double parent_size;
|
double size = 0.;
|
||||||
double size = 0.; /* Suppress warning */
|
|
||||||
gboolean size_set = FALSE;
|
gboolean size_set = FALSE;
|
||||||
|
|
||||||
char *family = NULL;
|
char *family = NULL;
|
||||||
|
double parent_size;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (node->font_desc)
|
if (node->font_desc)
|
||||||
|
Loading…
Reference in New Issue
Block a user