]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
On Windows, use _snprintf and _snwprintf instead of snprintf, swprintf.
authorBruno Haible <bruno@clisp.org>
Sun, 24 Aug 2003 18:47:20 +0000 (18:47 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:10:54 +0000 (12:10 +0200)
gettext-runtime/ChangeLog
gettext-runtime/Makefile.am
gettext-runtime/intl/ChangeLog
gettext-runtime/intl/vasnprintf.c
gettext-runtime/libasprintf/ChangeLog
gettext-runtime/libasprintf/configure.ac
gettext-runtime/libasprintf/vasnprintf.c
gettext-runtime/m4/ChangeLog
gettext-runtime/m4/gettext.m4
gettext-tools/ChangeLog
gettext-tools/Makefile.am

index 1d7501630416001f1d0eac52adeff56a1b094568..289885a03226a1d0f9f9bd60e8fabae8d0a38673 100644 (file)
@@ -1,3 +1,11 @@
+2003-08-24  Bruno Haible  <bruno@clisp.org>
+
+       * Makefile.am (config.h.msvc): Define HAVE__SNPRINTF, HAVE__SNWPRINTF.
+
+2003-08-24  Bruno Haible  <bruno@clisp.org>
+
+       * configure.ac: Define DLL_VARIABLE in config.h through AH_BOTTOM.
+
 2003-08-23  Bruno Haible  <bruno@clisp.org>
 
        * Makefile.am (config.h_vms): Define HAVE_READLINK and HAVE_WCSLEN.
index faf7de1c891388e87ae353c28b0fe52e744a4b20..41a56f5ae4ab2975ba587a611e859f546fbc0822 100644 (file)
@@ -157,6 +157,8 @@ config.h.msvc: config.h.in ../version.sh
            -e 's/#undef HAVE_WCSLEN$$/#define HAVE_WCSLEN 1/' \
            -e 's/#undef HAVE_WINT_T$$/#define HAVE_WINT_T 1/' \
            -e 's/#undef HAVE_WPRINTF$$/#define HAVE_WPRINTF 1/' \
+           -e 's/#undef HAVE__SNPRINTF$$/#define HAVE__SNPRINTF 1/' \
+           -e 's/#undef HAVE__SNWPRINTF$$/#define HAVE__SNWPRINTF 1/' \
            -e 's/#undef ICONV_CONST$$/#define ICONV_CONST const/' \
            -e 's/#undef STACK_DIRECTION$$/#define STACK_DIRECTION -1/' \
            -e 's/#undef STDC_HEADERS$$/#define STDC_HEADERS 1/' \
index e82a1ded7ae532a123881aa7a7803cbcb1eab54c..2701721f5b50fd68614c11efe9040cfbeb6a6be7 100644 (file)
@@ -1,3 +1,9 @@
+2003-08-24  Bruno Haible  <bruno@clisp.org>
+
+       * vasnprintf.c (local_wcslen): Protect against multiple definition.
+       (USE_SNPRINTF): Define also if only _snprintf() is available.
+       (SNPRINTF): Possibly define as _snprintf or _snwprintf.
+
 2003-08-24  Bruno Haible  <bruno@clisp.org>
 
        * libgnuintl.h.in: Use <stdarg.h> when compiling with MSVC, even though
index 6d2c768fd7e609c2e0616b81eccc4ffff226dc02..28938549f82d9d342cadc38799f385f906db4a16 100644 (file)
 #  define local_wcslen wcslen
 # else
    /* Solaris 2.5.1 has wcslen() in a separate library libw.so. To avoid
-      a dependency towards this library, here is a local substitute.  */
+      a dependency towards this library, here is a local substitute.
+      Define this substitute only once, even if this file is included
+      twice in the same compilation unit.  */
+#  ifndef local_wcslen_defined
+#   define local_wcslen_defined 1
 static size_t
 local_wcslen (const wchar_t *s)
 {
@@ -73,6 +77,7 @@ local_wcslen (const wchar_t *s)
     ;
   return ptr - s;
 }
+#  endif
 # endif
 #endif
 
@@ -83,15 +88,28 @@ local_wcslen (const wchar_t *s)
 # define DIRECTIVES wchar_t_directives
 # define PRINTF_PARSE wprintf_parse
 # define USE_SNPRINTF 1
-# define SNPRINTF swprintf
+# if HAVE__SNWPRINTF
+   /* On Windows, the function swprintf() has a different signature than
+      on Unix; we use the _snwprintf() function instead.  */
+#  define SNPRINTF _snwprintf
+# else
+   /* Unix.  */
+#  define SNPRINTF swprintf
+# endif
 #else
 # define VASNPRINTF vasnprintf
 # define CHAR_T char
 # define DIRECTIVE char_directive
 # define DIRECTIVES char_directives
 # define PRINTF_PARSE printf_parse
-# define USE_SNPRINTF HAVE_SNPRINTF
-# define SNPRINTF snprintf
+# define USE_SNPRINTF (HAVE__SNPRINTF || HAVE_SNPRINTF)
+# if HAVE__SNPRINTF
+   /* Windows.  */
+#  define SNPRINTF _snprintf
+# else
+   /* Unix.  */
+#  define SNPRINTF snprintf
+# endif
 #endif
 
 CHAR_T *
index de9a64dac8016a9792f8751b28e84bef6b1f0e9b..9e8ce65b1b84c7ef410d2847cdbc89a07aff8c72 100644 (file)
@@ -1,3 +1,10 @@
+2003-08-24  Bruno Haible  <bruno@clisp.org>
+
+       * vasnprintf.c (local_wcslen): Protect against multiple definition.
+       (USE_SNPRINTF): Define also if only _snprintf() is available.
+       (SNPRINTF): Possibly define as _snprintf or _snwprintf.
+       * configure.ac: Also check for _snprintf.
+
 2003-08-11  Bruno Haible  <bruno@clisp.org>
 
        * vasnprintf.c (local_wcslen): New function, for Solaris 2.5.1.
index 9bdc078871b5673a401b2ccaa1c0647c7e7e2bf7..7e9e1e6a7d739b507e67ac30ec5cfcb87678a38a 100644 (file)
@@ -68,7 +68,7 @@ AC_EGREP_CPP([Need own alloca], [
   ALLOCA_H=)
 AC_SUBST([ALLOCA_H])
 
-AC_CHECK_FUNCS([snprintf vasprintf wcslen])
+AC_CHECK_FUNCS([snprintf vasprintf wcslen _snprintf])
 gt_PRINTF_POSIX
 
 dnl Check for tools needed for formatting the documentation.
index 6d2c768fd7e609c2e0616b81eccc4ffff226dc02..28938549f82d9d342cadc38799f385f906db4a16 100644 (file)
 #  define local_wcslen wcslen
 # else
    /* Solaris 2.5.1 has wcslen() in a separate library libw.so. To avoid
-      a dependency towards this library, here is a local substitute.  */
+      a dependency towards this library, here is a local substitute.
+      Define this substitute only once, even if this file is included
+      twice in the same compilation unit.  */
+#  ifndef local_wcslen_defined
+#   define local_wcslen_defined 1
 static size_t
 local_wcslen (const wchar_t *s)
 {
@@ -73,6 +77,7 @@ local_wcslen (const wchar_t *s)
     ;
   return ptr - s;
 }
+#  endif
 # endif
 #endif
 
@@ -83,15 +88,28 @@ local_wcslen (const wchar_t *s)
 # define DIRECTIVES wchar_t_directives
 # define PRINTF_PARSE wprintf_parse
 # define USE_SNPRINTF 1
-# define SNPRINTF swprintf
+# if HAVE__SNWPRINTF
+   /* On Windows, the function swprintf() has a different signature than
+      on Unix; we use the _snwprintf() function instead.  */
+#  define SNPRINTF _snwprintf
+# else
+   /* Unix.  */
+#  define SNPRINTF swprintf
+# endif
 #else
 # define VASNPRINTF vasnprintf
 # define CHAR_T char
 # define DIRECTIVE char_directive
 # define DIRECTIVES char_directives
 # define PRINTF_PARSE printf_parse
-# define USE_SNPRINTF HAVE_SNPRINTF
-# define SNPRINTF snprintf
+# define USE_SNPRINTF (HAVE__SNPRINTF || HAVE_SNPRINTF)
+# if HAVE__SNPRINTF
+   /* Windows.  */
+#  define SNPRINTF _snprintf
+# else
+   /* Unix.  */
+#  define SNPRINTF snprintf
+# endif
 #endif
 
 CHAR_T *
index 10794c07df5b359fcbd8c5ff6b3b5252e0f77049..239a383b34f376d71c8f826134740e47665c8016 100644 (file)
@@ -1,3 +1,7 @@
+2003-08-24  Bruno Haible  <bruno@clisp.org>
+
+       * gettext.m4 (AM_INTL_SUBDIR): Also check for _snprintf, _snwprintf.
+
 2003-08-11  Bruno Haible  <bruno@clisp.org>
 
        * gettext.m4 (AM_INTL_SUBDIR): Also check for wcslen.
index f6565e422b1e8695611227a4dddd129ec4809afc..e62c515f0a83fa5eee1ed175f635e3f8cc471b1d 100644 (file)
@@ -1,4 +1,4 @@
-# gettext.m4 serial 23 (gettext-0.12.2)
+# gettext.m4 serial 24 (gettext-0.12.2)
 dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
 dnl This file is free software, distributed under the terms of the GNU
 dnl General Public License.  As a special exception to the GNU General
@@ -379,8 +379,8 @@ AC_DEFUN([AM_INTL_SUBDIR],
 stdlib.h string.h unistd.h sys/param.h])
   AC_CHECK_FUNCS([asprintf getcwd getegid geteuid getgid getuid mempcpy \
 munmap putenv setenv setlocale snprintf stpcpy strcasecmp strdup strtoul \
-tsearch wcslen wprintf __argz_count __argz_stringify __argz_next \
-__fsetlocking])
+tsearch wcslen wprintf _snprintf _snwprintf __argz_count __argz_stringify \
+__argz_next __fsetlocking])
 
   dnl Use the *_unlocked functions only if they are declared.
   dnl (because some of them were defined without being declared in Solaris
index b48f16ce6e41a63122a7cb431fd745097d0e2702..7fd6b8e74eed7a9e9bc6dacefbc880af373426bd 100644 (file)
@@ -1,3 +1,11 @@
+2003-08-24  Bruno Haible  <bruno@clisp.org>
+
+       * Makefile.am (config.h.msvc): Define HAVE__SNPRINTF, HAVE__SNWPRINTF.
+
+2003-08-24  Bruno Haible  <bruno@clisp.org>
+
+       * configure.ac: Define DLL_VARIABLE in config.h through AH_BOTTOM.
+
 2003-08-24  Bruno Haible  <bruno@clisp.org>
 
        * windows/gettextsrc.def: Add formatstring_gcc_internal,
index e2b8a9857b4a2a3bac2fd34c3a7daa20134958d8..e473041cccca5d81d7373424651045085c07e260 100644 (file)
@@ -198,6 +198,8 @@ config.h.msvc: config.h.in ../version.sh
            -e 's/#undef HAVE_WCSLEN$$/#define HAVE_WCSLEN 1/' \
            -e 's/#undef HAVE_WINT_T$$/#define HAVE_WINT_T 1/' \
            -e 's/#undef HAVE_WPRINTF$$/#define HAVE_WPRINTF 1/' \
+           -e 's/#undef HAVE__SNPRINTF$$/#define HAVE__SNPRINTF 1/' \
+           -e 's/#undef HAVE__SNWPRINTF$$/#define HAVE__SNWPRINTF 1/' \
            -e 's/#undef ICONV_CONST$$/#define ICONV_CONST const/' \
            -e 's/#undef SETLOCALE_CONST$$/#define SETLOCALE_CONST const/' \
            -e 's/#undef STACK_DIRECTION$$/#define STACK_DIRECTION -1/' \