diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2024-03-24 08:54:48 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2024-03-24 08:54:48 +0100 |
commit | 163a663518f33bab48b28431972e580b366b4d49 (patch) | |
tree | f518ffabaca4a0b93f0103d617e803792d3b0b43 /lib/striconveh.c | |
parent | 1b3a8d5ad2ea2f099d514d9dd51ebf926a628076 (diff) | |
parent | dd0000f7e25abe6c28d4329d324fd7fcab54094f (diff) |
Merge branch 'release/debian/1.2-1'HEADdebian/1.2-1master
Diffstat (limited to 'lib/striconveh.c')
-rw-r--r-- | lib/striconveh.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/lib/striconveh.c b/lib/striconveh.c index 01b4e327..db83a1dd 100644 --- a/lib/striconveh.c +++ b/lib/striconveh.c @@ -1,5 +1,5 @@ /* Character set conversion with error handling. - Copyright (C) 2001-2022 Free Software Foundation, Inc. + Copyright (C) 2001-2024 Free Software Foundation, Inc. Written by Bruno Haible and Simon Josefsson. This file is free software: you can redistribute it and/or modify @@ -81,7 +81,8 @@ iconveh_open (const char *to_codeset, const char *from_codeset, iconveh_t *cdp) if (STRCASEEQ (to_codeset, "UTF-8", 'U','T','F','-','8',0,0,0,0) # if (((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2) \ && !defined __UCLIBC__) \ - || _LIBICONV_VERSION >= 0x0105 + || _LIBICONV_VERSION >= 0x0105 \ + || defined ICONV_SET_TRANSLITERATE || c_strcasecmp (to_codeset, "UTF-8//TRANSLIT") == 0 # endif ) @@ -138,11 +139,12 @@ iconveh_close (const iconveh_t *cd) /* iconv_carefully is like iconv, except that it stops as soon as it encounters a conversion error, and it returns in *INCREMENTED a boolean telling whether it has incremented the input pointers past the error location. */ -# if !defined _LIBICONV_VERSION && !(defined __GLIBC__ && !defined __UCLIBC__) +# if !(defined _LIBICONV_VERSION && !(_LIBICONV_VERSION == 0x10b && defined __APPLE__)) \ + && !(defined __GLIBC__ && !defined __UCLIBC__) /* Irix iconv() inserts a NUL byte if it cannot convert. NetBSD iconv() inserts a question mark if it cannot convert. - Only GNU libiconv and GNU libc are known to prefer to fail rather - than doing a lossy conversion. */ + Only GNU libiconv (excluding the bastard Apple iconv) and GNU libc are + known to prefer to fail rather than doing a lossy conversion. */ static size_t iconv_carefully (iconv_t cd, const char **inbuf, size_t *inbytesleft, @@ -246,11 +248,12 @@ iconv_carefully_1 (iconv_t cd, *inbuf = inptr; *inbytesleft = inptr_end - inptr; -# if !defined _LIBICONV_VERSION && !(defined __GLIBC__ && !defined __UCLIBC__) +# if !(defined _LIBICONV_VERSION && !(_LIBICONV_VERSION == 0x10b && defined __APPLE__)) \ + && !(defined __GLIBC__ && !defined __UCLIBC__) /* Irix iconv() inserts a NUL byte if it cannot convert. NetBSD iconv() inserts a question mark if it cannot convert. - Only GNU libiconv and GNU libc are known to prefer to fail rather - than doing a lossy conversion. */ + Only GNU libiconv (excluding the bastard Apple iconv) and GNU libc are + known to prefer to fail rather than doing a lossy conversion. */ if (res != (size_t)(-1) && res > 0) { /* iconv() has already incremented INPTR. We cannot go back to a @@ -810,7 +813,7 @@ mem_cd_iconveh_internal (const char *src, size_t srclen, if (handler == iconveh_escape_sequence) { - static char hex[16] = "0123456789ABCDEF"; + static char const hex[16] = "0123456789ABCDEF"; scratchlen = 0; scratchbuf[scratchlen++] = '\\'; if (uc < 0x10000) @@ -947,13 +950,15 @@ mem_cd_iconveh_internal (const char *src, size_t srclen, } length = out2ptr - result; } -# if !defined _LIBICONV_VERSION && !(defined __GLIBC__ && !defined __UCLIBC__) +# if !(defined _LIBICONV_VERSION && !(_LIBICONV_VERSION == 0x10b && defined __APPLE__)) \ + && !(defined __GLIBC__ && !defined __UCLIBC__) /* IRIX iconv() inserts a NUL byte if it cannot convert. FreeBSD iconv(), NetBSD iconv(), and Solaris 11 iconv() insert a '?' if they cannot convert. musl libc iconv() inserts a '*' if it cannot convert. - Only GNU libiconv and GNU libc are known to prefer - to fail rather than doing a lossy conversion. */ + Only GNU libiconv (excluding the bastard Apple iconv) + and GNU libc are known to prefer to fail rather than + doing a lossy conversion. */ if (res != (size_t)(-1) && res > 0) { errno = EILSEQ; |