X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=src%2Ffccfg.c;h=09c59919d8f37bd1998f7d530f7b96865512b8a2;hb=HEAD;hp=ad9f7d2060b5c1a3c81e24c2c34203161a64443b;hpb=857b7efe1e301f670329c6836da52fbab8c5df66;p=fontconfig.git diff --git a/src/fccfg.c b/src/fccfg.c index ad9f7d2..09c5991 100644 --- a/src/fccfg.c +++ b/src/fccfg.c @@ -131,7 +131,7 @@ FcConfigNewestFile (FcStrSet *files) if (list) { while ((file = FcStrListNext (list))) - if (FcStat ((char *) file, &statb) == 0) + if (FcStat (file, &statb) == 0) if (!newest.set || statb.st_mtime - newest.time > 0) { newest.set = FcTrue; @@ -897,6 +897,11 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e) v.u.c = e->u.cval; v = FcValueSave (v); break; + case FcOpLangSet: + v.type = FcTypeLangSet; + v.u.l = e->u.lval; + v = FcValueSave (v); + break; case FcOpBool: v.type = FcTypeBool; v.u.b = e->u.bval; @@ -1055,6 +1060,25 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e) break; } break; + case FcTypeLangSet: + switch (e->op) { + case FcOpPlus: + v.type = FcTypeLangSet; + v.u.l = FcLangSetUnion (vl.u.l, vr.u.l); + if (!v.u.l) + v.type = FcTypeVoid; + break; + case FcOpMinus: + v.type = FcTypeLangSet; + v.u.l = FcLangSetSubtract (vl.u.l, vr.u.l); + if (!v.u.l) + v.type = FcTypeVoid; + break; + default: + v.type = FcTypeVoid; + break; + } + break; default: v.type = FcTypeVoid; break; @@ -1665,10 +1689,19 @@ static FcChar8 * FcConfigFileExists (const FcChar8 *dir, const FcChar8 *file) { FcChar8 *path; + int size; if (!dir) dir = (FcChar8 *) ""; - path = malloc (strlen ((char *) dir) + 1 + strlen ((char *) file) + 1); + + size = strlen ((char *) dir) + 1 + strlen ((char *) file) + 1; + /* + * workaround valgrind warning because glibc takes advantage of how it knows memory is + * allocated to implement strlen by reading in groups of 4 + */ + size = (size + 3) & ~3; + + path = malloc (size); if (!path) return 0; @@ -1687,7 +1720,7 @@ FcConfigFileExists (const FcChar8 *dir, const FcChar8 *file) #endif strcat ((char *) path, (char *) file); - FcMemAlloc (FC_MEM_STRING, strlen ((char *) path) + 1); + FcMemAlloc (FC_MEM_STRING, size); if (access ((char *) path, R_OK) == 0) return path;