iconvdata: Fix clang -Wstring-plus-int clang warning

clang issues an warning adding '{unsigned} int' to a string does not
append to the string.

Use array indexes instead of string addition (it is simpler than
add a supress warning).

Reviewed-by: Sam James <sam@gentoo.org>
This commit is contained in:
Adhemerval Zanella 2025-10-17 16:12:50 -03:00
parent d7dbcab417
commit ea3f174e85
3 changed files with 6 additions and 6 deletions

View File

@ -13286,7 +13286,7 @@ static const char __gbk_from_ucs4_tab12[][2] =
cp = "\xa8\xc0"; \
break; \
case 0x2c7 ... 0x2cb: \
cp = "\xa1\xa6\0\0\0\0\0\0\xa1\xa5\0\0\xa8\x40\0\0\xa8\x41" + ((ch - 0x2c7) * 4); \
cp = &"\xa1\xa6\0\0\0\0\0\0\xa1\xa5\0\0\xa8\x40\0\0\xa8\x41"[(ch - 0x2c7) * 4]; \
break; \
case 0x2d9: \
cp = "\xa8\x42"; \
@ -13330,7 +13330,7 @@ static const char __gbk_from_ucs4_tab12[][2] =
buf[1] = '\x80' + (ch - 0x2588); \
break; \
case 0x2593 ... 0x2595: \
cp = "\xa8\x88\0\0\xa8\x89\0\0\xa8\x8a" + ((ch - 0x2593) * 4); \
cp = &"\xa8\x88\0\0\xa8\x89\0\0\xa8\x8a"[(ch - 0x2593) * 4]; \
break; \
case 0x25a0: \
cp = "\xa1\xf6"; \
@ -13461,7 +13461,7 @@ static const char __gbk_from_ucs4_tab12[][2] =
cp = __gbk_from_ucs4_tab12[ch - 0xff01]; \
break; \
case 0xffe0 ... 0xffe5: \
cp = "\xa1\xe9\0\0\xa1\xea\0\0\xa9\x56\0\0\xa3\xfe\0\0\xa9\x57\0\0\xa3\xa4" + ((ch - 0xffe0) * 4); \
cp = &"\xa1\xe9\0\0\xa1\xea\0\0\xa9\x56\0\0\xa3\xfe\0\0\xa9\x57\0\0\xa3\xa4" [(ch - 0xffe0) * 4]; \
break; \
default: \
UNICODE_TAG_HANDLER (ch, 4); \

View File

@ -562,7 +562,7 @@ DIAG_IGNORE_Os_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
} \
\
assert (used >= 1 && used <= 4); \
escseq = ")A\0\0)G)E" + (used - 1) * 2; \
escseq = &")A\0\0)G)E"[(used - 1) * 2]; \
*outptr++ = ESC; \
*outptr++ = '$'; \
*outptr++ = *escseq++; \
@ -600,7 +600,7 @@ DIAG_IGNORE_Os_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
} \
\
assert ((used >> 5) >= 3 && (used >> 5) <= 7); \
escseq = "+I+J+K+L+M" + ((used >> 5) - 3) * 2; \
escseq = &"+I+J+K+L+M"[((used >> 5) - 3) * 2]; \
*outptr++ = ESC; \
*outptr++ = '$'; \
*outptr++ = *escseq++; \

View File

@ -326,7 +326,7 @@ enum
} \
\
assert ((used >> 3) >= 1 && (used >> 3) <= 3); \
escseq = ")A)G*H" + ((used >> 3) - 1) * 2; \
escseq = &")A)G*H"[((used >> 3) - 1) * 2]; \
*outptr++ = ESC; \
*outptr++ = '$'; \
*outptr++ = *escseq++; \