www.delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-Spam-Check-By: | sourceware.org |
Date: | Fri, 18 Dec 2009 11:10:32 +0100 |
From: | Corinna Vinschen <corinna-cygwin AT cygwin DOT com> |
To: | cygwin AT cygwin DOT com |
Subject: | Re: cygwin_conv_path() documentation RFE |
Message-ID: | <20091218101032.GH8059@calimero.vinschen.de> |
Reply-To: | cygwin AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
References: | <4B2AE912 DOT 7090003 AT etr-usa DOT com> |
MIME-Version: | 1.0 |
In-Reply-To: | <4B2AE912.7090003@etr-usa.com> |
User-Agent: | Mutt/1.5.20 (2009-06-14) |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
On Dec 17 19:29, Warren Young wrote: > On this page > > http://cygwin.com/1.7/cygwin-api/func-cygwin-conv-path.html > > the size parameter should say whether it's measured in bytes or > characters. > > For instance, if I pass CCP_POSIX_TO_WIN_W for the first parameter > and a pure ASCII file name for the 'from' parameter, it's obvious > the 'to' buffer needs to be at least 2x the size of 'from'. The > question the docs don't answer is whether I should pass >= > 2*(strlen(from)+1) for size or >= strlen(from)+1? I really thought that would be clear from the description of what happens if size is 0: "If size is 0, cygwin_conv_path just returns the required buffer size in bytes." and the subsequent example code which uses the size returned by cygwin_conv_path in a call to malloc and then, unchanged in the next cygwin_conv_path call. I suggest to implement it as in the example. Otherwise you will potentially need a buffer of 64K to return the path in it. Alternatively just use the cygwin_create_path function which will malloc the buffer for you. I'll change the description so that the value of "size" should be clear from the beginning. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |