Source: pxz
Version: 4.999.9~beta+git537418b-1
Severity: minor
Tags: upstream patch
Hi,
Trying to build pxz, I get a pile of warnings:
| pxz.c: In function ‘main’:
| pxz.c:271:4: warning: format ‘%ld’ expects argument of type ‘long \
int’, but argument 3 has type ‘uint64_t’ [-Wformat]
[...]
| pxz.c:445:4: warning: format ‘%ld’ expects argument of type ‘long \
int’, but argument 4 has type ‘ssize_t’ [-Wformat]
How about this patch?
diff --git a/pxz.c b/pxz.c
index 1833a15..14c4b1d 100644
--- a/pxz.c
+++ b/pxz.c
@@ -268,7 +268,7 @@ int main( int argc, char **argv ) {
chunk_size = (chunk_size + page_size)&~(page_size-1);
if ( opt_verbose ) {
- fprintf(stderr, "context size per thread: %ld B\n",
chunk_size);
+ fprintf(stderr, "context size per thread: %"PRIu64"
B\n", chunk_size);
}
if ( opt_threads && (threads > opt_threads || opt_force) ) {
@@ -292,9 +292,9 @@ int main( int argc, char **argv ) {
if ( opt_verbose ) {
if ( fo != stdout ) {
- fprintf(stderr, "%s -> %ld/%ld thread%c: [",
file[i], threads, (s.st_size+chunk_size-1)/chunk_size, threads != 1 ? 's' : '
');
+ fprintf(stderr, "%s -> %"PRIu64"/%"PRIu64"
thread%c: [", file[i], threads, (s.st_size+chunk_size-1)/chunk_size, threads !=
1 ? 's' : ' ');
} else {
- fprintf(stderr, "%ld thread%c: [", threads,
threads != 1 ? 's' : ' ');
+ fprintf(stderr, "%"PRIu64" thread%c: [",
threads, threads != 1 ? 's' : ' ');
}
fflush(stderr);
}
@@ -381,7 +381,7 @@ int main( int argc, char **argv ) {
free(mo);
if ( opt_verbose ) {
- fprintf(stderr, "%ld ", p);
+ fprintf(stderr, "%"PRIu64" ", p);
fflush(stderr);
}
}
@@ -442,7 +442,7 @@ int main( int argc, char **argv ) {
sigaction(SIGTERM, &old_action, NULL);
if ( opt_verbose ) {
- fprintf(stderr, "%ld -> %ld %3.3f%%\n", s.st_size, ts,
ts*100./s.st_size);
+ fprintf(stderr, "%"PRIuMAX" -> %zd %3.3f%%\n",
(uintmax_t) s.st_size, ts, ts*100./s.st_size);
}
if ( !opt_keep && unlink(file[i]) ) {
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]