From owner-freebsd-ipfw@FreeBSD.ORG Sat Mar 6 03:19:25 2004 Return-Path: Delivered-To: freebsd-ipfw@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7800916A4CE for ; Sat, 6 Mar 2004 03:19:25 -0800 (PST) Received: from numeri.campus.luth.se (numeri.campus.luth.se [130.240.197.103]) by mx1.FreeBSD.org (Postfix) with ESMTP id CEAE943D1F for ; Sat, 6 Mar 2004 03:19:24 -0800 (PST) (envelope-from k@numeri.campus.luth.se) Received: from numeri.campus.luth.se (localhost [127.0.0.1]) i26BJNT9012199 for ; Sat, 6 Mar 2004 12:19:23 +0100 (CET) (envelope-from k@numeri.campus.luth.se) Received: (from k@localhost) by numeri.campus.luth.se (8.12.10/8.12.10/Submit) id i26BJNnx012196 for ipfw@freebsd.org; Sat, 6 Mar 2004 12:19:23 +0100 (CET) (envelope-from k) Date: Sat, 6 Mar 2004 12:19:22 +0100 From: Johan Karlsson To: ipfw@freebsd.org Message-ID: <20040306111922.GA64109@numeri.campus.luth.se> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="x+6KMIRAuhnl3hBn" Content-Disposition: inline User-Agent: Mutt/1.4.1i Subject: WARNS cleanup for ipfw X-BeenThere: freebsd-ipfw@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: IPFW Technical Discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Mar 2004 11:19:25 -0000 --x+6KMIRAuhnl3hBn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi the attached patch makes ipfw WARNS=2 clean by using the %j/(uintmax_t) combo where so needed. If there are no objections I intend to commit this patch. take care /Johan K -- Johan Karlsson mailto:johan@FreeBSD.org --x+6KMIRAuhnl3hBn Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="ipfw.diff" Index: sbin/ipfw/Makefile =================================================================== RCS file: /home/ncvs/src/sbin/ipfw/Makefile,v retrieving revision 1.12 diff -u -r1.12 Makefile --- sbin/ipfw/Makefile 11 Jul 2002 17:33:37 -0000 1.12 +++ sbin/ipfw/Makefile 5 Mar 2004 22:06:10 -0000 @@ -2,7 +2,7 @@ PROG= ipfw SRCS= ipfw2.c -WARNS?= 0 +WARNS?= 2 MAN= ipfw.8 .include Index: sbin/ipfw/ipfw2.c =================================================================== RCS file: /home/ncvs/src/sbin/ipfw/ipfw2.c,v retrieving revision 1.45 diff -u -r1.45 ipfw2.c --- sbin/ipfw/ipfw2.c 24 Jan 2004 19:20:09 -0000 1.45 +++ sbin/ipfw/ipfw2.c 5 Mar 2004 22:05:38 -0000 @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -902,8 +903,9 @@ printf("%05u ", rule->rulenum); if (pcwidth>0 || bcwidth>0) - printf("%*llu %*llu ", pcwidth, align_uint64(&rule->pcnt), - bcwidth, align_uint64(&rule->bcnt)); + printf("%*ju %*ju ", pcwidth, + (uintmax_t)align_uint64(&rule->pcnt), + bcwidth, (uintmax_t)align_uint64(&rule->bcnt)); if (do_time == 2) printf("%10u ", rule->timestamp); @@ -1331,9 +1333,9 @@ bcopy(&d->rule, &rulenum, sizeof(rulenum)); printf("%05d", rulenum); if (pcwidth>0 || bcwidth>0) - printf(" %*llu %*llu (%ds)", pcwidth, - align_uint64(&d->pcnt), bcwidth, - align_uint64(&d->bcnt), d->expire); + printf(" %*ju %*ju (%ds)", pcwidth, + (uintmax_t)align_uint64(&d->pcnt), bcwidth, + (uintmax_t)align_uint64(&d->bcnt), d->expire); switch (d->dyn_type) { case O_LIMIT_PARENT: printf(" PARENT %d", d->count); @@ -1423,12 +1425,12 @@ ina.s_addr = htonl(q[l].id.dst_ip); printf("%15s/%-5d ", inet_ntoa(ina), q[l].id.dst_port); - printf("%4qu %8qu %2u %4u %3u\n", - q[l].tot_pkts, q[l].tot_bytes, + printf("%4ju %8ju %2u %4u %3u\n", + (uintmax_t)q[l].tot_pkts, (uintmax_t)q[l].tot_bytes, q[l].len, q[l].len_bytes, q[l].drops); if (verbose) - printf(" S %20qd F %20qd\n", - q[l].S, q[l].F); + printf(" S %20jd F %20jd\n", + (intmax_t)q[l].S, (intmax_t)q[l].F); } } @@ -1517,7 +1519,7 @@ p->pipe_nr, buf, p->delay); print_flowset_parms(&(p->fs), prefix); if (verbose) - printf(" V %20qd\n", p->V >> MY_M); + printf(" V %20jd\n", (intmax_t)p->V >> MY_M); q = (struct dn_flow_queue *)(p+1); list_queues(&(p->fs), q); @@ -1743,27 +1745,27 @@ if (show_counters) { for (n = 0, r = data; n < nstat; n++, r = NEXT(r)) { /* packet counter */ - width = snprintf(NULL, 0, "%llu", - align_uint64(&r->pcnt)); + width = snprintf(NULL, 0, "%ju", + (uintmax_t)align_uint64(&r->pcnt)); if (width > pcwidth) pcwidth = width; /* byte counter */ - width = snprintf(NULL, 0, "%llu", - align_uint64(&r->bcnt)); + width = snprintf(NULL, 0, "%ju", + (uintmax_t)align_uint64(&r->bcnt)); if (width > bcwidth) bcwidth = width; } } if (do_dynamic && ndyn) { for (n = 0, d = dynrules; n < ndyn; n++, d++) { - width = snprintf(NULL, 0, "%llu", - align_uint64(&d->pcnt)); + width = snprintf(NULL, 0, "%ju", + (uintmax_t)align_uint64(&d->pcnt)); if (width > pcwidth) pcwidth = width; - width = snprintf(NULL, 0, "%llu", - align_uint64(&d->bcnt)); + width = snprintf(NULL, 0, "%ju", + (uintmax_t)align_uint64(&d->bcnt)); if (width > bcwidth) bcwidth = width; } --x+6KMIRAuhnl3hBn--