[PATCH 1/3] Fix compiler warnings on %i format for long int.
Thadeu Lima de Souza Cascardo
cascardo en cascardo.info
Sab Mar 15 19:31:43 UTC 2014
On 64-bit platforms, we get the following warning:
decfile.c:213:3: warning: format ‘%i’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat]
Using %li works on both 32-bit ARM and 64-bit x86.
---
decfile.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/decfile.c b/decfile.c
index 100d4d3..1829667 100644
--- a/decfile.c
+++ b/decfile.c
@@ -210,7 +210,7 @@ static int parse_header_2014(struct pmhash *hash, char *buffer)
parse("hash", 10);
if (p - buffer != RNET_HEADER_HEAD_2014) {
- fprintf(stderr, "RNET_HEADER_HEAD_2014 in decfile.h needs to be adjusted to %i\n", p - buffer);
+ fprintf(stderr, "RNET_HEADER_HEAD_2014 in decfile.h needs to be adjusted to %li\n", p - buffer);
goto out_val;
}
@@ -294,24 +294,24 @@ static int parse_header_2014(struct pmhash *hash, char *buffer)
if (*p++ != '\r') {
fprintf(stderr,
- "missing CR at the %ith header character\n",
+ "missing CR at the %lith header character\n",
p - buffer);
goto out_val;
} else if (*p++ != '\n') {
fprintf(stderr,
- "missing LF at the %ith header character\n",
+ "missing LF at the %lith header character\n",
p - buffer);
goto out_val;
} else if (*p != 0) {
fprintf(stderr,
- "missing NUL at the %ith header character\n",
+ "missing NUL at the %lith header character\n",
p - buffer);
goto out_val;
} else if (p - buffer != RNET_HEADER_SIZE_2014) {
- fprintf(stderr, "RNET_HEADER_SIZE_2014 in decfile.h needs to be adjusted to %i,\nor parse_header in decfile.c needs updating\n", p - buffer);
+ fprintf(stderr, "RNET_HEADER_SIZE_2014 in decfile.h needs to be adjusted to %li,\nor parse_header in decfile.c needs updating\n", p - buffer);
goto out_val;
} else if (p - tail != RNET_HEADER_TAIL_2014) {
- fprintf(stderr, "RNET_HEADER_TAIL_2014 in decfile.h needs to be adjusted to %i\n", p - tail);
+ fprintf(stderr, "RNET_HEADER_TAIL_2014 in decfile.h needs to be adjusted to %li\n", p - tail);
goto out_val;
}
@@ -364,7 +364,7 @@ static int parse_header_2013(struct pmhash *hash, char *buffer)
parse("hash", 10);
if (p - buffer != RNET_HEADER_HEAD_2013) {
- fprintf(stderr, "RNET_HEADER_HEAD_2013 in decfile.h needs to be adjusted to %i\n", p - buffer);
+ fprintf(stderr, "RNET_HEADER_HEAD_2013 in decfile.h needs to be adjusted to %li\n", p - buffer);
goto out_val;
}
@@ -443,24 +443,24 @@ static int parse_header_2013(struct pmhash *hash, char *buffer)
if (*p++ != '\r') {
fprintf(stderr,
- "missing CR at the %ith header character\n",
+ "missing CR at the %lith header character\n",
p - buffer);
goto out_val;
} else if (*p++ != '\n') {
fprintf(stderr,
- "missing LF at the %ith header character\n",
+ "missing LF at the %lith header character\n",
p - buffer);
goto out_val;
} else if (*p != 0) {
fprintf(stderr,
- "missing NUL at the %ith header character\n",
+ "missing NUL at the %lith header character\n",
p - buffer);
goto out_val;
} else if (p - buffer != RNET_HEADER_SIZE_2013) {
- fprintf(stderr, "RNET_HEADER_SIZE_2013 in decfile.h needs to be adjusted to %i,\nor parse_header in decfile.c needs updating\n", p - buffer);
+ fprintf(stderr, "RNET_HEADER_SIZE_2013 in decfile.h needs to be adjusted to %li,\nor parse_header in decfile.c needs updating\n", p - buffer);
goto out_val;
} else if (p - tail != RNET_HEADER_TAIL_2013) {
- fprintf(stderr, "RNET_HEADER_TAIL_2013 in decfile.h needs to be adjusted to %i\n", p - tail);
+ fprintf(stderr, "RNET_HEADER_TAIL_2013 in decfile.h needs to be adjusted to %li\n", p - tail);
goto out_val;
}
--
1.8.1.4
Más información sobre la lista de distribución Softwares-impostos