aboutsummaryrefslogtreecommitdiff
path: root/localedata/tests-mbwc/tst_wcsncmp.c
diff options
context:
space:
mode:
authorStefan Liebler <stli@linux.vnet.ibm.com>2015-04-13 21:23:10 +0200
committerAndreas Krebbel <krebbel@linux.vnet.ibm.com>2015-04-13 21:25:04 +0200
commit920a0395ba9fa5949ec87aaf5daa0259da16749d (patch)
treef590d2c50132feb89be712a38754faaf3c7f45c6 /localedata/tests-mbwc/tst_wcsncmp.c
parentde8aadd52c97f9a04d5e8709b16dc5baf9292a09 (diff)
downloadglibc-920a0395ba9fa5949ec87aaf5daa0259da16749d.tar
glibc-920a0395ba9fa5949ec87aaf5daa0259da16749d.tar.gz
glibc-920a0395ba9fa5949ec87aaf5daa0259da16749d.tar.bz2
glibc-920a0395ba9fa5949ec87aaf5daa0259da16749d.zip
Use correct signedness in wcsncmp
[BZ #18206] * wcsmbs/wcsncmp.c (wcsncmp): Compare as wchar_t, not wint_t. Use signed comparision instead of substraction to avoid overflow bug. * localedata/tests-mbwc/tst_wcsncmp.c (tst_wcsncmp): Take the sign of ret. * localedata/tests-mbwc/dat_wcsncmp.c (tst_wcsncmp_loc): Do not expect precise return values. Only the sign matters. * wcsmbs/Makefile (strop-tests): Add wcsncmp. * wcsmbs/test-wcsncmp.c: New File. * string/test-strncmp.c: Add wcsncmp support.
Diffstat (limited to 'localedata/tests-mbwc/tst_wcsncmp.c')
-rw-r--r--localedata/tests-mbwc/tst_wcsncmp.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/localedata/tests-mbwc/tst_wcsncmp.c b/localedata/tests-mbwc/tst_wcsncmp.c
index d046ecd133..f93ca49e47 100644
--- a/localedata/tests-mbwc/tst_wcsncmp.c
+++ b/localedata/tests-mbwc/tst_wcsncmp.c
@@ -24,6 +24,7 @@ tst_wcsncmp (FILE * fp, int debug_flg)
ws2 = TST_INPUT (wcsncmp).ws2;
n = TST_INPUT (wcsncmp).n;
ret = wcsncmp (ws1, ws2, n);
+ ret = (ret > 0 ? 1 : ret < 0 ? -1 : 0);
if (debug_flg)
{