[linux-lvm] avoid ptrdiff_t-related format-mismatch warnings on x86_64

Jim Meyering jim at meyering.net
Thu Apr 26 12:15:54 UTC 2007


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  <jim at meyering.net>

	* 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
diff -u -p -r1.56 config.c
--- lib/config/config.c	25 Apr 2007 20:38:39 -0000	1.56
+++ lib/config/config.c	26 Apr 2007 12:14:39 -0000
@@ -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;




More information about the linux-lvm mailing list