summaryrefslogtreecommitdiff
path: root/wcsmbs
diff options
context:
space:
mode:
Diffstat (limited to 'wcsmbs')
-rw-r--r--wcsmbs/Makefile11
-rw-r--r--wcsmbs/bits/wchar-ldbl.h11
-rw-r--r--wcsmbs/bits/wchar2.h4
-rw-r--r--wcsmbs/btowc.c4
-rw-r--r--wcsmbs/c16rtomb.c45
-rw-r--r--wcsmbs/c32rtomb.c32
-rw-r--r--wcsmbs/isoc99_fwscanf.c11
-rw-r--r--wcsmbs/isoc99_swscanf.c15
-rw-r--r--wcsmbs/isoc99_vfwscanf.c13
-rw-r--r--wcsmbs/isoc99_vswscanf.c19
-rw-r--r--wcsmbs/isoc99_vwscanf.c13
-rw-r--r--wcsmbs/isoc99_wscanf.c11
-rw-r--r--wcsmbs/mbrlen.c4
-rw-r--r--wcsmbs/mbrtoc16.c4
-rw-r--r--wcsmbs/mbrtoc32.c32
-rw-r--r--wcsmbs/mbrtowc.c9
-rw-r--r--wcsmbs/mbsinit.c4
-rw-r--r--wcsmbs/mbsnrtowcs.c4
-rw-r--r--wcsmbs/mbsrtowcs.c4
-rw-r--r--wcsmbs/mbsrtowcs_l.c4
-rw-r--r--wcsmbs/test-char-types.c4
-rw-r--r--wcsmbs/test-wcpcpy.c4
-rw-r--r--wcsmbs/test-wcpncpy.c4
-rw-r--r--wcsmbs/test-wcscat.c4
-rw-r--r--wcsmbs/test-wcschrnul.c4
-rw-r--r--wcsmbs/test-wcscspn.c4
-rw-r--r--wcsmbs/test-wcsncat.c4
-rw-r--r--wcsmbs/test-wcsncpy.c4
-rw-r--r--wcsmbs/test-wcsnlen.c4
-rw-r--r--wcsmbs/test-wcspbrk.c4
-rw-r--r--wcsmbs/test-wcsspn.c4
-rw-r--r--wcsmbs/test-wmemchr.c4
-rw-r--r--wcsmbs/test-wmemset.c4
-rw-r--r--wcsmbs/tst-btowc.c4
-rw-r--r--wcsmbs/tst-c16-surrogate.c89
-rw-r--r--wcsmbs/tst-c32-state.c44
-rw-r--r--wcsmbs/tst-mbrtowc.c4
-rw-r--r--wcsmbs/tst-mbsrtowcs.c4
-rw-r--r--wcsmbs/tst-wcpncpy.c4
-rw-r--r--wcsmbs/tst-wcrtomb.c4
-rw-r--r--wcsmbs/tst-wcsnlen.c4
-rw-r--r--wcsmbs/tst-wcstod-nan-locale.c4
-rw-r--r--wcsmbs/tst-wcstod-nan-sign.c4
-rw-r--r--wcsmbs/tst-wcstod-round.c4
-rw-r--r--wcsmbs/tst-wcstol-locale.c4
-rw-r--r--wcsmbs/uchar.h4
-rw-r--r--wcsmbs/wchar.h17
-rw-r--r--wcsmbs/wcpcpy.c23
-rw-r--r--wcsmbs/wcpncpy.c61
-rw-r--r--wcsmbs/wcrtomb.c9
-rw-r--r--wcsmbs/wcscasecmp.c4
-rw-r--r--wcsmbs/wcscasecmp_l.c4
-rw-r--r--wcsmbs/wcscat.c25
-rw-r--r--wcsmbs/wcschr.c26
-rw-r--r--wcsmbs/wcschrnul.c4
-rw-r--r--wcsmbs/wcscmp.c4
-rw-r--r--wcsmbs/wcscoll.c4
-rw-r--r--wcsmbs/wcscoll_l.c4
-rw-r--r--wcsmbs/wcscpy.c62
-rw-r--r--wcsmbs/wcscspn.c4
-rw-r--r--wcsmbs/wcsdup.c4
-rw-r--r--wcsmbs/wcslen.c4
-rw-r--r--wcsmbs/wcsmbsload.c26
-rw-r--r--wcsmbs/wcsmbsload.h4
-rw-r--r--wcsmbs/wcsncase.c4
-rw-r--r--wcsmbs/wcsncase_l.c4
-rw-r--r--wcsmbs/wcsncat.c57
-rw-r--r--wcsmbs/wcsncmp.c4
-rw-r--r--wcsmbs/wcsncpy.c64
-rw-r--r--wcsmbs/wcsnlen.c26
-rw-r--r--wcsmbs/wcsnrtombs.c4
-rw-r--r--wcsmbs/wcspbrk.c4
-rw-r--r--wcsmbs/wcsrchr.c26
-rw-r--r--wcsmbs/wcsrtombs.c4
-rw-r--r--wcsmbs/wcsspn.c4
-rw-r--r--wcsmbs/wcsstr.c4
-rw-r--r--wcsmbs/wcstod.c4
-rw-r--r--wcsmbs/wcstod_l.c4
-rw-r--r--wcsmbs/wcstod_nan.c4
-rw-r--r--wcsmbs/wcstof.c4
-rw-r--r--wcsmbs/wcstof_l.c4
-rw-r--r--wcsmbs/wcstof_nan.c4
-rw-r--r--wcsmbs/wcstok.c4
-rw-r--r--wcsmbs/wcstol.c4
-rw-r--r--wcsmbs/wcstol_l.c4
-rw-r--r--wcsmbs/wcstold.c4
-rw-r--r--wcsmbs/wcstold_l.c4
-rw-r--r--wcsmbs/wcstold_nan.c4
-rw-r--r--wcsmbs/wcstoll.c4
-rw-r--r--wcsmbs/wcstoll_l.c4
-rw-r--r--wcsmbs/wcstoul.c4
-rw-r--r--wcsmbs/wcstoul_l.c4
-rw-r--r--wcsmbs/wcstoull.c4
-rw-r--r--wcsmbs/wcstoull_l.c4
-rw-r--r--wcsmbs/wcswidth.c4
-rw-r--r--wcsmbs/wcsxfrm.c4
-rw-r--r--wcsmbs/wcsxfrm_l.c4
-rw-r--r--wcsmbs/wctob.c4
-rw-r--r--wcsmbs/wcwidth.c4
-rw-r--r--wcsmbs/wcwidth.h4
-rw-r--r--wcsmbs/wmemchr.c4
-rw-r--r--wcsmbs/wmemcmp.c13
-rw-r--r--wcsmbs/wmemcpy.c4
-rw-r--r--wcsmbs/wmemmove.c4
-rw-r--r--wcsmbs/wmempcpy.c4
-rw-r--r--wcsmbs/wmemset.c4
106 files changed, 572 insertions, 534 deletions
diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile
index 2e02b22c3b..d8e465a662 100644
--- a/wcsmbs/Makefile
+++ b/wcsmbs/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1995-2018 Free Software Foundation, Inc.
+# Copyright (C) 1995-2019 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
# You should have received a copy of the GNU Lesser General Public
# License along with the GNU C Library; if not, see
-# <http://www.gnu.org/licenses/>.
+# <https://www.gnu.org/licenses/>.
#
# Sub-makefile for wcsmbs portion of the library.
@@ -42,7 +42,7 @@ routines := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \
wcsmbsload mbsrtowcs_l \
isoc99_wscanf isoc99_vwscanf isoc99_fwscanf isoc99_vfwscanf \
isoc99_swscanf isoc99_vswscanf \
- mbrtoc16 c16rtomb
+ mbrtoc16 c16rtomb mbrtoc32 c32rtomb
strop-tests := wcscmp wcsncmp wmemcmp wcslen wcschr wcsrchr wcscpy wcsnlen \
wcpcpy wcsncpy wcpncpy wcscat wcsncat wcschrnul wcsspn wcspbrk \
@@ -51,7 +51,8 @@ tests := tst-wcstof wcsmbs-tst1 tst-wcsnlen tst-btowc tst-mbrtowc \
tst-wcrtomb tst-wcpncpy tst-mbsrtowcs tst-wchar-h tst-mbrtowc2 \
tst-c16c32-1 wcsatcliff tst-wcstol-locale tst-wcstod-nan-locale \
tst-wcstod-round test-char-types tst-fgetwc-after-eof \
- tst-wcstod-nan-sign $(addprefix test-,$(strop-tests))
+ tst-wcstod-nan-sign tst-c16-surrogate tst-c32-state \
+ $(addprefix test-,$(strop-tests))
include ../Rules
@@ -68,6 +69,8 @@ $(objpfx)tst-wcrtomb.out: $(gen-locales)
$(objpfx)wcsmbs-tst1.out: $(gen-locales)
$(objpfx)tst-wcstol-locale.out: $(gen-locales)
$(objpfx)tst-wcstod-nan-locale.out: $(gen-locales)
+$(objpfx)tst-c16-surrogate.out: $(gen-locales)
+$(objpfx)tst-c32-state.out: $(gen-locales)
endif
$(objpfx)tst-wcstod-round: $(libm)
diff --git a/wcsmbs/bits/wchar-ldbl.h b/wcsmbs/bits/wchar-ldbl.h
index b91ee9fbf5..ae8f09800f 100644
--- a/wcsmbs/bits/wchar-ldbl.h
+++ b/wcsmbs/bits/wchar-ldbl.h
@@ -1,5 +1,5 @@
/* -mlong-double-64 compatibility mode for <wchar.h> functions.
- Copyright (C) 2006-2018 Free Software Foundation, Inc.
+ Copyright (C) 2006-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#ifndef _WCHAR_H
# error "Never include <bits/wchar-ldbl.h> directly; use <wchar.h> instead."
@@ -27,9 +27,7 @@ __LDBL_REDIR_DECL (swprintf);
__LDBL_REDIR_DECL (vfwprintf);
__LDBL_REDIR_DECL (vwprintf);
__LDBL_REDIR_DECL (vswprintf);
-# if defined __USE_ISOC99 && !defined __USE_GNU \
- && !defined __REDIRECT \
- && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K)
+# if !__GLIBC_USE (DEPRECATED_SCANF)
__LDBL_REDIR1_DECL (fwscanf, __nldbl___isoc99_fwscanf)
__LDBL_REDIR1_DECL (wscanf, __nldbl___isoc99_wscanf)
__LDBL_REDIR1_DECL (swscanf, __nldbl___isoc99_swscanf)
@@ -42,8 +40,7 @@ __LDBL_REDIR_DECL (swscanf);
#ifdef __USE_ISOC99
__LDBL_REDIR1_DECL (wcstold, wcstod);
-# if !defined __USE_GNU && !defined __REDIRECT \
- && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K)
+# if !__GLIBC_USE (DEPRECATED_SCANF)
__LDBL_REDIR1_DECL (vfwscanf, __nldbl___isoc99_vfwscanf)
__LDBL_REDIR1_DECL (vwscanf, __nldbl___isoc99_vwscanf)
__LDBL_REDIR1_DECL (vswscanf, __nldbl___isoc99_vswscanf)
diff --git a/wcsmbs/bits/wchar2.h b/wcsmbs/bits/wchar2.h
index d62b86de3e..f3fa74c90b 100644
--- a/wcsmbs/bits/wchar2.h
+++ b/wcsmbs/bits/wchar2.h
@@ -1,5 +1,5 @@
/* Checking macros for wchar functions.
- Copyright (C) 2005-2018 Free Software Foundation, Inc.
+ Copyright (C) 2005-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#ifndef _WCHAR_H
# error "Never include <bits/wchar2.h> directly; use <wchar.h> instead."
diff --git a/wcsmbs/btowc.c b/wcsmbs/btowc.c
index 39069a28d3..a57027a320 100644
--- a/wcsmbs/btowc.c
+++ b/wcsmbs/btowc.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <ctype.h>
#include <dlfcn.h>
diff --git a/wcsmbs/c16rtomb.c b/wcsmbs/c16rtomb.c
index 48a63d067b..7af9c15898 100644
--- a/wcsmbs/c16rtomb.c
+++ b/wcsmbs/c16rtomb.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011-2018 Free Software Foundation, Inc.
+/* Copyright (C) 2011-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <uchar.h>
#include <wchar.h>
@@ -26,7 +26,42 @@ static mbstate_t state;
size_t
c16rtomb (char *s, char16_t c16, mbstate_t *ps)
{
- // XXX The ISO C 11 spec I have does not say anything about handling
- // XXX surrogates in this interface.
- return wcrtomb (s, c16, ps ?: &state);
+ wchar_t wc = c16;
+
+ if (ps == NULL)
+ ps = &state;
+
+ if (s == NULL)
+ {
+ /* Reset any state relating to surrogate pairs. */
+ ps->__count &= 0x7fffffff;
+ ps->__value.__wch = 0;
+ wc = 0;
+ }
+
+ if (ps->__count & 0x80000000)
+ {
+ /* The previous call passed in the first surrogate of a
+ surrogate pair. */
+ ps->__count &= 0x7fffffff;
+ if (wc >= 0xdc00 && wc < 0xe000)
+ wc = (0x10000
+ + ((ps->__value.__wch & 0x3ff) << 10)
+ + (wc & 0x3ff));
+ else
+ /* This is not a low surrogate; ensure an EILSEQ error by
+ trying to decode the high surrogate as a wide character on
+ its own. */
+ wc = ps->__value.__wch;
+ ps->__value.__wch = 0;
+ }
+ else if (wc >= 0xd800 && wc < 0xdc00)
+ {
+ /* The high part of a surrogate pair. */
+ ps->__count |= 0x80000000;
+ ps->__value.__wch = wc;
+ return 0;
+ }
+
+ return wcrtomb (s, wc, ps);
}
diff --git a/wcsmbs/c32rtomb.c b/wcsmbs/c32rtomb.c
new file mode 100644
index 0000000000..c966e85214
--- /dev/null
+++ b/wcsmbs/c32rtomb.c
@@ -0,0 +1,32 @@
+/* Convert char32_t to multibyte.
+ Copyright (C) 2018-2019 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library 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.
+
+ The GNU C Library 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 the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <uchar.h>
+#include <wchar.h>
+
+
+/* This is the private state used if PS is NULL. */
+static mbstate_t state;
+
+size_t
+c32rtomb (char *s, char32_t c32, mbstate_t *ps)
+{
+ if (ps == NULL)
+ ps = &state;
+ return wcrtomb (s, c32, ps);
+}
diff --git a/wcsmbs/isoc99_fwscanf.c b/wcsmbs/isoc99_fwscanf.c
index 0c6a2c47ac..480ca9b7fb 100644
--- a/wcsmbs/isoc99_fwscanf.c
+++ b/wcsmbs/isoc99_fwscanf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <libioP.h>
#include <stdarg.h>
@@ -21,20 +21,15 @@
#include <wchar.h>
/* Read formatted input from STREAM according to the format string FORMAT. */
-/* VARARGS2 */
int
__isoc99_fwscanf (FILE *stream, const wchar_t *format, ...)
{
va_list arg;
int done;
- _IO_acquire_lock_clear_flags2 (stream);
- stream->_flags2 |= _IO_FLAGS2_SCANF_STD;
-
va_start (arg, format);
- done = _IO_vfwscanf (stream, format, arg, NULL);
+ done = __vfwscanf_internal (stream, format, arg, SCANF_ISOC99_A);
va_end (arg);
- _IO_release_lock (stream);
return done;
}
diff --git a/wcsmbs/isoc99_swscanf.c b/wcsmbs/isoc99_swscanf.c
index ff523db706..c29e5ad59e 100644
--- a/wcsmbs/isoc99_swscanf.c
+++ b/wcsmbs/isoc99_swscanf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,23 +13,24 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <stdarg.h>
-#include <stdio.h>
-#include <libioP.h>
-#include <wchar.h>
+#include <libio/strfile.h>
/* Read formatted input from S, according to the format string FORMAT. */
-/* VARARGS2 */
+
int
__isoc99_swscanf (const wchar_t *s, const wchar_t *format, ...)
{
va_list arg;
int done;
+ _IO_strfile sf;
+ struct _IO_wide_data wd;
+ FILE *f = _IO_strfile_readw (&sf, &wd, s);
va_start (arg, format);
- done = __isoc99_vswscanf (s, format, arg);
+ done = __vfwscanf_internal (f, format, arg, SCANF_ISOC99_A);
va_end (arg);
return done;
diff --git a/wcsmbs/isoc99_vfwscanf.c b/wcsmbs/isoc99_vfwscanf.c
index 7beb45b4d3..bd4e86df8c 100644
--- a/wcsmbs/isoc99_vfwscanf.c
+++ b/wcsmbs/isoc99_vfwscanf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,23 +13,16 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <libioP.h>
#include <stdio.h>
#include <wchar.h>
/* Read formatted input from STREAM according to the format string FORMAT. */
-/* VARARGS2 */
int
__isoc99_vfwscanf (FILE *stream, const wchar_t *format, va_list args)
{
- int done;
-
- _IO_acquire_lock_clear_flags2 (stream);
- stream->_flags2 |= _IO_FLAGS2_SCANF_STD;
- done = _IO_vfwscanf (stream, format, args, NULL);
- _IO_release_lock (stream);
- return done;
+ return __vfwscanf_internal (stream, format, args, SCANF_ISOC99_A);
}
libc_hidden_def (__isoc99_vfwscanf)
diff --git a/wcsmbs/isoc99_vswscanf.c b/wcsmbs/isoc99_vswscanf.c
index 130769154d..678a40c5a1 100644
--- a/wcsmbs/isoc99_vswscanf.c
+++ b/wcsmbs/isoc99_vswscanf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1993-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>.
+ <https://www.gnu.org/licenses/>.
As a special exception, if you link the code in this file with
files compiled with a GNU compiler to produce an executable,
@@ -24,24 +24,15 @@
This exception applies to code released by its copyright holders
in files containing the exception. */
-#include <libioP.h>
#include <wchar.h>
-#include "../libio/strfile.h"
+#include <libio/strfile.h>
int
__isoc99_vswscanf (const wchar_t *string, const wchar_t *format, va_list args)
{
- int ret;
_IO_strfile sf;
struct _IO_wide_data wd;
-#ifdef _IO_MTSAFE_IO
- sf._sbf._f._lock = NULL;
-#endif
- _IO_no_init (&sf._sbf._f, _IO_USER_LOCK, 0, &wd, &_IO_wstr_jumps);
- _IO_fwide (&sf._sbf._f, 1);
- _IO_wstr_init_static (&sf._sbf._f, (wchar_t *)string, 0, NULL);
- sf._sbf._f._flags2 |= _IO_FLAGS2_SCANF_STD;
- ret = _IO_vfwscanf ((FILE *) &sf._sbf, format, args, NULL);
- return ret;
+ FILE *f = _IO_strfile_readw (&sf, &wd, string);
+ return __vfwscanf_internal (f, format, args, SCANF_ISOC99_A);
}
libc_hidden_def (__isoc99_vswscanf)
diff --git a/wcsmbs/isoc99_vwscanf.c b/wcsmbs/isoc99_vwscanf.c
index 049521b964..0680684290 100644
--- a/wcsmbs/isoc99_vwscanf.c
+++ b/wcsmbs/isoc99_vwscanf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,22 +13,15 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <libioP.h>
#include <stdio.h>
#include <wchar.h>
/* Read formatted input from STDIN according to the format string FORMAT. */
-/* VARARGS2 */
int
__isoc99_vwscanf (const wchar_t *format, va_list args)
{
- int done;
-
- _IO_acquire_lock_clear_flags2 (stdin);
- stdin->_flags2 |= _IO_FLAGS2_SCANF_STD;
- done = _IO_vfwscanf (stdin, format, args, NULL);
- _IO_release_lock (stdin);
- return done;
+ return __vfwscanf_internal (stdin, format, args, SCANF_ISOC99_A);
}
diff --git a/wcsmbs/isoc99_wscanf.c b/wcsmbs/isoc99_wscanf.c
index abfbd50c11..f59b7620ce 100644
--- a/wcsmbs/isoc99_wscanf.c
+++ b/wcsmbs/isoc99_wscanf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <stdarg.h>
#include <stdio.h>
@@ -22,20 +22,15 @@
/* Read formatted input from stdin according to the format string FORMAT. */
-/* VARARGS1 */
int
__isoc99_wscanf (const wchar_t *format, ...)
{
va_list arg;
int done;
- _IO_acquire_lock_clear_flags2 (stdin);
- stdin->_flags2 |= _IO_FLAGS2_SCANF_STD;
-
va_start (arg, format);
- done = _IO_vfwscanf (stdin, format, arg, NULL);
+ done = __vfwscanf_internal (stdin, format, arg, SCANF_ISOC99_A);
va_end (arg);
- _IO_release_lock (stdin);
return done;
}
diff --git a/wcsmbs/mbrlen.c b/wcsmbs/mbrlen.c
index 405a7aefe3..2a2844c2e3 100644
--- a/wcsmbs/mbrlen.c
+++ b/wcsmbs/mbrlen.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <wchar.h>
diff --git a/wcsmbs/mbrtoc16.c b/wcsmbs/mbrtoc16.c
index e054743cd0..23906d3fec 100644
--- a/wcsmbs/mbrtoc16.c
+++ b/wcsmbs/mbrtoc16.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011-2018 Free Software Foundation, Inc.
+/* Copyright (C) 2011-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <assert.h>
#include <dlfcn.h>
diff --git a/wcsmbs/mbrtoc32.c b/wcsmbs/mbrtoc32.c
new file mode 100644
index 0000000000..4fc470d016
--- /dev/null
+++ b/wcsmbs/mbrtoc32.c
@@ -0,0 +1,32 @@
+/* Convert multibyte to char32_t.
+ Copyright (C) 2018-2019 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library 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.
+
+ The GNU C Library 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 the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <uchar.h>
+#include <wchar.h>
+
+
+/* This is the private state used if PS is NULL. */
+static mbstate_t state;
+
+size_t
+mbrtoc32 (char32_t *pc32, const char *s, size_t n, mbstate_t *ps)
+{
+ if (ps == NULL)
+ ps = &state;
+ return mbrtowc ((wchar_t *) pc32, s, n, ps);
+}
diff --git a/wcsmbs/mbrtowc.c b/wcsmbs/mbrtowc.c
index 954933d068..e4fd729ead 100644
--- a/wcsmbs/mbrtowc.c
+++ b/wcsmbs/mbrtowc.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <assert.h>
#include <dlfcn.h>
@@ -122,8 +122,3 @@ __mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
libc_hidden_def (__mbrtowc)
weak_alias (__mbrtowc, mbrtowc)
libc_hidden_weak (mbrtowc)
-
-/* There should be no difference between the UTF-32 handling required
- by mbrtoc32 and the wchar_t handling which has long since been
- implemented in mbrtowc. */
-weak_alias (__mbrtowc, mbrtoc32)
diff --git a/wcsmbs/mbsinit.c b/wcsmbs/mbsinit.c
index d2a0668193..d1c2081fb0 100644
--- a/wcsmbs/mbsinit.c
+++ b/wcsmbs/mbsinit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <string.h>
#include <wchar.h>
diff --git a/wcsmbs/mbsnrtowcs.c b/wcsmbs/mbsnrtowcs.c
index aef7858082..ce1ce54f07 100644
--- a/wcsmbs/mbsnrtowcs.c
+++ b/wcsmbs/mbsnrtowcs.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <assert.h>
#include <dlfcn.h>
diff --git a/wcsmbs/mbsrtowcs.c b/wcsmbs/mbsrtowcs.c
index ed854e792b..5c03d1be8a 100644
--- a/wcsmbs/mbsrtowcs.c
+++ b/wcsmbs/mbsrtowcs.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <wchar.h>
#include <locale/localeinfo.h>
diff --git a/wcsmbs/mbsrtowcs_l.c b/wcsmbs/mbsrtowcs_l.c
index c86055b505..527f4722ff 100644
--- a/wcsmbs/mbsrtowcs_l.c
+++ b/wcsmbs/mbsrtowcs_l.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2018 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 2002.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <assert.h>
#include <ctype.h>
diff --git a/wcsmbs/test-char-types.c b/wcsmbs/test-char-types.c
index 31237619d2..efda40d2ea 100644
--- a/wcsmbs/test-char-types.c
+++ b/wcsmbs/test-char-types.c
@@ -1,5 +1,5 @@
/* Test char16_t and char32_t types consistent with compiler.
- Copyright (C) 2018 Free Software Foundation, Inc.
+ Copyright (C) 2018-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <uchar.h>
diff --git a/wcsmbs/test-wcpcpy.c b/wcsmbs/test-wcpcpy.c
index 78ea4da2fd..7f6d60f3ce 100644
--- a/wcsmbs/test-wcpcpy.c
+++ b/wcsmbs/test-wcpcpy.c
@@ -1,5 +1,5 @@
/* Test wcspcpy functions.
- Copyright (C) 2015-2018 Free Software Foundation, Inc.
+ Copyright (C) 2015-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#define WIDE 1
#include "../string/test-stpcpy.c"
diff --git a/wcsmbs/test-wcpncpy.c b/wcsmbs/test-wcpncpy.c
index e86a51c7be..133e950572 100644
--- a/wcsmbs/test-wcpncpy.c
+++ b/wcsmbs/test-wcpncpy.c
@@ -1,5 +1,5 @@
/* Test wcpncpy functions.
- Copyright (C) 2015-2018 Free Software Foundation, Inc.
+ Copyright (C) 2015-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#define WIDE 1
#include "../string/test-stpncpy.c"
diff --git a/wcsmbs/test-wcscat.c b/wcsmbs/test-wcscat.c
index 22c64de38e..79d5457f95 100644
--- a/wcsmbs/test-wcscat.c
+++ b/wcsmbs/test-wcscat.c
@@ -1,5 +1,5 @@
/* Test wcscat functions.
- Copyright (C) 2015-2018 Free Software Foundation, Inc.
+ Copyright (C) 2015-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#define WIDE 1
#include "../string/test-strcat.c"
diff --git a/wcsmbs/test-wcschrnul.c b/wcsmbs/test-wcschrnul.c
index 10610f32cf..1f4acec957 100644
--- a/wcsmbs/test-wcschrnul.c
+++ b/wcsmbs/test-wcschrnul.c
@@ -1,5 +1,5 @@
/* Test wcschrnul functions.
- Copyright (C) 2015-2018 Free Software Foundation, Inc.
+ Copyright (C) 2015-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#define WIDE 1
#include "../string/test-strchrnul.c"
diff --git a/wcsmbs/test-wcscspn.c b/wcsmbs/test-wcscspn.c
index 3b37bda6a2..772147718d 100644
--- a/wcsmbs/test-wcscspn.c
+++ b/wcsmbs/test-wcscspn.c
@@ -1,5 +1,5 @@
/* Test wcscspn functions.
- Copyright (C) 2015-2018 Free Software Foundation, Inc.
+ Copyright (C) 2015-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#define WIDE 1
#include "../string/test-strcspn.c"
diff --git a/wcsmbs/test-wcsncat.c b/wcsmbs/test-wcsncat.c
index 4532995412..87916e7836 100644
--- a/wcsmbs/test-wcsncat.c
+++ b/wcsmbs/test-wcsncat.c
@@ -1,5 +1,5 @@
/* Test wcsncat functions.
- Copyright (C) 2015-2018 Free Software Foundation, Inc.
+ Copyright (C) 2015-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#define WIDE 1
#include "../string/test-strncat.c"
diff --git a/wcsmbs/test-wcsncpy.c b/wcsmbs/test-wcsncpy.c
index 98f98b1e37..5dc03e5605 100644
--- a/wcsmbs/test-wcsncpy.c
+++ b/wcsmbs/test-wcsncpy.c
@@ -1,5 +1,5 @@
/* Test wcsncpy functions.
- Copyright (C) 2015-2018 Free Software Foundation, Inc.
+ Copyright (C) 2015-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#define WIDE 1
#include "../string/test-strncpy.c"
diff --git a/wcsmbs/test-wcsnlen.c b/wcsmbs/test-wcsnlen.c
index 0f7a1b8769..5ff3aeeafb 100644
--- a/wcsmbs/test-wcsnlen.c
+++ b/wcsmbs/test-wcsnlen.c
@@ -1,5 +1,5 @@
/* Test wcsnlen function.
- Copyright (C) 2015-2018 Free Software Foundation, Inc.
+ Copyright (C) 2015-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#define WIDE 1
#include "../string/test-strnlen.c"
diff --git a/wcsmbs/test-wcspbrk.c b/wcsmbs/test-wcspbrk.c
index 31206485cf..74f8a0bd9d 100644
--- a/wcsmbs/test-wcspbrk.c
+++ b/wcsmbs/test-wcspbrk.c
@@ -1,5 +1,5 @@
/* Test wcspbrk functions.
- Copyright (C) 2015-2018 Free Software Foundation, Inc.
+ Copyright (C) 2015-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#define WIDE 1
#include "../string/test-strpbrk.c"
diff --git a/wcsmbs/test-wcsspn.c b/wcsmbs/test-wcsspn.c
index 395f44431d..7f362a3fc9 100644
--- a/wcsmbs/test-wcsspn.c
+++ b/wcsmbs/test-wcsspn.c
@@ -1,5 +1,5 @@
/* Test wcsspn functions.
- Copyright (C) 2015-2018 Free Software Foundation, Inc.
+ Copyright (C) 2015-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#define WIDE 1
#include "../string/test-strspn.c"
diff --git a/wcsmbs/test-wmemchr.c b/wcsmbs/test-wmemchr.c
index 36d890bd69..94392d515b 100644
--- a/wcsmbs/test-wmemchr.c
+++ b/wcsmbs/test-wmemchr.c
@@ -1,5 +1,5 @@
/* Test wmemchr functions.
- Copyright (C) 2015-2018 Free Software Foundation, Inc.
+ Copyright (C) 2015-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#define WIDE 1
#include "../string/test-memchr.c"
diff --git a/wcsmbs/test-wmemset.c b/wcsmbs/test-wmemset.c
index 856663d04b..e614fe15e7 100644
--- a/wcsmbs/test-wmemset.c
+++ b/wcsmbs/test-wmemset.c
@@ -1,5 +1,5 @@
/* Test wmemset functions.
- Copyright (C) 2015-2018 Free Software Foundation, Inc.
+ Copyright (C) 2015-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#define WIDE 1
#include "../string/test-memset.c"
diff --git a/wcsmbs/tst-btowc.c b/wcsmbs/tst-btowc.c
index 39ad0c23c0..6dbbad25b9 100644
--- a/wcsmbs/tst-btowc.c
+++ b/wcsmbs/tst-btowc.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2018 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2000.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <locale.h>
#include <stdio.h>
diff --git a/wcsmbs/tst-c16-surrogate.c b/wcsmbs/tst-c16-surrogate.c
new file mode 100644
index 0000000000..19e22099a5
--- /dev/null
+++ b/wcsmbs/tst-c16-surrogate.c
@@ -0,0 +1,89 @@
+/* Test c16rtomb handling of surrogate pairs (DR#488, bug 23794).
+ Copyright (C) 2018-2019 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library 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.
+
+ The GNU C Library 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 the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <locale.h>
+#include <stdio.h>
+#include <string.h>
+#include <uchar.h>
+#include <wchar.h>
+#include <array_length.h>
+#include <support/check.h>
+
+static int
+do_test (void)
+{
+ TEST_VERIFY_EXIT (setlocale (LC_ALL, "de_DE.UTF-8") != NULL);
+ /* Test conversions of surrogate pairs. */
+ for (char32_t c = 0x10000; c <= 0x10ffff; c += 0x123)
+ {
+ char32_t c_pos = c - 0x10000;
+ char16_t c_hi = (c_pos >> 10) + 0xd800;
+ char16_t c_lo = (c_pos & 0x3ff) + 0xdc00;
+ printf ("testing U+0x%08x (0x%x 0x%x)\n",
+ (unsigned int) c, (unsigned int) c_hi, (unsigned int) c_lo);
+ char buf[16] = { 0 };
+ size_t ret_hi = c16rtomb (buf, c_hi, NULL);
+ TEST_COMPARE (ret_hi, 0);
+ size_t ret_lo = c16rtomb (buf, c_lo, NULL);
+ TEST_COMPARE (ret_lo, 4);
+ wchar_t wc = 0;
+ size_t ret_wc = mbrtowc (&wc, buf, 4, NULL);
+ TEST_COMPARE (ret_wc, 4);
+ TEST_COMPARE (wc, (wchar_t) c);
+ }
+ /* Test errors for invalid conversions. */
+ static const char16_t err_cases[][2] =
+ {
+ /* High surrogate followed by non-surrogate. */
+ { 0xd800, 0x1 },
+ /* High surrogate followed by another high surrogate. */
+ { 0xd800, 0xd800 },
+ /* Low surrogate not following high surrogate. */
+ { 0xdc00, 0 }
+ };
+ for (size_t i = 0; i < array_length (err_cases); i++)
+ {
+ char16_t c_hi = err_cases[i][0];
+ char16_t c_lo = err_cases[i][1];
+ printf ("testing error case: 0x%x 0x%x\n", (unsigned int) c_hi,
+ (unsigned int) c_lo);
+ c16rtomb (NULL, 0, NULL);
+ char buf[16] = { 0 };
+ errno = 0;
+ size_t ret_hi = c16rtomb (buf, c_hi, NULL);
+ if (c_lo == 0)
+ {
+ /* Unmatched low surrogate in first place. */
+ TEST_COMPARE (ret_hi, (size_t) -1);
+ TEST_COMPARE (errno, EILSEQ);
+ }
+ else
+ {
+ /* High surrogate; error in second place. */
+ TEST_COMPARE (ret_hi, 0);
+ errno = 0;
+ size_t ret_lo = c16rtomb (buf, c_lo, NULL);
+ TEST_COMPARE (ret_lo, (size_t) -1);
+ TEST_COMPARE (errno, EILSEQ);
+ }
+ }
+ return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/wcsmbs/tst-c32-state.c b/wcsmbs/tst-c32-state.c
new file mode 100644
index 0000000000..44bacd3185
--- /dev/null
+++ b/wcsmbs/tst-c32-state.c
@@ -0,0 +1,44 @@
+/* Test mbrtowc and mbrtoc32 do not share state (bug 23793).
+ Copyright (C) 2018-2019 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library 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.
+
+ The GNU C Library 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 the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <locale.h>
+#include <uchar.h>
+#include <wchar.h>
+#include <support/check.h>
+
+static int
+do_test (void)
+{
+ TEST_VERIFY_EXIT (setlocale (LC_ALL, "de_DE.UTF-8") != NULL);
+ const char buf[] = "\u00ff";
+ wchar_t wc = 0;
+ char32_t c32 = 0;
+ size_t ret = mbrtowc (&wc, buf, 1, NULL);
+ TEST_COMPARE (ret, (size_t) -2);
+ ret = mbrtoc32 (&c32, buf, 1, NULL);
+ TEST_COMPARE (ret, (size_t) -2);
+ ret = mbrtowc (&wc, buf + 1, 1, NULL);
+ TEST_COMPARE (ret, 1);
+ TEST_COMPARE (wc, 0xff);
+ ret = mbrtoc32 (&c32, buf + 1, 1, NULL);
+ TEST_COMPARE (ret, 1);
+ TEST_COMPARE (c32, 0xff);
+ return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/wcsmbs/tst-mbrtowc.c b/wcsmbs/tst-mbrtowc.c
index 511859013c..6534d856de 100644
--- a/wcsmbs/tst-mbrtowc.c
+++ b/wcsmbs/tst-mbrtowc.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2018 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2000.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
/* We always want assert to be fully defined. */
#undef NDEBUG
diff --git a/wcsmbs/tst-mbsrtowcs.c b/wcsmbs/tst-mbsrtowcs.c
index 253ef2b278..1856ada1f8 100644
--- a/wcsmbs/tst-mbsrtowcs.c
+++ b/wcsmbs/tst-mbsrtowcs.c
@@ -1,5 +1,5 @@
/* Test NUL handling of mbsrtowcs.
- Copyright (C) 2004-2018 Free Software Foundation, Inc.
+ Copyright (C) 2004-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <stdio.h>
#include <string.h>
diff --git a/wcsmbs/tst-wcpncpy.c b/wcsmbs/tst-wcpncpy.c
index 5ec42d2f53..ef92b63799 100644
--- a/wcsmbs/tst-wcpncpy.c
+++ b/wcsmbs/tst-wcpncpy.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003-2018 Free Software Foundation, Inc.
+/* Copyright (C) 2003-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 2003.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <stdio.h>
#include <wchar.h>
diff --git a/wcsmbs/tst-wcrtomb.c b/wcsmbs/tst-wcrtomb.c
index 7d146751dd..ad700385d1 100644
--- a/wcsmbs/tst-wcrtomb.c
+++ b/wcsmbs/tst-wcrtomb.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2018 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2000.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <locale.h>
#include <stdio.h>
diff --git a/wcsmbs/tst-wcsnlen.c b/wcsmbs/tst-wcsnlen.c
index 5aff054e5d..bd5c92d1f7 100644
--- a/wcsmbs/tst-wcsnlen.c
+++ b/wcsmbs/tst-wcsnlen.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <stdio.h>
#include <wchar.h>
diff --git a/wcsmbs/tst-wcstod-nan-locale.c b/wcsmbs/tst-wcstod-nan-locale.c
index 1435a426dc..8e8db8f471 100644
--- a/wcsmbs/tst-wcstod-nan-locale.c
+++ b/wcsmbs/tst-wcstod-nan-locale.c
@@ -1,6 +1,6 @@
/* Test strtod functions work with all ASCII letters in NAN(...) in
Turkish locales (bug 19266). Wide string version.
- Copyright (C) 2015-2018 Free Software Foundation, Inc.
+ Copyright (C) 2015-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#define CHAR wchar_t
#define SFMT "L\"%ls\""
diff --git a/wcsmbs/tst-wcstod-nan-sign.c b/wcsmbs/tst-wcstod-nan-sign.c
index 4c40e50f4f..cda8f2f17e 100644
--- a/wcsmbs/tst-wcstod-nan-sign.c
+++ b/wcsmbs/tst-wcstod-nan-sign.c
@@ -1,6 +1,6 @@
/* Test strtod functions handle signs of NaNs (bug 23007).
Wide string version.
- Copyright (C) 2018 Free Software Foundation, Inc.
+ Copyright (C) 2018-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#define FNPFX wcsto
#define L_(C) L ## C
diff --git a/wcsmbs/tst-wcstod-round.c b/wcsmbs/tst-wcstod-round.c
index 9db907972f..3ec414be14 100644
--- a/wcsmbs/tst-wcstod-round.c
+++ b/wcsmbs/tst-wcstod-round.c
@@ -1,5 +1,5 @@
/* wide character shim for tst-strtod-round-skeleton.c.
- Copyright (C) 2016-2018 Free Software Foundation, Inc.
+ Copyright (C) 2016-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <wchar.h>
diff --git a/wcsmbs/tst-wcstol-locale.c b/wcsmbs/tst-wcstol-locale.c
index db75145338..677d925e71 100644
--- a/wcsmbs/tst-wcstol-locale.c
+++ b/wcsmbs/tst-wcstol-locale.c
@@ -1,6 +1,6 @@
/* Test strtol functions work with all ASCII letters in Turkish
locales (bug 19242). Wide string version.
- Copyright (C) 2015-2018 Free Software Foundation, Inc.
+ Copyright (C) 2015-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#define CHAR wchar_t
#define SFMT "L\"%ls\""
diff --git a/wcsmbs/uchar.h b/wcsmbs/uchar.h
index 4d9b2ec14d..7b09ecedcc 100644
--- a/wcsmbs/uchar.h
+++ b/wcsmbs/uchar.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011-2018 Free Software Foundation, Inc.
+/* Copyright (C) 2011-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
/*
* ISO C11 Standard: 7.28
diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h
index 6c94f3ebc6..fc62fa3e26 100644
--- a/wcsmbs/wchar.h
+++ b/wcsmbs/wchar.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
/*
* ISO C99 Standard: 7.24
@@ -632,13 +632,11 @@ extern int swscanf (const wchar_t *__restrict __s,
const wchar_t *__restrict __format, ...)
__THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
-# if defined __USE_ISOC99 && !defined __USE_GNU \
- && (!defined __LDBL_COMPAT || !defined __REDIRECT) \
- && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K)
+/* For historical reasons, the C99-compliant versions of the scanf
+ functions are at alternative names. When __LDBL_COMPAT is in
+ effect, this is handled in bits/wchar-ldbl.h. */
+#if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT
# ifdef __REDIRECT
-/* For strict ISO C99 or POSIX compliance disallow %as, %aS and %a[
- GNU extension which conflicts with valid %a followed by letter
- s, S or [. */
extern int __REDIRECT (fwscanf, (__FILE *__restrict __stream,
const wchar_t *__restrict __format, ...),
__isoc99_fwscanf)
@@ -687,7 +685,8 @@ extern int vswscanf (const wchar_t *__restrict __s,
__gnuc_va_list __arg)
__THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
-# if !defined __USE_GNU \
+/* Same redirection as above for the v*wscanf family. */
+# if !__GLIBC_USE (DEPRECATED_SCANF) \
&& (!defined __LDBL_COMPAT || !defined __REDIRECT) \
&& (defined __STRICT_ANSI__ || defined __USE_XOPEN2K)
# ifdef __REDIRECT
diff --git a/wcsmbs/wcpcpy.c b/wcsmbs/wcpcpy.c
index af0cf28d74..a1c26409aa 100644
--- a/wcsmbs/wcpcpy.c
+++ b/wcsmbs/wcpcpy.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
@@ -14,35 +14,22 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <wchar.h>
-#define __need_ptrdiff_t
-#include <stddef.h>
-
#ifdef WCPCPY
# define __wcpcpy WCPCPY
#endif
+
/* Copy SRC to DEST, returning the address of the terminating L'\0' in
DEST. */
wchar_t *
__wcpcpy (wchar_t *dest, const wchar_t *src)
{
- wchar_t *wcp = (wchar_t *) dest - 1;
- wint_t c;
- const ptrdiff_t off = src - dest + 1;
-
- do
- {
- c = wcp[off];
- *++wcp = c;
- }
- while (c != L'\0');
-
- return wcp;
+ size_t len = __wcslen (src);
+ return __wmemcpy (dest, src, len + 1) + len;
}
-
#ifndef WCPCPY
weak_alias (__wcpcpy, wcpcpy)
#endif
diff --git a/wcsmbs/wcpncpy.c b/wcsmbs/wcpncpy.c
index e633faf797..c39d3284ad 100644
--- a/wcsmbs/wcpncpy.c
+++ b/wcsmbs/wcpncpy.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <wchar.h>
@@ -27,59 +27,12 @@
wchar_t *
__wcpncpy (wchar_t *dest, const wchar_t *src, size_t n)
{
- wint_t c;
- wchar_t *const s = dest;
-
- if (n >= 4)
- {
- size_t n4 = n >> 2;
-
- for (;;)
- {
- c = *src++;
- *dest++ = c;
- if (c == L'\0')
- break;
- c = *src++;
- *dest++ = c;
- if (c == L'\0')
- break;
- c = *src++;
- *dest++ = c;
- if (c == L'\0')
- break;
- c = *src++;
- *dest++ = c;
- if (c == L'\0')
- break;
- if (--n4 == 0)
- goto last_chars;
- }
- n -= dest - s;
- goto zero_fill;
- }
-
- last_chars:
- n &= 3;
- if (n == 0)
+ size_t size = __wcsnlen (src, n);
+ __wmemcpy (dest, src, size);
+ dest += size;
+ if (size == n)
return dest;
-
- for (;;)
- {
- c = *src++;
- --n;
- *dest++ = c;
- if (c == L'\0')
- break;
- if (n == 0)
- return dest;
- }
-
- zero_fill:
- while (n-- > 0)
- dest[n] = L'\0';
-
- return dest - 1;
+ return wmemset (dest, L'\0', (n - size));
}
#ifndef WCPNCPY
diff --git a/wcsmbs/wcrtomb.c b/wcsmbs/wcrtomb.c
index 23f122599a..6ea3c09cb4 100644
--- a/wcsmbs/wcrtomb.c
+++ b/wcsmbs/wcrtomb.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <assert.h>
#include <dlfcn.h>
@@ -113,8 +113,3 @@ __wcrtomb (char *s, wchar_t wc, mbstate_t *ps)
}
weak_alias (__wcrtomb, wcrtomb)
libc_hidden_weak (wcrtomb)
-
-/* There should be no difference between the UTF-32 handling required
- by c32rtomb and the wchar_t handling which has long since been
- implemented in wcrtomb. */
-weak_alias (__wcrtomb, c32rtomb)
diff --git a/wcsmbs/wcscasecmp.c b/wcsmbs/wcscasecmp.c
index e2d7f7ce84..f1c7ab248d 100644
--- a/wcsmbs/wcscasecmp.c
+++ b/wcsmbs/wcscasecmp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/wcsmbs/wcscasecmp_l.c b/wcsmbs/wcscasecmp_l.c
index bbe50c607a..a5b6dff863 100644
--- a/wcsmbs/wcscasecmp_l.c
+++ b/wcsmbs/wcscasecmp_l.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#define USE_IN_EXTENDED_LOCALE_MODEL 1
#include <wcscasecmp.c>
diff --git a/wcsmbs/wcscat.c b/wcsmbs/wcscat.c
index 5fe4e02adc..54ce191fd4 100644
--- a/wcsmbs/wcscat.c
+++ b/wcsmbs/wcscat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <wchar.h>
@@ -26,26 +26,7 @@
wchar_t *
__wcscat (wchar_t *dest, const wchar_t *src)
{
- wchar_t *s1 = dest;
- const wchar_t *s2 = src;
- wchar_t c;
-
- /* Find the end of the string. */
- do
- c = *s1++;
- while (c != L'\0');
-
- /* Make S1 point before the next character, so we can increment
- it while memory is read (wins on pipelined cpus). */
- s1 -= 2;
-
- do
- {
- c = *s2++;
- *++s1 = c;
- }
- while (c != L'\0');
-
+ __wcscpy (dest + __wcslen (dest), src);
return dest;
}
#ifndef WCSCAT
diff --git a/wcsmbs/wcschr.c b/wcsmbs/wcschr.c
index 2136050f7a..6aca9bbcad 100644
--- a/wcsmbs/wcschr.c
+++ b/wcsmbs/wcschr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,9 +13,10 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <wchar.h>
+#include <loop_unroll.h>
#ifndef WCSCHR
# define WCSCHR __wcschr
@@ -25,12 +26,23 @@
wchar_t *
WCSCHR (const wchar_t *wcs, const wchar_t wc)
{
- do
- if (*wcs == wc)
- return (wchar_t *) wcs;
- while (*wcs++ != L'\0');
+ wchar_t *dest = NULL;
- return NULL;
+#define ITERATION(index) \
+ ({ \
+ if (*wcs == wc) \
+ dest = (wchar_t*) wcs; \
+ dest == NULL && *wcs++ != L'\0'; \
+ })
+
+#ifndef UNROLL_NTIMES
+# define UNROLL_NTIMES 1
+#endif
+
+ while (1)
+ UNROLL_REPEAT (UNROLL_NTIMES, ITERATION);
+
+ return dest;
}
libc_hidden_def (__wcschr)
weak_alias (__wcschr, wcschr)
diff --git a/wcsmbs/wcschrnul.c b/wcsmbs/wcschrnul.c
index af35da8ae3..a6af33d951 100644
--- a/wcsmbs/wcschrnul.c
+++ b/wcsmbs/wcschrnul.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <wchar.h>
diff --git a/wcsmbs/wcscmp.c b/wcsmbs/wcscmp.c
index 254bc7e257..bb06728050 100644
--- a/wcsmbs/wcscmp.c
+++ b/wcsmbs/wcscmp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <wchar.h>
diff --git a/wcsmbs/wcscoll.c b/wcsmbs/wcscoll.c
index eb71842b8b..2693445cc1 100644
--- a/wcsmbs/wcscoll.c
+++ b/wcsmbs/wcscoll.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <wchar.h>
#include "../locale/coll-lookup.h"
diff --git a/wcsmbs/wcscoll_l.c b/wcsmbs/wcscoll_l.c
index 2f0fa2fe27..602b281fb6 100644
--- a/wcsmbs/wcscoll_l.c
+++ b/wcsmbs/wcscoll_l.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <wchar.h>
diff --git a/wcsmbs/wcscpy.c b/wcsmbs/wcscpy.c
index 31a2dd0897..1d3ca33cbf 100644
--- a/wcsmbs/wcscpy.c
+++ b/wcsmbs/wcscpy.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
@@ -14,47 +14,41 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
-#include <stddef.h>
#include <wchar.h>
+#include <loop_unroll.h>
-#ifndef WCSCPY
-# define WCSCPY wcscpy
+#ifdef WCSCPY
+# define __wcscpy WCSCPY
#endif
/* Copy SRC to DEST. */
wchar_t *
-WCSCPY (wchar_t *dest, const wchar_t *src)
+__wcscpy (wchar_t *dest, const wchar_t *src)
{
- wint_t c;
- wchar_t *wcp;
-
- if (__alignof__ (wchar_t) >= sizeof (wchar_t))
- {
- const ptrdiff_t off = dest - src - 1;
-
- wcp = (wchar_t *) src;
-
- do
- {
- c = *wcp++;
- wcp[off] = c;
- }
- while (c != L'\0');
- }
- else
- {
- wcp = dest;
-
- do
- {
- c = *src++;
- *wcp++ = c;
- }
- while (c != L'\0');
- }
-
+#ifndef UNROLL_NTIMES
+ return __wmemcpy (dest, src, __wcslen (src) + 1);
+#else
+ /* Some architectures might have costly tail function call (powerpc
+ for instance) where wmemcpy call overhead for smalls sizes might
+ be more costly than just unrolling the main loop. */
+ wchar_t *wcp = dest;
+
+#define ITERATION(index) \
+ ({ \
+ wchar_t c = *src++; \
+ *wcp++ = c; \
+ c != L'\0'; \
+ })
+
+ while (1)
+ UNROLL_REPEAT(UNROLL_NTIMES, ITERATION);
return dest;
+#endif
}
+#ifndef WCSCPY
+weak_alias (__wcscpy, wcscpy)
+libc_hidden_def (__wcscpy)
+#endif
diff --git a/wcsmbs/wcscspn.c b/wcsmbs/wcscspn.c
index 845f532c82..2e3d65ca56 100644
--- a/wcsmbs/wcscspn.c
+++ b/wcsmbs/wcscspn.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <wchar.h>
diff --git a/wcsmbs/wcsdup.c b/wcsmbs/wcsdup.c
index cebf6eda95..1df5230069 100644
--- a/wcsmbs/wcsdup.c
+++ b/wcsmbs/wcsdup.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <wchar.h>
#include <string.h>
diff --git a/wcsmbs/wcslen.c b/wcsmbs/wcslen.c
index cfb076e469..482839a89f 100644
--- a/wcsmbs/wcslen.c
+++ b/wcsmbs/wcslen.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <wchar.h>
diff --git a/wcsmbs/wcsmbsload.c b/wcsmbs/wcsmbsload.c
index 02cf94bab8..39611b7636 100644
--- a/wcsmbs/wcsmbsload.c
+++ b/wcsmbs/wcsmbsload.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -14,12 +14,13 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <ctype.h>
#include <langinfo.h>
#include <limits.h>
#include <stdlib.h>
+#include <stdio.h>
#include <string.h>
#include <locale/localeinfo.h>
@@ -223,12 +224,25 @@ __wcsmbs_clone_conv (struct gconv_fcts *copy)
/* Copy the data. */
*copy = *orig;
- /* Now increment the usage counters.
- Note: This assumes copy->*_nsteps == 1. */
+ /* Now increment the usage counters. Note: This assumes
+ copy->*_nsteps == 1. The current locale holds a reference, so it
+ is still there after acquiring the lock. */
+
+ __libc_lock_lock (__gconv_lock);
+
+ bool overflow = false;
if (copy->towc->__shlib_handle != NULL)
- ++copy->towc->__counter;
+ overflow |= __builtin_add_overflow (copy->towc->__counter, 1,
+ &copy->towc->__counter);
if (copy->tomb->__shlib_handle != NULL)
- ++copy->tomb->__counter;
+ overflow |= __builtin_add_overflow (copy->tomb->__counter, 1,
+ &copy->tomb->__counter);
+
+ __libc_lock_unlock (__gconv_lock);
+
+ if (overflow)
+ __libc_fatal ("\
+Fatal glibc error: gconv module reference counter overflow\n");
}
diff --git a/wcsmbs/wcsmbsload.h b/wcsmbs/wcsmbsload.h
index 8ad9fcadf9..10a10b961c 100644
--- a/wcsmbs/wcsmbsload.h
+++ b/wcsmbs/wcsmbsload.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#ifndef _WCSMBSLOAD_H
#define _WCSMBSLOAD_H 1
diff --git a/wcsmbs/wcsncase.c b/wcsmbs/wcsncase.c
index 2f149b2434..4712860e85 100644
--- a/wcsmbs/wcsncase.c
+++ b/wcsmbs/wcsncase.c
@@ -1,6 +1,6 @@
/* Compare at most N wide characters of two strings without taking care
for the case.
- Copyright (C) 1992-2018 Free Software Foundation, Inc.
+ Copyright (C) 1992-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/wcsmbs/wcsncase_l.c b/wcsmbs/wcsncase_l.c
index ed0b1a81a8..83ce3a9e5c 100644
--- a/wcsmbs/wcsncase_l.c
+++ b/wcsmbs/wcsncase_l.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#define USE_IN_EXTENDED_LOCALE_MODEL 1
#include <wcsncase.c>
diff --git a/wcsmbs/wcsncat.c b/wcsmbs/wcsncat.c
index 8d4013b53d..94d7347175 100644
--- a/wcsmbs/wcsncat.c
+++ b/wcsmbs/wcsncat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <wchar.h>
@@ -26,54 +26,15 @@
wchar_t *
WCSNCAT (wchar_t *dest, const wchar_t *src, size_t n)
{
- wchar_t c;
- wchar_t * const s = dest;
+ wchar_t *ret = dest;
- /* Find the end of DEST. */
- do
- c = *dest++;
- while (c != L'\0');
+ /* Find the end of dest. */
+ dest += __wcslen (dest);
- /* Make DEST point before next character, so we can increment
- it while memory is read (wins on pipelined cpus). */
- dest -= 2;
+ size_t ds = __wcsnlen (src, n);
- if (n >= 4)
- {
- size_t n4 = n >> 2;
- do
- {
- c = *src++;
- *++dest = c;
- if (c == L'\0')
- return s;
- c = *src++;
- *++dest = c;
- if (c == L'\0')
- return s;
- c = *src++;
- *++dest = c;
- if (c == L'\0')
- return s;
- c = *src++;
- *++dest = c;
- if (c == L'\0')
- return s;
- } while (--n4 > 0);
- n &= 3;
- }
+ dest[ds] = L'\0';
+ __wmemcpy (dest, src, ds);
- while (n > 0)
- {
- c = *src++;
- *++dest = c;
- if (c == L'\0')
- return s;
- n--;
- }
-
- if (c != L'\0')
- *++dest = L'\0';
-
- return s;
+ return ret;
}
diff --git a/wcsmbs/wcsncmp.c b/wcsmbs/wcsncmp.c
index 5e8201243b..774ec33331 100644
--- a/wcsmbs/wcsncmp.c
+++ b/wcsmbs/wcsncmp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <wchar.h>
diff --git a/wcsmbs/wcsncpy.c b/wcsmbs/wcsncpy.c
index e9735854d2..721b7dab97 100644
--- a/wcsmbs/wcsncpy.c
+++ b/wcsmbs/wcsncpy.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <wchar.h>
@@ -26,62 +26,10 @@
wchar_t *
__wcsncpy (wchar_t *dest, const wchar_t *src, size_t n)
{
- wint_t c;
- wchar_t *const s = dest;
-
- --dest;
-
- if (n >= 4)
- {
- size_t n4 = n >> 2;
-
- for (;;)
- {
- c = *src++;
- *++dest = c;
- if (c == L'\0')
- break;
- c = *src++;
- *++dest = c;
- if (c == L'\0')
- break;
- c = *src++;
- *++dest = c;
- if (c == L'\0')
- break;
- c = *src++;
- *++dest = c;
- if (c == L'\0')
- break;
- if (--n4 == 0)
- goto last_chars;
- }
- n = n - (dest - s) - 1;
- if (n == 0)
- return s;
- goto zero_fill;
- }
-
- last_chars:
- n &= 3;
- if (n == 0)
- return s;
-
- do
- {
- c = *src++;
- *++dest = c;
- if (--n == 0)
- return s;
- }
- while (c != L'\0');
-
- zero_fill:
- do
- *++dest = L'\0';
- while (--n > 0);
-
- return s;
+ size_t size = __wcsnlen (src, n);
+ if (size != n)
+ __wmemset (dest + size, L'\0', n - size);
+ return __wmemcpy (dest, src, size);
}
#ifndef WCSNCPY
weak_alias (__wcsncpy, wcsncpy)
diff --git a/wcsmbs/wcsnlen.c b/wcsmbs/wcsnlen.c
index d8f60a3b5a..17e004dcc0 100644
--- a/wcsmbs/wcsnlen.c
+++ b/wcsmbs/wcsnlen.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <wchar.h>
@@ -26,24 +26,10 @@
size_t
__wcsnlen (const wchar_t *s, size_t maxlen)
{
- size_t len = 0;
-
- while (maxlen > 0 && s[len] != L'\0')
- {
- ++len;
- if (--maxlen == 0 || s[len] == L'\0')
- return len;
- ++len;
- if (--maxlen == 0 || s[len] == L'\0')
- return len;
- ++len;
- if (--maxlen == 0 || s[len] == L'\0')
- return len;
- ++len;
- --maxlen;
- }
-
- return len;
+ const wchar_t *ret = __wmemchr (s, L'\0', maxlen);
+ if (ret)
+ maxlen = ret - s;
+ return maxlen;
}
#ifndef WCSNLEN
weak_alias (__wcsnlen, wcsnlen)
diff --git a/wcsmbs/wcsnrtombs.c b/wcsmbs/wcsnrtombs.c
index 93d51cae37..ed86a1ecee 100644
--- a/wcsmbs/wcsnrtombs.c
+++ b/wcsmbs/wcsnrtombs.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <assert.h>
#include <dlfcn.h>
diff --git a/wcsmbs/wcspbrk.c b/wcsmbs/wcspbrk.c
index 24f9da352f..882f875c48 100644
--- a/wcsmbs/wcspbrk.c
+++ b/wcsmbs/wcspbrk.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <wchar.h>
diff --git a/wcsmbs/wcsrchr.c b/wcsmbs/wcsrchr.c
index f81c8f52d4..90fc3f5077 100644
--- a/wcsmbs/wcsrchr.c
+++ b/wcsmbs/wcsrchr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>
@@ -14,9 +14,10 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <wchar.h>
+#include <loop_unroll.h>
#ifndef WCSRCHR
# define WCSRCHR wcsrchr
@@ -26,12 +27,21 @@
wchar_t *
WCSRCHR (const wchar_t *wcs, const wchar_t wc)
{
- const wchar_t *retval = NULL;
+ wchar_t *retval = NULL;
- do
- if (*wcs == wc)
- retval = wcs;
- while (*wcs++ != L'\0');
+#define ITERATION(index) \
+ ({ \
+ if (*wcs == wc) \
+ retval = (wchar_t*) wcs; \
+ *wcs++ != L'\0'; \
+ })
- return (wchar_t *) retval;
+#ifndef UNROLL_NTIMES
+# define UNROLL_NTIMES 1
+#endif
+
+ while (1)
+ UNROLL_REPEAT (UNROLL_NTIMES, ITERATION);
+
+ return retval;
}
diff --git a/wcsmbs/wcsrtombs.c b/wcsmbs/wcsrtombs.c
index 9b85822464..27e59e4f46 100644
--- a/wcsmbs/wcsrtombs.c
+++ b/wcsmbs/wcsrtombs.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <assert.h>
#include <dlfcn.h>
diff --git a/wcsmbs/wcsspn.c b/wcsmbs/wcsspn.c
index e6caafcc2b..7a2ac80b27 100644
--- a/wcsmbs/wcsspn.c
+++ b/wcsmbs/wcsspn.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <wchar.h>
diff --git a/wcsmbs/wcsstr.c b/wcsmbs/wcsstr.c
index fba0325bf3..9661cb3d97 100644
--- a/wcsmbs/wcsstr.c
+++ b/wcsmbs/wcsstr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
/*
* The original strstr() file contains the following comment:
diff --git a/wcsmbs/wcstod.c b/wcsmbs/wcstod.c
index b081c0ae16..74c1b3f33d 100644
--- a/wcsmbs/wcstod.c
+++ b/wcsmbs/wcstod.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <stddef.h>
#include <locale.h>
diff --git a/wcsmbs/wcstod_l.c b/wcsmbs/wcstod_l.c
index 921c1fb229..2a33a0bdd1 100644
--- a/wcsmbs/wcstod_l.c
+++ b/wcsmbs/wcstod_l.c
@@ -1,5 +1,5 @@
/* Convert string representing a number to integer value, using given locale.
- Copyright (C) 1997-2018 Free Software Foundation, Inc.
+ Copyright (C) 1997-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <stddef.h>
#include <locale.h>
diff --git a/wcsmbs/wcstod_nan.c b/wcsmbs/wcstod_nan.c
index 1423f3e8aa..9638a4a627 100644
--- a/wcsmbs/wcstod_nan.c
+++ b/wcsmbs/wcstod_nan.c
@@ -1,5 +1,5 @@
/* Convert string for NaN payload to corresponding NaN. Wide strings, double.
- Copyright (C) 2015-2018 Free Software Foundation, Inc.
+ Copyright (C) 2015-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include "../stdlib/strtod_nan_wide.h"
#include <math-type-macros-double.h>
diff --git a/wcsmbs/wcstof.c b/wcsmbs/wcstof.c
index f27c9a68a6..95f41c485f 100644
--- a/wcsmbs/wcstof.c
+++ b/wcsmbs/wcstof.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <stddef.h>
#include <locale.h>
diff --git a/wcsmbs/wcstof_l.c b/wcsmbs/wcstof_l.c
index 3c8c9a7e1e..74bda419d9 100644
--- a/wcsmbs/wcstof_l.c
+++ b/wcsmbs/wcstof_l.c
@@ -1,5 +1,5 @@
/* Convert string representing a number to integer value, using given locale.
- Copyright (C) 1997-2018 Free Software Foundation, Inc.
+ Copyright (C) 1997-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <stddef.h>
#include <locale.h>
diff --git a/wcsmbs/wcstof_nan.c b/wcsmbs/wcstof_nan.c
index 96f2198667..fab41554f0 100644
--- a/wcsmbs/wcstof_nan.c
+++ b/wcsmbs/wcstof_nan.c
@@ -1,5 +1,5 @@
/* Convert string for NaN payload to corresponding NaN. Wide strings, float.
- Copyright (C) 2015-2018 Free Software Foundation, Inc.
+ Copyright (C) 2015-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include "../stdlib/strtod_nan_wide.h"
#include <math-type-macros-float.h>
diff --git a/wcsmbs/wcstok.c b/wcsmbs/wcstok.c
index 8fbf4af9d9..3ffac895a8 100644
--- a/wcsmbs/wcstok.c
+++ b/wcsmbs/wcstok.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <wchar.h>
#include <errno.h>
diff --git a/wcsmbs/wcstol.c b/wcsmbs/wcstol.c
index e9e09ca48c..308860a000 100644
--- a/wcsmbs/wcstol.c
+++ b/wcsmbs/wcstol.c
@@ -1,5 +1,5 @@
/* Function to parse a `long int' from text.
- Copyright (C) 1996-2018 Free Software Foundation, Inc.
+ Copyright (C) 1996-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#define USE_WIDE_CHAR 1
diff --git a/wcsmbs/wcstol_l.c b/wcsmbs/wcstol_l.c
index e6f9e8523e..1b08e52970 100644
--- a/wcsmbs/wcstol_l.c
+++ b/wcsmbs/wcstol_l.c
@@ -1,5 +1,5 @@
/* Convert string representing a number to integer value, using given locale.
- Copyright (C) 1997-2018 Free Software Foundation, Inc.
+ Copyright (C) 1997-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#define __need_wchar_t
#include <stddef.h>
diff --git a/wcsmbs/wcstold.c b/wcsmbs/wcstold.c
index b6c8ccb3c4..054f14185c 100644
--- a/wcsmbs/wcstold.c
+++ b/wcsmbs/wcstold.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <stddef.h>
#include <locale.h>
diff --git a/wcsmbs/wcstold_l.c b/wcsmbs/wcstold_l.c
index 1002f25574..0bea84848c 100644
--- a/wcsmbs/wcstold_l.c
+++ b/wcsmbs/wcstold_l.c
@@ -1,5 +1,5 @@
/* Convert string representing a number to integer value, using given locale.
- Copyright (C) 1997-2018 Free Software Foundation, Inc.
+ Copyright (C) 1997-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <stddef.h>
#include <locale.h>
diff --git a/wcsmbs/wcstold_nan.c b/wcsmbs/wcstold_nan.c
index 66793ec459..5d28dd2443 100644
--- a/wcsmbs/wcstold_nan.c
+++ b/wcsmbs/wcstold_nan.c
@@ -1,6 +1,6 @@
/* Convert string for NaN payload to corresponding NaN. Wide strings,
long double.
- Copyright (C) 2015-2018 Free Software Foundation, Inc.
+ Copyright (C) 2015-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <math.h>
diff --git a/wcsmbs/wcstoll.c b/wcsmbs/wcstoll.c
index d821d60b54..7e9e94ba0b 100644
--- a/wcsmbs/wcstoll.c
+++ b/wcsmbs/wcstoll.c
@@ -1,5 +1,5 @@
/* Function to parse a `long long int' from text.
- Copyright (C) 1996-2018 Free Software Foundation, Inc.
+ Copyright (C) 1996-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#define QUAD 1
diff --git a/wcsmbs/wcstoll_l.c b/wcsmbs/wcstoll_l.c
index bca3900d75..cf8aa73325 100644
--- a/wcsmbs/wcstoll_l.c
+++ b/wcsmbs/wcstoll_l.c
@@ -1,5 +1,5 @@
/* Convert string representing a number to integer value, using given locale.
- Copyright (C) 1997-2018 Free Software Foundation, Inc.
+ Copyright (C) 1997-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#define __need_wchar_t
#include <stddef.h>
diff --git a/wcsmbs/wcstoul.c b/wcsmbs/wcstoul.c
index b2e1bc918c..5c53ac96b4 100644
--- a/wcsmbs/wcstoul.c
+++ b/wcsmbs/wcstoul.c
@@ -1,5 +1,5 @@
/* Function to parse an `unsigned long int' from text.
- Copyright (C) 1996-2018 Free Software Foundation, Inc.
+ Copyright (C) 1996-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#define UNSIGNED 1
diff --git a/wcsmbs/wcstoul_l.c b/wcsmbs/wcstoul_l.c
index 6bdf43a06d..a642c8a1a1 100644
--- a/wcsmbs/wcstoul_l.c
+++ b/wcsmbs/wcstoul_l.c
@@ -1,5 +1,5 @@
/* Convert string representing a number to integer value, using given locale.
- Copyright (C) 1997-2018 Free Software Foundation, Inc.
+ Copyright (C) 1997-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#define __need_wchar_t
#include <stddef.h>
diff --git a/wcsmbs/wcstoull.c b/wcsmbs/wcstoull.c
index 6195b6f376..1129964088 100644
--- a/wcsmbs/wcstoull.c
+++ b/wcsmbs/wcstoull.c
@@ -1,5 +1,5 @@
/* Function to parse an `unsigned long long int' from text.
- Copyright (C) 1996-2018 Free Software Foundation, Inc.
+ Copyright (C) 1996-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#define QUAD 1
diff --git a/wcsmbs/wcstoull_l.c b/wcsmbs/wcstoull_l.c
index 8526d51266..9047e35243 100644
--- a/wcsmbs/wcstoull_l.c
+++ b/wcsmbs/wcstoull_l.c
@@ -1,5 +1,5 @@
/* Convert string representing a number to integer value, using given locale.
- Copyright (C) 1997-2018 Free Software Foundation, Inc.
+ Copyright (C) 1997-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#define __need_wchar_t
#include <stddef.h>
diff --git a/wcsmbs/wcswidth.c b/wcsmbs/wcswidth.c
index bdbc171b86..a3461c7082 100644
--- a/wcsmbs/wcswidth.c
+++ b/wcsmbs/wcswidth.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include "wcwidth.h"
diff --git a/wcsmbs/wcsxfrm.c b/wcsmbs/wcsxfrm.c
index d9c3489240..fb4f2537fd 100644
--- a/wcsmbs/wcsxfrm.c
+++ b/wcsmbs/wcsxfrm.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <wchar.h>
#include "../locale/coll-lookup.h"
diff --git a/wcsmbs/wcsxfrm_l.c b/wcsmbs/wcsxfrm_l.c
index 27f8e2a503..998638fb59 100644
--- a/wcsmbs/wcsxfrm_l.c
+++ b/wcsmbs/wcsxfrm_l.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <wchar.h>
#include "../locale/coll-lookup.h"
diff --git a/wcsmbs/wctob.c b/wcsmbs/wctob.c
index 906d68bd60..2c32ff8b22 100644
--- a/wcsmbs/wctob.c
+++ b/wcsmbs/wctob.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <dlfcn.h>
#include <gconv.h>
diff --git a/wcsmbs/wcwidth.c b/wcsmbs/wcwidth.c
index 26f6960e08..8393e56dda 100644
--- a/wcsmbs/wcwidth.c
+++ b/wcsmbs/wcwidth.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include "wcwidth.h"
diff --git a/wcsmbs/wcwidth.h b/wcsmbs/wcwidth.h
index 6fb3503196..91fb8d9fd5 100644
--- a/wcsmbs/wcwidth.h
+++ b/wcsmbs/wcwidth.h
@@ -1,5 +1,5 @@
/* Internal header containing implementation of wcwidth() function.
- Copyright (C) 1996-2018 Free Software Foundation, Inc.
+ Copyright (C) 1996-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <wchar.h>
#include <wctype.h>
diff --git a/wcsmbs/wmemchr.c b/wcsmbs/wmemchr.c
index d01939355e..19bf2cc515 100644
--- a/wcsmbs/wmemchr.c
+++ b/wcsmbs/wmemchr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <wchar.h>
diff --git a/wcsmbs/wmemcmp.c b/wcsmbs/wmemcmp.c
index d6cfd692c0..5d2624ed33 100644
--- a/wcsmbs/wmemcmp.c
+++ b/wcsmbs/wmemcmp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
@@ -14,16 +14,16 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <wchar.h>
-#ifndef WMEMCMP
-# define WMEMCMP wmemcmp
+#ifdef WMEMCMP
+# define __wmemcmp WMEMCMP
#endif
int
-WMEMCMP (const wchar_t *s1, const wchar_t *s2, size_t n)
+__wmemcmp (const wchar_t *s1, const wchar_t *s2, size_t n)
{
wchar_t c1;
wchar_t c2;
@@ -81,3 +81,6 @@ WMEMCMP (const wchar_t *s1, const wchar_t *s2, size_t n)
return 0;
}
+#ifndef WMEMCMP
+weak_alias (__wmemcmp, wmemcmp)
+#endif
diff --git a/wcsmbs/wmemcpy.c b/wcsmbs/wmemcpy.c
index 4980c9ba52..83da4a0a91 100644
--- a/wcsmbs/wmemcpy.c
+++ b/wcsmbs/wmemcpy.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <wchar.h>
#include <string.h>
diff --git a/wcsmbs/wmemmove.c b/wcsmbs/wmemmove.c
index f22ff6fbb5..b5296205b5 100644
--- a/wcsmbs/wmemmove.c
+++ b/wcsmbs/wmemmove.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <wchar.h>
#include <string.h>
diff --git a/wcsmbs/wmempcpy.c b/wcsmbs/wmempcpy.c
index fae854b804..1bc04d1d94 100644
--- a/wcsmbs/wmempcpy.c
+++ b/wcsmbs/wmempcpy.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1999.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <wchar.h>
#include <string.h>
diff --git a/wcsmbs/wmemset.c b/wcsmbs/wmemset.c
index 330f5a30e4..122e97ca56 100644
--- a/wcsmbs/wmemset.c
+++ b/wcsmbs/wmemset.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <wchar.h>