diff options
author | Denys Vlasenko | 2010-01-25 02:00:16 +0100 |
---|---|---|
committer | Denys Vlasenko | 2010-01-25 02:00:16 +0100 |
commit | 307b24c85172a40909d634e615a68c8c65770697 (patch) | |
tree | 04e23e5c5d09233ad4b58adde7a1d88a6884c294 /libbb/unicode.c | |
parent | 2315c8854c2be911283c5b4b7eb3f37332758abb (diff) | |
download | busybox-307b24c85172a40909d634e615a68c8c65770697.zip busybox-307b24c85172a40909d634e615a68c8c65770697.tar.gz |
testsuite-discovered fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/unicode.c')
-rw-r--r-- | libbb/unicode.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libbb/unicode.c b/libbb/unicode.c index 844c154..39b173e 100644 --- a/libbb/unicode.c +++ b/libbb/unicode.c @@ -203,11 +203,13 @@ size_t FAST_FUNC mbstowcs(wchar_t *dest, const char *src, size_t n) while (n) { wchar_t wc; - const char *rc = mbstowc_internal(dest ? dest : &wc, src); - if (rc == NULL) /* error */ + src = mbstowc_internal(&wc, src); + if (src == NULL) /* error */ return (size_t) -1L; if (dest) - dest++; + *dest++ = wc; + if (wc == 0) /* end-of-string */ + break; n--; } |