diff options
| author | Jörg Frings-Fürst <debian@jff.email> | 2026-03-08 17:28:33 +0100 |
|---|---|---|
| committer | Jörg Frings-Fürst <debian@jff.email> | 2026-03-08 17:28:33 +0100 |
| commit | 5f59a34ab747dde8ede7357f3431bf06bd6002fe (patch) | |
| tree | 056a4477fd870d454d5be5868cddab829a47f4d2 /tests/unistr | |
| parent | 27dae84ed92f1ef0300263091972338d12e78348 (diff) | |
New upstream version 1.4.2upstream/1.4.2upstream
Diffstat (limited to 'tests/unistr')
136 files changed, 353 insertions, 472 deletions
diff --git a/tests/unistr/test-chr.h b/tests/unistr/test-chr.h index 7e95af1b..fe007261 100644 --- a/tests/unistr/test-chr.h +++ b/tests/unistr/test-chr.h @@ -1,5 +1,5 @@ /* Test of uN_chr() functions. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-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 @@ -93,43 +93,35 @@ main (void) } /* Alignment tests. */ - { - int i, j; - for (i = 0; i < 32; i++) - { - for (j = 0; j < 128; j++) - input[i + j] = j; - for (j = 0; j < 128; j++) - { - ASSERT (U_CHR (input + i, 128, j) == input + i + j); - } - } - } + for (int i = 0; i < 32; i++) + { + for (int j = 0; j < 128; j++) + input[i + j] = j; + for (int j = 0; j < 128; j++) + { + ASSERT (U_CHR (input + i, 128, j) == input + i + j); + } + } /* Check that uN_chr() does not read past the first occurrence of the byte being searched. */ { UNIT *page_boundary = zerosize_ptr (); - size_t n; if (page_boundary != NULL) { - for (n = 1; n <= 500 / sizeof (UNIT); n++) + for (size_t n = 1; n <= 500 / sizeof (UNIT); n++) { UNIT *mem = page_boundary - n; U_SET (mem, 'X', n); ASSERT (U_CHR (mem, n, 'U') == NULL); - { - size_t i; - - for (i = 0; i < n; i++) - { - mem[i] = 'U'; - ASSERT (U_CHR (mem, 4000, 'U') == mem + i); - mem[i] = 'X'; - } - } + for (size_t i = 0; i < n; i++) + { + mem[i] = 'U'; + ASSERT (U_CHR (mem, 4000, 'U') == mem + i); + mem[i] = 'X'; + } } } } diff --git a/tests/unistr/test-cmp.h b/tests/unistr/test-cmp.h index 94e3d3f5..84f89287 100644 --- a/tests/unistr/test-cmp.h +++ b/tests/unistr/test-cmp.h @@ -1,5 +1,5 @@ /* Test of uN_cmp() functions. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-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 @@ -78,21 +78,19 @@ test_cmp (void) { UNIT foo[21]; UNIT bar[21]; - int i; - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { UNIT *a = foo + i; UNIT *b = bar + i; - int j; - for (j = 0; j < 8; j++) + for (int j = 0; j < 8; j++) a[j] = '-'; a[8] = '0'; - for (j = 9; j < 16; j++) + for (int j = 9; j < 16; j++) a[j] = '1'; - for (j = 0; j < 8; j++) + for (int j = 0; j < 8; j++) b[j] = '-'; b[8] = '1'; - for (j = 9; j < 16; j++) + for (int j = 9; j < 16; j++) b[j] = '0'; ASSERT (U_CMP (a, b, 16) < 0); } diff --git a/tests/unistr/test-cmp2.h b/tests/unistr/test-cmp2.h index d032bd89..5bf70674 100644 --- a/tests/unistr/test-cmp2.h +++ b/tests/unistr/test-cmp2.h @@ -1,5 +1,5 @@ /* Test of uN_cmp2() functions. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-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 diff --git a/tests/unistr/test-cpy-alloc.h b/tests/unistr/test-cpy-alloc.h index 4a2bfa05..9c490875 100644 --- a/tests/unistr/test-cpy-alloc.h +++ b/tests/unistr/test-cpy-alloc.h @@ -1,5 +1,5 @@ /* Test of uN_cpy_alloc() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 @@ -22,15 +22,13 @@ main () /* Test small copying operations. */ { static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' }; - size_t n; - for (n = 0; n <= SIZEOF (src); n++) + for (size_t n = 0; n <= SIZEOF (src); n++) { UNIT *result = U_CPY_ALLOC (src, n); - size_t i; ASSERT (result != NULL); - for (i = 0; i < n; i++) + for (size_t i = 0; i < n; i++) ASSERT (result[i] == src[i]); free (result); diff --git a/tests/unistr/test-cpy.h b/tests/unistr/test-cpy.h index e1a167bb..db264f43 100644 --- a/tests/unistr/test-cpy.h +++ b/tests/unistr/test-cpy.h @@ -1,5 +1,5 @@ /* Test of uN_cpy() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 @@ -22,19 +22,17 @@ main () /* Test small copying operations. */ { static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' }; - size_t n; - for (n = 0; n <= SIZEOF (src); n++) + for (size_t n = 0; n <= SIZEOF (src); n++) { UNIT dest[1 + SIZEOF (src) + 1] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC }; UNIT *ret; - size_t i; ret = U_CPY (dest + 1, src, n); ASSERT (ret == dest + 1); ASSERT (dest[0] == MAGIC); - for (i = 0; i < n; i++) + for (size_t i = 0; i < n; i++) ASSERT (dest[1 + i] == src[i]); ASSERT (dest[1 + n] == MAGIC); } diff --git a/tests/unistr/test-move.h b/tests/unistr/test-move.h index 765dcb5f..a4a22e45 100644 --- a/tests/unistr/test-move.h +++ b/tests/unistr/test-move.h @@ -1,5 +1,5 @@ /* Test of uN_move() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 @@ -22,19 +22,17 @@ main () /* Test copying operations with disjoint source and destination. */ { static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' }; - size_t n; - for (n = 0; n <= SIZEOF (src); n++) + for (size_t n = 0; n <= SIZEOF (src); n++) { UNIT dest[1 + SIZEOF (src) + 1] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC }; UNIT *ret; - size_t i; ret = U_MOVE (dest + 1, src, n); ASSERT (ret == dest + 1); ASSERT (dest[0] == MAGIC); - for (i = 0; i < n; i++) + for (size_t i = 0; i < n; i++) ASSERT (dest[1 + i] == src[i]); ASSERT (dest[1 + n] == MAGIC); } @@ -43,23 +41,21 @@ main () /* Test copying operations with overlap, in-place. */ { static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' }; - size_t n; - for (n = 0; n <= SIZEOF (src); n++) + for (size_t n = 0; n <= SIZEOF (src); n++) { UNIT dest[1 + SIZEOF (src) + 1]; UNIT *ret; - size_t i; dest[0] = MAGIC; - for (i = 0; i < n; i++) + for (size_t i = 0; i < n; i++) dest[1 + i] = src[i]; dest[1 + n] = MAGIC; ret = U_MOVE (dest + 1, dest + 1, n); ASSERT (ret == dest + 1); ASSERT (dest[0] == MAGIC); - for (i = 0; i < n; i++) + for (size_t i = 0; i < n; i++) ASSERT (dest[1 + i] == src[i]); ASSERT (dest[1 + n] == MAGIC); } @@ -69,23 +65,19 @@ main () { static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' }; static const UNIT src2[] = { 'C', 'L', 'I', 'M', 'A', 'T', 'E' }; - size_t d; ASSERT (SIZEOF (src) == SIZEOF (src2)); - for (d = 0; d <= SIZEOF (src); d++) + for (size_t d = 0; d <= SIZEOF (src); d++) { - size_t n; - - for (n = 0; n <= SIZEOF (src); n++) + for (size_t n = 0; n <= SIZEOF (src); n++) { UNIT dest[1 + 2 * SIZEOF (src) + 1]; UNIT *ret; - size_t i; dest[0] = MAGIC; - for (i = 0; i < SIZEOF (src2); i++) + for (size_t i = 0; i < SIZEOF (src2); i++) dest[1 + i] = src2[i]; - for (i = 0; i < SIZEOF (src); i++) + for (size_t i = 0; i < SIZEOF (src); i++) dest[1 + SIZEOF (src) + i] = src[i]; dest[1 + 2 * SIZEOF (src)] = MAGIC; @@ -93,13 +85,13 @@ main () U_MOVE (dest + 1 + SIZEOF (src) - d, dest + 1 + SIZEOF (src), n); ASSERT (ret == dest + 1 + SIZEOF (src) - d); ASSERT (dest[0] == MAGIC); - for (i = 0; i < SIZEOF (src) - d; i++) + for (size_t i = 0; i < SIZEOF (src) - d; i++) ASSERT (dest[1 + i] == src2[i]); - for (i = 0; i < n; i++) + for (size_t i = 0; i < n; i++) ASSERT (dest[1 + SIZEOF (src) - d + i] == src[i]); - for (i = SIZEOF (src) - d + n; i < SIZEOF (src2); i++) + for (size_t i = SIZEOF (src) - d + n; i < SIZEOF (src2); i++) ASSERT (dest[1 + i] == src2[i]); - for (i = (n >= d ? n - d : 0); i < SIZEOF (src); i++) + for (size_t i = (n >= d ? n - d : 0); i < SIZEOF (src); i++) ASSERT (dest[1 + SIZEOF (src) + i] == src[i]); ASSERT (dest[1 + 2 * SIZEOF (src)] == MAGIC); } @@ -110,36 +102,32 @@ main () { static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' }; static const UNIT src2[] = { 'C', 'L', 'I', 'M', 'A', 'T', 'E' }; - size_t d; ASSERT (SIZEOF (src) == SIZEOF (src2)); - for (d = 0; d <= SIZEOF (src); d++) + for (size_t d = 0; d <= SIZEOF (src); d++) { - size_t n; - - for (n = 0; n <= SIZEOF (src); n++) + for (size_t n = 0; n <= SIZEOF (src); n++) { UNIT dest[1 + 2 * SIZEOF (src) + 1]; UNIT *ret; - size_t i; dest[0] = MAGIC; - for (i = 0; i < SIZEOF (src); i++) + for (size_t i = 0; i < SIZEOF (src); i++) dest[1 + i] = src[i]; - for (i = 0; i < SIZEOF (src2); i++) + for (size_t i = 0; i < SIZEOF (src2); i++) dest[1 + SIZEOF (src) + i] = src2[i]; dest[1 + 2 * SIZEOF (src)] = MAGIC; ret = U_MOVE (dest + 1 + d, dest + 1, n); ASSERT (ret == dest + 1 + d); ASSERT (dest[0] == MAGIC); - for (i = 0; i < d; i++) + for (size_t i = 0; i < d; i++) ASSERT (dest[1 + i] == src[i]); - for (i = 0; i < n; i++) + for (size_t i = 0; i < n; i++) ASSERT (dest[1 + d + i] == src[i]); - for (i = d + n; i < SIZEOF (src); i++) + for (size_t i = d + n; i < SIZEOF (src); i++) ASSERT (dest[1 + i] == src[i]); - for (i = (d + n >= SIZEOF (src) ? d + n - SIZEOF (src) : 0); + for (size_t i = (d + n >= SIZEOF (src) ? d + n - SIZEOF (src) : 0); i < SIZEOF (src2); i++) ASSERT (dest[1 + SIZEOF (src) + i] == src2[i]); diff --git a/tests/unistr/test-pcpy.h b/tests/unistr/test-pcpy.h index c7298dca..62199043 100644 --- a/tests/unistr/test-pcpy.h +++ b/tests/unistr/test-pcpy.h @@ -1,5 +1,5 @@ /* Test of uN_pcpy() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 @@ -22,19 +22,17 @@ main () /* Test small copying operations. */ { static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' }; - size_t n; - for (n = 0; n <= SIZEOF (src); n++) + for (size_t n = 0; n <= SIZEOF (src); n++) { UNIT dest[1 + SIZEOF (src) + 1] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC }; UNIT *ret; - size_t i; ret = U_PCPY (dest + 1, src, n); ASSERT (ret == dest + 1 + n); ASSERT (dest[0] == MAGIC); - for (i = 0; i < n; i++) + for (size_t i = 0; i < n; i++) ASSERT (dest[1 + i] == src[i]); ASSERT (dest[1 + n] == MAGIC); } diff --git a/tests/unistr/test-set.h b/tests/unistr/test-set.h index 133ea638..36fb6d00 100644 --- a/tests/unistr/test-set.h +++ b/tests/unistr/test-set.h @@ -1,5 +1,5 @@ /* Test of uN_set() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 @@ -19,26 +19,21 @@ int main () { - { #define NMAX 7 - size_t n; - - for (n = 0; n <= NMAX; n++) - { - UNIT dest[1 + NMAX + 1] = - { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC }; - UNIT *ret; - size_t i; - - ret = U_SET (dest + 1, VALUE, n); - ASSERT (ret == dest + 1); - ASSERT (dest[0] == MAGIC); - for (i = 0; i < n; i++) - ASSERT (dest[1 + i] == VALUE); - ASSERT (dest[1 + n] == MAGIC); - } + for (size_t n = 0; n <= NMAX; n++) + { + UNIT dest[1 + NMAX + 1] = + { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC }; + UNIT *ret; + + ret = U_SET (dest + 1, VALUE, n); + ASSERT (ret == dest + 1); + ASSERT (dest[0] == MAGIC); + for (size_t i = 0; i < n; i++) + ASSERT (dest[1 + i] == VALUE); + ASSERT (dest[1 + n] == MAGIC); + } #undef NMAX - } return test_exit_status; } diff --git a/tests/unistr/test-stpcpy.h b/tests/unistr/test-stpcpy.h index d8b433d5..859f4869 100644 --- a/tests/unistr/test-stpcpy.h +++ b/tests/unistr/test-stpcpy.h @@ -1,5 +1,5 @@ /* Test of uN_stpcpy() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 @@ -22,22 +22,20 @@ main () /* Test small copying operations. */ { static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e', 0 }; - size_t n; - for (n = 1; n <= SIZEOF (src); n++) + for (size_t n = 1; n <= SIZEOF (src); n++) { UNIT dest[1 + SIZEOF (src) + 1] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC }; UNIT *result; - size_t i; result = U_STPCPY (dest + 1, src + SIZEOF (src) - n); ASSERT (result == dest + n); ASSERT (dest[0] == MAGIC); - for (i = 0; i < n; i++) + for (size_t i = 0; i < n; i++) ASSERT (dest[1 + i] == src[SIZEOF (src) - n + i]); ASSERT (dest[1 + n] == MAGIC); } diff --git a/tests/unistr/test-stpncpy.h b/tests/unistr/test-stpncpy.h index c651a83e..ff283868 100644 --- a/tests/unistr/test-stpncpy.h +++ b/tests/unistr/test-stpncpy.h @@ -1,5 +1,5 @@ /* Test of uN_stpncpy() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 @@ -21,22 +21,24 @@ check_single (const UNIT *input, size_t length, size_t n) { UNIT *dest; UNIT *result; - size_t i; dest = (UNIT *) malloc ((1 + n + 1) * sizeof (UNIT)); ASSERT (dest != NULL); - for (i = 0; i < 1 + n + 1; i++) + for (size_t i = 0; i < 1 + n + 1; i++) dest[i] = MAGIC; result = U_STPNCPY (dest + 1, input, n); ASSERT (result == dest + 1 + (n <= length ? n : length)); ASSERT (dest[0] == MAGIC); - for (i = 0; i < (n <= length ? n : length + 1); i++) - ASSERT (dest[1 + i] == input[i]); - for (; i < n; i++) - ASSERT (dest[1 + i] == 0); + { + size_t i; + for (i = 0; i < (n <= length ? n : length + 1); i++) + ASSERT (dest[1 + i] == input[i]); + for (; i < n; i++) + ASSERT (dest[1 + i] == 0); + } ASSERT (dest[1 + n] == MAGIC); free (dest); @@ -46,13 +48,12 @@ static void check (const UNIT *input, size_t input_length) { size_t length; - size_t n; ASSERT (input_length > 0); ASSERT (input[input_length - 1] == 0); length = input_length - 1; /* = U_STRLEN (input) */ - for (n = 0; n <= 2 * length + 2; n++) + for (size_t n = 0; n <= 2 * length + 2; n++) check_single (input, length, n); /* Check that U_STPNCPY (D, S, N) does not look at more than @@ -62,14 +63,13 @@ check (const UNIT *input, size_t input_length) if (page_boundary != NULL) { - for (n = 0; n <= 2 * length + 2; n++) + for (size_t n = 0; n <= 2 * length + 2; n++) { size_t n_to_copy = (n <= length ? n : length + 1); UNIT *copy; - size_t i; copy = (UNIT *) page_boundary - n_to_copy; - for (i = 0; i < n_to_copy; i++) + for (size_t i = 0; i < n_to_copy; i++) copy[i] = input[i]; check_single (copy, length, n); diff --git a/tests/unistr/test-strcat.h b/tests/unistr/test-strcat.h index cd0fb9f0..20d7564d 100644 --- a/tests/unistr/test-strcat.h +++ b/tests/unistr/test-strcat.h @@ -1,5 +1,5 @@ /* Test of uN_strcat() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 @@ -23,20 +23,17 @@ main () { static const UNIT base[] = { 'C', 'h', 'a', 'n', 'g', 'i', 'n', 'g', 0 }; static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e', 0 }; - size_t m; - size_t n; - for (m = 0; m < SIZEOF (base); m++) - for (n = 1; n <= SIZEOF (src); n++) + for (size_t m = 0; m < SIZEOF (base); m++) + for (size_t n = 1; n <= SIZEOF (src); n++) { UNIT dest[1 + (SIZEOF (base) - 1) + SIZEOF (src) + 1] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC }; UNIT *result; - size_t i; - for (i = 0; i < m; i++) + for (size_t i = 0; i < m; i++) dest[1 + i] = base[i]; dest[1 + m] = 0; @@ -44,9 +41,9 @@ main () ASSERT (result == dest + 1); ASSERT (dest[0] == MAGIC); - for (i = 0; i < m; i++) + for (size_t i = 0; i < m; i++) ASSERT (dest[1 + i] == base[i]); - for (i = 0; i < n; i++) + for (size_t i = 0; i < n; i++) ASSERT (dest[1 + m + i] == src[SIZEOF (src) - n + i]); ASSERT (dest[1 + m + n] == MAGIC); } diff --git a/tests/unistr/test-strchr.h b/tests/unistr/test-strchr.h index c5740a5d..e078e232 100644 --- a/tests/unistr/test-strchr.h +++ b/tests/unistr/test-strchr.h @@ -1,5 +1,5 @@ /* Test of uN_strchr() functions. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-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 @@ -86,28 +86,24 @@ test_strchr (void) } /* Alignment tests. */ - { - int i, j; - for (i = 0; i < 32; i++) - { - for (j = 0; j < 127; j++) - input[i + j] = j + 1; - input[i + 128] = 0; - for (j = 0; j < 127; j++) - { - ASSERT (U_STRCHR (input + i, j + 1) == input + i + j); - } - } - } + for (int i = 0; i < 32; i++) + { + for (int j = 0; j < 127; j++) + input[i + j] = j + 1; + input[i + 128] = 0; + for (int j = 0; j < 127; j++) + { + ASSERT (U_STRCHR (input + i, j + 1) == input + i + j); + } + } /* Check that uN_strchr() does not read past the end of the string. */ { char *page_boundary = (char *) zerosize_ptr (); - size_t n; if (page_boundary != NULL) { - for (n = 2; n <= 500 / sizeof (UNIT); n++) + for (size_t n = 2; n <= 500 / sizeof (UNIT); n++) { UNIT *mem = (UNIT *) (page_boundary - n * sizeof (UNIT)); U_SET (mem, 'X', n - 2); @@ -130,27 +126,22 @@ test_strchr (void) byte being searched. */ { char *page_boundary = (char *) zerosize_ptr (); - size_t n; if (page_boundary != NULL) { - for (n = 2; n <= 500 / sizeof (UNIT); n++) + for (size_t n = 2; n <= 500 / sizeof (UNIT); n++) { UNIT *mem = (UNIT *) (page_boundary - n * sizeof (UNIT)); U_SET (mem, 'X', n - 1); mem[n - 1] = 0; ASSERT (U_STRCHR (mem, 'U') == NULL); - { - size_t i; - - for (i = 0; i < n; i++) - { - mem[i] = 'U'; - ASSERT (U_STRCHR (mem, 'U') == mem + i); - mem[i] = 'X'; - } - } + for (size_t i = 0; i < n; i++) + { + mem[i] = 'U'; + ASSERT (U_STRCHR (mem, 'U') == mem + i); + mem[i] = 'X'; + } } } } diff --git a/tests/unistr/test-strcmp.h b/tests/unistr/test-strcmp.h index 97cb203a..234a2fbf 100644 --- a/tests/unistr/test-strcmp.h +++ b/tests/unistr/test-strcmp.h @@ -1,5 +1,5 @@ /* Test of uN_strcmp() and uN_strcoll() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-strcpy.h b/tests/unistr/test-strcpy.h index 6a1d81e8..a0818bb6 100644 --- a/tests/unistr/test-strcpy.h +++ b/tests/unistr/test-strcpy.h @@ -1,5 +1,5 @@ /* Test of uN_strcpy() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 @@ -22,22 +22,20 @@ main () /* Test small copying operations. */ { static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e', 0 }; - size_t n; - for (n = 1; n <= SIZEOF (src); n++) + for (size_t n = 1; n <= SIZEOF (src); n++) { UNIT dest[1 + SIZEOF (src) + 1] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC }; UNIT *result; - size_t i; result = U_STRCPY (dest + 1, src + SIZEOF (src) - n); ASSERT (result == dest + 1); ASSERT (dest[0] == MAGIC); - for (i = 0; i < n; i++) + for (size_t i = 0; i < n; i++) ASSERT (dest[1 + i] == src[SIZEOF (src) - n + i]); ASSERT (dest[1 + n] == MAGIC); } diff --git a/tests/unistr/test-strdup.h b/tests/unistr/test-strdup.h index 4f59bc06..9d53a544 100644 --- a/tests/unistr/test-strdup.h +++ b/tests/unistr/test-strdup.h @@ -1,5 +1,5 @@ /* Test of uN_strdup() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 @@ -22,15 +22,13 @@ main () /* Test small copying operations. */ { static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e', 0 }; - size_t n; - for (n = 1; n <= SIZEOF (src); n++) + for (size_t n = 1; n <= SIZEOF (src); n++) { UNIT *result = U_STRDUP (src + SIZEOF (src) - n); - size_t i; ASSERT (result != NULL); - for (i = 0; i < n; i++) + for (size_t i = 0; i < n; i++) ASSERT (result[i] == src[SIZEOF (src) - n + i]); free (result); diff --git a/tests/unistr/test-strncat.h b/tests/unistr/test-strncat.h index 0ba63afe..c2533c7c 100644 --- a/tests/unistr/test-strncat.h +++ b/tests/unistr/test-strncat.h @@ -1,5 +1,5 @@ /* Test of uN_strncat() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 @@ -20,34 +20,35 @@ static void check_single (const UNIT *input, size_t length, size_t n) { static const UNIT base[] = { 'C', 'h', 'a', 'n', 'g', 'i', 'n', 'g', 0 }; - size_t m; - for (m = 0; m < SIZEOF (base); m++) + for (size_t m = 0; m < SIZEOF (base); m++) { UNIT *dest; UNIT *result; - size_t i; dest = (UNIT *) malloc ((1 + m + n + 2) * sizeof (UNIT)); ASSERT (dest != NULL); dest[0] = MAGIC; - for (i = 0; i < m; i++) + for (size_t i = 0; i < m; i++) dest[1 + i] = base[i]; dest[1 + m] = 0; - for (i = 1; i < n + 2; i++) + for (size_t i = 1; i < n + 2; i++) dest[1 + m + i] = MAGIC; result = U_STRNCAT (dest + 1, input, n); ASSERT (result == dest + 1); ASSERT (dest[0] == MAGIC); - for (i = 0; i < m; i++) + for (size_t i = 0; i < m; i++) ASSERT (dest[1 + i] == base[i]); - for (i = 0; i < (n <= length ? n : length); i++) - ASSERT (dest[1 + m + i] == input[i]); - ASSERT (dest[1 + m + i] == 0); - ASSERT (dest[1 + m + i + 1] == MAGIC); + { + size_t i; + for (i = 0; i < (n <= length ? n : length); i++) + ASSERT (dest[1 + m + i] == input[i]); + ASSERT (dest[1 + m + i] == 0); + ASSERT (dest[1 + m + i + 1] == MAGIC); + } free (dest); } @@ -57,13 +58,12 @@ static void check (const UNIT *input, size_t input_length) { size_t length; - size_t n; ASSERT (input_length > 0); ASSERT (input[input_length - 1] == 0); length = input_length - 1; /* = U_STRLEN (input) */ - for (n = 0; n <= 2 * length + 2; n++) + for (size_t n = 0; n <= 2 * length + 2; n++) check_single (input, length, n); /* Check that U_STRNCAT (D, S, N) does not look at more than @@ -73,14 +73,13 @@ check (const UNIT *input, size_t input_length) if (page_boundary != NULL) { - for (n = 0; n <= 2 * length + 2; n++) + for (size_t n = 0; n <= 2 * length + 2; n++) { size_t n_to_copy = (n <= length ? n : length + 1); UNIT *copy; - size_t i; copy = (UNIT *) page_boundary - n_to_copy; - for (i = 0; i < n_to_copy; i++) + for (size_t i = 0; i < n_to_copy; i++) copy[i] = input[i]; check_single (copy, length, n); diff --git a/tests/unistr/test-strncmp.h b/tests/unistr/test-strncmp.h index bbd0aa68..033a24fb 100644 --- a/tests/unistr/test-strncmp.h +++ b/tests/unistr/test-strncmp.h @@ -1,5 +1,5 @@ /* Test of uN_strncmp() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-strncpy.h b/tests/unistr/test-strncpy.h index e24fa507..3e4afb8e 100644 --- a/tests/unistr/test-strncpy.h +++ b/tests/unistr/test-strncpy.h @@ -1,5 +1,5 @@ /* Test of uN_strncpy() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 @@ -21,22 +21,24 @@ check_single (const UNIT *input, size_t length, size_t n) { UNIT *dest; UNIT *result; - size_t i; dest = (UNIT *) malloc ((1 + n + 1) * sizeof (UNIT)); ASSERT (dest != NULL); - for (i = 0; i < 1 + n + 1; i++) + for (size_t i = 0; i < 1 + n + 1; i++) dest[i] = MAGIC; result = U_STRNCPY (dest + 1, input, n); ASSERT (result == dest + 1); ASSERT (dest[0] == MAGIC); - for (i = 0; i < (n <= length ? n : length + 1); i++) - ASSERT (dest[1 + i] == input[i]); - for (; i < n; i++) - ASSERT (dest[1 + i] == 0); + { + size_t i; + for (i = 0; i < (n <= length ? n : length + 1); i++) + ASSERT (dest[1 + i] == input[i]); + for (; i < n; i++) + ASSERT (dest[1 + i] == 0); + } ASSERT (dest[1 + n] == MAGIC); free (dest); @@ -46,13 +48,12 @@ static void check (const UNIT *input, size_t input_length) { size_t length; - size_t n; ASSERT (input_length > 0); ASSERT (input[input_length - 1] == 0); length = input_length - 1; /* = U_STRLEN (input) */ - for (n = 0; n <= 2 * length + 2; n++) + for (size_t n = 0; n <= 2 * length + 2; n++) check_single (input, length, n); /* Check that U_STRNCPY (D, S, N) does not look at more than @@ -62,14 +63,13 @@ check (const UNIT *input, size_t input_length) if (page_boundary != NULL) { - for (n = 0; n <= 2 * length + 2; n++) + for (size_t n = 0; n <= 2 * length + 2; n++) { size_t n_to_copy = (n <= length ? n : length + 1); UNIT *copy; - size_t i; copy = (UNIT *) page_boundary - n_to_copy; - for (i = 0; i < n_to_copy; i++) + for (size_t i = 0; i < n_to_copy; i++) copy[i] = input[i]; check_single (copy, length, n); diff --git a/tests/unistr/test-strnlen.h b/tests/unistr/test-strnlen.h index fd0c25cc..e8aff09c 100644 --- a/tests/unistr/test-strnlen.h +++ b/tests/unistr/test-strnlen.h @@ -1,5 +1,5 @@ /* Test of uN_strnlen() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 @@ -27,13 +27,12 @@ static void check (const UNIT *input, size_t input_length) { size_t length; - size_t n; ASSERT (input_length > 0); ASSERT (input[input_length - 1] == 0); length = input_length - 1; /* = U_STRLEN (input) */ - for (n = 0; n <= 2 * length + 2; n++) + for (size_t n = 0; n <= 2 * length + 2; n++) check_single (input, length, n); /* Check that U_STRNLEN (S, N) does not look at more than @@ -43,14 +42,13 @@ check (const UNIT *input, size_t input_length) if (page_boundary != NULL) { - for (n = 0; n <= 2 * length + 2; n++) + for (size_t n = 0; n <= 2 * length + 2; n++) { size_t n_to_copy = (n <= length ? n : length + 1); UNIT *copy; - size_t i; copy = (UNIT *) page_boundary - n_to_copy; - for (i = 0; i < n_to_copy; i++) + for (size_t i = 0; i < n_to_copy; i++) copy[i] = input[i]; check_single (copy, length, n); diff --git a/tests/unistr/test-u-strstr.h b/tests/unistr/test-u-strstr.h index 826089d9..9676072a 100644 --- a/tests/unistr/test-u-strstr.h +++ b/tests/unistr/test-u-strstr.h @@ -1,5 +1,5 @@ /* Test of uN_strstr() functions. - Copyright (C) 2004, 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2004, 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 @@ -130,10 +130,8 @@ test_u_strstr (void) UNIT *haystack = (UNIT *) malloc ((m + 1) * sizeof (UNIT)); if (haystack != NULL) { - size_t i; - haystack[0] = 'B'; - for (i = 1; i < m; i++) + for (size_t i = 1; i < m; i++) haystack[i] = 'A'; haystack[m] = '\0'; @@ -166,9 +164,7 @@ test_u_strstr (void) UNIT *needle = (UNIT *) malloc ((m + 1) * sizeof (UNIT)); if (needle != NULL) { - size_t i; - - for (i = 0; i < m; i++) + for (size_t i = 0; i < m; i++) needle[i] = 'A'; needle[m] = '\0'; @@ -188,15 +184,14 @@ test_u_strstr (void) UNIT *needle = (UNIT *) malloc ((m + 2) * sizeof (UNIT)); if (haystack != NULL && needle != NULL) { - size_t i; const UNIT *result; - for (i = 0; i < 2 * m; i++) + for (size_t i = 0; i < 2 * m; i++) haystack[i] = 'A'; haystack[2 * m] = 'B'; haystack[2 * m + 1] = 0; - for (i = 0; i < m; i++) + for (size_t i = 0; i < m; i++) needle[i] = 'A'; needle[m] = 'B'; needle[m + 1] = 0; diff --git a/tests/unistr/test-u-strtok.h b/tests/unistr/test-u-strtok.h index 6f73baf7..a4705104 100644 --- a/tests/unistr/test-u-strtok.h +++ b/tests/unistr/test-u-strtok.h @@ -1,5 +1,5 @@ /* Test of uN_strtok() functions. - Copyright (C) 2015-2025 Free Software Foundation, Inc. + Copyright (C) 2015-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 diff --git a/tests/unistr/test-u16-check.c b/tests/unistr/test-u16-check.c index 5e6c5daf..c45867b7 100644 --- a/tests/unistr/test-u16-check.c +++ b/tests/unistr/test-u16-check.c @@ -1,5 +1,5 @@ /* Test of u16_check() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u16-chr.c b/tests/unistr/test-u16-chr.c index 3457cd91..eb56dea7 100644 --- a/tests/unistr/test-u16-chr.c +++ b/tests/unistr/test-u16-chr.c @@ -1,5 +1,5 @@ /* Test of u16_chr() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u16-cmp.c b/tests/unistr/test-u16-cmp.c index 87ef97cf..501a60af 100644 --- a/tests/unistr/test-u16-cmp.c +++ b/tests/unistr/test-u16-cmp.c @@ -1,5 +1,5 @@ /* Test of u16_cmp() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u16-cmp2.c b/tests/unistr/test-u16-cmp2.c index 274aee7c..4c825bc3 100644 --- a/tests/unistr/test-u16-cmp2.c +++ b/tests/unistr/test-u16-cmp2.c @@ -1,5 +1,5 @@ /* Test of u16_cmp2() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u16-cpy-alloc.c b/tests/unistr/test-u16-cpy-alloc.c index 0398e100..9842d77e 100644 --- a/tests/unistr/test-u16-cpy-alloc.c +++ b/tests/unistr/test-u16-cpy-alloc.c @@ -1,5 +1,5 @@ /* Test of u16_cpy_alloc() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u16-cpy.c b/tests/unistr/test-u16-cpy.c index 5cdfbc73..8985fced 100644 --- a/tests/unistr/test-u16-cpy.c +++ b/tests/unistr/test-u16-cpy.c @@ -1,5 +1,5 @@ /* Test of u16_cpy() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u16-mblen.c b/tests/unistr/test-u16-mblen.c index 6d0c4765..b2fb5501 100644 --- a/tests/unistr/test-u16-mblen.c +++ b/tests/unistr/test-u16-mblen.c @@ -1,5 +1,5 @@ /* Test of u16_mblen() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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,10 +43,9 @@ main () /* Test ISO 646 unit input. */ { - ucs4_t c; uint16_t buf[1]; - for (c = 1; c < 0x80; c++) + for (ucs4_t c = 1; c < 0x80; c++) { buf[0] = c; ret = u16_mblen (buf, 1); diff --git a/tests/unistr/test-u16-mbsnlen.c b/tests/unistr/test-u16-mbsnlen.c index c354ddfb..13419e66 100644 --- a/tests/unistr/test-u16-mbsnlen.c +++ b/tests/unistr/test-u16-mbsnlen.c @@ -1,5 +1,5 @@ /* Test of u16_mbsnlen() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 @@ -35,9 +35,8 @@ main () '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; - size_t n; - for (n = 0; n <= SIZEOF (input); n++) + for (size_t n = 0; n <= SIZEOF (input); n++) { size_t len = u16_mbsnlen (input, n); ASSERT (len == n); @@ -55,9 +54,8 @@ main () 1, 2, 3, 3, 4, 5, 5, 6, 7, 8, 8, 9, 10, 10 }; - size_t n; - for (n = 0; n <= SIZEOF (input); n++) + for (size_t n = 0; n <= SIZEOF (input); n++) { size_t len = u16_mbsnlen (input, n); ASSERT (len == expected[n]); diff --git a/tests/unistr/test-u16-mbtouc-unsafe.c b/tests/unistr/test-u16-mbtouc-unsafe.c index eb78205e..406c5120 100644 --- a/tests/unistr/test-u16-mbtouc-unsafe.c +++ b/tests/unistr/test-u16-mbtouc-unsafe.c @@ -1,5 +1,5 @@ /* Test of u16_mbtouc_unsafe() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u16-mbtouc.c b/tests/unistr/test-u16-mbtouc.c index 3caee4c0..d677ac1c 100644 --- a/tests/unistr/test-u16-mbtouc.c +++ b/tests/unistr/test-u16-mbtouc.c @@ -1,5 +1,5 @@ /* Test of u16_mbtouc() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u16-mbtouc.h b/tests/unistr/test-u16-mbtouc.h index 07931f71..30c85d7f 100644 --- a/tests/unistr/test-u16-mbtouc.h +++ b/tests/unistr/test-u16-mbtouc.h @@ -1,5 +1,5 @@ /* Test of u16_mbtouc() and u16_mbtouc_unsafe() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 @@ -33,10 +33,9 @@ test_function (int (*my_u16_mbtouc) (ucs4_t *, const uint16_t *, size_t)) /* Test ISO 646 unit input. */ { - ucs4_t c; uint16_t buf[1]; - for (c = 0; c < 0x80; c++) + for (ucs4_t c = 0; c < 0x80; c++) { buf[0] = c; uc = 0xBADFACE; diff --git a/tests/unistr/test-u16-mbtoucr.c b/tests/unistr/test-u16-mbtoucr.c index 67226cc1..2e3e3c6d 100644 --- a/tests/unistr/test-u16-mbtoucr.c +++ b/tests/unistr/test-u16-mbtoucr.c @@ -1,5 +1,5 @@ /* Test of u16_mbtoucr() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 @@ -39,10 +39,9 @@ main () /* Test ISO 646 unit input. */ { - ucs4_t c; uint16_t buf[1]; - for (c = 0; c < 0x80; c++) + for (ucs4_t c = 0; c < 0x80; c++) { buf[0] = c; uc = 0xBADFACE; diff --git a/tests/unistr/test-u16-move.c b/tests/unistr/test-u16-move.c index 2190cbdb..b53eeb9e 100644 --- a/tests/unistr/test-u16-move.c +++ b/tests/unistr/test-u16-move.c @@ -1,5 +1,5 @@ /* Test of u16_move() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u16-next.c b/tests/unistr/test-u16-next.c index afb4da3e..992933bf 100644 --- a/tests/unistr/test-u16-next.c +++ b/tests/unistr/test-u16-next.c @@ -1,5 +1,5 @@ /* Test of u16_next() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 @@ -39,10 +39,9 @@ main () /* Test ISO 646 unit input. */ { - ucs4_t c; uint16_t buf[2]; - for (c = 1; c < 0x80; c++) + for (ucs4_t c = 1; c < 0x80; c++) { buf[0] = c; buf[1] = 0; diff --git a/tests/unistr/test-u16-pcpy.c b/tests/unistr/test-u16-pcpy.c index d53aa1da..f83cee68 100644 --- a/tests/unistr/test-u16-pcpy.c +++ b/tests/unistr/test-u16-pcpy.c @@ -1,5 +1,5 @@ /* Test of u16_pcpy() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u16-prev.c b/tests/unistr/test-u16-prev.c index 911b2c89..c2540499 100644 --- a/tests/unistr/test-u16-prev.c +++ b/tests/unistr/test-u16-prev.c @@ -1,5 +1,5 @@ /* Test of u16_prev() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 @@ -35,12 +35,11 @@ check (const uint16_t *input, size_t input_length, ucs4_t *puc) { uint16_t buf[100]; uint16_t *ptr; - size_t i; ucs4_t uc1; ptr = buf; *ptr++ = 0x2102; - for (i = 0; i < input_length; i++) + for (size_t i = 0; i < input_length; i++) ptr[i] = input[i]; if (u16_prev (&uc1, ptr + input_length, buf) != ptr) @@ -53,13 +52,12 @@ check (const uint16_t *input, size_t input_length, ucs4_t *puc) { uint16_t buf[100]; uint16_t *ptr; - size_t i; ucs4_t uc1; ptr = buf; *ptr++ = 0xD835; *ptr++ = 0xDD1E; - for (i = 0; i < input_length; i++) + for (size_t i = 0; i < input_length; i++) ptr[i] = input[i]; if (u16_prev (&uc1, ptr + input_length, buf) != ptr) @@ -88,11 +86,10 @@ check_invalid (const uint16_t *input, size_t input_length) { uint16_t buf[100]; uint16_t *ptr; - size_t i; ptr = buf; *ptr++ = 0x2102; - for (i = 0; i < input_length; i++) + for (size_t i = 0; i < input_length; i++) ptr[i] = input[i]; uc = 0xBADFACE; @@ -106,12 +103,11 @@ check_invalid (const uint16_t *input, size_t input_length) { uint16_t buf[100]; uint16_t *ptr; - size_t i; ptr = buf; *ptr++ = 0xD835; *ptr++ = 0xDD1E; - for (i = 0; i < input_length; i++) + for (size_t i = 0; i < input_length; i++) ptr[i] = input[i]; uc = 0xBADFACE; @@ -131,10 +127,9 @@ main () /* Test ISO 646 unit input. */ { - ucs4_t c; uint16_t buf[1]; - for (c = 0; c < 0x80; c++) + for (ucs4_t c = 0; c < 0x80; c++) { buf[0] = c; uc = 0xBADFACE; diff --git a/tests/unistr/test-u16-set.c b/tests/unistr/test-u16-set.c index 7ec1845a..adc33644 100644 --- a/tests/unistr/test-u16-set.c +++ b/tests/unistr/test-u16-set.c @@ -1,5 +1,5 @@ /* Test of u16_set() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u16-stpcpy.c b/tests/unistr/test-u16-stpcpy.c index 2d56c8d9..9985a8db 100644 --- a/tests/unistr/test-u16-stpcpy.c +++ b/tests/unistr/test-u16-stpcpy.c @@ -1,5 +1,5 @@ /* Test of u16_stpcpy() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u16-stpncpy.c b/tests/unistr/test-u16-stpncpy.c index 58e0c4a2..d8b2cab1 100644 --- a/tests/unistr/test-u16-stpncpy.c +++ b/tests/unistr/test-u16-stpncpy.c @@ -1,5 +1,5 @@ /* Test of u16_stpncpy() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u16-strcat.c b/tests/unistr/test-u16-strcat.c index a00bb5cd..30d2475a 100644 --- a/tests/unistr/test-u16-strcat.c +++ b/tests/unistr/test-u16-strcat.c @@ -1,5 +1,5 @@ /* Test of u16_strcat() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u16-strchr.c b/tests/unistr/test-u16-strchr.c index 5be29979..b59ca0fb 100644 --- a/tests/unistr/test-u16-strchr.c +++ b/tests/unistr/test-u16-strchr.c @@ -1,5 +1,5 @@ /* Test of u16_strchr() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u16-strcmp.c b/tests/unistr/test-u16-strcmp.c index c2d704fb..caa41898 100644 --- a/tests/unistr/test-u16-strcmp.c +++ b/tests/unistr/test-u16-strcmp.c @@ -1,5 +1,5 @@ /* Test of u16_strcmp() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u16-strcmp.h b/tests/unistr/test-u16-strcmp.h index 46b6f72d..571cc8db 100644 --- a/tests/unistr/test-u16-strcmp.h +++ b/tests/unistr/test-u16-strcmp.h @@ -1,5 +1,5 @@ /* Test of u16_strcmp() and u16_strcoll() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u16-strcoll.c b/tests/unistr/test-u16-strcoll.c index 7d6801d7..de32dad7 100644 --- a/tests/unistr/test-u16-strcoll.c +++ b/tests/unistr/test-u16-strcoll.c @@ -1,5 +1,5 @@ /* Test of u16_strcoll() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u16-strcpy.c b/tests/unistr/test-u16-strcpy.c index 62aac951..9e604cec 100644 --- a/tests/unistr/test-u16-strcpy.c +++ b/tests/unistr/test-u16-strcpy.c @@ -1,5 +1,5 @@ /* Test of u16_strcpy() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u16-strdup.c b/tests/unistr/test-u16-strdup.c index 95488128..31f34c32 100644 --- a/tests/unistr/test-u16-strdup.c +++ b/tests/unistr/test-u16-strdup.c @@ -1,5 +1,5 @@ /* Test of u16_strdup() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u16-strlen.c b/tests/unistr/test-u16-strlen.c index 42058cb6..c842912a 100644 --- a/tests/unistr/test-u16-strlen.c +++ b/tests/unistr/test-u16-strlen.c @@ -1,5 +1,5 @@ /* Test of u16_strlen() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u16-strmblen.c b/tests/unistr/test-u16-strmblen.c index 42cf3e6f..bfe70c6f 100644 --- a/tests/unistr/test-u16-strmblen.c +++ b/tests/unistr/test-u16-strmblen.c @@ -1,5 +1,5 @@ /* Test of u16_strmblen() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 @@ -36,10 +36,9 @@ main () /* Test ISO 646 unit input. */ { - ucs4_t c; uint16_t buf[2]; - for (c = 1; c < 0x80; c++) + for (ucs4_t c = 1; c < 0x80; c++) { buf[0] = c; buf[1] = 0; diff --git a/tests/unistr/test-u16-strmbtouc.c b/tests/unistr/test-u16-strmbtouc.c index 8f2e37ec..12ab3c0d 100644 --- a/tests/unistr/test-u16-strmbtouc.c +++ b/tests/unistr/test-u16-strmbtouc.c @@ -1,5 +1,5 @@ /* Test of u16_strmbtouc() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 @@ -39,10 +39,9 @@ main () /* Test ISO 646 unit input. */ { - ucs4_t c; uint16_t buf[2]; - for (c = 1; c < 0x80; c++) + for (ucs4_t c = 1; c < 0x80; c++) { buf[0] = c; buf[1] = 0; diff --git a/tests/unistr/test-u16-strncat.c b/tests/unistr/test-u16-strncat.c index 2cf25a81..ab60d7c6 100644 --- a/tests/unistr/test-u16-strncat.c +++ b/tests/unistr/test-u16-strncat.c @@ -1,5 +1,5 @@ /* Test of u16_strncat() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u16-strncmp.c b/tests/unistr/test-u16-strncmp.c index c8325830..5f4ab386 100644 --- a/tests/unistr/test-u16-strncmp.c +++ b/tests/unistr/test-u16-strncmp.c @@ -1,5 +1,5 @@ /* Test of u16_strncmp() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u16-strncpy.c b/tests/unistr/test-u16-strncpy.c index 1aad5c21..c0f562ed 100644 --- a/tests/unistr/test-u16-strncpy.c +++ b/tests/unistr/test-u16-strncpy.c @@ -1,5 +1,5 @@ /* Test of u16_strncpy() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u16-strnlen.c b/tests/unistr/test-u16-strnlen.c index 26922923..5bd461ae 100644 --- a/tests/unistr/test-u16-strnlen.c +++ b/tests/unistr/test-u16-strnlen.c @@ -1,5 +1,5 @@ /* Test of u16_strnlen() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u16-strstr.c b/tests/unistr/test-u16-strstr.c index 7c2996d2..51514994 100644 --- a/tests/unistr/test-u16-strstr.c +++ b/tests/unistr/test-u16-strstr.c @@ -1,5 +1,5 @@ /* Test of u16_strstr() function. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-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 diff --git a/tests/unistr/test-u16-strtok.c b/tests/unistr/test-u16-strtok.c index 8d08da0a..939895a3 100644 --- a/tests/unistr/test-u16-strtok.c +++ b/tests/unistr/test-u16-strtok.c @@ -1,5 +1,5 @@ /* Test of u16_strtok() function. - Copyright (C) 2015-2025 Free Software Foundation, Inc. + Copyright (C) 2015-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 diff --git a/tests/unistr/test-u16-to-u32.c b/tests/unistr/test-u16-to-u32.c index 5ddc99cd..00ea5554 100644 --- a/tests/unistr/test-u16-to-u32.c +++ b/tests/unistr/test-u16-to-u32.c @@ -1,5 +1,5 @@ /* Test of u16_to_u32() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u16-to-u8.c b/tests/unistr/test-u16-to-u8.c index 54cd3afb..d97db4c8 100644 --- a/tests/unistr/test-u16-to-u8.c +++ b/tests/unistr/test-u16-to-u8.c @@ -1,5 +1,5 @@ /* Test of u16_to_u8() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u16-uctomb.c b/tests/unistr/test-u16-uctomb.c index 93149219..5288f25d 100644 --- a/tests/unistr/test-u16-uctomb.c +++ b/tests/unistr/test-u16-uctomb.c @@ -1,5 +1,5 @@ /* Test of u16_uctomb() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 @@ -28,24 +28,20 @@ int main () { /* Test ISO 646 character, in particular the NUL character. */ - { - ucs4_t uc; - - for (uc = 0; uc < 0x80; uc++) - { - uint16_t buf[3] = { MAGIC, MAGIC, MAGIC }; - int ret; + for (ucs4_t uc = 0; uc < 0x80; uc++) + { + uint16_t buf[3] = { MAGIC, MAGIC, MAGIC }; + int ret; - ret = u16_uctomb (buf, uc, 0); - ASSERT (ret == -2); - ASSERT (buf[0] == MAGIC); + ret = u16_uctomb (buf, uc, 0); + ASSERT (ret == -2); + ASSERT (buf[0] == MAGIC); - ret = u16_uctomb (buf, uc, 1); - ASSERT (ret == 1); - ASSERT (buf[0] == uc); - ASSERT (buf[1] == MAGIC); - } - } + ret = u16_uctomb (buf, uc, 1); + ASSERT (ret == 1); + ASSERT (buf[0] == uc); + ASSERT (buf[1] == MAGIC); + } /* Test BMP character. */ { @@ -88,14 +84,12 @@ main () { ucs4_t invalid[] = { 0x110000, 0xD800, 0xDBFF, 0xDC00, 0xDFFF }; uint16_t buf[3] = { MAGIC, MAGIC, MAGIC }; - size_t i; - for (i = 0; i < SIZEOF (invalid); i++) + for (size_t i = 0; i < SIZEOF (invalid); i++) { ucs4_t uc = invalid[i]; - int n; - for (n = 0; n <= 2; n++) + for (int n = 0; n <= 2; n++) { int ret = u16_uctomb (buf, uc, n); ASSERT (ret == -1); diff --git a/tests/unistr/test-u32-check.c b/tests/unistr/test-u32-check.c index c6cf547e..9639e3d0 100644 --- a/tests/unistr/test-u32-check.c +++ b/tests/unistr/test-u32-check.c @@ -1,5 +1,5 @@ /* Test of u32_check() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u32-chr.c b/tests/unistr/test-u32-chr.c index 3d38487d..5079105e 100644 --- a/tests/unistr/test-u32-chr.c +++ b/tests/unistr/test-u32-chr.c @@ -1,5 +1,5 @@ /* Test of u32_chr() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u32-cmp.c b/tests/unistr/test-u32-cmp.c index a0574c36..30da4253 100644 --- a/tests/unistr/test-u32-cmp.c +++ b/tests/unistr/test-u32-cmp.c @@ -1,5 +1,5 @@ /* Test of u32_cmp() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u32-cmp2.c b/tests/unistr/test-u32-cmp2.c index 097a92ec..46cc1d3c 100644 --- a/tests/unistr/test-u32-cmp2.c +++ b/tests/unistr/test-u32-cmp2.c @@ -1,5 +1,5 @@ /* Test of u32_cmp2() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u32-cpy-alloc.c b/tests/unistr/test-u32-cpy-alloc.c index 3d86c606..06b3244b 100644 --- a/tests/unistr/test-u32-cpy-alloc.c +++ b/tests/unistr/test-u32-cpy-alloc.c @@ -1,5 +1,5 @@ /* Test of u32_cpy_alloc() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u32-cpy.c b/tests/unistr/test-u32-cpy.c index 8329592a..a6245b52 100644 --- a/tests/unistr/test-u32-cpy.c +++ b/tests/unistr/test-u32-cpy.c @@ -1,5 +1,5 @@ /* Test of u32_cpy() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u32-mblen.c b/tests/unistr/test-u32-mblen.c index 8ce13426..ff6139d9 100644 --- a/tests/unistr/test-u32-mblen.c +++ b/tests/unistr/test-u32-mblen.c @@ -1,5 +1,5 @@ /* Test of u32_mblen() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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,10 +43,9 @@ main () /* Test ISO 646 unit input. */ { - ucs4_t c; uint32_t buf[1]; - for (c = 1; c < 0x80; c++) + for (ucs4_t c = 1; c < 0x80; c++) { buf[0] = c; ret = u32_mblen (buf, 1); diff --git a/tests/unistr/test-u32-mbsnlen.c b/tests/unistr/test-u32-mbsnlen.c index 113b0c5f..212bb755 100644 --- a/tests/unistr/test-u32-mbsnlen.c +++ b/tests/unistr/test-u32-mbsnlen.c @@ -1,5 +1,5 @@ /* Test of u32_mbsnlen() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 @@ -35,9 +35,8 @@ main () '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; - size_t n; - for (n = 0; n <= SIZEOF (input); n++) + for (size_t n = 0; n <= SIZEOF (input); n++) { size_t len = u32_mbsnlen (input, n); ASSERT (len == n); @@ -50,9 +49,8 @@ main () { '-', '(', 0x1D51E, 0x00D7, 0x1D51F, ')', '=', 0x1D51F, 0x00D7, 0x1D51E }; - size_t n; - for (n = 0; n <= SIZEOF (input); n++) + for (size_t n = 0; n <= SIZEOF (input); n++) { size_t len = u32_mbsnlen (input, n); ASSERT (len == n); diff --git a/tests/unistr/test-u32-mbtouc-unsafe.c b/tests/unistr/test-u32-mbtouc-unsafe.c index 5bc8e0e9..4a50585e 100644 --- a/tests/unistr/test-u32-mbtouc-unsafe.c +++ b/tests/unistr/test-u32-mbtouc-unsafe.c @@ -1,5 +1,5 @@ /* Test of u32_mbtouc_unsafe() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u32-mbtouc.c b/tests/unistr/test-u32-mbtouc.c index b62c26d3..a05b6576 100644 --- a/tests/unistr/test-u32-mbtouc.c +++ b/tests/unistr/test-u32-mbtouc.c @@ -1,5 +1,5 @@ /* Test of u32_mbtouc() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u32-mbtouc.h b/tests/unistr/test-u32-mbtouc.h index 3a44c096..ef29debf 100644 --- a/tests/unistr/test-u32-mbtouc.h +++ b/tests/unistr/test-u32-mbtouc.h @@ -1,5 +1,5 @@ /* Test of u32_mbtouc() and u32_mbtouc_unsafe() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 @@ -33,10 +33,9 @@ test_function (int (*my_u32_mbtouc) (ucs4_t *, const uint32_t *, size_t)) /* Test ISO 646 unit input. */ { - ucs4_t c; uint32_t buf[1]; - for (c = 0; c < 0x80; c++) + for (ucs4_t c = 0; c < 0x80; c++) { buf[0] = c; uc = 0xBADFACE; diff --git a/tests/unistr/test-u32-mbtoucr.c b/tests/unistr/test-u32-mbtoucr.c index 11137449..5e01e7b2 100644 --- a/tests/unistr/test-u32-mbtoucr.c +++ b/tests/unistr/test-u32-mbtoucr.c @@ -1,5 +1,5 @@ /* Test of u32_mbtoucr() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 @@ -39,10 +39,9 @@ main () /* Test ISO 646 unit input. */ { - ucs4_t c; uint32_t buf[1]; - for (c = 0; c < 0x80; c++) + for (ucs4_t c = 0; c < 0x80; c++) { buf[0] = c; uc = 0xBADFACE; diff --git a/tests/unistr/test-u32-move.c b/tests/unistr/test-u32-move.c index 71cf48eb..a027c1d0 100644 --- a/tests/unistr/test-u32-move.c +++ b/tests/unistr/test-u32-move.c @@ -1,5 +1,5 @@ /* Test of u32_move() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u32-next.c b/tests/unistr/test-u32-next.c index dc17eca4..02ba1463 100644 --- a/tests/unistr/test-u32-next.c +++ b/tests/unistr/test-u32-next.c @@ -1,5 +1,5 @@ /* Test of u32_next() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 @@ -39,10 +39,9 @@ main () /* Test ISO 646 unit input. */ { - ucs4_t c; uint32_t buf[2]; - for (c = 1; c < 0x80; c++) + for (ucs4_t c = 1; c < 0x80; c++) { buf[0] = c; buf[1] = 0; diff --git a/tests/unistr/test-u32-pcpy.c b/tests/unistr/test-u32-pcpy.c index 8dc07d4c..3e891f5e 100644 --- a/tests/unistr/test-u32-pcpy.c +++ b/tests/unistr/test-u32-pcpy.c @@ -1,5 +1,5 @@ /* Test of u32_pcpy() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u32-prev.c b/tests/unistr/test-u32-prev.c index b9a339a1..b5974aa3 100644 --- a/tests/unistr/test-u32-prev.c +++ b/tests/unistr/test-u32-prev.c @@ -1,5 +1,5 @@ /* Test of u32_prev() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 @@ -35,12 +35,11 @@ check (const uint32_t *input, size_t input_length, ucs4_t *puc) { uint32_t buf[100]; uint32_t *ptr; - size_t i; ucs4_t uc1; ptr = buf; *ptr++ = 0x1D51E; - for (i = 0; i < input_length; i++) + for (size_t i = 0; i < input_length; i++) ptr[i] = input[i]; if (u32_prev (&uc1, ptr + input_length, buf) != ptr) @@ -69,11 +68,10 @@ check_invalid (const uint32_t *input, size_t input_length) { uint32_t buf[100]; uint32_t *ptr; - size_t i; ptr = buf; *ptr++ = 0x1D51E; - for (i = 0; i < input_length; i++) + for (size_t i = 0; i < input_length; i++) ptr[i] = input[i]; uc = 0xBADFACE; @@ -93,10 +91,9 @@ main () /* Test ISO 646 unit input. */ { - ucs4_t c; uint32_t buf[1]; - for (c = 0; c < 0x80; c++) + for (ucs4_t c = 0; c < 0x80; c++) { buf[0] = c; uc = 0xBADFACE; diff --git a/tests/unistr/test-u32-set.c b/tests/unistr/test-u32-set.c index 801f60a8..42243079 100644 --- a/tests/unistr/test-u32-set.c +++ b/tests/unistr/test-u32-set.c @@ -1,5 +1,5 @@ /* Test of u32_set() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u32-stpcpy.c b/tests/unistr/test-u32-stpcpy.c index 3c1ea6d2..3108a3f9 100644 --- a/tests/unistr/test-u32-stpcpy.c +++ b/tests/unistr/test-u32-stpcpy.c @@ -1,5 +1,5 @@ /* Test of u32_stpcpy() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u32-stpncpy.c b/tests/unistr/test-u32-stpncpy.c index 130ee221..9272492d 100644 --- a/tests/unistr/test-u32-stpncpy.c +++ b/tests/unistr/test-u32-stpncpy.c @@ -1,5 +1,5 @@ /* Test of u32_stpncpy() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u32-strcat.c b/tests/unistr/test-u32-strcat.c index 77a39f9d..3f797c19 100644 --- a/tests/unistr/test-u32-strcat.c +++ b/tests/unistr/test-u32-strcat.c @@ -1,5 +1,5 @@ /* Test of u32_strcat() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u32-strchr.c b/tests/unistr/test-u32-strchr.c index 0d5abe31..a598eb5f 100644 --- a/tests/unistr/test-u32-strchr.c +++ b/tests/unistr/test-u32-strchr.c @@ -1,5 +1,5 @@ /* Test of u32_strchr() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u32-strcmp.c b/tests/unistr/test-u32-strcmp.c index e7ebfaed..1ae637e2 100644 --- a/tests/unistr/test-u32-strcmp.c +++ b/tests/unistr/test-u32-strcmp.c @@ -1,5 +1,5 @@ /* Test of u32_strcmp() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u32-strcmp.h b/tests/unistr/test-u32-strcmp.h index 475f8c98..c58376ac 100644 --- a/tests/unistr/test-u32-strcmp.h +++ b/tests/unistr/test-u32-strcmp.h @@ -1,5 +1,5 @@ /* Test of u32_strcmp() and u32_strcoll() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u32-strcoll.c b/tests/unistr/test-u32-strcoll.c index 52d27f3a..13d7055e 100644 --- a/tests/unistr/test-u32-strcoll.c +++ b/tests/unistr/test-u32-strcoll.c @@ -1,5 +1,5 @@ /* Test of u32_strcoll() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u32-strcpy.c b/tests/unistr/test-u32-strcpy.c index e946a9e9..76665915 100644 --- a/tests/unistr/test-u32-strcpy.c +++ b/tests/unistr/test-u32-strcpy.c @@ -1,5 +1,5 @@ /* Test of u32_strcpy() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u32-strdup.c b/tests/unistr/test-u32-strdup.c index 8ce1c2a1..aa1d61ef 100644 --- a/tests/unistr/test-u32-strdup.c +++ b/tests/unistr/test-u32-strdup.c @@ -1,5 +1,5 @@ /* Test of u32_strdup() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u32-strlen.c b/tests/unistr/test-u32-strlen.c index f376a95d..b8eb276c 100644 --- a/tests/unistr/test-u32-strlen.c +++ b/tests/unistr/test-u32-strlen.c @@ -1,5 +1,5 @@ /* Test of u32_strlen() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u32-strmblen.c b/tests/unistr/test-u32-strmblen.c index dc60b17b..305bf586 100644 --- a/tests/unistr/test-u32-strmblen.c +++ b/tests/unistr/test-u32-strmblen.c @@ -1,5 +1,5 @@ /* Test of u32_strmblen() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 @@ -36,10 +36,9 @@ main () /* Test ISO 646 unit input. */ { - ucs4_t c; uint32_t buf[2]; - for (c = 1; c < 0x80; c++) + for (ucs4_t c = 1; c < 0x80; c++) { buf[0] = c; buf[1] = 0; diff --git a/tests/unistr/test-u32-strmbtouc.c b/tests/unistr/test-u32-strmbtouc.c index 54a2b4a6..03006b38 100644 --- a/tests/unistr/test-u32-strmbtouc.c +++ b/tests/unistr/test-u32-strmbtouc.c @@ -1,5 +1,5 @@ /* Test of u32_strmbtouc() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 @@ -39,10 +39,9 @@ main () /* Test ISO 646 unit input. */ { - ucs4_t c; uint32_t buf[2]; - for (c = 1; c < 0x80; c++) + for (ucs4_t c = 1; c < 0x80; c++) { buf[0] = c; buf[1] = 0; diff --git a/tests/unistr/test-u32-strncat.c b/tests/unistr/test-u32-strncat.c index 03e79a16..d77d8603 100644 --- a/tests/unistr/test-u32-strncat.c +++ b/tests/unistr/test-u32-strncat.c @@ -1,5 +1,5 @@ /* Test of u32_strncat() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u32-strncmp.c b/tests/unistr/test-u32-strncmp.c index 04d10b40..7681ad26 100644 --- a/tests/unistr/test-u32-strncmp.c +++ b/tests/unistr/test-u32-strncmp.c @@ -1,5 +1,5 @@ /* Test of u32_strncmp() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u32-strncpy.c b/tests/unistr/test-u32-strncpy.c index 6df69c45..cd4f0385 100644 --- a/tests/unistr/test-u32-strncpy.c +++ b/tests/unistr/test-u32-strncpy.c @@ -1,5 +1,5 @@ /* Test of u32_strncpy() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u32-strnlen.c b/tests/unistr/test-u32-strnlen.c index 81d24aa0..503fb82c 100644 --- a/tests/unistr/test-u32-strnlen.c +++ b/tests/unistr/test-u32-strnlen.c @@ -1,5 +1,5 @@ /* Test of u32_strnlen() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u32-strstr.c b/tests/unistr/test-u32-strstr.c index 09e258b1..39e9524d 100644 --- a/tests/unistr/test-u32-strstr.c +++ b/tests/unistr/test-u32-strstr.c @@ -1,5 +1,5 @@ /* Test of u32_strstr() function. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-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 diff --git a/tests/unistr/test-u32-strtok.c b/tests/unistr/test-u32-strtok.c index 14a4702c..5beefaac 100644 --- a/tests/unistr/test-u32-strtok.c +++ b/tests/unistr/test-u32-strtok.c @@ -1,5 +1,5 @@ /* Test of u32_strtok() function. - Copyright (C) 2015-2025 Free Software Foundation, Inc. + Copyright (C) 2015-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 diff --git a/tests/unistr/test-u32-to-u16.c b/tests/unistr/test-u32-to-u16.c index 7bb4567b..3941c1af 100644 --- a/tests/unistr/test-u32-to-u16.c +++ b/tests/unistr/test-u32-to-u16.c @@ -1,5 +1,5 @@ /* Test of u32_to_u16() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u32-to-u8.c b/tests/unistr/test-u32-to-u8.c index b9290415..98198646 100644 --- a/tests/unistr/test-u32-to-u8.c +++ b/tests/unistr/test-u32-to-u8.c @@ -1,5 +1,5 @@ /* Test of u32_to_u8() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u32-uctomb.c b/tests/unistr/test-u32-uctomb.c index f05b8646..752b2acd 100644 --- a/tests/unistr/test-u32-uctomb.c +++ b/tests/unistr/test-u32-uctomb.c @@ -1,5 +1,5 @@ /* Test of u32_uctomb() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 @@ -28,24 +28,20 @@ int main () { /* Test ISO 646 character, in particular the NUL character. */ - { - ucs4_t uc; - - for (uc = 0; uc < 0x80; uc++) - { - uint32_t buf[2] = { MAGIC, MAGIC }; - int ret; + for (ucs4_t uc = 0; uc < 0x80; uc++) + { + uint32_t buf[2] = { MAGIC, MAGIC }; + int ret; - ret = u32_uctomb (buf, uc, 0); - ASSERT (ret == -2); - ASSERT (buf[0] == MAGIC); + ret = u32_uctomb (buf, uc, 0); + ASSERT (ret == -2); + ASSERT (buf[0] == MAGIC); - ret = u32_uctomb (buf, uc, 1); - ASSERT (ret == 1); - ASSERT (buf[0] == uc); - ASSERT (buf[1] == MAGIC); - } - } + ret = u32_uctomb (buf, uc, 1); + ASSERT (ret == 1); + ASSERT (buf[0] == uc); + ASSERT (buf[1] == MAGIC); + } /* Test BMP character. */ { @@ -83,14 +79,12 @@ main () { ucs4_t invalid[] = { 0x110000, 0xD800, 0xDBFF, 0xDC00, 0xDFFF }; uint32_t buf[2] = { MAGIC, MAGIC }; - size_t i; - for (i = 0; i < SIZEOF (invalid); i++) + for (size_t i = 0; i < SIZEOF (invalid); i++) { ucs4_t uc = invalid[i]; - int n; - for (n = 0; n <= 2; n++) + for (int n = 0; n <= 2; n++) { int ret = u32_uctomb (buf, uc, n); ASSERT (ret == -1); diff --git a/tests/unistr/test-u8-check.c b/tests/unistr/test-u8-check.c index b4418990..a71c9387 100644 --- a/tests/unistr/test-u8-check.c +++ b/tests/unistr/test-u8-check.c @@ -1,5 +1,5 @@ /* Test of u8_check() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u8-chr.c b/tests/unistr/test-u8-chr.c index 44bfcf19..779a8d25 100644 --- a/tests/unistr/test-u8-chr.c +++ b/tests/unistr/test-u8-chr.c @@ -1,5 +1,5 @@ /* Test of u8_chr() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u8-cmp.c b/tests/unistr/test-u8-cmp.c index caf3577f..9b664720 100644 --- a/tests/unistr/test-u8-cmp.c +++ b/tests/unistr/test-u8-cmp.c @@ -1,5 +1,5 @@ /* Test of u8_cmp() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u8-cmp2.c b/tests/unistr/test-u8-cmp2.c index 49f30d61..a1493031 100644 --- a/tests/unistr/test-u8-cmp2.c +++ b/tests/unistr/test-u8-cmp2.c @@ -1,5 +1,5 @@ /* Test of u8_cmp2() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u8-cpy-alloc.c b/tests/unistr/test-u8-cpy-alloc.c index fa74fb29..49d671da 100644 --- a/tests/unistr/test-u8-cpy-alloc.c +++ b/tests/unistr/test-u8-cpy-alloc.c @@ -1,5 +1,5 @@ /* Test of u8_cpy_alloc() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u8-cpy.c b/tests/unistr/test-u8-cpy.c index e396175a..5580502c 100644 --- a/tests/unistr/test-u8-cpy.c +++ b/tests/unistr/test-u8-cpy.c @@ -1,5 +1,5 @@ /* Test of u8_cpy() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u8-mblen.c b/tests/unistr/test-u8-mblen.c index a6d56242..3889621b 100644 --- a/tests/unistr/test-u8-mblen.c +++ b/tests/unistr/test-u8-mblen.c @@ -1,5 +1,5 @@ /* Test of u8_mblen() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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,10 +43,9 @@ main () /* Test ISO 646 unit input. */ { - ucs4_t c; uint8_t buf[1]; - for (c = 1; c < 0x80; c++) + for (ucs4_t c = 1; c < 0x80; c++) { buf[0] = c; ret = u8_mblen (buf, 1); diff --git a/tests/unistr/test-u8-mbsnlen.c b/tests/unistr/test-u8-mbsnlen.c index 21231848..85d2dc6e 100644 --- a/tests/unistr/test-u8-mbsnlen.c +++ b/tests/unistr/test-u8-mbsnlen.c @@ -1,5 +1,5 @@ /* Test of u8_mbsnlen() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 @@ -48,9 +48,8 @@ main () 56, 56, 56, 57, 57, 57, 58, 59, 59, 59, 60, 60, 60, 61 }; - size_t n; - for (n = 0; n <= SIZEOF (input); n++) + for (size_t n = 0; n <= SIZEOF (input); n++) { size_t len = u8_mbsnlen (input, n); ASSERT (len == expected[n]); @@ -82,10 +81,9 @@ main () } /* 3.2. Lonely start characters. */ { - ucs4_t c; uint8_t input[2]; - for (c = 0xC0; c <= 0xFF; c++) + for (ucs4_t c = 0xC0; c <= 0xFF; c++) { input[0] = c; input[1] = ' '; diff --git a/tests/unistr/test-u8-mbtouc-unsafe.c b/tests/unistr/test-u8-mbtouc-unsafe.c index 731150b5..6c28d66d 100644 --- a/tests/unistr/test-u8-mbtouc-unsafe.c +++ b/tests/unistr/test-u8-mbtouc-unsafe.c @@ -1,5 +1,5 @@ /* Test of u8_mbtouc_unsafe() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u8-mbtouc.c b/tests/unistr/test-u8-mbtouc.c index 62a2258e..bd59f9d7 100644 --- a/tests/unistr/test-u8-mbtouc.c +++ b/tests/unistr/test-u8-mbtouc.c @@ -1,5 +1,5 @@ /* Test of u8_mbtouc() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 @@ -78,10 +78,9 @@ test_safe_function (int (*my_u8_mbtouc) (ucs4_t *, const uint8_t *, size_t)) } /* 3.2. Lonely start characters. */ { - ucs4_t c; uint8_t input[2]; - for (c = 0xC0; c <= 0xFF; c++) + for (ucs4_t c = 0xC0; c <= 0xFF; c++) { input[0] = c; input[1] = ' '; diff --git a/tests/unistr/test-u8-mbtouc.h b/tests/unistr/test-u8-mbtouc.h index 9764088f..6ba21e89 100644 --- a/tests/unistr/test-u8-mbtouc.h +++ b/tests/unistr/test-u8-mbtouc.h @@ -1,5 +1,5 @@ /* Test of u8_mbtouc() and u8_mbtouc_unsafe() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 @@ -33,10 +33,9 @@ test_function (int (*my_u8_mbtouc) (ucs4_t *, const uint8_t *, size_t)) /* Test ISO 646 unit input. */ { - ucs4_t c; uint8_t buf[1]; - for (c = 0; c < 0x80; c++) + for (ucs4_t c = 0; c < 0x80; c++) { buf[0] = c; uc = 0xBADFACE; diff --git a/tests/unistr/test-u8-mbtoucr.c b/tests/unistr/test-u8-mbtoucr.c index 9d016ce6..76691e5b 100644 --- a/tests/unistr/test-u8-mbtoucr.c +++ b/tests/unistr/test-u8-mbtoucr.c @@ -1,5 +1,5 @@ /* Test of u8_mbtoucr() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 @@ -39,10 +39,9 @@ main () /* Test ISO 646 unit input. */ { - ucs4_t c; uint8_t buf[1]; - for (c = 0; c < 0x80; c++) + for (ucs4_t c = 0; c < 0x80; c++) { buf[0] = c; uc = 0xBADFACE; diff --git a/tests/unistr/test-u8-move.c b/tests/unistr/test-u8-move.c index 88b1171e..ae625498 100644 --- a/tests/unistr/test-u8-move.c +++ b/tests/unistr/test-u8-move.c @@ -1,5 +1,5 @@ /* Test of u8_move() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u8-next.c b/tests/unistr/test-u8-next.c index 247236b3..83ef7008 100644 --- a/tests/unistr/test-u8-next.c +++ b/tests/unistr/test-u8-next.c @@ -1,5 +1,5 @@ /* Test of u8_next() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 @@ -39,10 +39,9 @@ main () /* Test ISO 646 unit input. */ { - ucs4_t c; uint8_t buf[2]; - for (c = 1; c < 0x80; c++) + for (ucs4_t c = 1; c < 0x80; c++) { buf[0] = c; buf[1] = 0; diff --git a/tests/unistr/test-u8-pcpy.c b/tests/unistr/test-u8-pcpy.c index fd86d84e..219fa4cb 100644 --- a/tests/unistr/test-u8-pcpy.c +++ b/tests/unistr/test-u8-pcpy.c @@ -1,5 +1,5 @@ /* Test of u8_pcpy() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u8-prev.c b/tests/unistr/test-u8-prev.c index f93b3914..c15c0290 100644 --- a/tests/unistr/test-u8-prev.c +++ b/tests/unistr/test-u8-prev.c @@ -1,5 +1,5 @@ /* Test of u8_prev() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 @@ -35,12 +35,11 @@ check (const uint8_t *input, size_t input_length, ucs4_t *puc) { uint8_t buf[100]; uint8_t *ptr; - size_t i; ucs4_t uc1; ptr = buf; *ptr++ = 'x'; - for (i = 0; i < input_length; i++) + for (size_t i = 0; i < input_length; i++) ptr[i] = input[i]; if (u8_prev (&uc1, ptr + input_length, buf) != ptr) @@ -53,13 +52,12 @@ check (const uint8_t *input, size_t input_length, ucs4_t *puc) { uint8_t buf[100]; uint8_t *ptr; - size_t i; ucs4_t uc1; ptr = buf; *ptr++ = 0xC3; *ptr++ = 0x97; - for (i = 0; i < input_length; i++) + for (size_t i = 0; i < input_length; i++) ptr[i] = input[i]; if (u8_prev (&uc1, ptr + input_length, buf) != ptr) @@ -72,14 +70,13 @@ check (const uint8_t *input, size_t input_length, ucs4_t *puc) { uint8_t buf[100]; uint8_t *ptr; - size_t i; ucs4_t uc1; ptr = buf; *ptr++ = 0xE2; *ptr++ = 0x84; *ptr++ = 0x82; - for (i = 0; i < input_length; i++) + for (size_t i = 0; i < input_length; i++) ptr[i] = input[i]; if (u8_prev (&uc1, ptr + input_length, buf) != ptr) @@ -92,7 +89,6 @@ check (const uint8_t *input, size_t input_length, ucs4_t *puc) { uint8_t buf[100]; uint8_t *ptr; - size_t i; ucs4_t uc1; ptr = buf; @@ -100,7 +96,7 @@ check (const uint8_t *input, size_t input_length, ucs4_t *puc) *ptr++ = 0x9D; *ptr++ = 0x94; *ptr++ = 0x9E; - for (i = 0; i < input_length; i++) + for (size_t i = 0; i < input_length; i++) ptr[i] = input[i]; if (u8_prev (&uc1, ptr + input_length, buf) != ptr) @@ -129,11 +125,10 @@ check_invalid (const uint8_t *input, size_t input_length) { uint8_t buf[100]; uint8_t *ptr; - size_t i; ptr = buf; *ptr++ = 'x'; - for (i = 0; i < input_length; i++) + for (size_t i = 0; i < input_length; i++) ptr[i] = input[i]; uc = 0xBADFACE; @@ -147,12 +142,11 @@ check_invalid (const uint8_t *input, size_t input_length) { uint8_t buf[100]; uint8_t *ptr; - size_t i; ptr = buf; *ptr++ = 0xC3; *ptr++ = 0x97; - for (i = 0; i < input_length; i++) + for (size_t i = 0; i < input_length; i++) ptr[i] = input[i]; uc = 0xBADFACE; @@ -166,13 +160,12 @@ check_invalid (const uint8_t *input, size_t input_length) { uint8_t buf[100]; uint8_t *ptr; - size_t i; ptr = buf; *ptr++ = 0xE2; *ptr++ = 0x84; *ptr++ = 0x82; - for (i = 0; i < input_length; i++) + for (size_t i = 0; i < input_length; i++) ptr[i] = input[i]; uc = 0xBADFACE; @@ -186,14 +179,13 @@ check_invalid (const uint8_t *input, size_t input_length) { uint8_t buf[100]; uint8_t *ptr; - size_t i; ptr = buf; *ptr++ = 0xF0; *ptr++ = 0x9D; *ptr++ = 0x94; *ptr++ = 0x9E; - for (i = 0; i < input_length; i++) + for (size_t i = 0; i < input_length; i++) ptr[i] = input[i]; uc = 0xBADFACE; @@ -213,10 +205,9 @@ main () /* Test ISO 646 unit input. */ { - ucs4_t c; uint8_t buf[1]; - for (c = 0; c < 0x80; c++) + for (ucs4_t c = 0; c < 0x80; c++) { buf[0] = c; uc = 0xBADFACE; diff --git a/tests/unistr/test-u8-set.c b/tests/unistr/test-u8-set.c index b3c99dbe..c403180d 100644 --- a/tests/unistr/test-u8-set.c +++ b/tests/unistr/test-u8-set.c @@ -1,5 +1,5 @@ /* Test of u8_set() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u8-stpcpy.c b/tests/unistr/test-u8-stpcpy.c index 3c4175fe..0abbc74c 100644 --- a/tests/unistr/test-u8-stpcpy.c +++ b/tests/unistr/test-u8-stpcpy.c @@ -1,5 +1,5 @@ /* Test of u8_stpcpy() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u8-stpncpy.c b/tests/unistr/test-u8-stpncpy.c index e21f86c1..8d0bcedc 100644 --- a/tests/unistr/test-u8-stpncpy.c +++ b/tests/unistr/test-u8-stpncpy.c @@ -1,5 +1,5 @@ /* Test of u8_stpncpy() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u8-strcat.c b/tests/unistr/test-u8-strcat.c index 8ae770d9..1287a922 100644 --- a/tests/unistr/test-u8-strcat.c +++ b/tests/unistr/test-u8-strcat.c @@ -1,5 +1,5 @@ /* Test of u8_strcat() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u8-strchr.c b/tests/unistr/test-u8-strchr.c index ea6b6bb5..f18b872f 100644 --- a/tests/unistr/test-u8-strchr.c +++ b/tests/unistr/test-u8-strchr.c @@ -1,5 +1,5 @@ /* Test of u8_strchr() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u8-strcmp.c b/tests/unistr/test-u8-strcmp.c index f940b276..076d97fa 100644 --- a/tests/unistr/test-u8-strcmp.c +++ b/tests/unistr/test-u8-strcmp.c @@ -1,5 +1,5 @@ /* Test of u8_strcmp() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u8-strcmp.h b/tests/unistr/test-u8-strcmp.h index fc010741..b187633d 100644 --- a/tests/unistr/test-u8-strcmp.h +++ b/tests/unistr/test-u8-strcmp.h @@ -1,5 +1,5 @@ /* Test of u8_strcmp() and u8_strcoll() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u8-strcoll.c b/tests/unistr/test-u8-strcoll.c index 19cc14cc..ab02ebff 100644 --- a/tests/unistr/test-u8-strcoll.c +++ b/tests/unistr/test-u8-strcoll.c @@ -1,5 +1,5 @@ /* Test of u8_strcoll() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u8-strcpy.c b/tests/unistr/test-u8-strcpy.c index 551daa56..06333a3c 100644 --- a/tests/unistr/test-u8-strcpy.c +++ b/tests/unistr/test-u8-strcpy.c @@ -1,5 +1,5 @@ /* Test of u8_strcpy() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u8-strdup.c b/tests/unistr/test-u8-strdup.c index 03e31161..4e226124 100644 --- a/tests/unistr/test-u8-strdup.c +++ b/tests/unistr/test-u8-strdup.c @@ -1,5 +1,5 @@ /* Test of u8_strdup() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u8-strlen.c b/tests/unistr/test-u8-strlen.c index 30e3ccbd..e149d739 100644 --- a/tests/unistr/test-u8-strlen.c +++ b/tests/unistr/test-u8-strlen.c @@ -1,5 +1,5 @@ /* Test of u8_strlen() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u8-strmblen.c b/tests/unistr/test-u8-strmblen.c index 3294445b..cf138251 100644 --- a/tests/unistr/test-u8-strmblen.c +++ b/tests/unistr/test-u8-strmblen.c @@ -1,5 +1,5 @@ /* Test of u8_strmblen() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 @@ -36,10 +36,9 @@ main () /* Test ISO 646 unit input. */ { - ucs4_t c; uint8_t buf[2]; - for (c = 1; c < 0x80; c++) + for (ucs4_t c = 1; c < 0x80; c++) { buf[0] = c; buf[1] = 0; diff --git a/tests/unistr/test-u8-strmbtouc.c b/tests/unistr/test-u8-strmbtouc.c index a0ccb661..32ec76e2 100644 --- a/tests/unistr/test-u8-strmbtouc.c +++ b/tests/unistr/test-u8-strmbtouc.c @@ -1,5 +1,5 @@ /* Test of u8_strmbtouc() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 @@ -39,10 +39,9 @@ main () /* Test ISO 646 unit input. */ { - ucs4_t c; uint8_t buf[2]; - for (c = 1; c < 0x80; c++) + for (ucs4_t c = 1; c < 0x80; c++) { buf[0] = c; buf[1] = 0; diff --git a/tests/unistr/test-u8-strncat.c b/tests/unistr/test-u8-strncat.c index 37eb68bb..8b9bd598 100644 --- a/tests/unistr/test-u8-strncat.c +++ b/tests/unistr/test-u8-strncat.c @@ -1,5 +1,5 @@ /* Test of u8_strncat() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u8-strncmp.c b/tests/unistr/test-u8-strncmp.c index e7711049..b29d3e41 100644 --- a/tests/unistr/test-u8-strncmp.c +++ b/tests/unistr/test-u8-strncmp.c @@ -1,5 +1,5 @@ /* Test of u8_strncmp() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u8-strncpy.c b/tests/unistr/test-u8-strncpy.c index acae29a9..becfedbc 100644 --- a/tests/unistr/test-u8-strncpy.c +++ b/tests/unistr/test-u8-strncpy.c @@ -1,5 +1,5 @@ /* Test of u8_strncpy() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u8-strnlen.c b/tests/unistr/test-u8-strnlen.c index db720513..15e71353 100644 --- a/tests/unistr/test-u8-strnlen.c +++ b/tests/unistr/test-u8-strnlen.c @@ -1,5 +1,5 @@ /* Test of u8_strnlen() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u8-strstr.c b/tests/unistr/test-u8-strstr.c index 340016f5..86aaea3e 100644 --- a/tests/unistr/test-u8-strstr.c +++ b/tests/unistr/test-u8-strstr.c @@ -1,5 +1,5 @@ /* Test of u8_strstr() function. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-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 diff --git a/tests/unistr/test-u8-strtok.c b/tests/unistr/test-u8-strtok.c index b61670b9..aa64bc03 100644 --- a/tests/unistr/test-u8-strtok.c +++ b/tests/unistr/test-u8-strtok.c @@ -1,5 +1,5 @@ /* Test of u8_strtok() function. - Copyright (C) 2015-2025 Free Software Foundation, Inc. + Copyright (C) 2015-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 diff --git a/tests/unistr/test-u8-to-u16.c b/tests/unistr/test-u8-to-u16.c index 3cbf675b..8edd01de 100644 --- a/tests/unistr/test-u8-to-u16.c +++ b/tests/unistr/test-u8-to-u16.c @@ -1,5 +1,5 @@ /* Test of u8_to_u16() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u8-to-u32.c b/tests/unistr/test-u8-to-u32.c index b4c5308a..2286e9a8 100644 --- a/tests/unistr/test-u8-to-u32.c +++ b/tests/unistr/test-u8-to-u32.c @@ -1,5 +1,5 @@ /* Test of u8_to_u32() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 diff --git a/tests/unistr/test-u8-uctomb.c b/tests/unistr/test-u8-uctomb.c index 31ae2e56..40f99744 100644 --- a/tests/unistr/test-u8-uctomb.c +++ b/tests/unistr/test-u8-uctomb.c @@ -1,5 +1,5 @@ /* Test of u8_uctomb() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-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 @@ -28,24 +28,20 @@ int main () { /* Test ISO 646 character, in particular the NUL character. */ - { - ucs4_t uc; - - for (uc = 0; uc < 0x80; uc++) - { - uint8_t buf[5] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC }; - int ret; + for (ucs4_t uc = 0; uc < 0x80; uc++) + { + uint8_t buf[5] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC }; + int ret; - ret = u8_uctomb (buf, uc, 0); - ASSERT (ret == -2); - ASSERT (buf[0] == MAGIC); + ret = u8_uctomb (buf, uc, 0); + ASSERT (ret == -2); + ASSERT (buf[0] == MAGIC); - ret = u8_uctomb (buf, uc, 1); - ASSERT (ret == 1); - ASSERT (buf[0] == uc); - ASSERT (buf[1] == MAGIC); - } - } + ret = u8_uctomb (buf, uc, 1); + ASSERT (ret == 1); + ASSERT (buf[0] == uc); + ASSERT (buf[1] == MAGIC); + } /* Test 2-byte character. */ { @@ -133,14 +129,12 @@ main () { ucs4_t invalid[] = { 0x110000, 0xD800, 0xDBFF, 0xDC00, 0xDFFF }; uint8_t buf[5] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC }; - size_t i; - for (i = 0; i < SIZEOF (invalid); i++) + for (size_t i = 0; i < SIZEOF (invalid); i++) { ucs4_t uc = invalid[i]; - int n; - for (n = 0; n <= 4; n++) + for (int n = 0; n <= 4; n++) { int ret = u8_uctomb (buf, uc, n); ASSERT (ret == -1); diff --git a/tests/unistr/test-unistr-h.c b/tests/unistr/test-unistr-h.c index 085fcac5..7178348c 100644 --- a/tests/unistr/test-unistr-h.c +++ b/tests/unistr/test-unistr-h.c @@ -1,5 +1,5 @@ /* Test of <unistr.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 |
