From afaca44046e9d6f7d5ff09228ce08d5b8e0c69dc Mon Sep 17 00:00:00 2001 From: Daniel Reinhold Date: Fri, 25 Oct 2002 11:23:30 +0000 Subject: [PATCH] type fix: replaced int type with proper wchar_t type for several functions (tsk, tsk, tsk) git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1647 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/libroot/posix/stdlib/multibyte.c | 41 ++++++++++----------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/src/kernel/libroot/posix/stdlib/multibyte.c b/src/kernel/libroot/posix/stdlib/multibyte.c index 6f75d14b41..181b327896 100644 --- a/src/kernel/libroot/posix/stdlib/multibyte.c +++ b/src/kernel/libroot/posix/stdlib/multibyte.c @@ -33,43 +33,46 @@ #include + /* * Stub multibyte character functions. * This cheezy implementation is fixed to the native single-byte * character set. */ + + int -mblen(s, n) - const char *s; - size_t n; +mblen(const char *s, size_t n) { if (s == NULL || *s == '\0') return 0; + if (n == 0) return -1; + return 1; } -/*ARGSUSED*/ + int -mbtowc(pwc, s, n) - int *pwc; - const char *s; - size_t n; +mbtowc(wchar_t *pwc, const char *s, size_t n) { if (s == NULL) return 0; + if (n == 0) return -1; + if (pwc) - *pwc = (int) *s; + *pwc = (wchar_t) *s; + return (*s != '\0'); } -/*ARGSUSED*/ + int -wctomb(char *s, int wchar) +wctomb(char *s, wchar_t wchar) { if (s == NULL) return 0; @@ -78,18 +81,15 @@ wctomb(char *s, int wchar) return 1; } -/*ARGSUSED*/ + size_t -mbstowcs(pwcs, s, n) - int *pwcs; - const char *s; - size_t n; +mbstowcs(wchar_t *pwcs, const char *s, size_t n) { int count = 0; if (n != 0) { do { - if ((*pwcs++ = (int) *s++) == 0) + if ((*pwcs++ = (wchar_t) *s++) == 0) break; count++; } while (--n != 0); @@ -98,12 +98,9 @@ mbstowcs(pwcs, s, n) return count; } -/*ARGSUSED*/ + size_t -wcstombs(s, pwcs, n) - char *s; - const int *pwcs; - size_t n; +wcstombs(char *s, const wchar_t *pwcs, size_t n) { int count = 0;