]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
intl: Fix bug in the exported *wprintf functions.
authorBruno Haible <bruno@clisp.org>
Fri, 17 Mar 2023 16:08:12 +0000 (17:08 +0100)
committerBruno Haible <bruno@clisp.org>
Fri, 17 Mar 2023 21:59:43 +0000 (22:59 +0100)
* autogen.sh (GNULIB_MODULES_LIBINTL): Add vasnwprintf-posix.
* gettext-runtime/intl/configure.ac: Hide the symbols from the gnulib modules
isnand-nolibm, isnanl-nolibm, printf-frexp, printf-frexpl, signbit, vasnwprintf,
frexp-nolibm, frexpl-nolibm.
* gettext-runtime/intl/printf.c: Don't instantiate the vasnwprintf code here.
* gettext-runtime/intl/wprintf-parse.h: Remove file, moved to gnulib.
* gettext-runtime/intl/vasnwprintf.h: Remove file, moved to gnulib.
* gettext-runtime/intl/Makefile.am (EXTRA_DIST): Remove wprintf-parse.h,
vasnwprintf.h.
(printf.lo): Simplify dependencies accordingly.

autogen.sh
gettext-runtime/intl/Makefile.am
gettext-runtime/intl/configure.ac
gettext-runtime/intl/printf.c
gettext-runtime/intl/vasnwprintf.h [deleted file]
gettext-runtime/intl/wprintf-parse.h [deleted file]

index a2d218fb30737c4cb75e335c548b8bae2ff724b8..6858e9799712633688e7a2c1fb8b0cc6fba0f0e7 100755 (executable)
@@ -120,6 +120,7 @@ if ! $skip_gnulib; then
     relocatable-lib-lgpl
     tsearch
     vasnprintf
+    vasnwprintf-posix
   '
   GNULIB_SETLOCALE_DEPENDENCIES=`$GNULIB_TOOL --extract-dependencies setlocale | sed -e 's/ .*//'`
   $GNULIB_TOOL --dir=gettext-runtime/intl --source-base=gnulib-lib --m4-base=gnulib-m4 --lgpl=2 --libtool --local-dir=gnulib-local --local-symlink \
index 1f7f1efd9fb194d14be9813bbdba5a5502f7757d..806d722f41c0f4dda4ef8a10221b0ac789b5517f 100644 (file)
@@ -71,8 +71,7 @@ EXTRA_DIST += \
   loadinfo.h \
   plural-exp.h \
   eval-plural.h \
-  wprintf-parse.h \
-  vasnprintf.h vasnwprintf.h \
+  vasnprintf.h \
   intl-exports.c os2compat.h os2compat.c \
   libgnuintl.in.h
 
@@ -365,7 +364,7 @@ plural.lo:           ../config.h $(srcdir)/plural-exp.h $(PLURAL_DEPS)
 plural-exp.lo:       ../config.h $(srcdir)/plural-exp.h
 langprefs.lo:        ../config.h
 log.lo:              ../config.h
-printf.lo:           ../config.h $(srcdir)/wprintf-parse.h $(srcdir)/vasnprintf.h $(srcdir)/vasnwprintf.h
+printf.lo:           ../config.h $(srcdir)/vasnprintf.h
 setlocale.lo:        ../config.h $(srcdir)/gettextP.h libgnuintl.h $(srcdir)/gmo.h $(srcdir)/loadinfo.h
 version.lo:          ../config.h libgnuintl.h
 osdep.lo:            ../config.h $(srcdir)/intl-exports.c $(srcdir)/os2compat.c
index bc99aacab57a63f126257692ec351029840da79d..aeed10f11287722fb63116ca5eaa087fcd805f64 100644 (file)
@@ -232,6 +232,10 @@ AH_VERBATIM([znoexport], [
 #define gl_LDBL_MAX                _libintl_LDBL_MAX
 /* Symbols defined by gnulib module 'free-posix'.  */
 #define rpl_free                   _libintl_free
+/* Symbols defined by gnulib module 'isnand-nolibm'.  */
+#define rpl_isnand                 _libintl_isnand
+/* Symbols defined by gnulib module 'isnanl-nolibm'.  */
+#define rpl_isnanl                 _libintl_isnanl
 /* Symbols defined by gnulib module 'localename'.  */
 #define gl_locale_name_canonicalize       _libintl_locale_name_canonicalize
 #define gl_locale_name_from_win32_LANGID  _libintl_locale_name_from_win32_LANGID
@@ -273,18 +277,30 @@ AH_VERBATIM([znoexport], [
 #define glthread_recursive_lock_destroy_multithreaded _libintl_recursive_lock_destroy_multithreaded
 #define glthread_once_singlethreaded                  _libintl_once_singlethreaded
 #define glthread_once_multithreaded                   _libintl_once_multithreaded
+/* Symbols defined by gnulib module 'printf-frexp'.  */
+#define printf_frexp               _libintl_printf_frexp
+/* Symbols defined by gnulib module 'printf-frexpl'.  */
+#define printf_frexpl              _libintl_printf_frexpl
 /* Symbols defined by gnulib module 'relocatable-lib-lgpl'.  */
 #define relocate                   _libintl_relocate
 #define relocate2                  _libintl_relocate2
 /* Symbols defined by gnulib module 'setlocale-null'.  */
 #define setlocale_null             _libintl_setlocale_null
 #define setlocale_null_r           _libintl_setlocale_null_r
+/* Symbols defined by gnulib module 'signbit'.  */
+#define gl_signbitf                _libintl_signbitf
+#define gl_signbitd                _libintl_signbitd
+#define gl_signbitl                _libintl_signbitl
 /* Symbols defined by gnulib module 'threadlib'.  */
 #define glthread_in_use            _libintl_glthread_in_use
 /* Symbols defined by gnulib module 'vasnprintf'.  */
 #define printf_fetchargs           _libintl_printf_fetchargs
 #define printf_parse               _libintl_printf_parse
 #define vasnprintf                 _libintl_vasnprintf
+/* Symbols defined by gnulib module 'vasnwprintf'.  */
+#define asnwprintf                 _libintl_asnwprintf
+#define wprintf_parse              _libintl_wprintf_parse
+#define vasnwprintf                _libintl_vasnwprintf
 /* Symbols defined by gnulib module 'windows-mutex'.  */
 #define glwthread_mutex_init       _libintl_glwthread_mutex_init
 #define glwthread_mutex_lock       _libintl_glwthread_mutex_lock
@@ -313,6 +329,16 @@ AH_VERBATIM([znoexport], [
 #define xsum3                      _libintl_xsum3
 #define xsum4                      _libintl_xsum4
 ])
+dnl Symbols defined by gnulib module 'frexp-nolibm'.
+if test $gl_func_frexp_no_libm != yes; then
+  AC_DEFINE([frexp],            [_libintl_frexp],    [Hidden symbol.])
+  AC_DEFINE([rpl_frexp],        [_libintl_frexp],    [Hidden symbol.])
+fi
+dnl Symbols defined by gnulib module 'frexpl-nolibm'.
+if test $HAVE_DECL_FREXPL = 0 || test $gl_func_frexpl_no_libm = no; then
+  AC_DEFINE([frexpl],           [_libintl_frexpl],    [Hidden symbol.])
+  AC_DEFINE([rpl_frexpl],       [_libintl_frexpl],    [Hidden symbol.])
+fi
 dnl Symbols defined by gnulib module 'memchr'.
 if test $REPLACE_MEMCHR = 1; then
   AC_DEFINE([memchr],           [_libintl_memchr],    [Hidden symbol.])
index ba509ca9e5c1fcd055c34287fbbcd781aa20f5ee..de2d58470dd6fc6b1b2d204cc4a91c5c4724b89f 100644 (file)
@@ -317,22 +317,25 @@ libintl_asprintf (char **resultp, const char *format, ...)
 
 #include <wchar.h>
 
-#define WIDE_CHAR_VERSION 1
+#if 0 /* not needed */
+
+/* Define auxiliary functions declared in "printf-args.h".  */
+#include "printf-args.c"
 
-#include "wprintf-parse.h"
 /* Define auxiliary functions declared in "wprintf-parse.h".  */
-#define CHAR_T wchar_t
-#define DIRECTIVE wchar_t_directive
-#define DIRECTIVES wchar_t_directives
-#define PRINTF_PARSE wprintf_parse
-#include "printf-parse.c"
+#include "wprintf-parse.c"
 
 /* Define functions declared in "vasnwprintf.h".  */
 #define vasnwprintf _libintl_vasnwprintf
-#include "vasnprintf.c"
-#if 0 /* not needed */
+#include "vasnwprintf.c"
 #define asnwprintf _libintl_asnwprintf
-#include "asnprintf.c"
+#include "asnwprintf.c"
+
+#else
+
+/* Get the declaration of _libintl_vasnwprintf.  */
+#include "vasnwprintf.h"
+
 #endif
 
 # if HAVE_DECL__SNWPRINTF
diff --git a/gettext-runtime/intl/vasnwprintf.h b/gettext-runtime/intl/vasnwprintf.h
deleted file mode 100644 (file)
index 05ac021..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/* vswprintf with automatic memory allocation.
-   Copyright (C) 2002-2003 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU Lesser General Public License as published by
-   the Free Software Foundation; either version 2.1 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public License
-   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
-
-#ifndef _VASNWPRINTF_H
-#define _VASNWPRINTF_H
-
-/* Get va_list.  */
-#include <stdarg.h>
-
-/* Get wchar_t, size_t.  */
-#include <stddef.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Write formatted output to a string dynamically allocated with malloc().
-   You can pass a preallocated buffer for the result in RESULTBUF and its
-   size in *LENGTHP; otherwise you pass RESULTBUF = NULL.
-   If successful, return the address of the string (this may be = RESULTBUF
-   if no dynamic memory allocation was necessary) and set *LENGTHP to the
-   number of resulting bytes, excluding the trailing NUL.  Upon error, set
-   errno and return NULL.  */
-extern wchar_t * asnwprintf (wchar_t *resultbuf, size_t *lengthp, const wchar_t *format, ...);
-extern wchar_t * vasnwprintf (wchar_t *resultbuf, size_t *lengthp, const wchar_t *format, va_list args);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _VASNWPRINTF_H */
diff --git a/gettext-runtime/intl/wprintf-parse.h b/gettext-runtime/intl/wprintf-parse.h
deleted file mode 100644 (file)
index ec16ca4..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/* Parse printf format string.
-   Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2011 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU Lesser General Public License as published by
-   the Free Software Foundation; either version 2.1 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public License
-   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
-
-#ifndef _WPRINTF_PARSE_H
-#define _WPRINTF_PARSE_H
-
-#if HAVE_FEATURES_H
-# include <features.h> /* for __GLIBC__, __UCLIBC__ */
-#endif
-
-#include "printf-args.h"
-
-
-/* Flags */
-#define FLAG_GROUP       1      /* ' flag */
-#define FLAG_LEFT        2      /* - flag */
-#define FLAG_SHOWSIGN    4      /* + flag */
-#define FLAG_SPACE       8      /* space flag */
-#define FLAG_ALT        16      /* # flag */
-#define FLAG_ZERO       32
-#if __GLIBC__ >= 2 && !defined __UCLIBC__
-# define FLAG_LOCALIZED 64      /* I flag, uses localized digits */
-#endif
-
-/* arg_index value indicating that no argument is consumed.  */
-#define ARG_NONE        (~(size_t)0)
-
-/* Number of directly allocated directives (no malloc() needed).  */
-#define N_DIRECT_ALLOC_DIRECTIVES 7
-
-/* A parsed directive.  */
-typedef struct
-{
-  const wchar_t* dir_start;
-  const wchar_t* dir_end;
-  int flags;
-  const wchar_t* width_start;
-  const wchar_t* width_end;
-  size_t width_arg_index;
-  const wchar_t* precision_start;
-  const wchar_t* precision_end;
-  size_t precision_arg_index;
-  wchar_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */
-  size_t arg_index;
-}
-wchar_t_directive;
-
-/* A parsed format string.  */
-typedef struct
-{
-  size_t count;
-  wchar_t_directive *dir;
-  size_t max_width_length;
-  size_t max_precision_length;
-  wchar_t_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES];
-}
-wchar_t_directives;
-
-
-/* Parses the format string.  Fills in the number N of directives, and fills
-   in directives[0], ..., directives[N-1], and sets directives[N].dir_start
-   to the end of the format string.  Also fills in the arg_type fields of the
-   arguments and the needed count of arguments.  */
-#ifdef STATIC
-STATIC
-#else
-extern
-#endif
-int wprintf_parse (const wchar_t *format, wchar_t_directives *d, arguments *a);
-
-#endif /* _WPRINTF_PARSE_H */