Permalink
Browse files

Strip leading/trailing whitespace when parsing colors and other strin…

…gs (bug #4937)
  • Loading branch information...
1 parent 808bb02 commit fd9bb43059a4e106bfa07babb0eb2f93146e49b2 @danakj danakj committed Oct 14, 2011
Showing with 7 additions and 1 deletion.
  1. +7 −1 obrender/theme.c
View
@@ -1797,6 +1797,7 @@ static gboolean read_string(XrmDatabase db, const gchar *rname, gchar **value)
if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) &&
retvalue.addr != NULL) {
+ g_strstrip(retvalue.addr);
*value = retvalue.addr;
ret = TRUE;
}
@@ -1815,7 +1816,12 @@ static gboolean read_color(XrmDatabase db, const RrInstance *inst,
if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) &&
retvalue.addr != NULL) {
- RrColor *c = RrColorParse(inst, retvalue.addr);
+ RrColor *c;
+
+ /* retvalue.addr is inside the xrdb database so we can't destroy it
+ but we can edit it in place, as g_strstrip does. */
+ g_strstrip(retvalue.addr);
+ c = RrColorParse(inst, retvalue.addr);
if (c != NULL) {
*value = c;
ret = TRUE;

0 comments on commit fd9bb43

Please sign in to comment.