svn commit: trunk/uClibc/libc/misc/wchar
carmelo at uclibc.org
carmelo at uclibc.org
Mon Sep 29 08:51:31 UTC 2008
Author: carmelo
Date: 2008-09-29 01:51:31 -0700 (Mon, 29 Sep 2008)
New Revision: 23549
Log:
i18n: Fix mbrtowc function to handle 0xc0 and 0xc1 sequence.
When the first byte of the multibyte sequence start with 0xc0
or 0xc1, the whole sequence is invalid, so the return value must
be -1 (instead of -2).
Fix bug #686.
Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono at st.com>
Acked-by: Carmelo Amoroso <carmelo.amoroso at st.com>
Modified:
trunk/uClibc/libc/misc/wchar/wchar.c
Changeset:
Modified: trunk/uClibc/libc/misc/wchar/wchar.c
===================================================================
--- trunk/uClibc/libc/misc/wchar/wchar.c 2008-09-29 08:16:51 UTC (rev 23548)
+++ trunk/uClibc/libc/misc/wchar/wchar.c 2008-09-29 08:51:31 UTC (rev 23549)
@@ -488,7 +488,8 @@
#ifdef __UCLIBC_MJN3_ONLY__
#warning TODO: Fix range for 16 bit wchar_t case.
#endif
- if ( ((unsigned char)(s[-1] - 0xc0)) < (0xfe - 0xc0) ) {
+ if (( ((unsigned char)(s[-1] - 0xc0)) < (0xfe - 0xc0) ) &&
+ (((unsigned char)s[-1] != 0xc0 ) && ((unsigned char)s[-1] != 0xc1 ))) {
goto START;
}
BAD:
More information about the uClibc-cvs
mailing list