diff options
Diffstat (limited to 'tests/uniconv/test-u8-conv-to-enc.c')
| -rw-r--r-- | tests/uniconv/test-u8-conv-to-enc.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/tests/uniconv/test-u8-conv-to-enc.c b/tests/uniconv/test-u8-conv-to-enc.c index f569c6a5..4953d521 100644 --- a/tests/uniconv/test-u8-conv-to-enc.c +++ b/tests/uniconv/test-u8-conv-to-enc.c @@ -1,5 +1,5 @@ /* Test of conversion from UTF-8 to legacy encodings. - Copyright (C) 2007-2024 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -44,20 +44,17 @@ main () #if HAVE_ICONV static enum iconv_ilseq_handler handlers[] = { iconveh_error, iconveh_question_mark, iconveh_escape_sequence }; - size_t h; - size_t o; - size_t i; /* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1, ISO-8859-2, and UTF-8. */ /* Test conversion from UTF-8 to ISO-8859-1 with no errors. */ - for (h = 0; h < SIZEOF (handlers); h++) + for (size_t h = 0; h < SIZEOF (handlers); h++) { enum iconv_ilseq_handler handler = handlers[h]; static const uint8_t input[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237"; static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; - for (o = 0; o < 2; o++) + for (size_t o = 0; o < 2; o++) { size_t *offsets = (o ? new_offsets (u8_strlen (input)) : NULL); size_t length; @@ -70,7 +67,7 @@ main () ASSERT (memcmp (result, expected, length) == 0); if (o) { - for (i = 0; i < 41; i++) + for (size_t i = 0; i < 41; i++) ASSERT (offsets[i] == (i < 1 ? i : i == 1 ? (size_t)(-1) : i < 13 ? i - 1 : @@ -88,11 +85,11 @@ main () } /* Test conversion from UTF-8 to ISO-8859-1 with EILSEQ. */ - for (h = 0; h < SIZEOF (handlers); h++) + for (size_t h = 0; h < SIZEOF (handlers); h++) { enum iconv_ilseq_handler handler = handlers[h]; static const uint8_t input[] = "Rafa\305\202 Maszkowski"; /* RafaĆ Maszkowski */ - for (o = 0; o < 2; o++) + for (size_t o = 0; o < 2; o++) { size_t *offsets = (o ? new_offsets (u8_strlen (input)) : NULL); size_t length = 0xdead; @@ -119,7 +116,7 @@ main () || memcmp (result, expected_translit, length) == 0); if (o) { - for (i = 0; i < 17; i++) + for (size_t i = 0; i < 17; i++) ASSERT (offsets[i] == (i < 5 ? i : i == 5 ? (size_t)(-1) : i - 1)); @@ -137,7 +134,7 @@ main () ASSERT (memcmp (result, expected, length) == 0); if (o) { - for (i = 0; i < 17; i++) + for (size_t i = 0; i < 17; i++) ASSERT (offsets[i] == (i < 5 ? i : i == 5 ? (size_t)(-1) : i + 4)); @@ -152,11 +149,11 @@ main () } /* Test conversion from UTF-8 to ISO-8859-1 with EINVAL. */ - for (h = 0; h < SIZEOF (handlers); h++) + for (size_t h = 0; h < SIZEOF (handlers); h++) { enum iconv_ilseq_handler handler = handlers[h]; static const uint8_t input[] = "\342"; - for (o = 0; o < 2; o++) + for (size_t o = 0; o < 2; o++) { size_t *offsets = (o ? new_offsets (u8_strlen (input)) : NULL); size_t length; |
