aboutsummaryrefslogtreecommitdiff
path: root/fontconfig/src/fcxml.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-02-01 09:35:49 +0100
committermarha <marha@users.sourceforge.net>2013-02-01 09:35:49 +0100
commitd78d8436d799f19f61642849e31e9ed6af3e6ae2 (patch)
tree436d3d26ae0fe678e3751a9dba65162ac54b2597 /fontconfig/src/fcxml.c
parent49c196c1056aaed97ff5cf43beff5c436d783b99 (diff)
parenta6d5f8de1394c338d01b65be7dba3520bf8bdf4b (diff)
downloadvcxsrv-d78d8436d799f19f61642849e31e9ed6af3e6ae2.tar.gz
vcxsrv-d78d8436d799f19f61642849e31e9ed6af3e6ae2.tar.bz2
vcxsrv-d78d8436d799f19f61642849e31e9ed6af3e6ae2.zip
Merge remote-tracking branch 'origin/released'
* origin/released: xkeyboard-config fontconfig mesa git update 1 feb 2013
Diffstat (limited to 'fontconfig/src/fcxml.c')
-rwxr-xr-xfontconfig/src/fcxml.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/fontconfig/src/fcxml.c b/fontconfig/src/fcxml.c
index cd6aa3109..dba58eaeb 100755
--- a/fontconfig/src/fcxml.c
+++ b/fontconfig/src/fcxml.c
@@ -260,6 +260,8 @@ FcExprDestroy (FcExpr *e)
case FcOpPrependFirst:
case FcOpAppend:
case FcOpAppendLast:
+ case FcOpDelete:
+ case FcOpDeleteAll:
break;
case FcOpOr:
case FcOpAnd:
@@ -2322,6 +2324,8 @@ static const FcOpMap fcModeOps[] = {
{ "prepend_first", FcOpPrependFirst },
{ "append", FcOpAppend },
{ "append_last", FcOpAppendLast },
+ { "delete", FcOpDelete },
+ { "delete_all", FcOpDeleteAll },
};
#define NUM_MODE_OPS (int) (sizeof fcModeOps / sizeof fcModeOps[0])
@@ -2364,6 +2368,13 @@ FcParseEdit (FcConfigParse *parse)
return;
expr = FcPopBinary (parse, FcOpComma);
+ if ((mode == FcOpDelete || mode == FcOpDeleteAll) &&
+ expr != NULL)
+ {
+ FcConfigMessage (parse, FcSevereWarning, "Expression doesn't take any effects for delete and delete_all");
+ FcExprDestroy (expr);
+ expr = NULL;
+ }
edit = FcEditCreate (parse, FcObjectFromName ((char *) name),
mode, expr, binding);
if (!edit)
@@ -2376,6 +2387,11 @@ FcParseEdit (FcConfigParse *parse)
FcEditDestroy (edit);
}
+typedef struct FcSubstStack {
+ FcTest *test;
+ FcEdit *edit;
+} FcSubstStack;
+
static void
FcParseMatch (FcConfigParse *parse)
{
@@ -2384,6 +2400,9 @@ FcParseMatch (FcConfigParse *parse)
FcTest *test = 0;
FcEdit *edit = 0;
FcVStack *vstack;
+ FcBool tested = FcFalse;
+ FcSubstStack *sstack = NULL;
+ int len, pos = 0;
kind_name = FcConfigGetAttribute (parse, "target");
if (!kind_name)
@@ -2402,6 +2421,16 @@ FcParseMatch (FcConfigParse *parse)
return;
}
}
+ len = FcVStackElements(parse);
+ if (len > 0)
+ {
+ sstack = malloc (sizeof (FcSubstStack) * (len + 1));
+ if (!sstack)
+ {
+ FcConfigMessage (parse, FcSevereError, "out of memory");
+ return;
+ }
+ }
while ((vstack = FcVStackPeek (parse)))
{
switch ((int) vstack->tag) {
@@ -2409,8 +2438,22 @@ FcParseMatch (FcConfigParse *parse)
vstack->u.test->next = test;
test = vstack->u.test;
vstack->tag = FcVStackNone;
+ tested = FcTrue;
break;
case FcVStackEdit:
+ /* due to the reverse traversal, <edit> node appears faster than
+ * <test> node if any. so we have to deal with it here rather than
+ * the above in FcVStackTest, and put recipes in reverse order.
+ */
+ if (tested)
+ {
+ sstack[pos].test = test;
+ sstack[pos].edit = edit;
+ pos++;
+ test = NULL;
+ edit = NULL;
+ tested = FcFalse;
+ }
vstack->u.edit->next = edit;
edit = vstack->u.edit;
vstack->tag = FcVStackNone;
@@ -2429,6 +2472,20 @@ FcParseMatch (FcConfigParse *parse)
}
if (!FcConfigAddEdit (parse->config, test, edit, kind))
FcConfigMessage (parse, FcSevereError, "out of memory");
+ if (sstack)
+ {
+ int i;
+
+ for (i = 0; i < pos; i++)
+ {
+ if (!FcConfigAddEdit (parse->config, sstack[pos - i - 1].test, sstack[pos - i - 1].edit, kind))
+ {
+ FcConfigMessage (parse, FcSevereError, "out of memory");
+ return;
+ }
+ }
+ free (sstack);
+ }
}
static void