Return-Path: Delivered-To: apmail-httpd-dev-archive@www.apache.org Received: (qmail 16971 invoked from network); 17 Feb 2010 14:33:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 17 Feb 2010 14:33:09 -0000 Received: (qmail 83988 invoked by uid 500); 17 Feb 2010 14:33:08 -0000 Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 83891 invoked by uid 500); 17 Feb 2010 14:33:08 -0000 Mailing-List: contact dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list dev@httpd.apache.org Received: (qmail 83882 invoked by uid 99); 17 Feb 2010 14:33:08 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Feb 2010 14:33:08 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of trawick@gmail.com designates 209.85.210.196 as permitted sender) Received: from [209.85.210.196] (HELO mail-yx0-f196.google.com) (209.85.210.196) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Feb 2010 14:33:00 +0000 Received: by yxe34 with SMTP id 34so4501205yxe.15 for ; Wed, 17 Feb 2010 06:32:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=h5CAqN589O2pv6ZGJdjSfuTOO6xh03qEoed13CrTITQ=; b=qrGNZ1/GbNH2xj3H14uDJG4AZtzk6YX1Ni0N0vrFrzsIxfCF0mdGj3g0pKmup9S9iH 8lsuTuaIhJzB0OAE2Dbobov55uo5WsYgceWaet8TUJp5KWVRX8bdqYsHDjO86swLVezc Xcr9f8wJ4nnGEtghAi71+QOuAXzMk42csOpUM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=MdUMBMIcQ9l4BwXbMuZrvkIgGpMyp+1PJWbgjXmLrEP5cnrrBvzu82V5SqFe5bYGWn QlQyB+ixr55ZjGUTb0ERoe/6szLMLPNwPv5dkOS7rSDOpFQf5Fpue4QrD4RB/0J8V5do g6x8gq8V4QGZCibo7yJ8SgYlDHr/+CMXMeiVk= MIME-Version: 1.0 Received: by 10.100.222.11 with SMTP id u11mr4649692ang.194.1266417158736; Wed, 17 Feb 2010 06:32:38 -0800 (PST) In-Reply-To: <4B7BFBC6.8000308@onelan.co.uk> References: <20100216202434.327F92388996@eris.apache.org> <4B7BFBC6.8000308@onelan.co.uk> Date: Wed, 17 Feb 2010 09:32:38 -0500 Message-ID: Subject: Re: svn commit: r910673 - /httpd/httpd/trunk/server/config.c From: Jeff Trawick To: dev@httpd.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org On Wed, Feb 17, 2010 at 9:23 AM, Barry Scott wro= te: > On 16/02/10 20:30, Jeff Trawick wrote: >> >> On Tue, Feb 16, 2010 at 3:24 PM, =A0wrote: >> >>> >>> Author: poirier >>> Date: Tue Feb 16 20:24:33 2010 >>> New Revision: 910673 >>> >>> URL: http://svn.apache.org/viewvc?rev=3D910673&view=3Drev >>> Log: >>> Fix compile warning (discarding constness of fname) >>> >>> Modified: >>> =A0 =A0httpd/httpd/trunk/server/config.c >>> >>> Modified: httpd/httpd/trunk/server/config.c >>> URL: >>> http://svn.apache.org/viewvc/httpd/httpd/trunk/server/config.c?rev=3D91= 0673&r1=3D910672&r2=3D910673&view=3Ddiff >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- httpd/httpd/trunk/server/config.c (original) >>> +++ httpd/httpd/trunk/server/config.c Tue Feb 16 20:24:33 2010 >>> @@ -1670,7 +1670,7 @@ >>> =A0 =A0 int current; >>> >>> =A0 =A0 /* find the first part of the filename */ >>> - =A0 =A0rest =3D ap_strchr(fname, '/'); >>> + =A0 =A0rest =3D ap_strchr((char*)fname, '/'); >>> >> >> Casting isn't the right fix, which I guess is to make rest const char >> * and then use ap_strchr_c() instead of ap_strchr() (hopefully that >> doesn't snowball). >> >> > > This is =A0a common problem that the C RTL solves using the > idiom of accepting a const char * as input and returning > a char * as output: > > char *strchr(const char *s, int c); > > You may wish to fix the ap_strchr signature to follow the > C standard solution rather then invite snow balling. The C standard signatures for strchr() and strstr() are busted and don't allow some simple program errors to be caught at compile time, so httpd provides different flavors which take char * or const char * as input depending on what operations on the returned pointer are desired. (You have to build in maintainer mode to trigger the compile warnings for misuse of the httpd APIs.) The fix was simply to use the httpd APIs properly.