delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/1999/05/03/18:41:47

Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm
Sender: cygwin-developers-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin-developers AT sourceware DOT cygnus DOT com
Message-ID: <372E2625.791A1EA@cityweb.de>
Date: Tue, 04 May 1999 00:41:41 +0200
From: Corinna Vinschen <corinna DOT vinschen AT cityweb DOT de>
X-Mailer: Mozilla 4.51 [en] (WinNT; I)
X-Accept-Language: de,en
MIME-Version: 1.0
To: Mumit Khan <khan AT xraylith DOT wisc DOT EDU>
CC: cygwin-developers AT sourceware DOT cygnus DOT com
Subject: Re: (fixed patch) "%E" formatting for the humans
References: <199905032225 DOT RAA14517 AT modi DOT xraylith DOT wisc DOT edu>

Mumit Khan wrote:
> 
> Corinna Vinschen <corinna DOT vinschen AT cityweb DOT de> writes:
> > Mumit Khan wrote:
> > > [...]
> > > +               const int bufferlen = 189;
> > > [...]
> >
> > Consider other native language versions of the system. E.g. german
> > expressions are longer than english one's in the most cases.
> 
> The reason I limited the buffer size here is that I don't much about how
> the various char buffers are scattered throughout winsup, and didn't want
> to introduce a subtle bug due to overruns. My scheme is very safe in that
> it will get the proper error messages as long as it fits within the
> supplied buffer, and if it doesn't, fall back on the old-style message.
> 
> Someone with more experience with/time on winsup should be able to track
> all the various buffer sizes and then just adjust this limit accordingly.
> 
> Regards,
> Mumit

FormatMessage has an option, to allocate the needed buffer itself
(FORMAT_MESSAGE_ALLOCATE_BUFFER or similar). This buffer should
then be freed with LocalFree() after usage.
Would this be an alternative?

Regards,
Corinna

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019