summaryrefslogtreecommitdiff
path: root/tests/uniname/test-uninames.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2026-03-08 17:28:33 +0100
committerJörg Frings-Fürst <debian@jff.email>2026-03-08 17:28:33 +0100
commit5f59a34ab747dde8ede7357f3431bf06bd6002fe (patch)
tree056a4477fd870d454d5be5868cddab829a47f4d2 /tests/uniname/test-uninames.c
parent27dae84ed92f1ef0300263091972338d12e78348 (diff)
New upstream version 1.4.2upstream/1.4.2upstream
Diffstat (limited to 'tests/uniname/test-uninames.c')
-rw-r--r--tests/uniname/test-uninames.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/tests/uniname/test-uninames.c b/tests/uniname/test-uninames.c
index 0804abf2..38dc618c 100644
--- a/tests/uniname/test-uninames.c
+++ b/tests/uniname/test-uninames.c
@@ -1,5 +1,5 @@
/* Test the Unicode character name functions.
- Copyright (C) 2000-2003, 2005, 2007, 2009-2025 Free Software Foundation,
+ Copyright (C) 2000-2003, 2005, 2007, 2009-2026 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
@@ -187,8 +187,7 @@ fill_aliases (const char *namealiases_filename)
static int
name_has_alias (unsigned int uc)
{
- int i;
- for (i = 0; i < ALIASLEN; i++)
+ for (int i = 0; i < ALIASLEN; i++)
if (unicode_aliases[i].uc == uc)
return 1;
return 0;
@@ -199,10 +198,9 @@ static int
test_name_lookup ()
{
int error = 0;
- unsigned int i;
char buf[UNINAME_MAX];
- for (i = 0; i < 0x11000; i++)
+ for (unsigned int i = 0; i < 0x11000; i++)
{
char *result = unicode_character_name (i, buf);
@@ -231,7 +229,7 @@ test_name_lookup ()
}
}
- for (i = 0x110000; i < 0x1000000; i++)
+ for (unsigned int i = 0x110000; i < 0x1000000; i++)
{
char *result = unicode_character_name (i, buf);
@@ -251,10 +249,9 @@ static int
test_inverse_lookup ()
{
int error = 0;
- unsigned int i;
/* First, verify all valid character names are recognized. */
- for (i = 0; i < 0x110000; i++)
+ for (unsigned int i = 0; i < 0x110000; i++)
if (unicode_names[i] != NULL)
{
unsigned int result = unicode_name_character (unicode_names[i]);
@@ -273,12 +270,12 @@ test_inverse_lookup ()
/* Second, generate random but likely names and verify they are not
recognized unless really valid. */
- for (i = 0; i < 10000; i++)
+ for (unsigned int i = 0; i < 10000; i++)
{
unsigned int i1, i2;
const char *s1;
const char *s2;
- unsigned int l1, l2, j1, j2;
+ unsigned int l1, l2;
char buf[2*UNINAME_MAX];
unsigned int result;
@@ -298,9 +295,9 @@ test_inverse_lookup ()
l2 = strlen (s2);
/* Concatenate a starting piece of s1 with an ending piece of s2. */
- for (j1 = 1; j1 <= l1; j1++)
+ for (unsigned int j1 = 1; j1 <= l1; j1++)
if (j1 == l1 || s1[j1] == ' ')
- for (j2 = 0; j2 < l2; j2++)
+ for (unsigned int j2 = 0; j2 < l2; j2++)
if (j2 == 0 || s2[j2-1] == ' ')
{
memcpy (buf, s1, j1);
@@ -333,11 +330,10 @@ static int
test_alias_lookup ()
{
int error = 0;
- unsigned int i;
char buf[UNINAME_MAX];
/* Verify all valid character names are recognized. */
- for (i = 0; i < ALIASLEN; i++)
+ for (unsigned int i = 0; i < ALIASLEN; i++)
if (unicode_aliases[i].uc != UNINAME_INVALID
/* Skip if the character has no canonical name (e.g. control
characters). */
@@ -371,8 +367,7 @@ main (int argc, char *argv[])
if (i < argc)
{
- int j;
- for (j = 0; j < ALIASLEN; j++)
+ for (int j = 0; j < ALIASLEN; j++)
unicode_aliases[j].uc = UNINAME_INVALID;
i++;