summaryrefslogtreecommitdiff
path: root/libc/wcsmbs
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2011-10-25 00:37:10 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2011-10-25 00:37:10 +0000
commit4bbe4e2185c5484328182720ff7b3bb4f9593bff (patch)
treecd67e40a74928c0f58d4f5b79d2e260e4099fee7 /libc/wcsmbs
parent91b4be71461f78cabe1fb5f164cea71b60e9e98a (diff)
downloadeglibc2-4bbe4e2185c5484328182720ff7b3bb4f9593bff.tar.gz
Merge changes between r15223 and r15532 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@15545 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc/wcsmbs')
-rw-r--r--libc/wcsmbs/Makefile5
-rw-r--r--libc/wcsmbs/test-wcschr.c2
-rw-r--r--libc/wcsmbs/test-wcscmp.c2
-rw-r--r--libc/wcsmbs/test-wcslen.c2
-rw-r--r--libc/wcsmbs/test-wmemcmp.c2
-rw-r--r--libc/wcsmbs/wcscmp.c4
-rw-r--r--libc/wcsmbs/wcslen.c11
-rw-r--r--libc/wcsmbs/wmemcmp.c21
8 files changed, 33 insertions, 16 deletions
diff --git a/libc/wcsmbs/Makefile b/libc/wcsmbs/Makefile
index 3af34464b..bffdaf4c8 100644
--- a/libc/wcsmbs/Makefile
+++ b/libc/wcsmbs/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1995-2000,2002,2003,2004,2005,2006,2007
+# Copyright (C) 1995-2000,2002,2003,2004,2005,2006,2007,2011
# Free Software Foundation, Inc.
# This file is part of the GNU C Library.
@@ -49,12 +49,13 @@ routines-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
routines-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \
+= isoc99_wscanf isoc99_vwscanf isoc99_fwscanf isoc99_vfwscanf
+strop-tests := wcscmp wmemcmp wcslen wcschr
tests := tst-wchar-h
tests-$(OPTION_EGLIBC_LOCALE_CODE) \
+= tst-btowc tst-mbrtowc tst-mbrtowc2 tst-wcrtomb
tests-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
+= tst-wcstof wcsmbs-tst1 tst-wcsnlen \
- tst-wcpncpy tst-mbsrtowcs wcsatcliff
+ tst-wcpncpy tst-mbsrtowcs wcsatcliff $(addprefix test-,$(strop-tests))
include ../Rules
diff --git a/libc/wcsmbs/test-wcschr.c b/libc/wcsmbs/test-wcschr.c
new file mode 100644
index 000000000..be0abf7ae
--- /dev/null
+++ b/libc/wcsmbs/test-wcschr.c
@@ -0,0 +1,2 @@
+#define WIDE 1
+#include "../string/test-strchr.c"
diff --git a/libc/wcsmbs/test-wcscmp.c b/libc/wcsmbs/test-wcscmp.c
new file mode 100644
index 000000000..aa18c30a6
--- /dev/null
+++ b/libc/wcsmbs/test-wcscmp.c
@@ -0,0 +1,2 @@
+#define WIDE 1
+#include "../string/test-strcmp.c"
diff --git a/libc/wcsmbs/test-wcslen.c b/libc/wcsmbs/test-wcslen.c
new file mode 100644
index 000000000..496fa185e
--- /dev/null
+++ b/libc/wcsmbs/test-wcslen.c
@@ -0,0 +1,2 @@
+#define WIDE 1
+#include "../string/test-strlen.c"
diff --git a/libc/wcsmbs/test-wmemcmp.c b/libc/wcsmbs/test-wmemcmp.c
new file mode 100644
index 000000000..73bc4b72c
--- /dev/null
+++ b/libc/wcsmbs/test-wmemcmp.c
@@ -0,0 +1,2 @@
+#define WIDE 1
+#include "../string/test-memcmp.c"
diff --git a/libc/wcsmbs/wcscmp.c b/libc/wcsmbs/wcscmp.c
index 6c93f702f..ddbd4aa93 100644
--- a/libc/wcsmbs/wcscmp.c
+++ b/libc/wcsmbs/wcscmp.c
@@ -37,11 +37,11 @@ WCSCMP (s1, s2)
{
c1 = (wint_t) *s1++;
c2 = (wint_t) *s2++;
- if (c1 == L'\0')
+ if (c2 == L'\0')
return c1 - c2;
}
while (c1 == c2);
- return c1 - c2;
+ return c1 < c2 ? -1 : 1;
}
libc_hidden_def (WCSCMP)
diff --git a/libc/wcsmbs/wcslen.c b/libc/wcsmbs/wcslen.c
index 1bced4bc9..4d7972b7c 100644
--- a/libc/wcsmbs/wcslen.c
+++ b/libc/wcsmbs/wcslen.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1997, 1998, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
@@ -19,10 +19,13 @@
#include <wchar.h>
-
/* Return length of string S. */
+#ifndef WCSLEN
+# define WCSLEN __wcslen
+#endif
+
size_t
-__wcslen (s)
+WCSLEN (s)
const wchar_t *s;
{
size_t len = 0;
@@ -40,4 +43,6 @@ __wcslen (s)
return len;
}
+#ifndef WCSLEN
weak_alias (__wcslen, wcslen)
+#endif
diff --git a/libc/wcsmbs/wmemcmp.c b/libc/wcsmbs/wmemcmp.c
index c6a321b89..73c6394f8 100644
--- a/libc/wcsmbs/wmemcmp.c
+++ b/libc/wcsmbs/wmemcmp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
@@ -19,9 +19,12 @@
#include <wchar.h>
+#ifndef WMEMCMP
+# define WMEMCMP wmemcmp
+#endif
int
-wmemcmp (s1, s2, n)
+WMEMCMP (s1, s2, n)
const wchar_t *s1;
const wchar_t *s2;
size_t n;
@@ -34,19 +37,19 @@ wmemcmp (s1, s2, n)
c1 = (wint_t) s1[0];
c2 = (wint_t) s2[0];
if (c1 - c2 != 0)
- return c1 - c2;
+ return c1 > c2 ? 1 : -1;
c1 = (wint_t) s1[1];
c2 = (wint_t) s2[1];
if (c1 - c2 != 0)
- return c1 - c2;
+ return c1 > c2 ? 1 : -1;
c1 = (wint_t) s1[2];
c2 = (wint_t) s2[2];
if (c1 - c2 != 0)
- return c1 - c2;
+ return c1 > c2 ? 1 : -1;
c1 = (wint_t) s1[3];
c2 = (wint_t) s2[3];
if (c1 - c2 != 0)
- return c1 - c2;
+ return c1 > c2 ? 1 : -1;
s1 += 4;
s2 += 4;
n -= 4;
@@ -57,7 +60,7 @@ wmemcmp (s1, s2, n)
c1 = (wint_t) s1[0];
c2 = (wint_t) s2[0];
if (c1 - c2 != 0)
- return c1 - c2;
+ return c1 > c2 ? 1 : -1;
++s1;
++s2;
--n;
@@ -67,7 +70,7 @@ wmemcmp (s1, s2, n)
c1 = (wint_t) s1[0];
c2 = (wint_t) s2[0];
if (c1 - c2 != 0)
- return c1 - c2;
+ return c1 > c2 ? 1 : -1;
++s1;
++s2;
--n;
@@ -77,7 +80,7 @@ wmemcmp (s1, s2, n)
c1 = (wint_t) s1[0];
c2 = (wint_t) s2[0];
if (c1 - c2 != 0)
- return c1 - c2;
+ return c1 > c2 ? 1 : -1;
}
return 0;