Fix compiler warnings

This commit is contained in:
Behdad Esfahbod 2012-12-29 22:11:09 -05:00
parent 4f6767470f
commit 24cdcf52ab
7 changed files with 53 additions and 55 deletions

View File

@ -708,7 +708,7 @@ FcConfigCompareValue (const FcValue *left_o,
case FcTypeInteger:
break; /* FcConfigPromote prevents this from happening */
case FcTypeDouble:
switch (op) {
switch ((int) op) {
case FcOpEqual:
case FcOpContains:
case FcOpListing:
@ -735,7 +735,7 @@ FcConfigCompareValue (const FcValue *left_o,
}
break;
case FcTypeBool:
switch (op) {
switch ((int) op) {
case FcOpEqual:
case FcOpContains:
case FcOpListing:
@ -750,7 +750,7 @@ FcConfigCompareValue (const FcValue *left_o,
}
break;
case FcTypeString:
switch (op) {
switch ((int) op) {
case FcOpEqual:
case FcOpListing:
if (flags & FcOpFlagIgnoreBlanks)
@ -775,7 +775,7 @@ FcConfigCompareValue (const FcValue *left_o,
}
break;
case FcTypeMatrix:
switch (op) {
switch ((int) op) {
case FcOpEqual:
case FcOpContains:
case FcOpListing:
@ -790,7 +790,7 @@ FcConfigCompareValue (const FcValue *left_o,
}
break;
case FcTypeCharSet:
switch (op) {
switch ((int) op) {
case FcOpContains:
case FcOpListing:
/* left contains right if right is a subset of left */
@ -811,7 +811,7 @@ FcConfigCompareValue (const FcValue *left_o,
}
break;
case FcTypeLangSet:
switch (op) {
switch ((int) op) {
case FcOpContains:
case FcOpListing:
ret = FcLangSetContains (left.u.l, right.u.l);
@ -830,7 +830,7 @@ FcConfigCompareValue (const FcValue *left_o,
}
break;
case FcTypeVoid:
switch (op) {
switch ((int) op) {
case FcOpEqual:
case FcOpContains:
case FcOpListing:
@ -841,7 +841,7 @@ FcConfigCompareValue (const FcValue *left_o,
}
break;
case FcTypeFTFace:
switch (op) {
switch ((int) op) {
case FcOpEqual:
case FcOpContains:
case FcOpListing:
@ -882,7 +882,7 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
FcChar8 *str;
FcOp op = FC_OP_GET_OP (e->op);
switch (op) {
switch ((int) op) {
case FcOpInteger:
v.type = FcTypeInteger;
v.u.i = e->u.ival;
@ -899,8 +899,8 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
case FcOpMatrix:
{
FcMatrix m;
v.type = FcTypeMatrix;
FcValue xx, xy, yx, yy;
v.type = FcTypeMatrix;
xx = FcConfigPromote (FcConfigEvaluate (p, e->u.mexpr->xx), v);
xy = FcConfigPromote (FcConfigEvaluate (p, e->u.mexpr->xy), v);
yx = FcConfigPromote (FcConfigEvaluate (p, e->u.mexpr->yx), v);
@ -986,9 +986,9 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
vr = FcConfigPromote (vr, vl);
if (vl.type == vr.type)
{
switch (vl.type) {
switch ((int) vl.type) {
case FcTypeDouble:
switch (op) {
switch ((int) op) {
case FcOpPlus:
v.type = FcTypeDouble;
v.u.d = vl.u.d + vr.u.d;
@ -1017,7 +1017,7 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
}
break;
case FcTypeBool:
switch (op) {
switch ((int) op) {
case FcOpOr:
v.type = FcTypeBool;
v.u.b = vl.u.b || vr.u.b;
@ -1032,7 +1032,7 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
}
break;
case FcTypeString:
switch (op) {
switch ((int) op) {
case FcOpPlus:
v.type = FcTypeString;
str = FcStrPlus (vl.u.s, vr.u.s);
@ -1048,7 +1048,7 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
}
break;
case FcTypeMatrix:
switch (op) {
switch ((int) op) {
case FcOpTimes:
v.type = FcTypeMatrix;
m = malloc (sizeof (FcMatrix));
@ -1069,7 +1069,7 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
}
break;
case FcTypeCharSet:
switch (op) {
switch ((int) op) {
case FcOpPlus:
v.type = FcTypeCharSet;
v.u.c = FcCharSetUnion (vl.u.c, vr.u.c);
@ -1088,7 +1088,7 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
}
break;
case FcTypeLangSet:
switch (op) {
switch ((int) op) {
case FcOpPlus:
v.type = FcTypeLangSet;
v.u.l = FcLangSetUnion (vl.u.l, vr.u.l);
@ -1118,7 +1118,7 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
break;
case FcOpNot:
vl = FcConfigEvaluate (p, e->u.tree.left);
switch (vl.type) {
switch ((int) vl.type) {
case FcTypeBool:
v.type = FcTypeBool;
v.u.b = !vl.u.b;
@ -1131,7 +1131,7 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
break;
case FcOpFloor:
vl = FcConfigEvaluate (p, e->u.tree.left);
switch (vl.type) {
switch ((int) vl.type) {
case FcTypeInteger:
v = vl;
break;
@ -1147,7 +1147,7 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
break;
case FcOpCeil:
vl = FcConfigEvaluate (p, e->u.tree.left);
switch (vl.type) {
switch ((int) vl.type) {
case FcTypeInteger:
v = vl;
break;
@ -1163,7 +1163,7 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
break;
case FcOpRound:
vl = FcConfigEvaluate (p, e->u.tree.left);
switch (vl.type) {
switch ((int) vl.type) {
case FcTypeInteger:
v = vl;
break;
@ -1179,7 +1179,7 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
break;
case FcOpTrunc:
vl = FcConfigEvaluate (p, e->u.tree.left);
switch (vl.type) {
switch ((int) vl.type) {
case FcTypeInteger:
v = vl;
break;

View File

@ -358,7 +358,7 @@ skip_percent (FcFormatContext *c)
/* skip an optional width specifier */
if (strtol ((const char *) c->format, (char **) &c->format, 10))
/* don't care */;
{/* don't care */}
if (!expect_char (c, '{'))
return FcFalse;

View File

@ -1005,7 +1005,6 @@ static const FcStringConst slantConsts[] = {
#define NUM_SLANT_CONSTS (int) (sizeof (slantConsts) / sizeof (slantConsts[0]))
#define FcIsSlant(s) FcStringIsConst(s,slantConsts,NUM_SLANT_CONSTS)
#define FcContainsSlant(s) FcStringContainsConst (s,slantConsts,NUM_SLANT_CONSTS)
static const FcStringConst decorativeConsts[] = {
@ -1019,7 +1018,6 @@ static const FcStringConst decorativeConsts[] = {
#define NUM_DECORATIVE_CONSTS (int) (sizeof (decorativeConsts) / sizeof (decorativeConsts[0]))
#define FcIsDecorative(s) FcStringIsConst(s,decorativeConsts,NUM_DECORATIVE_CONSTS)
#define FcContainsDecorative(s) FcStringContainsConst (s,decorativeConsts,NUM_DECORATIVE_CONSTS)
static double
@ -2262,7 +2260,7 @@ FcFreeTypeCheckGlyph (FT_Face face, FcChar32 ucs4,
*advance = slot->metrics.horiAdvance;
switch (slot->format) {
switch ((int) slot->format) {
case ft_glyph_format_bitmap:
/*
* Bitmaps are assumed to be reasonable; if
@ -2598,7 +2596,7 @@ addtag(FcChar8 *complex_, FT_ULong tag)
if (*complex_ != '\0')
strcat ((char *) complex_, " ");
strcat ((char *) complex_, "otlayout:");
strcat ((char *) complex_, OTLAYOUT_HEAD);
strcat ((char *) complex_, (char *) tagstring);
}

View File

@ -33,7 +33,7 @@ FcCompareNumber (FcValue *value1, FcValue *value2)
{
double v1, v2, v;
switch (value1->type) {
switch ((int) value1->type) {
case FcTypeInteger:
v1 = (double) value1->u.i;
break;
@ -43,7 +43,7 @@ FcCompareNumber (FcValue *value1, FcValue *value2)
default:
return -1.0;
}
switch (value2->type) {
switch ((int) value2->type) {
case FcTypeInteger:
v2 = (double) value2->u.i;
break;
@ -86,9 +86,9 @@ FcCompareLang (FcValue *v1, FcValue *v2)
FcLangResult result;
FcValue value1 = FcValueCanonicalize(v1), value2 = FcValueCanonicalize(v2);
switch (value1.type) {
switch ((int) value1.type) {
case FcTypeLangSet:
switch (value2.type) {
switch ((int) value2.type) {
case FcTypeLangSet:
result = FcLangSetCompare (value1.u.l, value2.u.l);
break;
@ -101,7 +101,7 @@ FcCompareLang (FcValue *v1, FcValue *v2)
}
break;
case FcTypeString:
switch (value2.type) {
switch ((int) value2.type) {
case FcTypeLangSet:
result = FcLangSetHasLang (value2.u.l, value1.u.s);
break;
@ -146,7 +146,7 @@ FcCompareSize (FcValue *value1, FcValue *value2)
{
double v1, v2, v;
switch (value1->type) {
switch ((int) value1->type) {
case FcTypeInteger:
v1 = value1->u.i;
break;
@ -156,7 +156,7 @@ FcCompareSize (FcValue *value1, FcValue *value2)
default:
return -1;
}
switch (value2->type) {
switch ((int) value2->type) {
case FcTypeInteger:
v2 = value2->u.i;
break;

View File

@ -296,7 +296,7 @@ FcObjectValidType (FcObject object, FcType type)
FcObjectType *t = FcObjectFindById (object);
if (t) {
switch (t->type) {
switch ((int) t->type) {
case FcTypeDouble:
case FcTypeInteger:
if (type == FcTypeDouble || type == FcTypeInteger)
@ -579,7 +579,7 @@ FcNameConvert (FcType type, FcChar8 *string)
FcMatrix m;
v.type = type;
switch (v.type) {
switch ((int) v.type) {
case FcTypeInteger:
if (!FcNameConstant (string, &v.u.i))
v.u.i = atoi ((char *) string);
@ -717,7 +717,7 @@ FcNameParse (const FcChar8 *name)
if ((c = FcNameGetConstant (save)))
{
t = FcNameGetObjectType ((char *) c->object);
switch (t->type) {
switch ((int) t->type) {
case FcTypeInteger:
case FcTypeDouble:
if (!FcPatternAddInteger (pat, c->object, c->value))

View File

@ -45,7 +45,7 @@ FcPatternCreate (void)
void
FcValueDestroy (FcValue v)
{
switch (v.type) {
switch ((int) v.type) {
case FcTypeString:
if (!FcSharedStrFree (v.u.s))
FcStrFree ((FcChar8 *) v.u.s);
@ -69,7 +69,7 @@ FcValueCanonicalize (const FcValue *v)
{
FcValue new;
switch (v->type)
switch ((int) v->type)
{
case FcTypeString:
new.u.s = FcValueString(v);
@ -93,7 +93,7 @@ FcValueCanonicalize (const FcValue *v)
FcValue
FcValueSave (FcValue v)
{
switch (v.type) {
switch ((int) v.type) {
case FcTypeString:
v.u.s = FcSharedStr (v.u.s);
if (!v.u.s)
@ -140,7 +140,7 @@ FcValueListDestroy (FcValueListPtr l)
FcValueListPtr next;
for (; l; l = next)
{
switch (l->value.type) {
switch ((int) l->value.type) {
case FcTypeString:
if (!FcSharedStrFree ((FcChar8 *)l->value.u.s))
FcStrFree ((FcChar8 *)l->value.u.s);
@ -892,7 +892,7 @@ FcPatternObjectGetInteger (const FcPattern *p, FcObject object, int id, int *i)
r = FcPatternObjectGet (p, object, id, &v);
if (r != FcResultMatch)
return r;
switch (v.type) {
switch ((int) v.type) {
case FcTypeDouble:
*i = (int) v.u.d;
break;
@ -921,7 +921,7 @@ FcPatternObjectGetDouble (const FcPattern *p, FcObject object, int id, double *d
r = FcPatternObjectGet (p, object, id, &v);
if (r != FcResultMatch)
return r;
switch (v.type) {
switch ((int) v.type) {
case FcTypeDouble:
*d = v.u.d;
break;
@ -1293,7 +1293,7 @@ FcValueListSerializeAlloc (FcSerialize *serialize, const FcValueList *vl)
{
if (!FcSerializeAlloc (serialize, vl, sizeof (FcValueList)))
return FcFalse;
switch (vl->value.type) {
switch ((int) vl->value.type) {
case FcTypeString:
if (!FcStrSerializeAlloc (serialize, vl->value.u.s))
return FcFalse;
@ -1339,7 +1339,7 @@ FcValueListSerialize (FcSerialize *serialize, const FcValueList *vl)
vl_serialized->next = NULL;
vl_serialized->value.type = vl->value.type;
switch (vl->value.type) {
switch ((int) vl->value.type) {
case FcTypeInteger:
vl_serialized->value.u.i = vl->value.u.i;
break;

View File

@ -1175,7 +1175,7 @@ FcParseBlank (FcConfigParse *parse)
if (!parse->config->blanks)
goto bail;
}
switch (v->tag) {
switch ((int) v->tag) {
case FcVStackInteger:
if (!FcBlanksAdd (parse->config->blanks, v->u.integer))
goto bail;
@ -1368,7 +1368,7 @@ FcParseRange (FcConfigParse *parse)
FcConfigMessage (parse, FcSevereError, "too many elements in range");
return;
}
switch (vstack->tag) {
switch ((int) vstack->tag) {
case FcVStackInteger:
n = vstack->u.integer;
break;
@ -1435,7 +1435,7 @@ FcParseCharSet (FcConfigParse *parse)
while ((vstack = FcVStackPeek (parse)))
{
switch (vstack->tag) {
switch ((int) vstack->tag) {
case FcVStackInteger:
if (!FcCharSetAddChar (charset, vstack->u.integer))
{
@ -1479,7 +1479,7 @@ FcParseLangSet (FcConfigParse *parse)
while ((vstack = FcVStackPeek (parse)))
{
switch (vstack->tag) {
switch ((int) vstack->tag) {
case FcVStackString:
if (!FcLangSetAdd (langset, vstack->u.string))
{
@ -1602,7 +1602,7 @@ FcParseAlias (FcConfigParse *parse)
return;
while ((vstack = FcVStackPeek (parse)))
{
switch (vstack->tag) {
switch ((int) vstack->tag) {
case FcVStackFamily:
if (family)
{
@ -1731,7 +1731,7 @@ FcPopExpr (FcConfigParse *parse)
FcExpr *expr = 0;
if (!vstack)
return 0;
switch (vstack->tag) {
switch ((int) vstack->tag) {
case FcVStackNone:
break;
case FcVStackString:
@ -2349,7 +2349,7 @@ FcParseMatch (FcConfigParse *parse)
}
while ((vstack = FcVStackPeek (parse)))
{
switch (vstack->tag) {
switch ((int) vstack->tag) {
case FcVStackTest:
vstack->u.test->next = test;
test = vstack->u.test;
@ -2383,7 +2383,7 @@ FcParseAcceptRejectFont (FcConfigParse *parse, FcElement element)
while ((vstack = FcVStackPeek (parse)))
{
switch (vstack->tag) {
switch ((int) vstack->tag) {
case FcVStackGlob:
if (!FcConfigGlobAdd (parse->config,
vstack->u.string,
@ -2422,7 +2422,7 @@ FcPopValue (FcConfigParse *parse)
if (!vstack)
return value;
switch (vstack->tag) {
switch ((int) vstack->tag) {
case FcVStackString:
value.u.s = FcSharedStr (vstack->u.string);
if (value.u.s)
@ -2521,7 +2521,7 @@ FcParsePattern (FcConfigParse *parse)
while ((vstack = FcVStackPeek (parse)))
{
switch (vstack->tag) {
switch ((int) vstack->tag) {
case FcVStackPattern:
if (!FcPatternAppend (pattern, vstack->u.pattern))
{