From owner-freebsd-audit Sun Nov 17 4:22:36 2002 Delivered-To: freebsd-audit@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E6EB937B401; Sun, 17 Nov 2002 04:22:21 -0800 (PST) Received: from numeri.campus.luth.se (numeri.campus.luth.se [130.240.197.103]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0DEF543E3B; Sun, 17 Nov 2002 04:22:21 -0800 (PST) (envelope-from k@numeri.campus.luth.se) Received: from numeri.campus.luth.se (localhost [127.0.0.1]) by numeri.campus.luth.se (8.12.6/8.12.6) with ESMTP id gAHCMD4q021532; Sun, 17 Nov 2002 13:22:13 +0100 (CET) (envelope-from k@numeri.campus.luth.se) Received: (from k@localhost) by numeri.campus.luth.se (8.12.6/8.12.6/Submit) id gAHCMB47021531; Sun, 17 Nov 2002 13:22:11 +0100 (CET) Date: Sun, 17 Nov 2002 13:22:10 +0100 From: Johan Karlsson To: freebsd-audit@freebsd.org Cc: Sheldon Hearn , ken@freebsd.org Subject: removing print format warnings using PRIu64 from inttypes.h Message-ID: <20021117122210.GB746@numeri.campus.luth.se> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="4bRzO86E/ozDv8r1" Content-Disposition: inline User-Agent: Mutt/1.4i Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --4bRzO86E/ozDv8r1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi I'm trying to remove warnings from sbin/* and among other warnings there are print format warnigs on alpha/sparc64. cc -O -pipe -g -mcpu=ev4 -mtune=ev5 -Wall -Wno-format-y2k -Wno-uninitialized -c /usr/src/sbin/camcontrol/camcontrol.c /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) cc -O -pipe -g -mcpu=ev4 -mtune=ev5 -Wall -Wno-format-y2k -Wno-uninitialized -c /usr/src/sbin/camcontrol/util.c /usr/src/sbin/camcontrol/util.c: In function `arg_put': /usr/src/sbin/camcontrol/util.c:119: warning: int format, different type arg (arg 2) In rev 1.14 of src/usr.bin/find/ls.c obrien used PRId64 from (included from to get rid of similar warnings. I have attached a patch for sbin/camcontrol, please have a look at it and let me know it this is the correct way to write the code. Does anyone know if PRId64 et al is documented somewhere? /Johan -- Johan Karlsson mailto:johan@FreeBSD.org --4bRzO86E/ozDv8r1 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="camcontrol.diff" Index: sbin/camcontrol/Makefile =================================================================== RCS file: /home/ncvs/src/sbin/camcontrol/Makefile,v retrieving revision 1.11 diff -u -r1.11 Makefile --- sbin/camcontrol/Makefile 24 Jan 2002 16:53:08 -0000 1.11 +++ sbin/camcontrol/Makefile 10 Nov 2002 14:28:43 -0000 @@ -9,7 +9,6 @@ .else CFLAGS+= -DMINIMALISTIC .endif -WARNS= 0 DPADD= ${LIBCAM} ${LIBSBUF} LDADD= -lcam -lsbuf MAN= camcontrol.8 Index: sbin/camcontrol/camcontrol.c =================================================================== RCS file: /home/ncvs/src/sbin/camcontrol/camcontrol.c,v retrieving revision 1.47 diff -u -r1.47 camcontrol.c --- sbin/camcontrol/camcontrol.c 8 Sep 2002 05:39:36 -0000 1.47 +++ sbin/camcontrol/camcontrol.c 10 Nov 2002 14:28:43 -0000 @@ -30,6 +30,8 @@ #include #include + +#include #include #include #include @@ -3075,7 +3077,8 @@ percentage = 10000 * val; fprintf(stdout, - "\rFormatting: %qd.%02qd %% " + "\rFormatting: " + "%"PRIu64".%02"PRIu64" %% " "(%d/%d) done", percentage / (0x10000 * 100), (percentage / 0x10000) % 100, Index: sbin/camcontrol/modeedit.c =================================================================== RCS file: /home/ncvs/src/sbin/camcontrol/modeedit.c,v retrieving revision 1.11 diff -u -r1.11 modeedit.c --- sbin/camcontrol/modeedit.c 30 May 2002 21:38:58 -0000 1.11 +++ sbin/camcontrol/modeedit.c 10 Nov 2002 14:28:43 -0000 @@ -641,7 +641,7 @@ char *line; /* Pointer to static fgetln buffer. */ char *name; /* Name portion of the line buffer. */ char *value; /* Value portion of line buffer. */ - int length; /* Length of static fgetln buffer. */ + size_t length; /* Length of static fgetln buffer. */ #define ABORT_READ(message, param) do { \ warnx(message, param); \ Index: sbin/camcontrol/util.c =================================================================== RCS file: /home/ncvs/src/sbin/camcontrol/util.c,v retrieving revision 1.7 diff -u -r1.7 util.c --- sbin/camcontrol/util.c 1 Dec 2000 12:01:35 -0000 1.7 +++ sbin/camcontrol/util.c 10 Nov 2002 14:28:43 -0000 @@ -48,10 +48,12 @@ "$FreeBSD: src/sbin/camcontrol/util.c,v 1.7 2000/12/01 12:01:35 jedgar Exp $"; #endif /* not lint */ +#include + +#include #include #include #include -#include #include #include "camcontrol.h" @@ -116,7 +118,7 @@ { case 'i': case 'b': - printf("%d ", (intptr_t)arg); + printf("%"PRIdPTR" ", (intptr_t)arg); break; case 'c': --4bRzO86E/ozDv8r1-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message