From owner-cvs-all@FreeBSD.ORG Mon Jan 10 13:13:26 2005 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 98A8A16A4CE; Mon, 10 Jan 2005 13:13:26 +0000 (GMT) Received: from gw.Awfulhak.org (awfulhak.demon.co.uk [80.177.173.150]) by mx1.FreeBSD.org (Postfix) with ESMTP id D75ED43D39; Mon, 10 Jan 2005 13:13:25 +0000 (GMT) (envelope-from brian@FreeBSD.org) Received: from dev.lan.Awfulhak.org (brian@dev.lan.Awfulhak.org [172.16.0.5]) by gw.Awfulhak.org (8.13.1/8.13.1) with ESMTP id j0ADDHLF069579; Mon, 10 Jan 2005 13:13:17 GMT (envelope-from brian@FreeBSD.org) Date: Mon, 10 Jan 2005 13:13:16 +0000 From: Brian Somers To: Giorgos Keramidas Message-ID: <20050110131316.2d8d099f@dev.lan.Awfulhak.org> In-Reply-To: <20050110122225.GB2693@orion.daedalusnetworks.priv> References: <200501101112.j0ABCaEQ062701@repoman.freebsd.org> <20050110122225.GB2693@orion.daedalusnetworks.priv> X-Mailer: Sylpheed-Claws 0.9.13 (GTK+ 1.2.10; i386-portbld-freebsd6.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.8 required=5.0 tests=ALL_TRUSTED autolearn=failed version=3.0.1 X-Spam-Checker-Version: SpamAssassin 3.0.1 (2004-10-22) on gw.lan.Awfulhak.org cc: cvs-src@FreeBSD.org cc: src-committers@FreeBSD.org cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/usr.sbin/ppp route.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jan 2005 13:13:26 -0000 On Mon, 10 Jan 2005 14:22:25 +0200, Giorgos Keramidas wrote: > On 2005-01-10 11:12, Brian Somers wrote: > > > > Cast unsigned variables to int > > > > Revision Changes Path > > 1.94 +1 -1 src/usr.sbin/ppp/route.c > > % static void > % p_flags(struct prompt *prompt, u_int32_t f, unsigned max) > % { > % char name[33], *flags; > % register struct bits *p = bits; > % > % if (max > sizeof name - 1) > % max = sizeof name - 1; > % > % for (flags = name; p->b_mask && flags - name < (int)max; p++) > % if (p->b_mask & f) > % *flags++ = p->b_val; > % *flags = '\0'; > % - prompt_Printf(prompt, "%-*.*s", max, max, name); > % + prompt_Printf(prompt, "%-*.*s", (int)max, (int)max, name); > % } > > Hi Brian, > > Since p_flags is used only once in route.c can't we just fix the type > of `max' in the argument list of p_flags() to avoid the need for casts > altogether? Well, the problem then becomes (with high WARNS values) a warning that max is compared with an unsigned type. I chose to make the prototype unsigned as it seemed to make more sense to restrict the argument to what we expect... -- Brian Somers Don't _EVER_ lose your sense of humour !