* lib/base32.c (base32_encode): Mark b32str as not NUL-terminated.
* lib/base64.c (b64c): Mark as not NUL-terminated.
* lib/bcp47.c (struct script): Mark the 'code' field as not
NUL-terminated.
* lib/striconveh.c (mem_cd_iconveh_internal): Mark hex as not
NUL-terminated.
* lib/unicase/special-casing.in.h (struct special_casing_rule): Mark the
'code' field as not NUL-terminated.
+2025-04-02 Bruno Haible <bruno@clisp.org>
+
+ Silence some -Wunterminated-string-initialization warnings.
+ * lib/base32.c (base32_encode): Mark b32str as not NUL-terminated.
+ * lib/base64.c (b64c): Mark as not NUL-terminated.
+ * lib/bcp47.c (struct script): Mark the 'code' field as not
+ NUL-terminated.
+ * lib/striconveh.c (mem_cd_iconveh_internal): Mark hex as not
+ NUL-terminated.
+ * lib/unicase/special-casing.in.h (struct special_casing_rule): Mark the
+ 'code' field as not NUL-terminated.
+
2025-04-02 Bruno Haible <bruno@clisp.org>
getlocalename_l-unsafe: Avoid undefined behaviour on Solaris 11.4.
base32_encode (const char *restrict in, idx_t inlen,
char *restrict out, idx_t outlen)
{
- static const char b32str[32] =
+ static const char b32str[32] _GL_ATTRIBUTE_NONSTRING =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
while (inlen && outlen)
return ch;
}
-static const char b64c[64] =
+static const char b64c[64] _GL_ATTRIBUTE_NONSTRING =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
/* Base64 encode IN array of size INLEN into OUT array. OUT needs
struct script
{
- char name[12]; /* Script name, lowercased, NUL-terminated */
- char code[4]; /* Script code, not NUL-terminated */
+ char name[12]; /* Script name, lowercased, NUL-terminated */
+ char code[4] _GL_ATTRIBUTE_NONSTRING; /* Script code, not NUL-terminated */
};
/* Table of script names and four-letter script codes.
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)
{
/* The first two bytes are the code, in big-endian order. The third byte
only distinguishes different rules pertaining to the same code. */
- /*unsigned*/ char code[3];
+ /*unsigned*/ char code[3] _GL_ATTRIBUTE_NONSTRING;
/* True when this rule is not the last one for the given code. */
/*bool*/ unsigned int has_next : 1;