From 3878a125410d1dd461aee1e40f9ac00d68be71f2 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 1 Jan 2013 19:52:14 -0600 Subject: [PATCH] Make FC_DBG_OBJTYPES debug messages into warnings And remove FC_DBG_OBJTYPES since it has no use now. --- src/fcdbg.c | 30 +++++++++++++++++++----------- src/fcint.h | 5 ++++- src/fcpat.c | 21 +++++++++------------ 3 files changed, 32 insertions(+), 24 deletions(-) diff --git a/src/fcdbg.c b/src/fcdbg.c index 20fc6c8..e8cbe32 100644 --- a/src/fcdbg.c +++ b/src/fcdbg.c @@ -27,44 +27,52 @@ #include static void -_FcValuePrint (const FcValue v) +_FcValuePrintFile (FILE *f, const FcValue v) { switch (v.type) { case FcTypeVoid: - printf (""); + fprintf (f, ""); break; case FcTypeInteger: - printf ("%d(i)", v.u.i); + fprintf (f, "%d(i)", v.u.i); break; case FcTypeDouble: - printf ("%g(f)", v.u.d); + fprintf (f, "%g(f)", v.u.d); break; case FcTypeString: - printf ("\"%s\"", v.u.s); + fprintf (f, "\"%s\"", v.u.s); break; case FcTypeBool: - printf ("%s", v.u.b ? "True" : "False"); + fprintf (f, "%s", v.u.b ? "True" : "False"); break; 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; case FcTypeCharSet: /* XXX */ - FcCharSetPrint (v.u.c); + if (f == stdout) + FcCharSetPrint (v.u.c); break; case FcTypeLangSet: FcLangSetPrint (v.u.l); break; case FcTypeFTFace: - printf ("face"); + fprintf (f, "face"); break; } } +void +FcValuePrintFile (FILE *f, const FcValue v) +{ + fprintf (f, " "); + _FcValuePrintFile (f, v); +} + void FcValuePrint (const FcValue v) { printf (" "); - _FcValuePrint (v); + _FcValuePrintFile (stdout, v); } void @@ -74,7 +82,7 @@ FcValuePrintWithPosition (const FcValue v, FcBool show_pos_mark) printf (" [insert here] "); else printf (" "); - _FcValuePrint (v); + _FcValuePrintFile (stdout, v); } static void diff --git a/src/fcint.h b/src/fcint.h index 68074f0..76b95ca 100644 --- a/src/fcint.h +++ b/src/fcint.h @@ -86,7 +86,6 @@ extern pfnSHGetFolderPathA pSHGetFolderPathA; #define FC_DBG_SCANV 256 #define FC_DBG_CONFIG 1024 #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_STATIC0(_line, _cond) _FC_ASSERT_STATIC1 (_line, (_cond)) @@ -703,6 +702,10 @@ FcPrivate FcChar16 * FcCharSetGetNumbers(const FcCharSet *c); /* fcdbg.c */ + +FcPrivate void +FcValuePrintFile (FILE *f, const FcValue v); + FcPrivate void FcValuePrintWithPosition (const FcValue v, FcBool show_pos_mark); diff --git a/src/fcpat.c b/src/fcpat.c index 5d94295..0aab7a0 100644 --- a/src/fcpat.c +++ b/src/fcpat.c @@ -553,12 +553,10 @@ FcPatternObjectListAdd (FcPattern *p, { if (!FcObjectValidType (object, l->value.type)) { - if (FcDebug() & FC_DBG_OBJTYPES) - { - printf ("FcPattern object %s does not accept value ", - FcObjectName (object)); - FcValuePrint (l->value); - } + fprintf (stderr, + "Fontconfig warning: FcPattern object %s does not accept value", FcObjectName (object)); + FcValuePrintFile (stderr, l->value); + fprintf (stderr, "\n"); goto bail0; } } @@ -613,12 +611,11 @@ FcPatternObjectAddWithBinding (FcPattern *p, */ if (!FcObjectValidType (object, value.type)) { - if (FcDebug() & FC_DBG_OBJTYPES) - { - printf ("FcPattern object %s does not accept value ", - FcObjectName (object)); - FcValuePrint (value); - } + fprintf (stderr, + "Fontconfig warning: FcPattern object %s does not accept value", + FcObjectName (object)); + FcValuePrintFile (stderr, value); + fprintf (stderr, "\n"); goto bail1; }