[Fontconfig] [PATCH 8/9] FcObjectValidType: tweak -1 checking

Mike Frysinger vapier at gentoo.org
Tue Feb 21 11:19:21 PST 2012


Newer gcc doesn't like when you switch on an enum and use a value
that isn't declared:

fcname.c: In function 'FcObjectValidType':
fcname.c:299:2: warning: case value '4294967295'
	not in enumerated type 'FcType' [-Wswitch]

So tweak the logic to avoid this warning.

Signed-off-by: Mike Frysinger <vapier at gentoo.org>
---
 src/fcname.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/src/fcname.c b/src/fcname.c
index 864ad40..1b32b0f 100644
--- a/src/fcname.c
+++ b/src/fcname.c
@@ -296,8 +296,6 @@ FcObjectValidType (FcObject object, FcType type)
 
     if (t) {
 	switch (t->type) {
-	case -1:
-	    return FcTrue;
 	case FcTypeDouble:
 	case FcTypeInteger:
 	    if (type == FcTypeDouble || type == FcTypeInteger)
@@ -308,7 +306,7 @@ FcObjectValidType (FcObject object, FcType type)
 		return FcTrue;
 	    break;
 	default:
-	    if (type == t->type)
+	    if (t->type == -1 || type == t->type)
 		return FcTrue;
 	    break;
 	}
-- 
1.7.8.4



More information about the Fontconfig mailing list