Strip leading/trailing whitespace when parsing colors and other strings (bug #4937)
This commit is contained in:
parent
808bb02af8
commit
fd9bb43059
1 changed files with 7 additions and 1 deletions
|
@ -1797,6 +1797,7 @@ static gboolean read_string(XrmDatabase db, const gchar *rname, gchar **value)
|
||||||
|
|
||||||
if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) &&
|
if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) &&
|
||||||
retvalue.addr != NULL) {
|
retvalue.addr != NULL) {
|
||||||
|
g_strstrip(retvalue.addr);
|
||||||
*value = retvalue.addr;
|
*value = retvalue.addr;
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1815,7 +1816,12 @@ static gboolean read_color(XrmDatabase db, const RrInstance *inst,
|
||||||
|
|
||||||
if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) &&
|
if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) &&
|
||||||
retvalue.addr != NULL) {
|
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) {
|
if (c != NULL) {
|
||||||
*value = c;
|
*value = c;
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
|
|
Loading…
Reference in a new issue