Add FcTypeUnknown to FcType to avoid comparison of constant -1
This change reverts 9acc14c34a
because it doesn't work as expected when building
with -fshort-enums which is default for older arms ABIs
Thanks for pointing this out, Thomas Klausner, Valery Ushakov, and Martin Husemann
This commit is contained in:
parent
38ab7ab2fb
commit
197d06c49b
|
@ -48,8 +48,9 @@
|
|||
__o__ = va_arg (va, const char *); \
|
||||
if (!__o__) \
|
||||
break; \
|
||||
__v__.type = va_arg (va, FcType); \
|
||||
__v__.type = va_arg (va, int); \
|
||||
switch (__v__.type) { \
|
||||
case FcTypeUnknown: \
|
||||
case FcTypeVoid: \
|
||||
goto _FcPatternVapBuild_bail1; \
|
||||
case FcTypeInteger: \
|
||||
|
|
|
@ -185,6 +185,7 @@ typedef int FcBool;
|
|||
#define FC_LCD_LEGACY 3
|
||||
|
||||
typedef enum _FcType {
|
||||
FcTypeUnknown = -1,
|
||||
FcTypeVoid,
|
||||
FcTypeInteger,
|
||||
FcTypeDouble,
|
||||
|
|
|
@ -721,7 +721,7 @@ FcConfigPromote (FcValue v, FcValue u, FcValuePromotionBuffer *buf)
|
|||
|
||||
FcBool
|
||||
FcConfigCompareValue (const FcValue *left_o,
|
||||
FcOp op_,
|
||||
unsigned int op_,
|
||||
const FcValue *right_o)
|
||||
{
|
||||
FcValue left = FcValueCanonicalize(left_o);
|
||||
|
@ -736,6 +736,8 @@ FcConfigCompareValue (const FcValue *left_o,
|
|||
if (left.type == right.type)
|
||||
{
|
||||
switch (left.type) {
|
||||
case FcTypeUnknown:
|
||||
break; /* No way to guess how to compare for this object */
|
||||
case FcTypeInteger:
|
||||
break; /* FcConfigPromote prevents this from happening */
|
||||
case FcTypeDouble:
|
||||
|
|
|
@ -30,6 +30,9 @@ static void
|
|||
_FcValuePrintFile (FILE *f, const FcValue v)
|
||||
{
|
||||
switch (v.type) {
|
||||
case FcTypeUnknown:
|
||||
fprintf (f, "<unknown>");
|
||||
break;
|
||||
case FcTypeVoid:
|
||||
fprintf (f, "<void>");
|
||||
break;
|
||||
|
@ -98,6 +101,10 @@ FcValueBindingPrint (const FcValueListPtr l)
|
|||
case FcValueBindingSame:
|
||||
printf ("(=)");
|
||||
break;
|
||||
default:
|
||||
/* shouldn't be reached */
|
||||
printf ("(?)");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -107,7 +107,9 @@ extern pfnSHGetFolderPathA pSHGetFolderPathA;
|
|||
FC_ASSERT_STATIC (sizeof (FcRef) == sizeof (int));
|
||||
|
||||
typedef enum _FcValueBinding {
|
||||
FcValueBindingWeak, FcValueBindingStrong, FcValueBindingSame
|
||||
FcValueBindingWeak, FcValueBindingStrong, FcValueBindingSame,
|
||||
/* to make sure sizeof (FcValueBinding) == 4 even with -fshort-enums */
|
||||
FcValueBindingEnd = 0xffffffff
|
||||
} FcValueBinding;
|
||||
|
||||
#define FcStrdup(s) ((FcChar8 *) strdup ((const char *) (s)))
|
||||
|
@ -623,7 +625,7 @@ FcConfigSetFonts (FcConfig *config,
|
|||
|
||||
FcPrivate FcBool
|
||||
FcConfigCompareValue (const FcValue *m,
|
||||
FcOp op,
|
||||
unsigned int op_,
|
||||
const FcValue *v);
|
||||
|
||||
FcPrivate FcBool
|
||||
|
|
|
@ -252,6 +252,7 @@ FcListValueHash (FcValue *value)
|
|||
{
|
||||
FcValue v = FcValueCanonicalize(value);
|
||||
switch (v.type) {
|
||||
case FcTypeUnknown:
|
||||
case FcTypeVoid:
|
||||
return 0;
|
||||
case FcTypeInteger:
|
||||
|
|
|
@ -76,6 +76,8 @@ FcObjectValidType (FcObject object, FcType type)
|
|||
|
||||
if (t) {
|
||||
switch ((int) t->type) {
|
||||
case FcTypeUnknown:
|
||||
return FcTrue;
|
||||
case FcTypeDouble:
|
||||
case FcTypeInteger:
|
||||
if (type == FcTypeDouble || type == FcTypeInteger)
|
||||
|
@ -86,7 +88,7 @@ FcObjectValidType (FcObject object, FcType type)
|
|||
return FcTrue;
|
||||
break;
|
||||
default:
|
||||
if ((unsigned int) t->type == (unsigned int) -1 || type == t->type)
|
||||
if (type == t->type)
|
||||
return FcTrue;
|
||||
break;
|
||||
}
|
||||
|
@ -474,6 +476,7 @@ FcNameUnparseValue (FcStrBuf *buf,
|
|||
FcValue v = FcValueCanonicalize(v0);
|
||||
|
||||
switch (v.type) {
|
||||
case FcTypeUnknown:
|
||||
case FcTypeVoid:
|
||||
return FcTrue;
|
||||
case FcTypeInteger:
|
||||
|
|
|
@ -63,7 +63,7 @@ retry:
|
|||
return NULL;
|
||||
|
||||
ot->object.object = (const char *) FcStrdup (str);
|
||||
ot->object.type = -1;
|
||||
ot->object.type = FcTypeUnknown;
|
||||
ot->id = fc_atomic_int_add (next_id, +1);
|
||||
ot->next = ots;
|
||||
|
||||
|
|
|
@ -246,6 +246,8 @@ FcValueEqual (FcValue va, FcValue vb)
|
|||
return FcFalse;
|
||||
}
|
||||
switch (va.type) {
|
||||
case FcTypeUnknown:
|
||||
return FcFalse; /* don't know how to compare this object */
|
||||
case FcTypeVoid:
|
||||
return FcTrue;
|
||||
case FcTypeInteger:
|
||||
|
@ -294,6 +296,7 @@ static FcChar32
|
|||
FcValueHash (const FcValue *v)
|
||||
{
|
||||
switch (v->type) {
|
||||
case FcTypeUnknown:
|
||||
case FcTypeVoid:
|
||||
return 0;
|
||||
case FcTypeInteger:
|
||||
|
@ -317,7 +320,7 @@ FcValueHash (const FcValue *v)
|
|||
case FcTypeLangSet:
|
||||
return FcLangSetHash (FcValueLangSet(v));
|
||||
}
|
||||
return FcFalse;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static FcBool
|
||||
|
|
|
@ -705,7 +705,7 @@ FcTestCreate (FcConfigParse *parse,
|
|||
FcMatchKind kind,
|
||||
FcQual qual,
|
||||
const FcChar8 *field,
|
||||
FcOp compare,
|
||||
unsigned int compare,
|
||||
FcExpr *expr)
|
||||
{
|
||||
FcTest *test = (FcTest *) malloc (sizeof (FcTest));
|
||||
|
|
Loading…
Reference in New Issue