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
This commit is contained in:
Patrick Lam 2006-01-07 06:36:24 +00:00
parent c60ec7cc6d
commit 5fe09702f4
3 changed files with 45 additions and 5 deletions

View File

@ -1,3 +1,21 @@
2006-01-06 Patrick Lam <plam@mit.edu>
* src/fcdbg.c (FcPatternPrint):
Print out full pathname in fc-match -v as well. Reported by
Frederic Crozat.
2006-01-06 Mike Fabian <mfabian@suse.de>
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 <plam@mit.edu>
* AUTHORS:

View File

@ -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");

View File

@ -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))