From 5fe09702f4fc4ec6d55f30b80999ce2c219bd966 Mon Sep 17 00:00:00 2001 From: Patrick Lam Date: Sat, 7 Jan 2006 06:36:24 +0000 Subject: [PATCH] Print out full pathname in fc-match -v as well. Reported by Frederic Crozat. Fix bug where fc-match crashes when given __DUMMY__ property to match on. (I added the __DUMMY__ string to enable callers of FcObjectToPtrLookup to distinguish an error return from a successful return. -PL) reviewed by: plam --- ChangeLog | 18 ++++++++++++++++++ src/fcdbg.c | 21 ++++++++++++++++++++- src/fcname.c | 11 +++++++---- 3 files changed, 45 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 645cb83..7fcda1c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2006-01-06 Patrick Lam + * src/fcdbg.c (FcPatternPrint): + + Print out full pathname in fc-match -v as well. Reported by + Frederic Crozat. + +2006-01-06 Mike Fabian + reviewed by: plam + + * src/fcname.c (FcNameParse): + + Fix bug where fc-match crashes when given __DUMMY__ property to + match on. + + (I added the __DUMMY__ string to enable callers of + FcObjectToPtrLookup to distinguish an error return from a + successful return. -PL) + 2006-01-05 Patrick Lam * AUTHORS: diff --git a/src/fcdbg.c b/src/fcdbg.c index 607ddc1..e548189 100644 --- a/src/fcdbg.c +++ b/src/fcdbg.c @@ -111,7 +111,26 @@ FcPatternPrint (const FcPattern *p) { e = FcPatternEltU(p->elts) + i; printf ("\t%s:", FcObjectPtrU(e->object)); - FcValueListPrint (e->values); + /* so that fc-match properly displays file: foo... */ + if (e->object == FcObjectToPtr(FC_FILE)) + { + FcChar8 * s; + FcPatternGetString (p, FC_FILE, 0, &s); + printf (" \"%s\"", s); + switch (FcValueListPtrU(e->values)->binding) { + case FcValueBindingWeak: + printf ("(w)"); + break; + case FcValueBindingStrong: + printf ("(s)"); + break; + case FcValueBindingSame: + printf ("(=)"); + break; + } + } + else + FcValueListPrint (e->values); printf ("\n"); } printf ("\n"); diff --git a/src/fcname.c b/src/fcname.c index d710035..3c902cd 100644 --- a/src/fcname.c +++ b/src/fcname.c @@ -29,8 +29,11 @@ #include "fcint.h" /* Please do not revoke any of these bindings. */ +/* The __DUMMY__ object enables callers to distinguish the error return + * of FcObjectToPtrLookup from FC_FAMILY's FcObjectPtr, which would + * otherwise be 0. */ static const FcObjectType _FcBaseObjectTypes[] = { - { "__DUMMY__", FcTypeVoid, }, + { "__DUMMY__", FcTypeVoid, }, { FC_FAMILY, FcTypeString, }, { FC_FAMILYLANG, FcTypeString, }, { FC_STYLE, FcTypeString, }, @@ -207,8 +210,8 @@ FcObjectToPtrLookup (const char * object) } } - /* We didn't match. Look for the correct FcObjectTypeList - * to replace it in-place. */ + /* We didn't match. Look for the application's FcObjectTypeList + * and replace it in-place. */ for (l = _FcObjectTypes; l; l = l->next) { if (l->types == _FcUserObjectNames) @@ -703,7 +706,7 @@ FcNameParse (const FcChar8 *name) for (;;) { name = FcNameFindNext (name, ":,", save, &delim); - if (t) + if (t && strcmp (t->object, _FcBaseObjectTypes[0].object)) { v = FcNameConvert (t->type, save, &m); if (!FcPatternAdd (pat, t->object, v, FcTrue)) -- 2.39.5