diff options
author | Mattias Andrée <maandree@operamail.com> | 2015-09-02 04:44:53 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2015-09-02 04:44:53 +0200 |
commit | bd5d2162efae9913f2666c80bdf944a65ea95590 (patch) | |
tree | 7cfda8110528b22a8377bf9fdf526b9e203beda9 /src/wchar/wcscmp.c | |
parent | remove old debug line (diff) | |
download | slibc-bd5d2162efae9913f2666c80bdf944a65ea95590.tar.gz slibc-bd5d2162efae9913f2666c80bdf944a65ea95590.tar.bz2 slibc-bd5d2162efae9913f2666c80bdf944a65ea95590.tar.xz |
fix more errors
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/wchar/wcscmp.c')
-rw-r--r-- | src/wchar/wcscmp.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/wchar/wcscmp.c b/src/wchar/wcscmp.c index c9d1180..7539458 100644 --- a/src/wchar/wcscmp.c +++ b/src/wchar/wcscmp.c @@ -16,7 +16,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <wchar.h> -#include <inttypes.h> +#include <stdint.h> #include <wctype.h> @@ -111,7 +111,7 @@ int wcsncmp(const wchar_t* a, const wchar_t* b, size_t length) int wcsncasecmp(const wchar_t* a, const wchar_t* b, size_t length) { wchar_t c1, c2; - for (; size--; a++, b++) + for (; length--; a++, b++) if (*a != *b) { c1 = iswalpha(*a) ? towlower(*a) : *a; @@ -119,6 +119,9 @@ int wcsncasecmp(const wchar_t* a, const wchar_t* b, size_t length) if (c1 < c2) return -1; if (c1 > c2) return +1; } + else if (!*a && !*b) return 0; + else if (!*a) return -1; + else if (!*b) return +1; return 0; } |