Make FC_DBG_OBJTYPES debug messages into warnings

And remove FC_DBG_OBJTYPES since it has no use now.
This commit is contained in:
Behdad Esfahbod 2013-01-01 19:52:14 -06:00
parent 209750a4e0
commit 3878a12541
3 changed files with 32 additions and 24 deletions

View File

@ -27,44 +27,52 @@
#include <stdlib.h> #include <stdlib.h>
static void static void
_FcValuePrint (const FcValue v) _FcValuePrintFile (FILE *f, const FcValue v)
{ {
switch (v.type) { switch (v.type) {
case FcTypeVoid: case FcTypeVoid:
printf ("<void>"); fprintf (f, "<void>");
break; break;
case FcTypeInteger: case FcTypeInteger:
printf ("%d(i)", v.u.i); fprintf (f, "%d(i)", v.u.i);
break; break;
case FcTypeDouble: case FcTypeDouble:
printf ("%g(f)", v.u.d); fprintf (f, "%g(f)", v.u.d);
break; break;
case FcTypeString: case FcTypeString:
printf ("\"%s\"", v.u.s); fprintf (f, "\"%s\"", v.u.s);
break; break;
case FcTypeBool: case FcTypeBool:
printf ("%s", v.u.b ? "True" : "False"); fprintf (f, "%s", v.u.b ? "True" : "False");
break; break;
case FcTypeMatrix: case FcTypeMatrix:
printf ("[%g %g; %g %g]", v.u.m->xx, v.u.m->xy, v.u.m->yx, v.u.m->yy); fprintf (f, "[%g %g; %g %g]", v.u.m->xx, v.u.m->xy, v.u.m->yx, v.u.m->yy);
break; break;
case FcTypeCharSet: /* XXX */ case FcTypeCharSet: /* XXX */
FcCharSetPrint (v.u.c); if (f == stdout)
FcCharSetPrint (v.u.c);
break; break;
case FcTypeLangSet: case FcTypeLangSet:
FcLangSetPrint (v.u.l); FcLangSetPrint (v.u.l);
break; break;
case FcTypeFTFace: case FcTypeFTFace:
printf ("face"); fprintf (f, "face");
break; break;
} }
} }
void
FcValuePrintFile (FILE *f, const FcValue v)
{
fprintf (f, " ");
_FcValuePrintFile (f, v);
}
void void
FcValuePrint (const FcValue v) FcValuePrint (const FcValue v)
{ {
printf (" "); printf (" ");
_FcValuePrint (v); _FcValuePrintFile (stdout, v);
} }
void void
@ -74,7 +82,7 @@ FcValuePrintWithPosition (const FcValue v, FcBool show_pos_mark)
printf (" [insert here] "); printf (" [insert here] ");
else else
printf (" "); printf (" ");
_FcValuePrint (v); _FcValuePrintFile (stdout, v);
} }
static void static void

View File

@ -86,7 +86,6 @@ extern pfnSHGetFolderPathA pSHGetFolderPathA;
#define FC_DBG_SCANV 256 #define FC_DBG_SCANV 256
#define FC_DBG_CONFIG 1024 #define FC_DBG_CONFIG 1024
#define FC_DBG_LANGSET 2048 #define FC_DBG_LANGSET 2048
#define FC_DBG_OBJTYPES 4096
#define _FC_ASSERT_STATIC1(_line, _cond) typedef int _static_assert_on_line_##_line##_failed[(_cond)?1:-1] #define _FC_ASSERT_STATIC1(_line, _cond) typedef int _static_assert_on_line_##_line##_failed[(_cond)?1:-1]
#define _FC_ASSERT_STATIC0(_line, _cond) _FC_ASSERT_STATIC1 (_line, (_cond)) #define _FC_ASSERT_STATIC0(_line, _cond) _FC_ASSERT_STATIC1 (_line, (_cond))
@ -703,6 +702,10 @@ FcPrivate FcChar16 *
FcCharSetGetNumbers(const FcCharSet *c); FcCharSetGetNumbers(const FcCharSet *c);
/* fcdbg.c */ /* fcdbg.c */
FcPrivate void
FcValuePrintFile (FILE *f, const FcValue v);
FcPrivate void FcPrivate void
FcValuePrintWithPosition (const FcValue v, FcBool show_pos_mark); FcValuePrintWithPosition (const FcValue v, FcBool show_pos_mark);

View File

@ -553,12 +553,10 @@ FcPatternObjectListAdd (FcPattern *p,
{ {
if (!FcObjectValidType (object, l->value.type)) if (!FcObjectValidType (object, l->value.type))
{ {
if (FcDebug() & FC_DBG_OBJTYPES) fprintf (stderr,
{ "Fontconfig warning: FcPattern object %s does not accept value", FcObjectName (object));
printf ("FcPattern object %s does not accept value ", FcValuePrintFile (stderr, l->value);
FcObjectName (object)); fprintf (stderr, "\n");
FcValuePrint (l->value);
}
goto bail0; goto bail0;
} }
} }
@ -613,12 +611,11 @@ FcPatternObjectAddWithBinding (FcPattern *p,
*/ */
if (!FcObjectValidType (object, value.type)) if (!FcObjectValidType (object, value.type))
{ {
if (FcDebug() & FC_DBG_OBJTYPES) fprintf (stderr,
{ "Fontconfig warning: FcPattern object %s does not accept value",
printf ("FcPattern object %s does not accept value ", FcObjectName (object));
FcObjectName (object)); FcValuePrintFile (stderr, value);
FcValuePrint (value); fprintf (stderr, "\n");
}
goto bail1; goto bail1;
} }