|
|
18aefd |
diff -rNu compat-locales-sap-1.0.10.orig/saplocales-2.2.5/iconv/libc-diag.h compat-locales-sap-1.0.10/saplocales-2.2.5/iconv/libc-diag.h
|
|
|
18aefd |
--- compat-locales-sap-1.0.10.orig/saplocales-2.2.5/iconv/libc-diag.h 1970-01-01 01:00:00.000000000 +0100
|
|
|
18aefd |
+++ compat-locales-sap-1.0.10/saplocales-2.2.5/iconv/libc-diag.h 2018-01-10 07:36:33.762358809 +0100
|
|
|
18aefd |
@@ -0,0 +1,74 @@
|
|
|
18aefd |
+/* Macros for controlling diagnostic output from the compiler.
|
|
|
18aefd |
+ Copyright (C) 2014-2018 Free Software Foundation, Inc.
|
|
|
18aefd |
+ This file is part of the GNU C Library.
|
|
|
18aefd |
+
|
|
|
18aefd |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
18aefd |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
18aefd |
+ License as published by the Free Software Foundation; either
|
|
|
18aefd |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
18aefd |
+
|
|
|
18aefd |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
18aefd |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
18aefd |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
18aefd |
+ Lesser General Public License for more details.
|
|
|
18aefd |
+
|
|
|
18aefd |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
18aefd |
+ License along with the GNU C Library; if not, see
|
|
|
18aefd |
+ <http://www.gnu.org/licenses/>. */
|
|
|
18aefd |
+
|
|
|
18aefd |
+#ifndef _LIBC_DIAG_H
|
|
|
18aefd |
+#define _LIBC_DIAG_H 1
|
|
|
18aefd |
+
|
|
|
18aefd |
+/* Ignore the value of an expression when a cast to void does not
|
|
|
18aefd |
+ suffice (in particular, for a call to a function declared with
|
|
|
18aefd |
+ attribute warn_unused_result). */
|
|
|
18aefd |
+#define ignore_value(x) \
|
|
|
18aefd |
+ ({ __typeof__ (x) __ignored_value = (x); (void) __ignored_value; })
|
|
|
18aefd |
+
|
|
|
18aefd |
+/* The macros to control diagnostics are structured like this, rather
|
|
|
18aefd |
+ than a single macro that both pushes and pops diagnostic state and
|
|
|
18aefd |
+ takes the affected code as an argument, because the GCC pragmas
|
|
|
18aefd |
+ work by disabling the diagnostic for a range of source locations
|
|
|
18aefd |
+ and do not work when all the pragmas and the affected code are in a
|
|
|
18aefd |
+ single macro expansion. */
|
|
|
18aefd |
+
|
|
|
18aefd |
+/* Push diagnostic state. */
|
|
|
18aefd |
+#define DIAG_PUSH_NEEDS_COMMENT _Pragma ("GCC diagnostic push")
|
|
|
18aefd |
+
|
|
|
18aefd |
+/* Pop diagnostic state. */
|
|
|
18aefd |
+#define DIAG_POP_NEEDS_COMMENT _Pragma ("GCC diagnostic pop")
|
|
|
18aefd |
+
|
|
|
18aefd |
+#define _DIAG_STR1(s) #s
|
|
|
18aefd |
+#define _DIAG_STR(s) _DIAG_STR1(s)
|
|
|
18aefd |
+
|
|
|
18aefd |
+/* Ignore the diagnostic OPTION. VERSION is the most recent GCC
|
|
|
18aefd |
+ version for which the diagnostic has been confirmed to appear in
|
|
|
18aefd |
+ the absence of the pragma (in the form MAJOR.MINOR for GCC 4.x,
|
|
|
18aefd |
+ just MAJOR for GCC 5 and later). Uses of this pragma should be
|
|
|
18aefd |
+ reviewed when the GCC version given is no longer supported for
|
|
|
18aefd |
+ building glibc; the version number should always be on the same
|
|
|
18aefd |
+ source line as the macro name, so such uses can be found with grep.
|
|
|
18aefd |
+ Uses should come with a comment giving more details of the
|
|
|
18aefd |
+ diagnostic, and an architecture on which it is seen if possibly
|
|
|
18aefd |
+ optimization-related and not in architecture-specific code. This
|
|
|
18aefd |
+ macro should only be used if the diagnostic seems hard to fix (for
|
|
|
18aefd |
+ example, optimization-related false positives). */
|
|
|
18aefd |
+#define DIAG_IGNORE_NEEDS_COMMENT(version, option) \
|
|
|
18aefd |
+ _Pragma (_DIAG_STR (GCC diagnostic ignored option))
|
|
|
18aefd |
+
|
|
|
18aefd |
+/* Similar to DIAG_IGNORE_NEEDS_COMMENT the following macro ignores the
|
|
|
18aefd |
+ diagnostic OPTION but only if optimizations for size are enabled.
|
|
|
18aefd |
+ This is required because different warnings may be generated for
|
|
|
18aefd |
+ different optimization levels. For example a key piece of code may
|
|
|
18aefd |
+ only generate a warning when compiled at -Os, but at -O2 you could
|
|
|
18aefd |
+ still want the warning to be enabled to catch errors. In this case
|
|
|
18aefd |
+ you would use DIAG_IGNORE_Os_NEEDS_COMMENT to disable the warning
|
|
|
18aefd |
+ only for -Os. */
|
|
|
18aefd |
+#ifdef __OPTIMIZE_SIZE__
|
|
|
18aefd |
+# define DIAG_IGNORE_Os_NEEDS_COMMENT(version, option) \
|
|
|
18aefd |
+ _Pragma (_DIAG_STR (GCC diagnostic ignored option))
|
|
|
18aefd |
+#else
|
|
|
18aefd |
+# define DIAG_IGNORE_Os_NEEDS_COMMENT(version, option)
|
|
|
18aefd |
+#endif
|
|
|
18aefd |
+
|
|
|
18aefd |
+#endif /* libc-diag.h */
|
|
|
18aefd |
diff -rNu compat-locales-sap-1.0.10.orig/saplocales-2.2.5/iconv/loop.c compat-locales-sap-1.0.10/saplocales-2.2.5/iconv/loop.c
|
|
|
18aefd |
--- compat-locales-sap-1.0.10.orig/saplocales-2.2.5/iconv/loop.c 2018-01-09 12:42:01.393580878 +0100
|
|
|
18aefd |
+++ compat-locales-sap-1.0.10/saplocales-2.2.5/iconv/loop.c 2018-01-09 12:42:28.069281608 +0100
|
|
|
18aefd |
@@ -1,5 +1,5 @@
|
|
|
18aefd |
/* Conversion loop frame work.
|
|
|
18aefd |
- Copyright (C) 1998-2002, 2003, 2005, 2008 Free Software Foundation, Inc.
|
|
|
18aefd |
+ Copyright (C) 1998-2018 Free Software Foundation, Inc.
|
|
|
18aefd |
This file is part of the GNU C Library.
|
|
|
18aefd |
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
|
|
18aefd |
|
|
|
18aefd |
@@ -14,9 +14,8 @@
|
|
|
18aefd |
Lesser General Public License for more details.
|
|
|
18aefd |
|
|
|
18aefd |
You should have received a copy of the GNU Lesser General Public
|
|
|
18aefd |
- License along with the GNU C Library; if not, write to the Free
|
|
|
18aefd |
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
|
18aefd |
- 02111-1307 USA. */
|
|
|
18aefd |
+ License along with the GNU C Library; if not, see
|
|
|
18aefd |
+ <http://www.gnu.org/licenses/>. */
|
|
|
18aefd |
|
|
|
18aefd |
/* This file provides a frame for the reader loop in all conversion modules.
|
|
|
18aefd |
The actual code must (of course) be provided in the actual module source
|
|
|
18aefd |
@@ -39,7 +38,7 @@
|
|
|
18aefd |
BODY this is supposed to expand to the body of the loop.
|
|
|
18aefd |
The user must provide this.
|
|
|
18aefd |
|
|
|
18aefd |
- EXTRA_LOOP_DECLS extra arguments passed from converion loop call.
|
|
|
18aefd |
+ EXTRA_LOOP_DECLS extra arguments passed from conversion loop call.
|
|
|
18aefd |
|
|
|
18aefd |
INIT_PARAMS code to define and initialize variables from params.
|
|
|
18aefd |
UPDATE_PARAMS code to store result in params.
|
|
|
18aefd |
@@ -57,17 +56,17 @@
|
|
|
18aefd |
#include <sys/param.h> /* For MIN. */
|
|
|
18aefd |
#define __need_size_t
|
|
|
18aefd |
#include <stddef.h>
|
|
|
18aefd |
-
|
|
|
18aefd |
+#include <libc-diag.h>
|
|
|
18aefd |
|
|
|
18aefd |
/* We have to provide support for machines which are not able to handled
|
|
|
18aefd |
unaligned memory accesses. Some of the character encodings have
|
|
|
18aefd |
representations with a fixed width of 2 or 4 bytes. But if we cannot
|
|
|
18aefd |
access unaligned memory we still have to read byte-wise. */
|
|
|
18aefd |
#undef FCTNAME2
|
|
|
18aefd |
-#if defined _STRING_ARCH_unaligned || !defined DEFINE_UNALIGNED
|
|
|
18aefd |
+#if _STRING_ARCH_unaligned || !defined DEFINE_UNALIGNED
|
|
|
18aefd |
/* We can handle unaligned memory access. */
|
|
|
18aefd |
-# define get16(addr) *((__const uint16_t *) (addr))
|
|
|
18aefd |
-# define get32(addr) *((__const uint32_t *) (addr))
|
|
|
18aefd |
+# define get16(addr) *((const uint16_t *) (addr))
|
|
|
18aefd |
+# define get32(addr) *((const uint32_t *) (addr))
|
|
|
18aefd |
|
|
|
18aefd |
/* We need no special support for writing values either. */
|
|
|
18aefd |
# define put16(addr, val) *((uint16_t *) (addr)) = (val)
|
|
|
18aefd |
@@ -78,13 +77,13 @@
|
|
|
18aefd |
/* Distinguish between big endian and little endian. */
|
|
|
18aefd |
# if __BYTE_ORDER == __LITTLE_ENDIAN
|
|
|
18aefd |
# define get16(addr) \
|
|
|
18aefd |
- (((__const unsigned char *) (addr))[1] << 8 \
|
|
|
18aefd |
- | ((__const unsigned char *) (addr))[0])
|
|
|
18aefd |
+ (((const unsigned char *) (addr))[1] << 8 \
|
|
|
18aefd |
+ | ((const unsigned char *) (addr))[0])
|
|
|
18aefd |
# define get32(addr) \
|
|
|
18aefd |
- (((((__const unsigned char *) (addr))[3] << 8 \
|
|
|
18aefd |
- | ((__const unsigned char *) (addr))[2]) << 8 \
|
|
|
18aefd |
- | ((__const unsigned char *) (addr))[1]) << 8 \
|
|
|
18aefd |
- | ((__const unsigned char *) (addr))[0])
|
|
|
18aefd |
+ (((((const unsigned char *) (addr))[3] << 8 \
|
|
|
18aefd |
+ | ((const unsigned char *) (addr))[2]) << 8 \
|
|
|
18aefd |
+ | ((const unsigned char *) (addr))[1]) << 8 \
|
|
|
18aefd |
+ | ((const unsigned char *) (addr))[0])
|
|
|
18aefd |
|
|
|
18aefd |
# define put16(addr, val) \
|
|
|
18aefd |
({ uint16_t __val = (val); \
|
|
|
18aefd |
@@ -103,13 +102,13 @@
|
|
|
18aefd |
(void) 0; })
|
|
|
18aefd |
# else
|
|
|
18aefd |
# define get16(addr) \
|
|
|
18aefd |
- (((__const unsigned char *) (addr))[0] << 8 \
|
|
|
18aefd |
- | ((__const unsigned char *) (addr))[1])
|
|
|
18aefd |
+ (((const unsigned char *) (addr))[0] << 8 \
|
|
|
18aefd |
+ | ((const unsigned char *) (addr))[1])
|
|
|
18aefd |
# define get32(addr) \
|
|
|
18aefd |
- (((((__const unsigned char *) (addr))[0] << 8 \
|
|
|
18aefd |
- | ((__const unsigned char *) (addr))[1]) << 8 \
|
|
|
18aefd |
- | ((__const unsigned char *) (addr))[2]) << 8 \
|
|
|
18aefd |
- | ((__const unsigned char *) (addr))[3])
|
|
|
18aefd |
+ (((((const unsigned char *) (addr))[0] << 8 \
|
|
|
18aefd |
+ | ((const unsigned char *) (addr))[1]) << 8 \
|
|
|
18aefd |
+ | ((const unsigned char *) (addr))[2]) << 8 \
|
|
|
18aefd |
+ | ((const unsigned char *) (addr))[3])
|
|
|
18aefd |
|
|
|
18aefd |
# define put16(addr, val) \
|
|
|
18aefd |
({ uint16_t __val = (val); \
|
|
|
18aefd |
@@ -214,8 +213,6 @@
|
|
|
18aefd |
points. */
|
|
|
18aefd |
#define STANDARD_TO_LOOP_ERR_HANDLER(Incr) \
|
|
|
18aefd |
{ \
|
|
|
18aefd |
- struct __gconv_trans_data *trans; \
|
|
|
18aefd |
- \
|
|
|
18aefd |
result = __GCONV_ILLEGAL_INPUT; \
|
|
|
18aefd |
\
|
|
|
18aefd |
if (irreversible == NULL) \
|
|
|
18aefd |
@@ -228,21 +225,17 @@
|
|
|
18aefd |
UPDATE_PARAMS; \
|
|
|
18aefd |
\
|
|
|
18aefd |
/* First try the transliteration methods. */ \
|
|
|
18aefd |
- for (trans = step_data->__trans; trans != NULL; trans = trans->__next) \
|
|
|
18aefd |
- { \
|
|
|
18aefd |
- result = DL_CALL_FCT (trans->__trans_fct, \
|
|
|
18aefd |
- (step, step_data, trans->__data, *inptrp, \
|
|
|
18aefd |
- &inptr, inend, &outptr, irreversible)); \
|
|
|
18aefd |
- if (result != __GCONV_ILLEGAL_INPUT) \
|
|
|
18aefd |
- break; \
|
|
|
18aefd |
- } \
|
|
|
18aefd |
+ if ((step_data->__flags & __GCONV_TRANSLIT) != 0) \
|
|
|
18aefd |
+ result = __gconv_transliterate \
|
|
|
18aefd |
+ (step, step_data, *inptrp, \
|
|
|
18aefd |
+ &inptr, inend, &outptr, irreversible); \
|
|
|
18aefd |
\
|
|
|
18aefd |
REINIT_PARAMS; \
|
|
|
18aefd |
\
|
|
|
18aefd |
/* If any of them recognized the input continue with the loop. */ \
|
|
|
18aefd |
if (result != __GCONV_ILLEGAL_INPUT) \
|
|
|
18aefd |
{ \
|
|
|
18aefd |
- if (__builtin_expect (result == __GCONV_FULL_OUTPUT, 0)) \
|
|
|
18aefd |
+ if (__glibc_unlikely (result == __GCONV_FULL_OUTPUT)) \
|
|
|
18aefd |
break; \
|
|
|
18aefd |
\
|
|
|
18aefd |
continue; \
|
|
|
18aefd |
@@ -343,7 +336,7 @@
|
|
|
18aefd |
|
|
|
18aefd |
/* Include the file a second time to define the function to handle
|
|
|
18aefd |
unaligned access. */
|
|
|
18aefd |
-#if !defined DEFINE_UNALIGNED && !defined _STRING_ARCH_unaligned \
|
|
|
18aefd |
+#if !defined DEFINE_UNALIGNED && !_STRING_ARCH_unaligned \
|
|
|
18aefd |
&& MIN_NEEDED_INPUT != 1 && MAX_NEEDED_INPUT % MIN_NEEDED_INPUT == 0 \
|
|
|
18aefd |
&& MIN_NEEDED_OUTPUT != 1 && MAX_NEEDED_OUTPUT % MIN_NEEDED_OUTPUT == 0
|
|
|
18aefd |
# undef get16
|
|
|
18aefd |
@@ -355,12 +348,10 @@
|
|
|
18aefd |
# define DEFINE_UNALIGNED
|
|
|
18aefd |
# include "loop.c"
|
|
|
18aefd |
# undef DEFINE_UNALIGNED
|
|
|
18aefd |
-#endif
|
|
|
18aefd |
-
|
|
|
18aefd |
-
|
|
|
18aefd |
-#if MAX_NEEDED_INPUT > 1
|
|
|
18aefd |
-# define SINGLE(fct) SINGLE2 (fct)
|
|
|
18aefd |
-# define SINGLE2(fct) fct##_single
|
|
|
18aefd |
+#else
|
|
|
18aefd |
+# if MAX_NEEDED_INPUT > 1
|
|
|
18aefd |
+# define SINGLE(fct) SINGLE2 (fct)
|
|
|
18aefd |
+# define SINGLE2(fct) fct##_single
|
|
|
18aefd |
static inline int
|
|
|
18aefd |
__attribute ((always_inline))
|
|
|
18aefd |
SINGLE(LOOPFCT) (struct __gconv_step *step,
|
|
|
18aefd |
@@ -370,46 +361,57 @@
|
|
|
18aefd |
size_t *irreversible EXTRA_LOOP_DECLS)
|
|
|
18aefd |
{
|
|
|
18aefd |
mbstate_t *state = step_data->__statep;
|
|
|
18aefd |
-#ifdef LOOP_NEED_FLAGS
|
|
|
18aefd |
+# ifdef LOOP_NEED_FLAGS
|
|
|
18aefd |
int flags = step_data->__flags;
|
|
|
18aefd |
-#endif
|
|
|
18aefd |
-#ifdef LOOP_NEED_DATA
|
|
|
18aefd |
+# endif
|
|
|
18aefd |
+# ifdef LOOP_NEED_DATA
|
|
|
18aefd |
void *data = step->__data;
|
|
|
18aefd |
-#endif
|
|
|
18aefd |
+# endif
|
|
|
18aefd |
int result = __GCONV_OK;
|
|
|
18aefd |
unsigned char bytebuf[MAX_NEEDED_INPUT];
|
|
|
18aefd |
const unsigned char *inptr = *inptrp;
|
|
|
18aefd |
unsigned char *outptr = *outptrp;
|
|
|
18aefd |
size_t inlen;
|
|
|
18aefd |
|
|
|
18aefd |
-#ifdef INIT_PARAMS
|
|
|
18aefd |
+# ifdef INIT_PARAMS
|
|
|
18aefd |
INIT_PARAMS;
|
|
|
18aefd |
-#endif
|
|
|
18aefd |
+# endif
|
|
|
18aefd |
|
|
|
18aefd |
-#ifdef UNPACK_BYTES
|
|
|
18aefd |
+# ifdef UNPACK_BYTES
|
|
|
18aefd |
UNPACK_BYTES
|
|
|
18aefd |
-#else
|
|
|
18aefd |
+# else
|
|
|
18aefd |
/* Add the bytes from the state to the input buffer. */
|
|
|
18aefd |
+ assert ((state->__count & 7) <= sizeof (state->__value));
|
|
|
18aefd |
for (inlen = 0; inlen < (size_t) (state->__count & 7); ++inlen)
|
|
|
18aefd |
bytebuf[inlen] = state->__value.__wchb[inlen];
|
|
|
18aefd |
-#endif
|
|
|
18aefd |
+# endif
|
|
|
18aefd |
|
|
|
18aefd |
/* Are there enough bytes in the input buffer? */
|
|
|
18aefd |
- if (__builtin_expect (inptr + (MIN_NEEDED_INPUT - inlen) > inend, 0))
|
|
|
18aefd |
+ if (MIN_NEEDED_INPUT > 1
|
|
|
18aefd |
+ && __builtin_expect (inptr + (MIN_NEEDED_INPUT - inlen) > inend, 0))
|
|
|
18aefd |
{
|
|
|
18aefd |
*inptrp = inend;
|
|
|
18aefd |
-#ifdef STORE_REST
|
|
|
18aefd |
+# ifdef STORE_REST
|
|
|
18aefd |
+
|
|
|
18aefd |
+ /* Building with -O3 GCC emits a `array subscript is above array
|
|
|
18aefd |
+ bounds' warning. GCC BZ #64739 has been opened for this. */
|
|
|
18aefd |
+ DIAG_PUSH_NEEDS_COMMENT;
|
|
|
18aefd |
+ DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Warray-bounds");
|
|
|
18aefd |
+ while (inptr < inend)
|
|
|
18aefd |
+ bytebuf[inlen++] = *inptr++;
|
|
|
18aefd |
+ DIAG_POP_NEEDS_COMMENT;
|
|
|
18aefd |
+
|
|
|
18aefd |
inptr = bytebuf;
|
|
|
18aefd |
inptrp = &inptr;
|
|
|
18aefd |
inend = &bytebuf[inlen];
|
|
|
18aefd |
|
|
|
18aefd |
STORE_REST
|
|
|
18aefd |
-#else
|
|
|
18aefd |
+# else
|
|
|
18aefd |
/* We don't have enough input for another complete input
|
|
|
18aefd |
character. */
|
|
|
18aefd |
while (inptr < inend)
|
|
|
18aefd |
state->__value.__wchb[inlen++] = *inptr++;
|
|
|
18aefd |
-#endif
|
|
|
18aefd |
+# endif
|
|
|
18aefd |
|
|
|
18aefd |
return __GCONV_INCOMPLETE_INPUT;
|
|
|
18aefd |
}
|
|
|
18aefd |
@@ -438,7 +440,7 @@
|
|
|
18aefd |
bytes from the state and at least one more, or the character is still
|
|
|
18aefd |
incomplete, or we have some other error (like illegal input character,
|
|
|
18aefd |
no space in output buffer). */
|
|
|
18aefd |
- if (__builtin_expect (inptr != bytebuf, 1))
|
|
|
18aefd |
+ if (__glibc_likely (inptr != bytebuf))
|
|
|
18aefd |
{
|
|
|
18aefd |
/* We found a new character. */
|
|
|
18aefd |
assert (inptr - bytebuf > (state->__count & 7));
|
|
|
18aefd |
@@ -449,11 +451,11 @@
|
|
|
18aefd |
result = __GCONV_OK;
|
|
|
18aefd |
|
|
|
18aefd |
/* Clear the state buffer. */
|
|
|
18aefd |
-#ifdef CLEAR_STATE
|
|
|
18aefd |
+# ifdef CLEAR_STATE
|
|
|
18aefd |
CLEAR_STATE;
|
|
|
18aefd |
-#else
|
|
|
18aefd |
+# else
|
|
|
18aefd |
state->__count &= ~7;
|
|
|
18aefd |
-#endif
|
|
|
18aefd |
+# endif
|
|
|
18aefd |
}
|
|
|
18aefd |
else if (result == __GCONV_INCOMPLETE_INPUT)
|
|
|
18aefd |
{
|
|
|
18aefd |
@@ -462,37 +464,38 @@
|
|
|
18aefd |
assert (inend != &bytebuf[MAX_NEEDED_INPUT]);
|
|
|
18aefd |
|
|
|
18aefd |
*inptrp += inend - bytebuf - (state->__count & 7);
|
|
|
18aefd |
-#ifdef STORE_REST
|
|
|
18aefd |
+# ifdef STORE_REST
|
|
|
18aefd |
inptrp = &inptr;
|
|
|
18aefd |
|
|
|
18aefd |
STORE_REST
|
|
|
18aefd |
-#else
|
|
|
18aefd |
+# else
|
|
|
18aefd |
/* We don't have enough input for another complete input
|
|
|
18aefd |
character. */
|
|
|
18aefd |
assert (inend - inptr > (state->__count & ~7));
|
|
|
18aefd |
- assert (inend - inptr <= 7);
|
|
|
18aefd |
+ assert (inend - inptr <= sizeof (state->__value));
|
|
|
18aefd |
state->__count = (state->__count & ~7) | (inend - inptr);
|
|
|
18aefd |
inlen = 0;
|
|
|
18aefd |
while (inptr < inend)
|
|
|
18aefd |
state->__value.__wchb[inlen++] = *inptr++;
|
|
|
18aefd |
-#endif
|
|
|
18aefd |
+# endif
|
|
|
18aefd |
}
|
|
|
18aefd |
|
|
|
18aefd |
return result;
|
|
|
18aefd |
}
|
|
|
18aefd |
-# undef SINGLE
|
|
|
18aefd |
-# undef SINGLE2
|
|
|
18aefd |
-#endif
|
|
|
18aefd |
+# undef SINGLE
|
|
|
18aefd |
+# undef SINGLE2
|
|
|
18aefd |
+# endif
|
|
|
18aefd |
|
|
|
18aefd |
|
|
|
18aefd |
-#ifdef ONEBYTE_BODY
|
|
|
18aefd |
+# ifdef ONEBYTE_BODY
|
|
|
18aefd |
/* Define the shortcut function for btowc. */
|
|
|
18aefd |
static wint_t
|
|
|
18aefd |
gconv_btowc (struct __gconv_step *step, unsigned char c)
|
|
|
18aefd |
ONEBYTE_BODY
|
|
|
18aefd |
-# define FROM_ONEBYTE gconv_btowc
|
|
|
18aefd |
-#endif
|
|
|
18aefd |
+# define FROM_ONEBYTE gconv_btowc
|
|
|
18aefd |
+# endif
|
|
|
18aefd |
|
|
|
18aefd |
+#endif
|
|
|
18aefd |
|
|
|
18aefd |
/* We remove the macro definitions so that we can include this file again
|
|
|
18aefd |
for the definition of another function. */
|
|
|
18aefd |
diff -rNu compat-locales-sap-1.0.10.orig/saplocales-2.2.5/iconv/skeleton.c compat-locales-sap-1.0.10/saplocales-2.2.5/iconv/skeleton.c
|
|
|
18aefd |
--- compat-locales-sap-1.0.10.orig/saplocales-2.2.5/iconv/skeleton.c 2018-01-09 12:42:01.394580867 +0100
|
|
|
18aefd |
+++ compat-locales-sap-1.0.10/saplocales-2.2.5/iconv/skeleton.c 2018-01-10 07:58:37.922439161 +0100
|
|
|
18aefd |
@@ -1,5 +1,5 @@
|
|
|
18aefd |
/* Skeleton for a conversion module.
|
|
|
18aefd |
- Copyright (C) 1998-2002, 2005 Free Software Foundation, Inc.
|
|
|
18aefd |
+ Copyright (C) 1998-2018 Free Software Foundation, Inc.
|
|
|
18aefd |
This file is part of the GNU C Library.
|
|
|
18aefd |
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
|
|
18aefd |
|
|
|
18aefd |
@@ -14,9 +14,8 @@
|
|
|
18aefd |
Lesser General Public License for more details.
|
|
|
18aefd |
|
|
|
18aefd |
You should have received a copy of the GNU Lesser General Public
|
|
|
18aefd |
- License along with the GNU C Library; if not, write to the Free
|
|
|
18aefd |
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
|
18aefd |
- 02111-1307 USA. */
|
|
|
18aefd |
+ License along with the GNU C Library; if not, see
|
|
|
18aefd |
+ <http://www.gnu.org/licenses/>. */
|
|
|
18aefd |
|
|
|
18aefd |
/* This file can be included to provide definitions of several things
|
|
|
18aefd |
many modules have in common. It can be customized using the following
|
|
|
18aefd |
@@ -39,24 +38,24 @@
|
|
|
18aefd |
|
|
|
18aefd |
FROM_LOOP_MIN_NEEDED_FROM
|
|
|
18aefd |
FROM_LOOP_MAX_NEEDED_FROM
|
|
|
18aefd |
- minimal/maximal number of bytes needed on input
|
|
|
18aefd |
- of one round through the FROM_LOOP. Defaults
|
|
|
18aefd |
- to MIN_NEEDED_FROM and MAX_NEEDED_FROM, respectively.
|
|
|
18aefd |
+ minimal/maximal number of bytes needed on input
|
|
|
18aefd |
+ of one round through the FROM_LOOP. Defaults
|
|
|
18aefd |
+ to MIN_NEEDED_FROM and MAX_NEEDED_FROM, respectively.
|
|
|
18aefd |
FROM_LOOP_MIN_NEEDED_TO
|
|
|
18aefd |
FROM_LOOP_MAX_NEEDED_TO
|
|
|
18aefd |
- minimal/maximal number of bytes needed on output
|
|
|
18aefd |
- of one round through the FROM_LOOP. Defaults
|
|
|
18aefd |
- to MIN_NEEDED_TO and MAX_NEEDED_TO, respectively.
|
|
|
18aefd |
+ minimal/maximal number of bytes needed on output
|
|
|
18aefd |
+ of one round through the FROM_LOOP. Defaults
|
|
|
18aefd |
+ to MIN_NEEDED_TO and MAX_NEEDED_TO, respectively.
|
|
|
18aefd |
TO_LOOP_MIN_NEEDED_FROM
|
|
|
18aefd |
TO_LOOP_MAX_NEEDED_FROM
|
|
|
18aefd |
- minimal/maximal number of bytes needed on input
|
|
|
18aefd |
- of one round through the TO_LOOP. Defaults
|
|
|
18aefd |
- to MIN_NEEDED_TO and MAX_NEEDED_TO, respectively.
|
|
|
18aefd |
+ minimal/maximal number of bytes needed on input
|
|
|
18aefd |
+ of one round through the TO_LOOP. Defaults
|
|
|
18aefd |
+ to MIN_NEEDED_TO and MAX_NEEDED_TO, respectively.
|
|
|
18aefd |
TO_LOOP_MIN_NEEDED_TO
|
|
|
18aefd |
TO_LOOP_MAX_NEEDED_TO
|
|
|
18aefd |
- minimal/maximal number of bytes needed on output
|
|
|
18aefd |
- of one round through the TO_LOOP. Defaults
|
|
|
18aefd |
- to MIN_NEEDED_FROM and MAX_NEEDED_FROM, respectively.
|
|
|
18aefd |
+ minimal/maximal number of bytes needed on output
|
|
|
18aefd |
+ of one round through the TO_LOOP. Defaults
|
|
|
18aefd |
+ to MIN_NEEDED_FROM and MAX_NEEDED_FROM, respectively.
|
|
|
18aefd |
|
|
|
18aefd |
FROM_DIRECTION this macro is supposed to return a value != 0
|
|
|
18aefd |
if we convert from the current character set,
|
|
|
18aefd |
@@ -145,6 +144,7 @@
|
|
|
18aefd |
#endif
|
|
|
18aefd |
|
|
|
18aefd |
#include <sysdep.h>
|
|
|
18aefd |
+#include <stdint.h>
|
|
|
18aefd |
|
|
|
18aefd |
#ifndef DL_CALL_FCT
|
|
|
18aefd |
# define DL_CALL_FCT(fct, args) fct args
|
|
|
18aefd |
@@ -163,7 +163,6 @@
|
|
|
18aefd |
# endif
|
|
|
18aefd |
#endif
|
|
|
18aefd |
|
|
|
18aefd |
-
|
|
|
18aefd |
/* How many bytes are needed at most for the from-charset. */
|
|
|
18aefd |
#ifndef MAX_NEEDED_FROM
|
|
|
18aefd |
# define MAX_NEEDED_FROM MIN_NEEDED_FROM
|
|
|
18aefd |
@@ -204,10 +203,10 @@
|
|
|
18aefd |
/* Define macros which can access unaligned buffers. These macros are
|
|
|
18aefd |
supposed to be used only in code outside the inner loops. For the inner
|
|
|
18aefd |
loops we have other definitions which allow optimized access. */
|
|
|
18aefd |
-#ifdef _STRING_ARCH_unaligned
|
|
|
18aefd |
+#if _STRING_ARCH_unaligned
|
|
|
18aefd |
/* We can handle unaligned memory access. */
|
|
|
18aefd |
-# define get16u(addr) *((__const uint16_t *) (addr))
|
|
|
18aefd |
-# define get32u(addr) *((__const uint32_t *) (addr))
|
|
|
18aefd |
+# define get16u(addr) *((const uint16_t *) (addr))
|
|
|
18aefd |
+# define get32u(addr) *((const uint32_t *) (addr))
|
|
|
18aefd |
|
|
|
18aefd |
/* We need no special support for writing values either. */
|
|
|
18aefd |
# define put16u(addr, val) *((uint16_t *) (addr)) = (val)
|
|
|
18aefd |
@@ -216,13 +215,13 @@
|
|
|
18aefd |
/* Distinguish between big endian and little endian. */
|
|
|
18aefd |
# if __BYTE_ORDER == __LITTLE_ENDIAN
|
|
|
18aefd |
# define get16u(addr) \
|
|
|
18aefd |
- (((__const unsigned char *) (addr))[1] << 8 \
|
|
|
18aefd |
- | ((__const unsigned char *) (addr))[0])
|
|
|
18aefd |
+ (((const unsigned char *) (addr))[1] << 8 \
|
|
|
18aefd |
+ | ((const unsigned char *) (addr))[0])
|
|
|
18aefd |
# define get32u(addr) \
|
|
|
18aefd |
- (((((__const unsigned char *) (addr))[3] << 8 \
|
|
|
18aefd |
- | ((__const unsigned char *) (addr))[2]) << 8 \
|
|
|
18aefd |
- | ((__const unsigned char *) (addr))[1]) << 8 \
|
|
|
18aefd |
- | ((__const unsigned char *) (addr))[0])
|
|
|
18aefd |
+ (((((const unsigned char *) (addr))[3] << 8 \
|
|
|
18aefd |
+ | ((const unsigned char *) (addr))[2]) << 8 \
|
|
|
18aefd |
+ | ((const unsigned char *) (addr))[1]) << 8 \
|
|
|
18aefd |
+ | ((const unsigned char *) (addr))[0])
|
|
|
18aefd |
|
|
|
18aefd |
# define put16u(addr, val) \
|
|
|
18aefd |
({ uint16_t __val = (val); \
|
|
|
18aefd |
@@ -241,13 +240,13 @@
|
|
|
18aefd |
(void) 0; })
|
|
|
18aefd |
# else
|
|
|
18aefd |
# define get16u(addr) \
|
|
|
18aefd |
- (((__const unsigned char *) (addr))[0] << 8 \
|
|
|
18aefd |
- | ((__const unsigned char *) (addr))[1])
|
|
|
18aefd |
+ (((const unsigned char *) (addr))[0] << 8 \
|
|
|
18aefd |
+ | ((const unsigned char *) (addr))[1])
|
|
|
18aefd |
# define get32u(addr) \
|
|
|
18aefd |
- (((((__const unsigned char *) (addr))[0] << 8 \
|
|
|
18aefd |
- | ((__const unsigned char *) (addr))[1]) << 8 \
|
|
|
18aefd |
- | ((__const unsigned char *) (addr))[2]) << 8 \
|
|
|
18aefd |
- | ((__const unsigned char *) (addr))[3])
|
|
|
18aefd |
+ (((((const unsigned char *) (addr))[0] << 8 \
|
|
|
18aefd |
+ | ((const unsigned char *) (addr))[1]) << 8 \
|
|
|
18aefd |
+ | ((const unsigned char *) (addr))[2]) << 8 \
|
|
|
18aefd |
+ | ((const unsigned char *) (addr))[3])
|
|
|
18aefd |
|
|
|
18aefd |
# define put16u(addr, val) \
|
|
|
18aefd |
({ uint16_t __val = (val); \
|
|
|
18aefd |
@@ -410,7 +409,7 @@
|
|
|
18aefd |
/* If the function is called with no input this means we have to reset
|
|
|
18aefd |
to the initial state. The possibly partly converted input is
|
|
|
18aefd |
dropped. */
|
|
|
18aefd |
- if (__builtin_expect (do_flush, 0))
|
|
|
18aefd |
+ if (__glibc_unlikely (do_flush))
|
|
|
18aefd |
{
|
|
|
18aefd |
/* This should never happen during error handling. */
|
|
|
18aefd |
assert (outbufstart == NULL);
|
|
|
18aefd |
@@ -461,7 +460,7 @@
|
|
|
18aefd |
|
|
|
18aefd |
if (result != __GCONV_EMPTY_INPUT)
|
|
|
18aefd |
{
|
|
|
18aefd |
- if (__builtin_expect (outerr != outbuf, 0))
|
|
|
18aefd |
+ if (__glibc_unlikely (outerr != outbuf))
|
|
|
18aefd |
{
|
|
|
18aefd |
/* We have a problem. Undo the conversion. */
|
|
|
18aefd |
outbuf = outstart;
|
|
|
18aefd |
@@ -502,8 +501,9 @@
|
|
|
18aefd |
}
|
|
|
18aefd |
else
|
|
|
18aefd |
{
|
|
|
18aefd |
- /* We preserve the initial values of the pointer variables. */
|
|
|
18aefd |
- const unsigned char *inptr = *inptrp;
|
|
|
18aefd |
+ /* We preserve the initial values of the pointer variables,
|
|
|
18aefd |
+ but only some conversion modules need it. */
|
|
|
18aefd |
+ const unsigned char *inptr __attribute__ ((__unused__)) = *inptrp;
|
|
|
18aefd |
unsigned char *outbuf = (__builtin_expect (outbufstart == NULL, 1)
|
|
|
18aefd |
? data->__outbuf : *outbufstart);
|
|
|
18aefd |
unsigned char *outend = data->__outbufend;
|
|
|
18aefd |
@@ -514,7 +514,7 @@
|
|
|
18aefd |
size_t *lirreversiblep = irreversible ? &lirreversible : NULL;
|
|
|
18aefd |
|
|
|
18aefd |
/* The following assumes that encodings, which have a variable length
|
|
|
18aefd |
- what might unalign a buffer even though it is a aligned in the
|
|
|
18aefd |
+ what might unalign a buffer even though it is an aligned in the
|
|
|
18aefd |
beginning, either don't have the minimal number of bytes as a divisor
|
|
|
18aefd |
of the maximum length or have a minimum length of 1. This is true
|
|
|
18aefd |
for all known and supported encodings.
|
|
|
18aefd |
@@ -523,7 +523,7 @@
|
|
|
18aefd |
INTERNAL, for which the subexpression evaluates to 1, but INTERNAL
|
|
|
18aefd |
buffers are always aligned correctly. */
|
|
|
18aefd |
#define POSSIBLY_UNALIGNED \
|
|
|
18aefd |
- (!defined _STRING_ARCH_unaligned \
|
|
|
18aefd |
+ (!_STRING_ARCH_unaligned \
|
|
|
18aefd |
&& (((FROM_LOOP_MIN_NEEDED_FROM != 1 \
|
|
|
18aefd |
&& FROM_LOOP_MAX_NEEDED_FROM % FROM_LOOP_MIN_NEEDED_FROM == 0) \
|
|
|
18aefd |
&& (FROM_LOOP_MIN_NEEDED_TO != 1 \
|
|
|
18aefd |
@@ -554,8 +554,8 @@
|
|
|
18aefd |
&& consume_incomplete && (data->__statep->__count & 7) != 0)
|
|
|
18aefd |
{
|
|
|
18aefd |
/* Yep, we have some bytes left over. Process them now.
|
|
|
18aefd |
- But this must not happen while we are called from an
|
|
|
18aefd |
- error handler. */
|
|
|
18aefd |
+ But this must not happen while we are called from an
|
|
|
18aefd |
+ error handler. */
|
|
|
18aefd |
assert (outbufstart == NULL);
|
|
|
18aefd |
|
|
|
18aefd |
# if FROM_LOOP_MAX_NEEDED_FROM > 1
|
|
|
18aefd |
@@ -593,8 +593,6 @@
|
|
|
18aefd |
|
|
|
18aefd |
while (1)
|
|
|
18aefd |
{
|
|
|
18aefd |
- struct __gconv_trans_data *trans;
|
|
|
18aefd |
-
|
|
|
18aefd |
/* Remember the start value for this round. */
|
|
|
18aefd |
inptr = *inptrp;
|
|
|
18aefd |
/* The outbuf buffer is empty. */
|
|
|
18aefd |
@@ -604,7 +602,7 @@
|
|
|
18aefd |
SAVE_RESET_STATE (1);
|
|
|
18aefd |
#endif
|
|
|
18aefd |
|
|
|
18aefd |
- if (__builtin_expect (!unaligned, 1))
|
|
|
18aefd |
+ if (__glibc_likely (!unaligned))
|
|
|
18aefd |
{
|
|
|
18aefd |
if (FROM_DIRECTION)
|
|
|
18aefd |
/* Run the conversion loop. */
|
|
|
18aefd |
@@ -635,38 +633,31 @@
|
|
|
18aefd |
|
|
|
18aefd |
/* If we were called as part of an error handling module we
|
|
|
18aefd |
don't do anything else here. */
|
|
|
18aefd |
- if (__builtin_expect (outbufstart != NULL, 0))
|
|
|
18aefd |
+ if (__glibc_unlikely (outbufstart != NULL))
|
|
|
18aefd |
{
|
|
|
18aefd |
*outbufstart = outbuf;
|
|
|
18aefd |
return status;
|
|
|
18aefd |
}
|
|
|
18aefd |
|
|
|
18aefd |
- /* Give the transliteration module the chance to store the
|
|
|
18aefd |
- original text and the result in case it needs a context. */
|
|
|
18aefd |
- for (trans = data->__trans; trans != NULL; trans = trans->__next)
|
|
|
18aefd |
- if (trans->__trans_context_fct != NULL)
|
|
|
18aefd |
- DL_CALL_FCT (trans->__trans_context_fct,
|
|
|
18aefd |
- (trans->__data, inptr, *inptrp, outstart, outbuf));
|
|
|
18aefd |
-
|
|
|
18aefd |
/* We finished one use of the loops. */
|
|
|
18aefd |
++data->__invocation_counter;
|
|
|
18aefd |
|
|
|
18aefd |
/* If this is the last step leave the loop, there is nothing
|
|
|
18aefd |
- we can do. */
|
|
|
18aefd |
- if (__builtin_expect (data->__flags & __GCONV_IS_LAST, 0))
|
|
|
18aefd |
+ we can do. */
|
|
|
18aefd |
+ if (__glibc_unlikely (data->__flags & __GCONV_IS_LAST))
|
|
|
18aefd |
{
|
|
|
18aefd |
/* Store information about how many bytes are available. */
|
|
|
18aefd |
data->__outbuf = outbuf;
|
|
|
18aefd |
|
|
|
18aefd |
/* Remember how many non-identical characters we
|
|
|
18aefd |
- converted in a irreversible way. */
|
|
|
18aefd |
+ converted in an irreversible way. */
|
|
|
18aefd |
*irreversible += lirreversible;
|
|
|
18aefd |
|
|
|
18aefd |
break;
|
|
|
18aefd |
}
|
|
|
18aefd |
|
|
|
18aefd |
/* Write out all output which was produced. */
|
|
|
18aefd |
- if (__builtin_expect (outbuf > outstart, 1))
|
|
|
18aefd |
+ if (__glibc_likely (outbuf > outstart))
|
|
|
18aefd |
{
|
|
|
18aefd |
const unsigned char *outerr = data->__outbuf;
|
|
|
18aefd |
int result;
|
|
|
18aefd |
@@ -677,14 +668,14 @@
|
|
|
18aefd |
|
|
|
18aefd |
if (result != __GCONV_EMPTY_INPUT)
|
|
|
18aefd |
{
|
|
|
18aefd |
- if (__builtin_expect (outerr != outbuf, 0))
|
|
|
18aefd |
+ if (__glibc_unlikely (outerr != outbuf))
|
|
|
18aefd |
{
|
|
|
18aefd |
#ifdef RESET_INPUT_BUFFER
|
|
|
18aefd |
RESET_INPUT_BUFFER;
|
|
|
18aefd |
#else
|
|
|
18aefd |
/* We have a problem in one of the functions below.
|
|
|
18aefd |
Undo the conversion upto the error point. */
|
|
|
18aefd |
- size_t nstatus;
|
|
|
18aefd |
+ size_t nstatus __attribute__ ((unused));
|
|
|
18aefd |
|
|
|
18aefd |
/* Reload the pointers. */
|
|
|
18aefd |
*inptrp = inptr;
|
|
|
18aefd |
@@ -695,7 +686,7 @@
|
|
|
18aefd |
SAVE_RESET_STATE (0);
|
|
|
18aefd |
# endif
|
|
|
18aefd |
|
|
|
18aefd |
- if (__builtin_expect (!unaligned, 1))
|
|
|
18aefd |
+ if (__glibc_likely (!unaligned))
|
|
|
18aefd |
{
|
|
|
18aefd |
if (FROM_DIRECTION)
|
|
|
18aefd |
/* Run the conversion loop. */
|
|
|
18aefd |
@@ -738,7 +729,7 @@
|
|
|
18aefd |
|
|
|
18aefd |
/* If we haven't consumed a single byte decrement
|
|
|
18aefd |
the invocation counter. */
|
|
|
18aefd |
- if (__builtin_expect (outbuf == outstart, 0))
|
|
|
18aefd |
+ if (__glibc_unlikely (outbuf == outstart))
|
|
|
18aefd |
--data->__invocation_counter;
|
|
|
18aefd |
#endif /* reset input buffer */
|
|
|
18aefd |
}
|
|
|
18aefd |
@@ -782,7 +773,7 @@
|
|
|
18aefd |
STORE_REST
|
|
|
18aefd |
# else
|
|
|
18aefd |
/* Make sure the remaining bytes fit into the state objects
|
|
|
18aefd |
- buffer. */
|
|
|
18aefd |
+ buffer. */
|
|
|
18aefd |
assert (inend - *inptrp < 4);
|
|
|
18aefd |
|
|
|
18aefd |
size_t cnt;
|