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>
static void
_FcValuePrint (const FcValue v)
_FcValuePrintFile (FILE *f, const FcValue v)
{
switch (v.type) {
case FcTypeVoid:
printf ("<void>");
fprintf (f, "<void>");
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

View File

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

View File

@ -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;
}