summaryrefslogtreecommitdiff
path: root/tests/uniconv
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2026-03-08 17:28:50 +0100
committerJörg Frings-Fürst <debian@jff.email>2026-03-08 17:28:50 +0100
commitff33e1d252f46bec1a33e28700da3282fc24047a (patch)
tree5c15bc695be820b393a8496c5807ecafbbdeb89b /tests/uniconv
parentb2ac982cc8b5290699eb5f52fb043d3d15e2624b (diff)
parent5f59a34ab747dde8ede7357f3431bf06bd6002fe (diff)
Update upstream source from tag 'upstream/1.4.2'
Update to upstream version '1.4.2' with Debian dir 493e96bcd865e4f9990e20bee26408c96231d727
Diffstat (limited to 'tests/uniconv')
-rw-r--r--tests/uniconv/test-u16-conv-from-enc.c35
-rw-r--r--tests/uniconv/test-u16-conv-to-enc.c23
-rw-r--r--tests/uniconv/test-u16-strconv-from-enc.c13
-rw-r--r--tests/uniconv/test-u16-strconv-to-enc.c9
-rw-r--r--tests/uniconv/test-u32-conv-from-enc.c35
-rw-r--r--tests/uniconv/test-u32-conv-to-enc.c19
-rw-r--r--tests/uniconv/test-u32-strconv-from-enc.c13
-rw-r--r--tests/uniconv/test-u32-strconv-to-enc.c7
-rw-r--r--tests/uniconv/test-u8-conv-from-enc.c35
-rw-r--r--tests/uniconv/test-u8-conv-to-enc.c23
-rw-r--r--tests/uniconv/test-u8-strconv-from-enc.c13
-rw-r--r--tests/uniconv/test-u8-strconv-to-enc.c9
-rw-r--r--tests/uniconv/test-uniconv-h.c2
13 files changed, 106 insertions, 130 deletions
diff --git a/tests/uniconv/test-u16-conv-from-enc.c b/tests/uniconv/test-u16-conv-from-enc.c
index 6dffc71e..4ff51a26 100644
--- a/tests/uniconv/test-u16-conv-from-enc.c
+++ b/tests/uniconv/test-u16-conv-from-enc.c
@@ -1,5 +1,5 @@
/* Test of conversion to UTF-16 from legacy encodings.
- 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
@@ -44,15 +44,12 @@ 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 ISO-8859-1 to UTF-16 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";
@@ -62,7 +59,7 @@ main ()
'e', 'n', ' ', 'B', 0xFC, 'b', 'c', 'h', 'e', 'n', ' ', 'o', 'h',
'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF
};
- for (o = 0; o < 2; o++)
+ for (size_t o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
size_t length;
@@ -75,7 +72,7 @@ main ()
ASSERT (u16_cmp (result, expected, SIZEOF (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);
@@ -85,7 +82,7 @@ main ()
}
/* Test conversion from ISO-8859-2 to UTF-16 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[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */
@@ -94,7 +91,7 @@ main ()
'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w',
's', 'k', 'i'
};
- for (o = 0; o < 2; o++)
+ for (size_t o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
size_t length;
@@ -107,7 +104,7 @@ main ()
ASSERT (u16_cmp (result, expected, SIZEOF (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);
@@ -122,7 +119,7 @@ main ()
if (iconv_supports_encoding ("ISO-2022-JP-2"))
{
/* Test conversions from autodetect_jp to UTF-16. */
- 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[] = "\244\263\244\363\244\313\244\301\244\317"; /* こんにちは in EUC-JP */
@@ -130,7 +127,7 @@ main ()
{
0x3053, 0x3093, 0x306B, 0x3061, 0x306F
};
- for (o = 0; o < 2; o++)
+ for (size_t o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
size_t length;
@@ -143,7 +140,7 @@ main ()
ASSERT (u16_cmp (result, expected, SIZEOF (expected)) == 0);
if (o)
{
- for (i = 0; i < 10; i++)
+ for (size_t i = 0; i < 10; i++)
ASSERT (offsets[i] == ((i % 2) == 0 ? i / 2 : (size_t)(-1)));
ASSERT (offsets[10] == MAGIC);
free (offsets);
@@ -151,7 +148,7 @@ main ()
free (result);
}
}
- 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[] = "\202\261\202\361\202\311\202\277\202\315"; /* こんにちは in Shift_JIS */
@@ -159,7 +156,7 @@ main ()
{
0x3053, 0x3093, 0x306B, 0x3061, 0x306F
};
- for (o = 0; o < 2; o++)
+ for (size_t o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
size_t length;
@@ -172,7 +169,7 @@ main ()
ASSERT (u16_cmp (result, expected, SIZEOF (expected)) == 0);
if (o)
{
- for (i = 0; i < 10; i++)
+ for (size_t i = 0; i < 10; i++)
ASSERT (offsets[i] == ((i % 2) == 0 ? i / 2 : (size_t)(-1)));
ASSERT (offsets[10] == MAGIC);
free (offsets);
@@ -180,7 +177,7 @@ main ()
free (result);
}
}
- 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[] = "\033$B$3$s$K$A$O\033(B"; /* こんにちは in ISO-2022-JP-2 */
@@ -188,7 +185,7 @@ main ()
{
0x3053, 0x3093, 0x306B, 0x3061, 0x306F
};
- for (o = 0; o < 2; o++)
+ for (size_t o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
size_t length;
@@ -201,7 +198,7 @@ main ()
ASSERT (u16_cmp (result, expected, SIZEOF (expected)) == 0);
if (o)
{
- for (i = 0; i < 16; i++)
+ for (size_t i = 0; i < 16; i++)
ASSERT (offsets[i] == (i == 0 ? 0 :
i == 5 ? 1 :
i == 7 ? 2 :
diff --git a/tests/uniconv/test-u16-conv-to-enc.c b/tests/uniconv/test-u16-conv-to-enc.c
index 2d12c1d1..6464b56e 100644
--- a/tests/uniconv/test-u16-conv-to-enc.c
+++ b/tests/uniconv/test-u16-conv-to-enc.c
@@ -1,5 +1,5 @@
/* Test of conversion from UTF-16 to legacy encodings.
- 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
@@ -43,15 +43,12 @@ 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-16 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 uint16_t input[] = /* Ärger mit bösen Bübchen ohne Augenmaß */
@@ -61,7 +58,7 @@ main ()
'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF
};
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 (SIZEOF (input)) : NULL);
size_t length;
@@ -74,7 +71,7 @@ main ()
ASSERT (memcmp (result, expected, length) == 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);
@@ -84,7 +81,7 @@ main ()
}
/* Test conversion from UTF-16 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 uint16_t input[] = /* Rafał Maszkowski */
@@ -92,7 +89,7 @@ main ()
'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w',
's', 'k', 'i'
};
- for (o = 0; o < 2; o++)
+ for (size_t o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (SIZEOF (input)) : NULL);
size_t length = 0xdead;
@@ -119,7 +116,7 @@ main ()
|| memcmp (result, expected_translit, length) == 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);
@@ -135,7 +132,7 @@ main ()
ASSERT (memcmp (result, expected, length) == 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);
free (offsets);
@@ -148,11 +145,11 @@ main ()
}
/* Test conversion from UTF-16 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 uint16_t input[] = { 0xD845 };
- for (o = 0; o < 2; o++)
+ for (size_t o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (SIZEOF (input)) : NULL);
size_t length;
diff --git a/tests/uniconv/test-u16-strconv-from-enc.c b/tests/uniconv/test-u16-strconv-from-enc.c
index 93ebead6..af321276 100644
--- a/tests/uniconv/test-u16-strconv-from-enc.c
+++ b/tests/uniconv/test-u16-strconv-from-enc.c
@@ -1,5 +1,5 @@
/* Test of conversion to UTF-16 from legacy encodings.
- 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
@@ -32,13 +32,12 @@ main ()
#if HAVE_ICONV
static enum iconv_ilseq_handler handlers[] =
{ iconveh_error, iconveh_question_mark, iconveh_escape_sequence };
- size_t h;
/* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1,
ISO-8859-2, and UTF-8. */
/* Test conversion from ISO-8859-1 to UTF-16 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";
@@ -55,7 +54,7 @@ main ()
}
/* Test conversion from ISO-8859-2 to UTF-16 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[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */
@@ -76,7 +75,7 @@ main ()
if (iconv_supports_encoding ("ISO-2022-JP-2"))
{
/* Test conversions from autodetect_jp to UTF-16. */
- 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[] = "\244\263\244\363\244\313\244\301\244\317"; /* こんにちは in EUC-JP */
@@ -89,7 +88,7 @@ main ()
ASSERT (u16_strcmp (result, expected) == 0);
free (result);
}
- 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[] = "\202\261\202\361\202\311\202\277\202\315"; /* こんにちは in Shift_JIS */
@@ -102,7 +101,7 @@ main ()
ASSERT (u16_strcmp (result, expected) == 0);
free (result);
}
- 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[] = "\033$B$3$s$K$A$O\033(B"; /* こんにちは in ISO-2022-JP-2 */
diff --git a/tests/uniconv/test-u16-strconv-to-enc.c b/tests/uniconv/test-u16-strconv-to-enc.c
index 9378c647..6dfc9460 100644
--- a/tests/uniconv/test-u16-strconv-to-enc.c
+++ b/tests/uniconv/test-u16-strconv-to-enc.c
@@ -1,5 +1,5 @@
/* Test of conversion from UTF-16 to legacy encodings.
- 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
@@ -32,13 +32,12 @@ main ()
#if HAVE_ICONV
static enum iconv_ilseq_handler handlers[] =
{ iconveh_error, iconveh_question_mark, iconveh_escape_sequence };
- size_t h;
/* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1,
ISO-8859-2, and UTF-8. */
/* Test conversion from UTF-16 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 uint16_t input[] = /* Ärger mit bösen Bübchen ohne Augenmaß */
@@ -55,7 +54,7 @@ main ()
}
/* Test conversion from UTF-16 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 uint16_t input[] = /* Rafał Maszkowski */
@@ -92,7 +91,7 @@ main ()
# if 0
/* Test conversion from UTF-16 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 uint16_t input[] = { 0xD845, 0 };
diff --git a/tests/uniconv/test-u32-conv-from-enc.c b/tests/uniconv/test-u32-conv-from-enc.c
index 677c11fc..8cd013f9 100644
--- a/tests/uniconv/test-u32-conv-from-enc.c
+++ b/tests/uniconv/test-u32-conv-from-enc.c
@@ -1,5 +1,5 @@
/* Test of conversion to UTF-32 from legacy encodings.
- 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
@@ -44,15 +44,12 @@ 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 ISO-8859-1 to UTF-16 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";
@@ -62,7 +59,7 @@ main ()
'e', 'n', ' ', 'B', 0xFC, 'b', 'c', 'h', 'e', 'n', ' ', 'o', 'h',
'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF
};
- for (o = 0; o < 2; o++)
+ for (size_t o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
size_t length;
@@ -75,7 +72,7 @@ main ()
ASSERT (u32_cmp (result, expected, SIZEOF (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);
@@ -85,7 +82,7 @@ main ()
}
/* Test conversion from ISO-8859-2 to UTF-16 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[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */
@@ -94,7 +91,7 @@ main ()
'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w',
's', 'k', 'i'
};
- for (o = 0; o < 2; o++)
+ for (size_t o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
size_t length;
@@ -107,7 +104,7 @@ main ()
ASSERT (u32_cmp (result, expected, SIZEOF (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);
@@ -122,7 +119,7 @@ main ()
if (iconv_supports_encoding ("ISO-2022-JP-2"))
{
/* Test conversions from autodetect_jp to UTF-16. */
- 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[] = "\244\263\244\363\244\313\244\301\244\317"; /* こんにちは in EUC-JP */
@@ -130,7 +127,7 @@ main ()
{
0x3053, 0x3093, 0x306B, 0x3061, 0x306F
};
- for (o = 0; o < 2; o++)
+ for (size_t o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
size_t length;
@@ -143,7 +140,7 @@ main ()
ASSERT (u32_cmp (result, expected, SIZEOF (expected)) == 0);
if (o)
{
- for (i = 0; i < 10; i++)
+ for (size_t i = 0; i < 10; i++)
ASSERT (offsets[i] == ((i % 2) == 0 ? i / 2 : (size_t)(-1)));
ASSERT (offsets[10] == MAGIC);
free (offsets);
@@ -151,7 +148,7 @@ main ()
free (result);
}
}
- 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[] = "\202\261\202\361\202\311\202\277\202\315"; /* こんにちは in Shift_JIS */
@@ -159,7 +156,7 @@ main ()
{
0x3053, 0x3093, 0x306B, 0x3061, 0x306F
};
- for (o = 0; o < 2; o++)
+ for (size_t o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
size_t length;
@@ -172,7 +169,7 @@ main ()
ASSERT (u32_cmp (result, expected, SIZEOF (expected)) == 0);
if (o)
{
- for (i = 0; i < 10; i++)
+ for (size_t i = 0; i < 10; i++)
ASSERT (offsets[i] == ((i % 2) == 0 ? i / 2 : (size_t)(-1)));
ASSERT (offsets[10] == MAGIC);
free (offsets);
@@ -180,7 +177,7 @@ main ()
free (result);
}
}
- 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[] = "\033$B$3$s$K$A$O\033(B"; /* こんにちは in ISO-2022-JP-2 */
@@ -188,7 +185,7 @@ main ()
{
0x3053, 0x3093, 0x306B, 0x3061, 0x306F
};
- for (o = 0; o < 2; o++)
+ for (size_t o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
size_t length;
@@ -201,7 +198,7 @@ main ()
ASSERT (u32_cmp (result, expected, SIZEOF (expected)) == 0);
if (o)
{
- for (i = 0; i < 16; i++)
+ for (size_t i = 0; i < 16; i++)
ASSERT (offsets[i] == (i == 0 ? 0 :
i == 5 ? 1 :
i == 7 ? 2 :
diff --git a/tests/uniconv/test-u32-conv-to-enc.c b/tests/uniconv/test-u32-conv-to-enc.c
index cdb9c363..e23e2867 100644
--- a/tests/uniconv/test-u32-conv-to-enc.c
+++ b/tests/uniconv/test-u32-conv-to-enc.c
@@ -1,5 +1,5 @@
/* Test of conversion from UTF-32 to legacy encodings.
- 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
@@ -43,15 +43,12 @@ 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-32 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 uint32_t input[] = /* Ärger mit bösen Bübchen ohne Augenmaß */
@@ -61,7 +58,7 @@ main ()
'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF
};
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 (SIZEOF (input)) : NULL);
size_t length;
@@ -74,7 +71,7 @@ main ()
ASSERT (memcmp (result, expected, length) == 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);
@@ -84,7 +81,7 @@ main ()
}
/* Test conversion from UTF-32 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 uint32_t input[] = /* Rafał Maszkowski */
@@ -92,7 +89,7 @@ main ()
'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w',
's', 'k', 'i'
};
- for (o = 0; o < 2; o++)
+ for (size_t o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (SIZEOF (input)) : NULL);
size_t length = 0xdead;
@@ -119,7 +116,7 @@ main ()
|| memcmp (result, expected_translit, length) == 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);
@@ -135,7 +132,7 @@ main ()
ASSERT (memcmp (result, expected, length) == 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);
free (offsets);
diff --git a/tests/uniconv/test-u32-strconv-from-enc.c b/tests/uniconv/test-u32-strconv-from-enc.c
index 9d7d7349..b2040d44 100644
--- a/tests/uniconv/test-u32-strconv-from-enc.c
+++ b/tests/uniconv/test-u32-strconv-from-enc.c
@@ -1,5 +1,5 @@
/* Test of conversion to UTF-32 from legacy encodings.
- 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
@@ -32,13 +32,12 @@ main ()
#if HAVE_ICONV
static enum iconv_ilseq_handler handlers[] =
{ iconveh_error, iconveh_question_mark, iconveh_escape_sequence };
- size_t h;
/* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1,
ISO-8859-2, and UTF-8. */
/* Test conversion from ISO-8859-1 to UTF-16 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";
@@ -55,7 +54,7 @@ main ()
}
/* Test conversion from ISO-8859-2 to UTF-16 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[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */
@@ -76,7 +75,7 @@ main ()
if (iconv_supports_encoding ("ISO-2022-JP-2"))
{
/* Test conversions from autodetect_jp to UTF-16. */
- 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[] = "\244\263\244\363\244\313\244\301\244\317"; /* こんにちは in EUC-JP */
@@ -89,7 +88,7 @@ main ()
ASSERT (u32_strcmp (result, expected) == 0);
free (result);
}
- 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[] = "\202\261\202\361\202\311\202\277\202\315"; /* こんにちは in Shift_JIS */
@@ -102,7 +101,7 @@ main ()
ASSERT (u32_strcmp (result, expected) == 0);
free (result);
}
- 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[] = "\033$B$3$s$K$A$O\033(B"; /* こんにちは in ISO-2022-JP-2 */
diff --git a/tests/uniconv/test-u32-strconv-to-enc.c b/tests/uniconv/test-u32-strconv-to-enc.c
index 8ff053e5..7b4d80b4 100644
--- a/tests/uniconv/test-u32-strconv-to-enc.c
+++ b/tests/uniconv/test-u32-strconv-to-enc.c
@@ -1,5 +1,5 @@
/* Test of conversion from UTF-32 to legacy encodings.
- 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
@@ -31,13 +31,12 @@ main ()
#if HAVE_ICONV
static enum iconv_ilseq_handler handlers[] =
{ iconveh_error, iconveh_question_mark, iconveh_escape_sequence };
- size_t h;
/* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1,
ISO-8859-2, and UTF-8. */
/* Test conversion from UTF-32 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 uint32_t input[] = /* Ärger mit bösen Bübchen ohne Augenmaß */
@@ -54,7 +53,7 @@ main ()
}
/* Test conversion from UTF-32 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 uint32_t input[] = /* Rafał Maszkowski */
diff --git a/tests/uniconv/test-u8-conv-from-enc.c b/tests/uniconv/test-u8-conv-from-enc.c
index f0bc956e..9fda9959 100644
--- a/tests/uniconv/test-u8-conv-from-enc.c
+++ b/tests/uniconv/test-u8-conv-from-enc.c
@@ -1,5 +1,5 @@
/* Test of conversion to UTF-8 from legacy encodings.
- 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
@@ -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 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 uint8_t 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);
size_t length;
@@ -70,7 +67,7 @@ main ()
ASSERT (u8_cmp (result, expected, u8_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 :
@@ -83,12 +80,12 @@ main ()
}
/* Test conversion from ISO-8859-2 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[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */
static const uint8_t expected[] = "Rafa\305\202 Maszkowski";
- for (o = 0; o < 2; o++)
+ for (size_t o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
size_t length;
@@ -101,7 +98,7 @@ main ()
ASSERT (u8_cmp (result, expected, u8_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 + 1));
ASSERT (offsets[16] == MAGIC);
@@ -117,12 +114,12 @@ main ()
if (iconv_supports_encoding ("ISO-2022-JP-2"))
{
/* Test conversions from autodetect_jp to UTF-8. */
- 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[] = "\244\263\244\363\244\313\244\301\244\317"; /* こんにちは in EUC-JP */
static const uint8_t expected[] = "\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257"; /* こんにちは */
- for (o = 0; o < 2; o++)
+ for (size_t o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
size_t length;
@@ -135,7 +132,7 @@ main ()
ASSERT (u8_cmp (result, expected, u8_strlen (expected)) == 0);
if (o)
{
- for (i = 0; i < 10; i++)
+ for (size_t i = 0; i < 10; i++)
ASSERT (offsets[i] == ((i % 2) == 0 ? (i / 2) * 3 : (size_t)(-1)));
ASSERT (offsets[10] == MAGIC);
free (offsets);
@@ -143,12 +140,12 @@ main ()
free (result);
}
}
- 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[] = "\202\261\202\361\202\311\202\277\202\315"; /* こんにちは in Shift_JIS */
static const uint8_t expected[] = "\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257"; /* こんにちは */
- for (o = 0; o < 2; o++)
+ for (size_t o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
size_t length;
@@ -161,7 +158,7 @@ main ()
ASSERT (u8_cmp (result, expected, u8_strlen (expected)) == 0);
if (o)
{
- for (i = 0; i < 10; i++)
+ for (size_t i = 0; i < 10; i++)
ASSERT (offsets[i] == ((i % 2) == 0 ? (i / 2) * 3 : (size_t)(-1)));
ASSERT (offsets[10] == MAGIC);
free (offsets);
@@ -169,12 +166,12 @@ main ()
free (result);
}
}
- 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[] = "\033$B$3$s$K$A$O\033(B"; /* こんにちは in ISO-2022-JP-2 */
static const uint8_t expected[] = "\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257"; /* こんにちは */
- for (o = 0; o < 2; o++)
+ for (size_t o = 0; o < 2; o++)
{
size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
size_t length;
@@ -187,7 +184,7 @@ main ()
ASSERT (u8_cmp (result, expected, u8_strlen (expected)) == 0);
if (o)
{
- for (i = 0; i < 16; i++)
+ for (size_t i = 0; i < 16; i++)
ASSERT (offsets[i] == (i == 0 ? 0 :
i == 5 ? 3 :
i == 7 ? 6 :
diff --git a/tests/uniconv/test-u8-conv-to-enc.c b/tests/uniconv/test-u8-conv-to-enc.c
index 1f1b5c7b..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-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
@@ -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;
diff --git a/tests/uniconv/test-u8-strconv-from-enc.c b/tests/uniconv/test-u8-strconv-from-enc.c
index 0211aa34..9ff66383 100644
--- a/tests/uniconv/test-u8-strconv-from-enc.c
+++ b/tests/uniconv/test-u8-strconv-from-enc.c
@@ -1,5 +1,5 @@
/* Test of conversion to UTF-8 from legacy encodings.
- 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
@@ -32,13 +32,12 @@ main ()
#if HAVE_ICONV
static enum iconv_ilseq_handler handlers[] =
{ iconveh_error, iconveh_question_mark, iconveh_escape_sequence };
- size_t h;
/* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1,
ISO-8859-2, and UTF-8. */
/* 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";
@@ -50,7 +49,7 @@ main ()
}
/* Test conversion from ISO-8859-2 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[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */
@@ -67,7 +66,7 @@ main ()
if (iconv_supports_encoding ("ISO-2022-JP-2"))
{
/* Test conversions from autodetect_jp to UTF-8. */
- 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[] = "\244\263\244\363\244\313\244\301\244\317"; /* こんにちは in EUC-JP */
@@ -77,7 +76,7 @@ main ()
ASSERT (u8_strcmp (result, expected) == 0);
free (result);
}
- 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[] = "\202\261\202\361\202\311\202\277\202\315"; /* こんにちは in Shift_JIS */
@@ -87,7 +86,7 @@ main ()
ASSERT (u8_strcmp (result, expected) == 0);
free (result);
}
- 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[] = "\033$B$3$s$K$A$O\033(B"; /* こんにちは in ISO-2022-JP-2 */
diff --git a/tests/uniconv/test-u8-strconv-to-enc.c b/tests/uniconv/test-u8-strconv-to-enc.c
index 48e5d075..09521487 100644
--- a/tests/uniconv/test-u8-strconv-to-enc.c
+++ b/tests/uniconv/test-u8-strconv-to-enc.c
@@ -1,5 +1,5 @@
/* Test of conversion from UTF-8 to legacy encodings.
- 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
@@ -32,13 +32,12 @@ main ()
#if HAVE_ICONV
static enum iconv_ilseq_handler handlers[] =
{ iconveh_error, iconveh_question_mark, iconveh_escape_sequence };
- size_t h;
/* 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";
@@ -50,7 +49,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 uint8_t input[] = "Rafa\305\202 Maszkowski"; /* Rafał Maszkowski */
@@ -83,7 +82,7 @@ main ()
# if 0
/* 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";
diff --git a/tests/uniconv/test-uniconv-h.c b/tests/uniconv/test-uniconv-h.c
index 150cbe73..cfb16aa4 100644
--- a/tests/uniconv/test-uniconv-h.c
+++ b/tests/uniconv/test-uniconv-h.c
@@ -1,5 +1,5 @@
/* Test of <uniconv.h>.
- Copyright (C) 2025 Free Software Foundation, Inc.
+ Copyright (C) 2025-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