summaryrefslogtreecommitdiff
path: root/tests/unistr/test-chr.h
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2024-03-24 08:54:48 +0100
committerJörg Frings-Fürst <debian@jff.email>2024-03-24 08:54:48 +0100
commit163a663518f33bab48b28431972e580b366b4d49 (patch)
treef518ffabaca4a0b93f0103d617e803792d3b0b43 /tests/unistr/test-chr.h
parent1b3a8d5ad2ea2f099d514d9dd51ebf926a628076 (diff)
parentdd0000f7e25abe6c28d4329d324fd7fcab54094f (diff)
Merge branch 'release/debian/1.2-1'HEADdebian/1.2-1master
Diffstat (limited to 'tests/unistr/test-chr.h')
-rw-r--r--tests/unistr/test-chr.h19
1 files changed, 10 insertions, 9 deletions
diff --git a/tests/unistr/test-chr.h b/tests/unistr/test-chr.h
index f8f87015..f7bfc2ba 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-2022 Free Software Foundation, Inc.
+ Copyright (C) 2008-2024 Free Software Foundation, Inc.
This 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,7 +20,6 @@ int
main (void)
{
size_t size = 0x100000;
- size_t i;
size_t length;
UNIT *input;
uint32_t *input32 = (uint32_t *) malloc (size * sizeof (uint32_t));
@@ -29,7 +28,7 @@ main (void)
input32[0] = 'a';
input32[1] = 'b';
u32_set (input32 + 2, 'c', 1024);
- for (i = 1026; i < size - 2; i += 63)
+ for (size_t i = 1026; i < size - 2; i += 63)
{
size_t last = i + 63 < size - 2 ? i + 63 : size - 2;
ucs4_t uc = 'd' | (i - 1026);
@@ -48,9 +47,11 @@ main (void)
ASSERT (U_CHR (input, length, 'a') == input);
ASSERT (U_CHR (input, 0, 'a') == NULL);
- void *page_boundary = zerosize_ptr ();
- if (page_boundary)
- ASSERT (U_CHR (page_boundary, 0, 'a') == NULL);
+ {
+ void *page_boundary = zerosize_ptr ();
+ if (page_boundary != NULL)
+ ASSERT (U_CHR (page_boundary, 0, 'a') == NULL);
+ }
ASSERT (U_CHR (input, length, 'b') == input + 1);
ASSERT (U_CHR (input, length, 'c') == input + 2);
@@ -59,7 +60,7 @@ main (void)
{
UNIT *exp = input + 1026;
UNIT *prev = input + 1;
- for (i = 1026; i < size - 2; i += 63)
+ for (size_t i = 1026; i < size - 2; i += 63)
{
UNIT c[6];
size_t n;
@@ -108,14 +109,14 @@ main (void)
/* Check that uN_chr() does not read past the first occurrence of the
byte being searched. */
{
- char *page_boundary = (char *) zerosize_ptr ();
+ UNIT *page_boundary = zerosize_ptr ();
size_t n;
if (page_boundary != NULL)
{
for (n = 1; n <= 500 / sizeof (UNIT); n++)
{
- UNIT *mem = (UNIT *) (page_boundary - n * sizeof (UNIT));
+ UNIT *mem = page_boundary - n;
U_SET (mem, 'X', n);
ASSERT (U_CHR (mem, n, 'U') == NULL);