diff options
| author | Jörg Frings-Fürst <debian@jff.email> | 2026-03-10 13:24:07 +0100 |
|---|---|---|
| committer | Jörg Frings-Fürst <debian@jff.email> | 2026-03-10 13:24:07 +0100 |
| commit | cfd1f17f1a85d95ea12bca8dae42add7dad1ad11 (patch) | |
| tree | 8016486f8ee7157213f2d09ff2491bfa9c94638a /tests/unistr | |
| parent | 14e4d584d0121031ec40e6c35869745f1747ff29 (diff) | |
| parent | 1403307d6e2fb4e7b5d97a35f40d1e95134561ab (diff) | |
Merge branch 'release/debian/1.4.2-1'HEADdebian/1.4.2-1master
Diffstat (limited to 'tests/unistr')
136 files changed, 378 insertions, 471 deletions
diff --git a/tests/unistr/test-chr.h b/tests/unistr/test-chr.h index b5fe4adb..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-2024 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 3eb1be32..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-2024 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 d0547904..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-2024 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 c380101d..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-2024 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 2dc66fa8..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-2024 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 74acb9a6..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-2024 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 a1572803..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-2024 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 ca59422a..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-2024 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 a9d6031d..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-2024 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 3fc03d51..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-2024 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 8faeb0c8..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-2024 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 ad102c2e..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-2024 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 ea8c1321..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-2024 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 6dffdace..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-2024 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 ccc8b824..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-2024 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 c505fc26..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-2024 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 64fecebb..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-2024 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 c3ad19c6..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-2024 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 abc83fb9..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-2024 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 36783cdf..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-2024 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 74272d3b..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-2024 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 3573938d..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-2024 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 5f0b16e5..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-2024 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 075c8c45..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-2024 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 2eb0dbd0..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-2024 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 bbc16456..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-2024 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 cf9993fa..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-2024 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 d67980ea..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-2024 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 76c479a1..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-2024 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 da6a9057..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-2024 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 21a3918a..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-2024 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 5c33948a..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-2024 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 593ddb11..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-2024 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 887912b3..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-2024 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 57dcfa58..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-2024 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 b20741e2..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-2024 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 11b3a1a4..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-2024 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 7a6597dd..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-2024 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 616041d2..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-2024 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 1986fae3..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-2024 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 8ec36d4c..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-2024 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 5047b7a5..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-2024 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 d4b6311f..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-2024 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 3a0f3b18..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-2024 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 5e3d6940..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-2024 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 9d2f475d..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-2024 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 936bddcb..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-2024 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 8c7ca858..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-2024 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 c9f28096..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-2024 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 3fef0324..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-2024 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 e69c314e..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-2024 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 1424c02b..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-2024 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 4ac462d1..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-2024 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 cb4bcf3d..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-2024 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 d74cddc0..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-2024 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 be09783d..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-2024 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 f00a913b..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-2024 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 91977733..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-2024 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 03b9eaa8..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-2024 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 b64b8ed7..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-2024 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 474681ff..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-2024 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 f866ab04..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-2024 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 0fbb8c0a..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-2024 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 f3f9d106..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-2024 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 0ba5f8b4..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-2024 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 513e2607..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-2024 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 ed72229c..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-2024 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 25c9eafc..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-2024 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 63bc20d4..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-2024 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 37e6342f..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-2024 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 4267fe1e..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-2024 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 82c9a379..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-2024 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 ee3811f4..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-2024 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 af77cc25..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-2024 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 d04b24aa..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-2024 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 99e644dc..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-2024 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 c6ac1751..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-2024 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 37d8abac..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-2024 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 64e1b5cc..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-2024 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 721f8903..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-2024 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 ef9f319d..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-2024 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 4b149103..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-2024 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 6f9f31d7..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-2024 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 22a6e70e..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-2024 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 f81701fe..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-2024 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 d06ab615..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-2024 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 8dfdf64f..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-2024 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 591684d4..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-2024 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 7a0863ee..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-2024 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 ba563deb..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-2024 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 5bdac739..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-2024 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 a800a66d..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-2024 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 672c9cce..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-2024 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 b261b855..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-2024 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 963e0fe7..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-2024 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 22691c6d..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-2024 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 24d83410..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-2024 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 f3b3fc61..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-2024 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 c0827063..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-2024 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 920edf23..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-2024 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 b5063784..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-2024 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 d0e11542..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-2024 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 33987177..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-2024 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 3048b4f3..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-2024 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 9793dc31..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-2024 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 a4727a40..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-2024 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 f3779b02..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-2024 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 dfe70be3..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-2024 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 aae840de..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-2024 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 a0c7ad79..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-2024 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 d46e1fba..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-2024 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 dbd83ad5..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-2024 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 418bdaed..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-2024 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 d06e0e0b..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-2024 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 6cdb850c..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-2024 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 c51e2184..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-2024 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 2a999f66..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-2024 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 e404ea79..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-2024 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 e60b8611..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-2024 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 177d4bfc..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-2024 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 de67daf4..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-2024 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 9cf181b1..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-2024 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 fdb76026..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-2024 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 02a38b89..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-2024 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 a18637e8..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-2024 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 9eac79f1..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-2024 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 eef95ad4..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-2024 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 a45be4ad..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-2024 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 f6f9c05d..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-2024 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 8d799c5b..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-2024 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 12da0fb5..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-2024 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 02d4b93d..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-2024 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 546ad221..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-2024 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 2180b6bd..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-2024 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 0d030a7d..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-2024 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 new file mode 100644 index 00000000..7178348c --- /dev/null +++ b/tests/unistr/test-unistr-h.c @@ -0,0 +1,26 @@ +/* Test of <unistr.h>. + 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 + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include <unistr.h> + +int +main (void) +{ + return 0; +} |
