diff options
Diffstat (limited to 'lib/striconveh.c')
-rw-r--r-- | lib/striconveh.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/lib/striconveh.c b/lib/striconveh.c index 952754ba..9289591b 100644 --- a/lib/striconveh.c +++ b/lib/striconveh.c @@ -1,5 +1,5 @@ /* Character set conversion with error handling. - Copyright (C) 2001-2024 Free Software Foundation, Inc. + Copyright (C) 2001-2025 Free Software Foundation, Inc. Written by Bruno Haible and Simon Josefsson. This file is free software: you can redistribute it and/or modify @@ -130,8 +130,7 @@ iconveh_close (const iconveh_t *cd) it has incremented the input pointers past the error location. */ # 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. +/* NetBSD iconv() inserts a question mark if it cannot convert. 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 @@ -239,8 +238,7 @@ iconv_carefully_1 (iconv_t cd, *inbytesleft = inptr_end - inptr; # 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. + /* NetBSD iconv() inserts a question mark if it cannot convert. 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) @@ -792,7 +790,8 @@ mem_cd_iconveh_internal (const char *src, size_t srclen, if (handler == iconveh_escape_sequence) { - static char const hex[16] = "0123456789ABCDEF"; + static char const hex[16] _GL_ATTRIBUTE_NONSTRING = + "0123456789ABCDEF"; scratchlen = 0; scratchbuf[scratchlen++] = '\\'; if (uc < 0x10000) @@ -839,9 +838,7 @@ mem_cd_iconveh_internal (const char *src, size_t srclen, /* FreeBSD iconv(), NetBSD iconv(), and Solaris 11 iconv() insert a '?' if they cannot convert. This is what we want. - But IRIX iconv() inserts a NUL byte if it - cannot convert. - And musl libc iconv() inserts a '*' if it + But musl libc iconv() inserts a '*' if it cannot convert. */ : (res > 0 && !(out2ptr_try - out2ptr == 1 @@ -931,8 +928,7 @@ mem_cd_iconveh_internal (const char *src, size_t srclen, } # 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 + /* 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 (excluding the bastard Apple iconv) |