Re: [PATCH 03/14] Define SNPRINTF_SIZE_CORR=1 for Microsoft Visual C++
- From
Marius Storm-Olsen <mstormo@gmail.com>
- Date
- Aug 22, 2009, 11:32 UTC
- Message-ID
- <18cd41840908220432me657c17gfe1b79b73d25592b@mail.gmail.com>
- In-Reply-To
- <7vfxbkbyvw.fsf@alter.siamese.dyndns.org>
[Resending to list since gmail web interface was setup to do HTML mails by default. Grrr Get plain text, reply with plain text. Obvious, isn't it Google? Sorry guys..]
On Sat, Aug 22, 2009 at 12:11 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 26 quoted lines
> > Johannes Sixt <j6t@kdbg.org> writes: > > > Not quite. The parameter *is* the size of the buffer and vsnprintf does not > > write beyond the buffer. However, it has the awkward behavior that if the > > buffer is too short by exactly one byte... > > Thanks; I was fooled by the leading comment. How about ... > > compat/snprintf.c | 3 ++- > 1 files changed, 2 insertions(+), 1 deletions(-) > > diff --git a/compat/snprintf.c b/compat/snprintf.c > index 6c0fb05..4d07087 100644 > --- a/compat/snprintf.c > +++ b/compat/snprintf.c > @@ -3,7 +3,8 @@ > /* > * The size parameter specifies the available space, i.e. includes > * the trailing NUL byte; but Windows's vsnprintf expects the > - * number of characters to write without the trailing NUL. > + * number of characters to write, and does not necessarily write the > + * trailing NUL. > */ > #ifndef SNPRINTF_SIZE_CORR > #if defined(__MINGW32__) && defined(__GNUC__) && __GNUC__ < 4
Agreed. If you'd like, I'll squash that into the change, and make the commit msg more clear.
-- .marius