aboutsummaryrefslogtreecommitdiffstats
path: root/intl
diff options
context:
space:
mode:
Diffstat (limited to 'intl')
-rw-r--r--intl/ChangeLog4
-rw-r--r--intl/Makefile.in22
-rw-r--r--intl/VERSION2
-rw-r--r--intl/langprefs.c4
-rw-r--r--intl/libgnuintl.h.in2
-rw-r--r--intl/localcharset.c28
-rw-r--r--intl/localename.c4
-rw-r--r--intl/lock.c6
-rw-r--r--intl/lock.h34
-rw-r--r--intl/printf-args.c8
-rw-r--r--intl/printf-args.h10
-rw-r--r--intl/printf-parse.c21
-rw-r--r--intl/printf.c67
-rw-r--r--intl/relocatable.c6
-rw-r--r--intl/vasnprintf.c38
15 files changed, 161 insertions, 95 deletions
diff --git a/intl/ChangeLog b/intl/ChangeLog
index fd4940c52..a1e3707ed 100644
--- a/intl/ChangeLog
+++ b/intl/ChangeLog
@@ -1,4 +1,4 @@
-2006-07-21 GNU <[email protected]>
+2006-11-27 GNU <[email protected]>
- * Version 0.15 released.
+ * Version 0.16.1 released.
diff --git a/intl/Makefile.in b/intl/Makefile.in
index c1d5fbde5..525922e11 100644
--- a/intl/Makefile.in
+++ b/intl/Makefile.in
@@ -51,7 +51,17 @@ subdir = intl
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
-mkinstalldirs = @install_sh@ -d
+
+# We use $(mkdir_p).
+# In automake <= 1.9.x, $(mkdir_p) is defined either as "mkdir -p --" or as
+# "$(mkinstalldirs)" or as "$(install_sh) -d". For these automake versions,
+# @install_sh@ does not start with $(SHELL), so we add it.
+# In automake >= 1.10, @mkdir_p@ is derived from ${MKDIR_P}, which is defined
+# either as "/path/to/mkdir -p" or ".../install-sh -c -d". For these automake
+# versions, $(mkinstalldirs) and $(install_sh) are unused.
+mkinstalldirs = $(SHELL) @install_sh@ -d
+install_sh = $(SHELL) @install_sh@
+MKDIR_P = @MKDIR_P@
mkdir_p = @mkdir_p@
l = @INTL_LIBTOOL_SUFFIX_PREFIX@
@@ -159,11 +169,11 @@ config.charset locale.alias ref-add.sin ref-del.sin export.h \
$(HEADERS) $(SOURCES)
DISTFILES.generated = plural.c
DISTFILES.normal = VERSION
-DISTFILES.gettext = COPYING.LIB-2.0 COPYING.LIB-2.1 libintl.glibc \
-libgnuintl.h_vms Makefile.vms \
-libgnuintl.h.msvc-static libgnuintl.h.msvc-shared README.woe32 Makefile.msvc
+DISTFILES.gettext = COPYING.LIB-2.0 COPYING.LIB-2.1 libintl.glibc README.woe32
DISTFILES.obsolete = xopen-msg.sed linux-msg.sed po2tbl.sed.in cat-compat.c \
-COPYING.LIB-2 gettext.h libgettext.h plural-eval.c libgnuintl.h
+COPYING.LIB-2 gettext.h libgettext.h plural-eval.c libgnuintl.h \
+libgnuintl.h_vms Makefile.vms libgnuintl.h.msvc-static \
+libgnuintl.h.msvc-shared Makefile.msvc
all: all-@USE_INCLUDED_LIBINTL@
all-yes: libintl.$la libintl.h charset.alias ref-add.sed ref-del.sed
@@ -190,7 +200,7 @@ libintl.la libgnuintl.la: $(OBJECTS)
# Maintainers of other packages that include the intl directory must *not*
# change these values.
LTV_CURRENT=8
-LTV_REVISION=0
+LTV_REVISION=1
LTV_AGE=0
.SUFFIXES:
diff --git a/intl/VERSION b/intl/VERSION
index fb7452c29..2525c4ea8 100644
--- a/intl/VERSION
+++ b/intl/VERSION
@@ -1 +1 @@
-GNU gettext library from gettext-0.15
+GNU gettext library from gettext-0.16.1
diff --git a/intl/langprefs.c b/intl/langprefs.c
index 5436040f9..59c8def21 100644
--- a/intl/langprefs.c
+++ b/intl/langprefs.c
@@ -1,5 +1,5 @@
/* Determine the user's language preferences.
- Copyright (C) 2004-2005 Free Software Foundation, Inc.
+ Copyright (C) 2004-2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published
@@ -35,7 +35,7 @@ extern void _nl_locale_name_canonicalize (char *name);
/* Determine the user's language preferences, as a colon separated list of
locale names in XPG syntax
- language[_territory[.codeset]][@modifier]
+ language[_territory][.codeset][@modifier]
The result must not be freed; it is statically allocated.
The LANGUAGE environment variable does not need to be considered; it is
already taken into account by the caller. */
diff --git a/intl/libgnuintl.h.in b/intl/libgnuintl.h.in
index 1a053f3af..5e1ccd676 100644
--- a/intl/libgnuintl.h.in
+++ b/intl/libgnuintl.h.in
@@ -53,7 +53,7 @@ extern "C" {
/* Version number: (major<<16) + (minor<<8) + subminor */
-#define LIBINTL_VERSION 0x000F00
+#define LIBINTL_VERSION 0x001000
extern int libintl_version;
diff --git a/intl/localcharset.c b/intl/localcharset.c
index e8505bfa9..e796ae71c 100644
--- a/intl/localcharset.c
+++ b/intl/localcharset.c
@@ -19,26 +19,15 @@
/* Written by Bruno Haible <[email protected]>. */
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include <config.h>
/* Specification. */
#include "localcharset.h"
-#if HAVE_STDDEF_H
-# include <stddef.h>
-#endif
-
+#include <stddef.h>
#include <stdio.h>
-#if HAVE_STRING_H
-# include <string.h>
-#else
-# include <strings.h>
-#endif
-#if HAVE_STDLIB_H
-# include <stdlib.h>
-#endif
+#include <string.h>
+#include <stdlib.h>
#if defined _WIN32 || defined __WIN32__
# define WIN32_NATIVE
@@ -53,7 +42,7 @@
# if HAVE_LANGINFO_CODESET
# include <langinfo.h>
# else
-# if HAVE_SETLOCALE
+# if 0 /* see comment below */
# include <locale.h>
# endif
# endif
@@ -76,6 +65,11 @@
# define relocate(pathname) (pathname)
#endif
+/* Get LIBDIR. */
+#ifndef LIBDIR
+# include "configmake.h"
+#endif
+
#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__
/* Win32, Cygwin, OS/2, DOS */
# define ISSLASH(C) ((C) == '/' || (C) == '\\')
@@ -358,7 +352,7 @@ locale_charset (void)
(like SunOS 4 or DJGPP) have only the C locale. Therefore we don't
use setlocale here; it would return "C" when it doesn't support the
locale name the user has set. */
-# if HAVE_SETLOCALE && 0
+# if 0
locale = setlocale (LC_CTYPE, NULL);
# endif
if (locale == NULL || locale[0] == '\0')
diff --git a/intl/localename.c b/intl/localename.c
index 1b8b99a1a..e1b4615a0 100644
--- a/intl/localename.c
+++ b/intl/localename.c
@@ -973,12 +973,12 @@ _nl_locale_name_canonicalize (char *name)
However it does not specify the exact format. Neither do SUSV2 and
ISO C 99. So we can use this feature only on selected systems (e.g.
those using GNU C Library). */
-#if defined _LIBC || (defined __GNU_LIBRARY__ && __GNU_LIBRARY__ >= 2)
+#if defined _LIBC || (defined __GLIBC__ && __GLIBC__ >= 2)
# define HAVE_LOCALE_NULL
#endif
/* Determine the current locale's name, and canonicalize it into XPG syntax
- language[_territory[.codeset]][@modifier]
+ language[_territory][.codeset][@modifier]
The codeset part in the result is not reliable; the locale_charset()
should be used for codeset information instead.
The result must not be freed; it is statically allocated. */
diff --git a/intl/lock.c b/intl/lock.c
index a860459d1..f60a8d9be 100644
--- a/intl/lock.c
+++ b/intl/lock.c
@@ -1,5 +1,5 @@
/* Locking in multithreaded situations.
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published
@@ -20,9 +20,7 @@
Based on GCC's gthr-posix.h, gthr-posix95.h, gthr-solaris.h,
gthr-win32.h. */
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include <config.h>
#include "lock.h"
diff --git a/intl/lock.h b/intl/lock.h
index be99139dc..04d136922 100644
--- a/intl/lock.h
+++ b/intl/lock.h
@@ -1,5 +1,5 @@
/* Locking in multithreaded situations.
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published
@@ -71,6 +71,10 @@
# include <pthread.h>
# include <stdlib.h>
+# ifdef __cplusplus
+extern "C" {
+# endif
+
# if PTHREAD_IN_USE_DETECTION_HARD
/* The pthread_in_use() detection needs to be done at runtime. */
@@ -356,6 +360,10 @@ typedef pthread_once_t gl_once_t;
while (0)
extern int glthread_once_singlethreaded (pthread_once_t *once_control);
+# ifdef __cplusplus
+}
+# endif
+
#endif
/* ========================================================================= */
@@ -367,6 +375,10 @@ extern int glthread_once_singlethreaded (pthread_once_t *once_control);
# include <pth.h>
# include <stdlib.h>
+# ifdef __cplusplus
+extern "C" {
+# endif
+
# if USE_PTH_THREADS_WEAK
/* Use weak references to the GNU Pth threads library. */
@@ -469,6 +481,10 @@ typedef pth_once_t gl_once_t;
extern void glthread_once_call (void *arg);
extern int glthread_once_singlethreaded (pth_once_t *once_control);
+# ifdef __cplusplus
+}
+# endif
+
#endif
/* ========================================================================= */
@@ -481,6 +497,10 @@ extern int glthread_once_singlethreaded (pth_once_t *once_control);
# include <synch.h>
# include <stdlib.h>
+# ifdef __cplusplus
+extern "C" {
+# endif
+
# if USE_SOLARIS_THREADS_WEAK
/* Use weak references to the old Solaris threads library. */
@@ -601,6 +621,10 @@ typedef struct
extern void glthread_once (gl_once_t *once_control, void (*initfunction) (void));
extern int glthread_once_singlethreaded (gl_once_t *once_control);
+# ifdef __cplusplus
+}
+# endif
+
#endif
/* ========================================================================= */
@@ -609,6 +633,10 @@ extern int glthread_once_singlethreaded (gl_once_t *once_control);
# include <windows.h>
+# ifdef __cplusplus
+extern "C" {
+# endif
+
/* We can use CRITICAL_SECTION directly, rather than the Win32 Event, Mutex,
Semaphore types, because
- we need only to synchronize inside a single process (address space),
@@ -742,6 +770,10 @@ typedef struct
glthread_once (&NAME, INITFUNCTION)
extern void glthread_once (gl_once_t *once_control, void (*initfunction) (void));
+# ifdef __cplusplus
+}
+# endif
+
#endif
/* ========================================================================= */
diff --git a/intl/printf-args.c b/intl/printf-args.c
index 47b73d2c1..ee0faba16 100644
--- a/intl/printf-args.c
+++ b/intl/printf-args.c
@@ -16,9 +16,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA. */
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include <config.h>
/* Specification. */
#include "printf-args.h"
@@ -59,7 +57,7 @@ printf_fetchargs (va_list args, arguments *a)
case TYPE_ULONGINT:
ap->a.a_ulongint = va_arg (args, unsigned long int);
break;
-#ifdef HAVE_LONG_LONG
+#ifdef HAVE_LONG_LONG_INT
case TYPE_LONGLONGINT:
ap->a.a_longlongint = va_arg (args, long long int);
break;
@@ -131,7 +129,7 @@ printf_fetchargs (va_list args, arguments *a)
case TYPE_COUNT_LONGINT_POINTER:
ap->a.a_count_longint_pointer = va_arg (args, long int *);
break;
-#ifdef HAVE_LONG_LONG
+#ifdef HAVE_LONG_LONG_INT
case TYPE_COUNT_LONGLONGINT_POINTER:
ap->a.a_count_longlongint_pointer = va_arg (args, long long int *);
break;
diff --git a/intl/printf-args.h b/intl/printf-args.h
index 625b8036a..886febe66 100644
--- a/intl/printf-args.h
+++ b/intl/printf-args.h
@@ -1,5 +1,5 @@
/* Decomposed printf argument list.
- Copyright (C) 1999, 2002-2003 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002-2003, 2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published
@@ -48,7 +48,7 @@ typedef enum
TYPE_UINT,
TYPE_LONGINT,
TYPE_ULONGINT,
-#ifdef HAVE_LONG_LONG
+#ifdef HAVE_LONG_LONG_INT
TYPE_LONGLONGINT,
TYPE_ULONGLONGINT,
#endif
@@ -69,7 +69,7 @@ typedef enum
TYPE_COUNT_SHORT_POINTER,
TYPE_COUNT_INT_POINTER,
TYPE_COUNT_LONGINT_POINTER
-#ifdef HAVE_LONG_LONG
+#ifdef HAVE_LONG_LONG_INT
, TYPE_COUNT_LONGLONGINT_POINTER
#endif
} arg_type;
@@ -88,7 +88,7 @@ typedef struct
unsigned int a_uint;
long int a_longint;
unsigned long int a_ulongint;
-#ifdef HAVE_LONG_LONG
+#ifdef HAVE_LONG_LONG_INT
long long int a_longlongint;
unsigned long long int a_ulonglongint;
#endif
@@ -110,7 +110,7 @@ typedef struct
short * a_count_short_pointer;
int * a_count_int_pointer;
long int * a_count_longint_pointer;
-#ifdef HAVE_LONG_LONG
+#ifdef HAVE_LONG_LONG_INT
long long int * a_count_longlongint_pointer;
#endif
}
diff --git a/intl/printf-parse.c b/intl/printf-parse.c
index 20240e379..1a06b1a90 100644
--- a/intl/printf-parse.c
+++ b/intl/printf-parse.c
@@ -1,5 +1,5 @@
/* Formatted output to strings.
- Copyright (C) 1999-2000, 2002-2003 Free Software Foundation, Inc.
+ Copyright (C) 1999-2000, 2002-2003, 2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published
@@ -16,9 +16,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA. */
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include <config.h>
/* Specification. */
#if WIDE_CHAR_VERSION
@@ -385,11 +383,14 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
switch (c)
{
case 'd': case 'i':
-#ifdef HAVE_LONG_LONG
+#ifdef HAVE_LONG_LONG_INT
+ /* If 'long long' exists and is larger than 'long': */
if (flags >= 16 || (flags & 4))
type = TYPE_LONGLONGINT;
else
#endif
+ /* If 'long long' exists and is the same as 'long', we parse
+ "lld" into TYPE_LONGINT. */
if (flags >= 8)
type = TYPE_LONGINT;
else if (flags & 2)
@@ -400,11 +401,14 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
type = TYPE_INT;
break;
case 'o': case 'u': case 'x': case 'X':
-#ifdef HAVE_LONG_LONG
+#ifdef HAVE_LONG_LONG_INT
+ /* If 'long long' exists and is larger than 'long': */
if (flags >= 16 || (flags & 4))
type = TYPE_ULONGLONGINT;
else
#endif
+ /* If 'unsigned long long' exists and is the same as
+ 'unsigned long', we parse "llu" into TYPE_ULONGINT. */
if (flags >= 8)
type = TYPE_ULONGINT;
else if (flags & 2)
@@ -459,11 +463,14 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
type = TYPE_POINTER;
break;
case 'n':
-#ifdef HAVE_LONG_LONG
+#ifdef HAVE_LONG_LONG_INT
+ /* If 'long long' exists and is larger than 'long': */
if (flags >= 16 || (flags & 4))
type = TYPE_COUNT_LONGLONGINT_POINTER;
else
#endif
+ /* If 'long long' exists and is the same as 'long', we parse
+ "lln" into TYPE_COUNT_LONGINT_POINTER. */
if (flags >= 8)
type = TYPE_COUNT_LONGINT_POINTER;
else if (flags & 2)
diff --git a/intl/printf.c b/intl/printf.c
index 275968b37..004c66f78 100644
--- a/intl/printf.c
+++ b/intl/printf.c
@@ -47,9 +47,16 @@ char *alloca ();
#if !HAVE_POSIX_PRINTF
+#include <errno.h>
+#include <limits.h>
#include <stdlib.h>
#include <string.h>
+/* Some systems, like OSF/1 4.0 and Woe32, don't have EOVERFLOW. */
+#ifndef EOVERFLOW
+# define EOVERFLOW E2BIG
+#endif
+
/* When building a DLL, we must export some functions. Note that because
the functions are only defined for binary backward compatibility, we
don't need to use __declspec(dllimport) in any case. */
@@ -96,9 +103,15 @@ libintl_vfprintf (FILE *stream, const char *format, va_list args)
int retval = -1;
if (result != NULL)
{
- if (fwrite (result, 1, length, stream) == length)
- retval = length;
+ size_t written = fwrite (result, 1, length, stream);
free (result);
+ if (written == length)
+ {
+ if (length > INT_MAX)
+ errno = EOVERFLOW;
+ else
+ retval = length;
+ }
}
return retval;
}
@@ -152,6 +165,11 @@ libintl_vsprintf (char *resultbuf, const char *format, va_list args)
free (result);
return -1;
}
+ if (length > INT_MAX)
+ {
+ errno = EOVERFLOW;
+ return -1;
+ }
else
return length;
}
@@ -194,12 +212,16 @@ libintl_vsnprintf (char *resultbuf, size_t length, const char *format, va_list a
{
if (maxlength > 0)
{
- if (length < maxlength)
- abort ();
- memcpy (resultbuf, result, maxlength - 1);
- resultbuf[maxlength - 1] = '\0';
+ size_t pruned_length =
+ (length < maxlength ? length : maxlength - 1);
+ memcpy (resultbuf, result, pruned_length);
+ resultbuf[pruned_length] = '\0';
}
free (result);
+ }
+ if (length > INT_MAX)
+ {
+ errno = EOVERFLOW;
return -1;
}
else
@@ -232,6 +254,12 @@ libintl_vasprintf (char **resultp, const char *format, va_list args)
char *result = libintl_vasnprintf (NULL, &length, format, args);
if (result == NULL)
return -1;
+ if (length > INT_MAX)
+ {
+ free (result);
+ errno = EOVERFLOW;
+ return -1;
+ }
*resultp = result;
return length;
}
@@ -293,9 +321,14 @@ libintl_vfwprintf (FILE *stream, const wchar_t *format, va_list args)
for (i = 0; i < length; i++)
if (fputwc (result[i], stream) == WEOF)
break;
- if (i == length)
- retval = length;
free (result);
+ if (i == length)
+ {
+ if (length > INT_MAX)
+ errno = EOVERFLOW;
+ else
+ retval = length;
+ }
}
return retval;
}
@@ -348,12 +381,22 @@ libintl_vswprintf (wchar_t *resultbuf, size_t length, const wchar_t *format, va_
{
if (maxlength > 0)
{
- if (length < maxlength)
- abort ();
- memcpy (resultbuf, result, (maxlength - 1) * sizeof (wchar_t));
- resultbuf[maxlength - 1] = 0;
+ size_t pruned_length =
+ (length < maxlength ? length : maxlength - 1);
+ memcpy (resultbuf, result, pruned_length * sizeof (wchar_t));
+ resultbuf[pruned_length] = 0;
}
free (result);
+ /* Unlike vsnprintf, which has to return the number of character that
+ would have been produced if the resultbuf had been sufficiently
+ large, the vswprintf function has to return a negative value if
+ the resultbuf was not sufficiently large. */
+ if (length >= maxlength)
+ return -1;
+ }
+ if (length > INT_MAX)
+ {
+ errno = EOVERFLOW;
return -1;
}
else
diff --git a/intl/relocatable.c b/intl/relocatable.c
index 7cc8daf77..5e1dde6c8 100644
--- a/intl/relocatable.c
+++ b/intl/relocatable.c
@@ -1,5 +1,5 @@
/* Provide relocatable packages.
- Copyright (C) 2003-2005 Free Software Foundation, Inc.
+ Copyright (C) 2003-2006 Free Software Foundation, Inc.
Written by Bruno Haible <[email protected]>, 2003.
This program is free software; you can redistribute it and/or modify it
@@ -25,9 +25,7 @@
# define _GNU_SOURCE 1
#endif
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
+#include <config.h>
/* Specification. */
#include "relocatable.h"
diff --git a/intl/vasnprintf.c b/intl/vasnprintf.c
index cef29a756..8b073103b 100644
--- a/intl/vasnprintf.c
+++ b/intl/vasnprintf.c
@@ -23,9 +23,7 @@
# define _GNU_SOURCE 1
#endif
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include <config.h>
#ifndef IN_LIBINTL
# include <alloca.h>
#endif
@@ -41,7 +39,7 @@
#include <stdlib.h> /* abort(), malloc(), realloc(), free() */
#include <string.h> /* memcpy(), strlen() */
#include <errno.h> /* errno */
-#include <limits.h> /* CHAR_BIT, INT_MAX */
+#include <limits.h> /* CHAR_BIT */
#include <float.h> /* DBL_MAX_EXP, LDBL_MAX_EXP */
#if WIDE_CHAR_VERSION
# include "wprintf-parse.h"
@@ -52,11 +50,6 @@
/* Checked size_t computations. */
#include "xsize.h"
-/* Some systems, like OSF/1 4.0 and Woe32, don't have EOVERFLOW. */
-#ifndef EOVERFLOW
-# define EOVERFLOW E2BIG
-#endif
-
#ifdef HAVE_WCHAR_T
# ifdef HAVE_WCSLEN
# define local_wcslen wcslen
@@ -256,7 +249,7 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar
case TYPE_COUNT_LONGINT_POINTER:
*a.arg[dp->arg_index].a.a_count_longint_pointer = length;
break;
-#ifdef HAVE_LONG_LONG
+#ifdef HAVE_LONG_LONG_INT
case TYPE_COUNT_LONGLONGINT_POINTER:
*a.arg[dp->arg_index].a.a_count_longlongint_pointer = length;
break;
@@ -330,7 +323,7 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar
{
case 'd': case 'i': case 'u':
-# ifdef HAVE_LONG_LONG
+# ifdef HAVE_LONG_LONG_INT
if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
tmp_length =
(unsigned int) (sizeof (unsigned long long) * CHAR_BIT
@@ -360,7 +353,7 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar
break;
case 'o':
-# ifdef HAVE_LONG_LONG
+# ifdef HAVE_LONG_LONG_INT
if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
tmp_length =
(unsigned int) (sizeof (unsigned long long) * CHAR_BIT
@@ -388,7 +381,7 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar
break;
case 'x': case 'X':
-# ifdef HAVE_LONG_LONG
+# ifdef HAVE_LONG_LONG_INT
if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
tmp_length =
(unsigned int) (sizeof (unsigned long long) * CHAR_BIT
@@ -535,7 +528,7 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar
switch (type)
{
-#ifdef HAVE_LONG_LONG
+#ifdef HAVE_LONG_LONG_INT
case TYPE_LONGLONGINT:
case TYPE_ULONGLONGINT:
*p++ = 'l';
@@ -689,7 +682,7 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar
SNPRINTF_BUF (arg);
}
break;
-#ifdef HAVE_LONG_LONG
+#ifdef HAVE_LONG_LONG_INT
case TYPE_LONGLONGINT:
{
long long int arg = a.arg[dp->arg_index].a.a_longlongint;
@@ -870,19 +863,12 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar
free (buf_malloced);
CLEANUP ();
*lengthp = length;
- if (length > INT_MAX)
- goto length_overflow;
+ /* Note that we can produce a big string of a length > INT_MAX. POSIX
+ says that snprintf() fails with errno = EOVERFLOW in this case, but
+ that's only because snprintf() returns an 'int'. This function does
+ not have this limitation. */
return result;
- length_overflow:
- /* We could produce such a big string, but its length doesn't fit into
- an 'int'. POSIX says that snprintf() fails with errno = EOVERFLOW in
- this case. */
- if (result != resultbuf)
- free (result);
- errno = EOVERFLOW;
- return NULL;
-
out_of_memory:
if (!(result == resultbuf || result == NULL))
free (result);