diff options
Diffstat (limited to 'lib/libc/locale/utf8.c')
-rw-r--r-- | lib/libc/locale/utf8.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libc/locale/utf8.c b/lib/libc/locale/utf8.c index 8ccfdb1..e096b87 100644 --- a/lib/libc/locale/utf8.c +++ b/lib/libc/locale/utf8.c @@ -1,4 +1,5 @@ /*- + * Copyright 2013 Garrett D'Amore <garrett@damore.org> * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2002-2004 Tim J. Robbins * All rights reserved. @@ -70,7 +71,7 @@ _UTF8_init(struct xlocale_ctype *l, _RuneLocale *rl) l->__mbsnrtowcs = _UTF8_mbsnrtowcs; l->__wcsnrtombs = _UTF8_wcsnrtombs; l->runes = rl; - l->__mb_cur_max = 6; + l->__mb_cur_max = 4; /* * UCS-4 encoding used as the internal representation, so * slots 0x0080-0x00FF are occuped and must be excluded @@ -165,6 +166,7 @@ _UTF8_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n, wch = (unsigned char)*s++ & mask; else wch = us->ch; + for (i = (us->want == 0) ? 1 : 0; i < MIN(want, n); i++) { if ((*s & 0xc0) != 0x80) { /* |