[fcformat] Fix default-value handling

This commit is contained in:
Behdad Esfahbod 2009-03-13 12:11:13 -04:00
parent 3074a73b41
commit f6d8343989
1 changed files with 11 additions and 10 deletions

View File

@ -737,9 +737,9 @@ interpret_simple (FcFormatContext *c,
e = FcPatternObjectFindElt (pat, e = FcPatternObjectFindElt (pat,
FcObjectFromName ((const char *) c->word)); FcObjectFromName ((const char *) c->word));
if (e) if (e || else_string)
{ {
FcValueListPtr l; FcValueListPtr l = NULL;
if (add_colon) if (add_colon)
FcStrBufChar (buf, ':'); FcStrBufChar (buf, ':');
@ -749,7 +749,8 @@ interpret_simple (FcFormatContext *c,
FcStrBufChar (buf, '='); FcStrBufChar (buf, '=');
} }
l = FcPatternEltValues(e); if (e)
l = FcPatternEltValues(e);
if (idx != -1) if (idx != -1)
{ {
@ -765,16 +766,16 @@ interpret_simple (FcFormatContext *c,
} }
else goto notfound; else goto notfound;
} }
else else if (l)
{ {
FcNameUnparseValueList (buf, l, '\0'); FcNameUnparseValueList (buf, l, '\0');
} }
} else
else {
notfound: notfound:
{ if (else_string)
if (else_string) FcStrBufString (buf, else_string);
printf ("%s", else_string); }
} }
return FcTrue; return FcTrue;