|
|
c6d234 |
Fix type errors in string tests introduced by the patches to implement
|
|
|
c6d234 |
rhbz#1268008.
|
|
|
c6d234 |
|
|
|
c6d234 |
Patch originally from Stefan Liebler <STLI@de.ibm.com>.
|
|
|
c6d234 |
|
|
|
c6d234 |
diff --git a/benchtests/bench-stpncpy.c b/benchtests/bench-stpncpy.c
|
|
|
c6d234 |
index e428102f5db30cfc..d37b401e303fd4bc 100644
|
|
|
c6d234 |
--- a/benchtests/bench-stpncpy.c
|
|
|
c6d234 |
+++ b/benchtests/bench-stpncpy.c
|
|
|
c6d234 |
@@ -74,4 +74,5 @@ STUPID_STPNCPY (CHAR *dst, const CHAR *src, size_t n)
|
|
|
c6d234 |
return dst + nc;
|
|
|
c6d234 |
}
|
|
|
c6d234 |
|
|
|
c6d234 |
+#undef CHAR
|
|
|
c6d234 |
#include "bench-strncpy.c"
|
|
|
c6d234 |
diff --git a/benchtests/bench-strncpy.c b/benchtests/bench-strncpy.c
|
|
|
c6d234 |
index 2cfd56ab5ab2cb06..94f66f93acfd18fc 100644
|
|
|
c6d234 |
--- a/benchtests/bench-strncpy.c
|
|
|
c6d234 |
+++ b/benchtests/bench-strncpy.c
|
|
|
c6d234 |
@@ -144,6 +144,8 @@ do_test (size_t align1, size_t align2, size_t len, size_t n, int max_char)
|
|
|
c6d234 |
size_t i;
|
|
|
c6d234 |
CHAR *s1, *s2;
|
|
|
c6d234 |
|
|
|
c6d234 |
+/* For wcsncpy: align1 and align2 here mean alignment not in bytes,
|
|
|
c6d234 |
+ but in wchar_ts, in bytes it will equal to align * (sizeof (wchar_t)). */
|
|
|
c6d234 |
align1 &= 7;
|
|
|
c6d234 |
if ((align1 + len) * sizeof (CHAR) >= page_size)
|
|
|
c6d234 |
return;
|
|
|
c6d234 |
@@ -152,8 +154,8 @@ do_test (size_t align1, size_t align2, size_t len, size_t n, int max_char)
|
|
|
c6d234 |
if ((align2 + len) * sizeof (CHAR) >= page_size)
|
|
|
c6d234 |
return;
|
|
|
c6d234 |
|
|
|
c6d234 |
- s1 = (CHAR *) (buf1 + align1);
|
|
|
c6d234 |
- s2 = (CHAR *) (buf2 + align2);
|
|
|
c6d234 |
+ s1 = (CHAR *) (buf1) + align1;
|
|
|
c6d234 |
+ s2 = (CHAR *) (buf2) + align2;
|
|
|
c6d234 |
|
|
|
c6d234 |
for (i = 0; i < len; ++i)
|
|
|
c6d234 |
s1[i] = 32 + 23 * i % (max_char - 32);
|
|
|
c6d234 |
diff --git a/benchtests/bench-strspn.c b/benchtests/bench-strspn.c
|
|
|
c6d234 |
index e1f227278480ac7a..39039d09915e191e 100644
|
|
|
c6d234 |
--- a/benchtests/bench-strspn.c
|
|
|
c6d234 |
+++ b/benchtests/bench-strspn.c
|
|
|
c6d234 |
@@ -139,7 +139,7 @@ do_test (size_t align, size_t pos, size_t len)
|
|
|
c6d234 |
for (i = 0; i < pos; ++i)
|
|
|
c6d234 |
s[i] = acc[random () % len];
|
|
|
c6d234 |
s[pos] = random () & BIG_CHAR;
|
|
|
c6d234 |
- if (strchr (acc, s[pos]))
|
|
|
c6d234 |
+ if (STRCHR (acc, s[pos]))
|
|
|
c6d234 |
s[pos] = '\0';
|
|
|
c6d234 |
else
|
|
|
c6d234 |
{
|
|
|
c6d234 |
diff --git a/string/test-stpncpy.c b/string/test-stpncpy.c
|
|
|
c6d234 |
index 69c8181269523def..f35340957f7092a9 100644
|
|
|
c6d234 |
--- a/string/test-stpncpy.c
|
|
|
c6d234 |
+++ b/string/test-stpncpy.c
|
|
|
c6d234 |
@@ -75,4 +75,5 @@ STUPID_STPNCPY (CHAR *dst, const CHAR *src, size_t n)
|
|
|
c6d234 |
return dst + nc;
|
|
|
c6d234 |
}
|
|
|
c6d234 |
|
|
|
c6d234 |
+#undef CHAR
|
|
|
c6d234 |
#include "test-strncpy.c"
|
|
|
c6d234 |
diff --git a/string/test-strcat.c b/string/test-strcat.c
|
|
|
c6d234 |
index a822733cff7fd39e..dca8dd47aa119ce0 100644
|
|
|
c6d234 |
--- a/string/test-strcat.c
|
|
|
c6d234 |
+++ b/string/test-strcat.c
|
|
|
c6d234 |
@@ -71,7 +71,7 @@ SIMPLE_STRCAT (CHAR *dst, const CHAR *src)
|
|
|
c6d234 |
}
|
|
|
c6d234 |
|
|
|
c6d234 |
static void
|
|
|
c6d234 |
-do_one_test (impl_t *impl, CHAR *dst, const char *src)
|
|
|
c6d234 |
+do_one_test (impl_t *impl, CHAR *dst, const CHAR *src)
|
|
|
c6d234 |
{
|
|
|
c6d234 |
size_t k = STRLEN (dst);
|
|
|
c6d234 |
if (CALL (impl, dst, src) != dst)
|
|
|
c6d234 |
diff --git a/string/test-strncmp.c b/string/test-strncmp.c
|
|
|
c6d234 |
index 950bf248385787b6..63b16eaa385f942a 100644
|
|
|
c6d234 |
--- a/string/test-strncmp.c
|
|
|
c6d234 |
+++ b/string/test-strncmp.c
|
|
|
c6d234 |
@@ -210,7 +210,7 @@ do_test (size_t align1, size_t align2, size_t len, size_t n, int max_char,
|
|
|
c6d234 |
if (align1 + (n + 1) * CHARBYTES >= page_size)
|
|
|
c6d234 |
return;
|
|
|
c6d234 |
|
|
|
c6d234 |
- align2 &= 7;
|
|
|
c6d234 |
+ align2 &= 63;
|
|
|
c6d234 |
if (align2 + (n + 1) * CHARBYTES >= page_size)
|
|
|
c6d234 |
return;
|
|
|
c6d234 |
|
|
|
c6d234 |
@@ -359,8 +359,8 @@ check1 (void)
|
|
|
c6d234 |
size_t i, offset;
|
|
|
c6d234 |
int exp_result;
|
|
|
c6d234 |
|
|
|
c6d234 |
- strcpy(s1, L("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrs"));
|
|
|
c6d234 |
- strcpy(s2, L("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkLMNOPQRSTUV"));
|
|
|
c6d234 |
+ STRCPY(s1, L("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrs"));
|
|
|
c6d234 |
+ STRCPY(s2, L("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkLMNOPQRSTUV"));
|
|
|
c6d234 |
|
|
|
c6d234 |
/* Check possible overflow bug for wcsncmp */
|
|
|
c6d234 |
s1[4] = CHAR__MAX;
|
|
|
c6d234 |
diff --git a/string/test-strncpy.c b/string/test-strncpy.c
|
|
|
c6d234 |
index bdccc98301f22c10..1dbc57d9c33e6eb9 100644
|
|
|
c6d234 |
--- a/string/test-strncpy.c
|
|
|
c6d234 |
+++ b/string/test-strncpy.c
|
|
|
c6d234 |
@@ -94,7 +94,7 @@ STUPID_STRNCPY (CHAR *dst, const CHAR *src, size_t n)
|
|
|
c6d234 |
typedef CHAR *(*proto_t) (CHAR *, const CHAR *, size_t);
|
|
|
c6d234 |
|
|
|
c6d234 |
static void
|
|
|
c6d234 |
-do_one_test (impl_t *impl, CHAR *dst, const char *src, size_t len, size_t n)
|
|
|
c6d234 |
+do_one_test (impl_t *impl, CHAR *dst, const CHAR *src, size_t len, size_t n)
|
|
|
c6d234 |
{
|
|
|
c6d234 |
if (CALL (impl, dst, src, n) != STRNCPY_RESULT (dst, len, n))
|
|
|
c6d234 |
{
|
|
|
c6d234 |
diff --git a/string/test-strnlen.c b/string/test-strnlen.c
|
|
|
c6d234 |
index 43db896e917ec4e0..db999b53fb546460 100644
|
|
|
c6d234 |
--- a/string/test-strnlen.c
|
|
|
c6d234 |
+++ b/string/test-strnlen.c
|
|
|
c6d234 |
@@ -80,7 +80,7 @@ do_test (size_t align, size_t len, size_t maxlen, int max_char)
|
|
|
c6d234 |
CHAR *buf = (CHAR *) (buf1);
|
|
|
c6d234 |
|
|
|
c6d234 |
for (i = 0; i < len; ++i)
|
|
|
c6d234 |
- buf[align + i] = 1 + 7 * i % max_char;
|
|
|
c6d234 |
+ buf[align + i] = 1 + 11111 * i % max_char;
|
|
|
c6d234 |
buf[align + len] = 0;
|
|
|
c6d234 |
|
|
|
c6d234 |
FOR_EACH_IMPL (impl, 0)
|