Skip to contentSkip to conversation

avoid ptrdiff_t-related format-mismatch warnings on x86_64

linux-lvm Jim Meyering 1 participant 1 message Apr 26, 2007

lore
Share & tools
lore
#0 lore raw

Building from cvs, I saw about a dozen of these warnings:

config/config.c:493: warning: format '%d' expects type 'int', but argument 5 has type 'long int'

This fixes them:

2007-04-26 Jim Meyering <[email protected]>

* lib/config/config.c (match): Use %ld, not %d, to match argument of type ptrdiff_t.
(_type): Likewise.

Index: lib/config/config.c
===================================================================
RCS file: /cvs/lvm2/LVM2/lib/config/config.c,v
retrieving revision 1.56

config/config.c +2 -2
diff -u -p -r1.56 config.c
@@ -83,7 +83,7 @@ static const int sep = '/';
 
 #define match(t) do {\
    if (!_match_aux(p, (t))) {\
-	log_error("Parse error at byte %d (line %d): unexpected token", p->tb - p->fb + 1, p->line); \
+	log_error("Parse error at byte %ld (line %d): unexpected token", p->tb - p->fb + 1, p->line); \
       return 0;\
    } \
 } while(0);
@@ -590,7 +590,7 @@ static struct config_value *_type(struct
 		break;
 
 	default:
-		log_error("Parse error at byte %d (line %d): expected a value", p->tb - p->fb + 1, p->line);
+		log_error("Parse error at byte %ld (line %d): expected a value", p->tb - p->fb + 1, p->line);
 		return 0;
 	}
 	return v;