Date: Sun, 2 Feb 2003 21:36:26 +0100 From: Johan Karlsson <johan@freebsd.org> To: FreeBSD-audit <audit@freebsd.org> Subject: using 'PRIu64' from <inttypes.h> to get rid of warnings Message-ID: <20030202203626.GC759@numeri.campus.luth.se>
next in thread | raw e-mail | index | archive | help
Hi
is this the correct way to remove warning in printf statements?
Index: camcontrol.c
===================================================================
RCS file: /home/ncvs/src/sbin/camcontrol/camcontrol.c,v
retrieving revision 1.48
diff -u -r1.48 camcontrol.c
--- camcontrol.c 17 Dec 2002 06:05:21 -0000 1.48
+++ camcontrol.c 2 Feb 2003 19:00:52 -0000
@@ -30,6 +30,8 @@
#include <sys/ioctl.h>
#include <sys/types.h>
+
+#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -3086,7 +3088,8 @@
percentage = 10000 * val;
fprintf(stdout,
- "\rFormatting: %qd.%02qd %% "
+ "\rFormatting: "
+ "%"PRIu64".%02"PRIu64" %% "
"(%d/%d) done",
percentage / (0x10000 * 100),
(percentage / 0x10000) % 100,
The warnings are
/usr/src/sbin/camcontrol/camcontrol.c: In function `scsiformat':
/usr/src/sbin/camcontrol/camcontrol.c:3082: warning: long long int format, u_int64_t arg (arg 3)
/usr/src/sbin/camcontrol/camcontrol.c:3082: warning: long long int format, u_int64_t arg (arg 4)
Are the PRIu64 et al documented somewhere?
/Johan K
--
Johan Karlsson mailto:johan@FreeBSD.org
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-audit" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030202203626.GC759>
