[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] snprintf: guarantee %1$d, for libintl
From: |
Bruno Haible |
Subject: |
Re: [PATCH] snprintf: guarantee %1$d, for libintl |
Date: |
Thu, 7 Jul 2011 12:51:18 +0200 |
User-agent: |
KMail/1.9.9 |
Hi Eric,
Eric Blake wrote:
> I added this comment in the .m4 files:
>
> dnl Libintl 0.17 will replace snprintf ...
> ...
> Libintl specifically favors _snprintf, with broken return value,
> even when compiled on mingw with a fixed snprintf, because the
> only behavior which it wants to fix is %1$s handling. But this
> means that the replacement libintl_snprintf has a broken return.
While this is true for libintl 0.17, it is partially fixed in libintl 0.18.1.1
through this change:
<http://lists.gnu.org/archive/html/bug-gnulib/2010-04/msg00202.html>
I'm applying this additional change in gettext:
2011-07-07 Bruno Haible <address@hidden>
Complete the change in vasnprintf.c from 2010-04-10.
* printf.c (system_vsnprintf) [mingw]: Prefer vsnprintf over
_vsnprintf.
--- gettext-runtime/intl/printf.c.orig Thu Jul 7 12:46:02 2011
+++ gettext-runtime/intl/printf.c Thu Jul 7 12:45:50 2011
@@ -1,5 +1,5 @@
/* Formatted output to strings, using POSIX/XSI format strings with positions.
- Copyright (C) 2003, 2006-2007, 2009-2010 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2006-2007, 2009-2011 Free Software Foundation, Inc.
Written by Bruno Haible <address@hidden>, 2003.
This program is free software: you can redistribute it and/or modify
@@ -191,8 +191,13 @@
#if HAVE_SNPRINTF
# if HAVE_DECL__SNPRINTF
- /* Windows. */
-# define system_vsnprintf _vsnprintf
+ /* Windows. The mingw function vsnprintf() has fewer bugs than the MSVCRT
+ function _vsnprintf(), so prefer that. */
+# if defined __MINGW32__
+# define system_vsnprintf vsnprintf
+# else
+# define system_vsnprintf _vsnprintf
+# endif
# else
/* Unix. */
# define system_vsnprintf vsnprintf
@@ -302,7 +307,8 @@
#endif
# if HAVE_DECL__SNWPRINTF
- /* Windows. */
+ /* Windows. The function vswprintf() has a different signature than
+ on Unix; we use the function _vsnwprintf() instead. */
# define system_vswprintf _vsnwprintf
# else
/* Unix. */
--
In memoriam Jan Hus <http://en.wikipedia.org/wiki/Jan_Hus>