using 'PRIu64' from <inttypes.h> to get rid of warnings
Johan Karlsson <[email protected]> Sun, 2 Feb 2003 21:36:26 +0100
| Newsgroups | gmane.os.freebsd.devel.audit |
|---|---|
| Message-ID | <[email protected]> |
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:[email protected]
To Unsubscribe: send mail to [email protected]
with "unsubscribe freebsd-audit" in the body of the message