Add the range support in blank element

This commit is contained in:
Akira TAGOH 2010-12-06 12:18:23 +09:00
parent 51e352a1bd
commit d975cdda78
1 changed files with 21 additions and 14 deletions

View File

@ -1092,30 +1092,37 @@ FcStartElement(void *userData, const XML_Char *name, const XML_Char **attr)
static void static void
FcParseBlank (FcConfigParse *parse) FcParseBlank (FcConfigParse *parse)
{ {
int n = FcVStackElements (parse); int n = FcVStackElements (parse);
FcChar32 i;
while (n-- > 0) while (n-- > 0)
{ {
FcVStack *v = FcVStackFetch (parse, n); FcVStack *v = FcVStackFetch (parse, n);
if (v->tag != FcVStackInteger) if (!parse->config->blanks)
FcConfigMessage (parse, FcSevereError, "non-integer blank");
else
{ {
parse->config->blanks = FcBlanksCreate ();
if (!parse->config->blanks) if (!parse->config->blanks)
{ goto bail;
parse->config->blanks = FcBlanksCreate (); }
if (!parse->config->blanks) switch (v->tag) {
{ case FcVStackInteger:
FcConfigMessage (parse, FcSevereError, "out of memory");
break;
}
}
if (!FcBlanksAdd (parse->config->blanks, v->u.integer)) if (!FcBlanksAdd (parse->config->blanks, v->u.integer))
goto bail;
break;
case FcVStackRange:
for (i = v->u.range.begin; i <= v->u.range.end; i++)
{ {
FcConfigMessage (parse, FcSevereError, "out of memory"); if (!FcBlanksAdd (parse->config->blanks, i))
break; goto bail;
} }
break;
default:
FcConfigMessage (parse, FcSevereError, "invalid element in blank");
break;
} }
} }
return;
bail:
FcConfigMessage (parse, FcSevereError, "out of memory");
} }
static void static void