Return-Path: Delivered-To: apmail-stdcxx-dev-archive@www.apache.org Received: (qmail 20407 invoked from network); 15 Apr 2008 05:03:00 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 Apr 2008 05:03:00 -0000 Received: (qmail 54434 invoked by uid 500); 15 Apr 2008 05:03:00 -0000 Delivered-To: apmail-stdcxx-dev-archive@stdcxx.apache.org Received: (qmail 54414 invoked by uid 500); 15 Apr 2008 05:03:00 -0000 Mailing-List: contact dev-help@stdcxx.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@stdcxx.apache.org Delivered-To: mailing list dev@stdcxx.apache.org Received: (qmail 54405 invoked by uid 99); 15 Apr 2008 05:03:00 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Apr 2008 22:03:00 -0700 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 msebor@gmail.com designates 209.85.200.170 as permitted sender) Received: from [209.85.200.170] (HELO wf-out-1314.google.com) (209.85.200.170) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Apr 2008 05:02:06 +0000 Received: by wf-out-1314.google.com with SMTP id 27so1936359wfd.2 for ; Mon, 14 Apr 2008 22:02:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:organization:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; bh=t2AVkR9EPdInSLpYqgbO9bvuso0JPIJ2wksOyWonYcA=; b=YKznxM6P1YOBmg/q2kgz886d8AFfctxmJOvdZDBD0Fkg/jl8A+plkVHuXUD061trWfcaByZ0Ul5DyMiHh/97tus53GFyH2I5ua3v0Px2e1R9QldXjA0xOK9Wys3OA8rNMpCRX09mFws/TEb1nTXji/m4aJU5FbipddTeSqLQAcE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:organization:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=uJGWWUFpMEIDHVDE5fwlwCnQXrBiPmVrKozgTKy/Hd0POk8UPNBuB+R5W7jNgWcVS3XPw32mymMe45MEqo6lVzhyUooJZGhpY7qk+e2sgc9Yb0Ld7RGTyEz63SF8/YtUocMPfqLZ9OwP0Q7sLGrfuYs87TU6FB0/XqYgiG5CKBY= Received: by 10.143.34.11 with SMTP id m11mr2096287wfj.222.1208235745798; Mon, 14 Apr 2008 22:02:25 -0700 (PDT) Received: from localhost.localdomain ( [71.229.200.170]) by mx.google.com with ESMTPS id 30sm13670846wfd.19.2008.04.14.22.02.23 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 14 Apr 2008 22:02:24 -0700 (PDT) Message-ID: <480436DE.3040502@roguewave.com> Date: Mon, 14 Apr 2008 23:02:22 -0600 From: Martin Sebor Organization: Rogue Wave Software, Inc. User-Agent: Thunderbird 2.0.0.12 (X11/20080226) MIME-Version: 1.0 To: dev@stdcxx.apache.org Subject: Re: svn commit: r647908 - in /stdcxx/trunk/tests: self/0.printf.cpp src/fmt_defs.h src/printf.cpp References: <20080414171556.87A691A9832@eris.apache.org> <48039BE0.4020702@roguewave.com> <4803BD77.5020405@roguewave.com> <4803CF95.5010801@roguewave.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: Martin Sebor X-Virus-Checked: Checked by ClamAV on apache.org Travis Vitek wrote: > Travis Vitek wrote: >> Unless I'm totally misunderstanding you (it seems that I may be), this >> would limit maximum command line length to 256 characters. >> > > Okay, I think I'm finally seeing the light. My understanding of how this > was intended to work was totally wrong. I had mistakenly thought that if > the maxsize format specifier (%{*} or %{n}) wasn't provided that > rw_vasnprintf() would intellegently switch to a dynamic buffer and leave > the original user provided buffer alone. Heh. I just responded to your other post agreeing with your first approach. Either I don't remember how it was supposed to work or I managed to confuse myself (or let you confuse me ;-) > > I now understand that if the caller uses a static buffer, they are > expected (required) to indicate maximum number of characters to be > written to the buffer using the previously mentioned format specifier. > With that specifier, maxsize would get set and the guard check and > free() call are avoided. I thought that's how it was supposed to work until you brought up the _rw_system() use case which certainly shouldn't be limited to 256 characters. > The guard bytes that were added in > [r351515|http://svn.apache.org/viewvc?view=rev&revision=351515] will > usually detect that a buffer was not allocated with a previous call to > _rw_bufcat(), and the assertion will trigger. Unfortunately there wasn't > a comment there to indicate that this was expected behavior and that the > caller was using the function improperly. > > So after a whole day of this I think I have the appropriate solution. It > is consistent with what Martin did in r351515, so I have that much going > for me. I'm planning on committing the fix shortly. Oh, goody :) I see I managed to confuse you too ;-) rw_vasnprintf() was modeled after GNU asprintf() and vasnprintf() http://www.gnu.org/software/libc/manual/html_mono/libc.html#Dynamic-Output (I'm not sure if the latter is GNU or someone else's invention but it's out there). I *think* it's supposed to handle the _rw_system() use case. Martin