summaryrefslogtreecommitdiff
path: root/tests/test-striconveh.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-striconveh.c')
-rw-r--r--tests/test-striconveh.c170
1 files changed, 83 insertions, 87 deletions
diff --git a/tests/test-striconveh.c b/tests/test-striconveh.c
index fac29457..c5d06b43 100644
--- a/tests/test-striconveh.c
+++ b/tests/test-striconveh.c
@@ -1,5 +1,5 @@
/* Test of character set conversion with error handling.
- Copyright (C) 2007-2025 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
@@ -52,10 +52,6 @@ main ()
iconveh_replacement_character,
iconveh_escape_sequence
};
- size_t indirect;
- size_t h;
- size_t o;
- size_t i;
/* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1,
ISO-8859-2, UTF-8, and with libiconv or glibc also GB18030. */
@@ -147,14 +143,14 @@ main ()
/* ------------------------ Test mem_cd_iconveh() ------------------------ */
/* Test conversion from ISO-8859-2 to ISO-8859-1 with no errors. */
- for (indirect = 0; indirect <= 1; indirect++)
+ for (size_t indirect = 0; indirect <= 1; indirect++)
{
- 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 char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
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 (strlen (input)) : NULL);
char *result = NULL;
@@ -171,7 +167,7 @@ main ()
ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
if (o)
{
- for (i = 0; i < 37; i++)
+ for (size_t i = 0; i < 37; i++)
ASSERT (offsets[i] == i);
ASSERT (offsets[37] == MAGIC);
free (offsets);
@@ -182,13 +178,13 @@ main ()
}
/* Test conversion from ASCII to ISO-8859-1 with invalid input (EILSEQ). */
- for (indirect = 0; indirect <= 1; indirect++)
+ for (size_t indirect = 0; indirect <= 1; indirect++)
{
- 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 char input[] = "Rafa\263 Maszkowski"; /* Rafa? Maszkowski */
- for (o = 0; o < 2; o++)
+ for (size_t o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
char *result = NULL;
@@ -218,7 +214,7 @@ main ()
ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
if (o)
{
- for (i = 0; i < 16; i++)
+ for (size_t i = 0; i < 16; i++)
ASSERT (offsets[i] == i);
ASSERT (offsets[16] == MAGIC);
free (offsets);
@@ -232,13 +228,13 @@ main ()
}
/* Test conversion from ISO-8859-2 to ISO-8859-1 with EILSEQ. */
- for (indirect = 0; indirect <= 1; indirect++)
+ for (size_t indirect = 0; indirect <= 1; indirect++)
{
- 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 char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */
- for (o = 0; o < 2; o++)
+ for (size_t o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
char *result = NULL;
@@ -267,7 +263,7 @@ main ()
ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
if (o)
{
- for (i = 0; i < 16; i++)
+ for (size_t i = 0; i < 16; i++)
ASSERT (offsets[i] == i);
ASSERT (offsets[16] == MAGIC);
free (offsets);
@@ -283,7 +279,7 @@ main ()
ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
if (o)
{
- for (i = 0; i < 16; i++)
+ for (size_t i = 0; i < 16; i++)
ASSERT (offsets[i] == (i < 5 ? i :
i + 5));
ASSERT (offsets[16] == MAGIC);
@@ -298,12 +294,12 @@ main ()
}
/* Test conversion from ISO-8859-1 to UTF-8 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 char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
static const char expected[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237";
- for (o = 0; o < 2; o++)
+ for (size_t o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
char *result = NULL;
@@ -318,7 +314,7 @@ main ()
ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
if (o)
{
- for (i = 0; i < 37; i++)
+ for (size_t i = 0; i < 37; i++)
ASSERT (offsets[i] == (i < 1 ? i :
i < 12 ? i + 1 :
i < 18 ? i + 2 :
@@ -332,12 +328,12 @@ main ()
# if (defined _LIBICONV_VERSION && !(_LIBICONV_VERSION == 0x10b && defined __APPLE__)) || (defined __GLIBC__ && !defined __UCLIBC__)
/* Test conversion from ISO-8859-1 to GB18030 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 char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
static const char expected[] = "\2010\2072rger mit b\2010\2132sen B\250\271bchen ohne Augenma\2010\2118";
- for (o = 0; o < 2; o++)
+ for (size_t o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
char *result = NULL;
@@ -352,7 +348,7 @@ main ()
ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
if (o)
{
- for (i = 0; i < 37; i++)
+ for (size_t i = 0; i < 37; i++)
ASSERT (offsets[i] == (i < 1 ? i :
i < 12 ? i + 3 :
i < 18 ? i + 6 :
@@ -366,12 +362,12 @@ main ()
# endif
/* 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 char 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 (strlen (input)) : NULL);
char *result = NULL;
@@ -386,7 +382,7 @@ main ()
ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 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 :
@@ -403,11 +399,11 @@ main ()
}
/* Test conversion from ASCII to UTF-8 with invalid input (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 char input[] = "Rafa\263 Maszkowski"; /* Rafa? Maszkowski */
- for (o = 0; o < 2; o++)
+ for (size_t o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
char *result = NULL;
@@ -434,7 +430,7 @@ main ()
ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
if (o)
{
- for (i = 0; i < 16; i++)
+ for (size_t i = 0; i < 16; i++)
ASSERT (offsets[i] == i);
ASSERT (offsets[16] == MAGIC);
free (offsets);
@@ -450,7 +446,7 @@ main ()
ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
if (o)
{
- for (i = 0; i < 16; i++)
+ for (size_t i = 0; i < 16; i++)
ASSERT (offsets[i] == (i < 5 ? i : i + 2));
ASSERT (offsets[16] == MAGIC);
free (offsets);
@@ -466,11 +462,11 @@ main ()
/* Test conversion from ASCII to GB18030 with invalid input (EILSEQ).
Note: glibc's GB18030 converter was buggy in glibc-2.15; fixed by
Andreas Schwab on 2012-02-06. */
- 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 char input[] = "Rafa\263 Maszkowski"; /* Rafa? Maszkowski */
- for (o = 0; o < 2; o++)
+ for (size_t o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
char *result = NULL;
@@ -497,7 +493,7 @@ main ()
ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
if (o)
{
- for (i = 0; i < 16; i++)
+ for (size_t i = 0; i < 16; i++)
ASSERT (offsets[i] == i);
ASSERT (offsets[16] == MAGIC);
free (offsets);
@@ -513,7 +509,7 @@ main ()
ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
if (o)
{
- for (i = 0; i < 16; i++)
+ for (size_t i = 0; i < 16; i++)
ASSERT (offsets[i] == (i < 5 ? i : i + 3));
ASSERT (offsets[16] == MAGIC);
free (offsets);
@@ -527,11 +523,11 @@ main ()
# endif
/* 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 char 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 (strlen (input)) : NULL);
char *result = NULL;
@@ -558,7 +554,7 @@ main ()
ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 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));
@@ -576,7 +572,7 @@ main ()
ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 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));
@@ -591,11 +587,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 char input[] = "\342";
- for (o = 0; o < 2; o++)
+ for (size_t o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
char *result = NULL;
@@ -623,7 +619,7 @@ main ()
-1 / EILSEQ when converting the 7th byte of the input "+VDLYP9hA". */
# if !(defined __sun && !defined _LIBICONV_VERSION)
/* Test conversion from UTF-7 to UTF-8 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];
/* This is base64 encoded 0x54 0x32 0xD8 0x3F 0xD8 0x40. It would
@@ -650,7 +646,7 @@ main ()
# if (defined _LIBICONV_VERSION && !(_LIBICONV_VERSION == 0x10b && defined __APPLE__)) || (defined __GLIBC__ && !defined __UCLIBC__)
/* Test conversion from UTF-7 to GB18030 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];
/* This is base64 encoded 0x54 0x32 0xD8 0x3F 0xD8 0x40. It would
@@ -680,7 +676,7 @@ main ()
the input "+2D/YQNhB" to U+1FED8 U+3FD8 U+40D8. */
# if !(defined __NetBSD__ && !defined _LIBICONV_VERSION)
/* Test conversion from UTF-7 to UTF-8 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];
/* This is base64 encoded 0xD8 0x3F 0xD8 0x40 0xD8 0x41. It would
@@ -752,7 +748,7 @@ main ()
/* Test conversion from UTF-7 to GB18030 with EILSEQ.
Note: glibc's GB18030 converter was buggy in glibc-2.15; fixed by
Andreas Schwab on 2012-02-06. */
- for (h = 0; h < SIZEOF (handlers); h++)
+ for (size_t h = 0; h < SIZEOF (handlers); h++)
{
enum iconv_ilseq_handler handler = handlers[h];
/* This is base64 encoded 0xD8 0x3F 0xD8 0x40 0xD8 0x41. It would
@@ -825,9 +821,9 @@ main ()
/* ------------------------ Test str_cd_iconveh() ------------------------ */
/* Test conversion from ISO-8859-2 to ISO-8859-1 with no errors. */
- for (indirect = 0; indirect <= 1; indirect++)
+ for (size_t indirect = 0; indirect <= 1; indirect++)
{
- 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 char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
@@ -844,9 +840,9 @@ main ()
}
/* Test conversion from ASCII to ISO-8859-1 with invalid input (EILSEQ). */
- for (indirect = 0; indirect <= 1; indirect++)
+ for (size_t indirect = 0; indirect <= 1; indirect++)
{
- 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 char input[] = "Rafa\263 Maszkowski"; /* Rafa? Maszkowski */
@@ -875,9 +871,9 @@ main ()
}
/* Test conversion from ISO-8859-2 to ISO-8859-1 with EILSEQ. */
- for (indirect = 0; indirect <= 1; indirect++)
+ for (size_t indirect = 0; indirect <= 1; indirect++)
{
- 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 char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */
@@ -913,7 +909,7 @@ main ()
}
/* Test conversion from ISO-8859-1 to UTF-8 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 char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
@@ -928,7 +924,7 @@ main ()
# if (defined _LIBICONV_VERSION && !(_LIBICONV_VERSION == 0x10b && defined __APPLE__)) || (defined __GLIBC__ && !defined __UCLIBC__)
/* Test conversion from ISO-8859-1 to GB18030 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 char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
@@ -943,7 +939,7 @@ main ()
# endif
/* 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 char input[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237";
@@ -957,7 +953,7 @@ main ()
}
/* Test conversion from ASCII to UTF-8 with invalid input (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 char input[] = "Rafa\263 Maszkowski"; /* Rafa? Maszkowski */
@@ -993,7 +989,7 @@ main ()
/* Test conversion from ASCII to GB18030 with invalid input (EILSEQ).
Note: glibc's GB18030 converter was buggy in glibc-2.15; fixed by
Andreas Schwab on 2012-02-06. */
- 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 char input[] = "Rafa\263 Maszkowski"; /* Rafa? Maszkowski */
@@ -1027,7 +1023,7 @@ main ()
# endif
/* 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 char input[] = "Costs: 27 \342\202\254"; /* EURO SIGN */
@@ -1060,7 +1056,7 @@ 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 char input[] = "\342";
@@ -1084,12 +1080,12 @@ main ()
/* ------------------------- Test mem_iconveh() ------------------------- */
/* Test conversion from ISO-8859-2 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 char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
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 (strlen (input)) : NULL);
char *result = NULL;
@@ -1104,7 +1100,7 @@ main ()
ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
if (o)
{
- for (i = 0; i < 37; i++)
+ for (size_t i = 0; i < 37; i++)
ASSERT (offsets[i] == i);
ASSERT (offsets[37] == MAGIC);
free (offsets);
@@ -1114,11 +1110,11 @@ main ()
}
/* Test conversion from ISO-8859-2 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 char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */
- for (o = 0; o < 2; o++)
+ for (size_t o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
char *result = NULL;
@@ -1145,7 +1141,7 @@ main ()
ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
if (o)
{
- for (i = 0; i < 16; i++)
+ for (size_t i = 0; i < 16; i++)
ASSERT (offsets[i] == i);
ASSERT (offsets[16] == MAGIC);
free (offsets);
@@ -1161,7 +1157,7 @@ main ()
ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
if (o)
{
- for (i = 0; i < 16; i++)
+ for (size_t i = 0; i < 16; i++)
ASSERT (offsets[i] == (i < 5 ? i :
i + 5));
ASSERT (offsets[16] == MAGIC);
@@ -1175,12 +1171,12 @@ main ()
}
/* Test conversion from ISO-8859-1 to UTF-8 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 char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
static const char expected[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237";
- for (o = 0; o < 2; o++)
+ for (size_t o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
char *result = NULL;
@@ -1195,7 +1191,7 @@ main ()
ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
if (o)
{
- for (i = 0; i < 37; i++)
+ for (size_t i = 0; i < 37; i++)
ASSERT (offsets[i] == (i < 1 ? i :
i < 12 ? i + 1 :
i < 18 ? i + 2 :
@@ -1209,12 +1205,12 @@ main ()
# if (defined _LIBICONV_VERSION && !(_LIBICONV_VERSION == 0x10b && defined __APPLE__)) || (defined __GLIBC__ && !defined __UCLIBC__)
/* Test conversion from ISO-8859-1 to GB18030 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 char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
static const char expected[] = "\2010\2072rger mit b\2010\2132sen B\250\271bchen ohne Augenma\2010\2118";
- for (o = 0; o < 2; o++)
+ for (size_t o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
char *result = NULL;
@@ -1229,7 +1225,7 @@ main ()
ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
if (o)
{
- for (i = 0; i < 37; i++)
+ for (size_t i = 0; i < 37; i++)
ASSERT (offsets[i] == (i < 1 ? i :
i < 12 ? i + 3 :
i < 18 ? i + 6 :
@@ -1243,12 +1239,12 @@ main ()
# endif
/* 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 char 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 (strlen (input)) : NULL);
char *result = NULL;
@@ -1263,7 +1259,7 @@ main ()
ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 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 :
@@ -1280,11 +1276,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 char 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 (strlen (input)) : NULL);
char *result = NULL;
@@ -1311,7 +1307,7 @@ main ()
ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 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));
@@ -1329,7 +1325,7 @@ main ()
ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 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));
@@ -1344,11 +1340,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 char input[] = "\342";
- for (o = 0; o < 2; o++)
+ for (size_t o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
char *result = NULL;
@@ -1373,7 +1369,7 @@ main ()
/* ------------------------- Test str_iconveh() ------------------------- */
/* Test conversion from ISO-8859-2 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 char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
@@ -1385,7 +1381,7 @@ main ()
}
/* Test conversion from ISO-8859-2 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 char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */
@@ -1416,7 +1412,7 @@ main ()
}
/* Test conversion from ISO-8859-1 to UTF-8 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 char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
@@ -1429,7 +1425,7 @@ main ()
# if (defined _LIBICONV_VERSION && !(_LIBICONV_VERSION == 0x10b && defined __APPLE__)) || (defined __GLIBC__ && !defined __UCLIBC__)
/* Test conversion from ISO-8859-1 to GB18030 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 char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
@@ -1442,7 +1438,7 @@ main ()
# endif
/* 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 char input[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237";
@@ -1454,7 +1450,7 @@ 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 char input[] = "Costs: 27 \342\202\254"; /* EURO SIGN */
@@ -1485,7 +1481,7 @@ 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 char input[] = "\342";