fix failure of mbsrtowcs to record stop position when dest is full

This commit is contained in:
Rich Felker 2013-06-29 16:16:47 -04:00
parent 9b732fe51b
commit 4ca442157e
1 changed files with 4 additions and 1 deletions

View File

@ -54,7 +54,10 @@ resume0:
wn--; wn--;
c = 0; c = 0;
} else for (;;) { } else for (;;) {
if (!wn) return wn0; if (!wn) {
*src = (const void *)s;
return wn0;
}
if (*s-1u < 0x7f && (uintptr_t)s%4 == 0) { if (*s-1u < 0x7f && (uintptr_t)s%4 == 0) {
while (wn>=4 && !(( *(uint32_t*)s | *(uint32_t*)s-0x01010101) & 0x80808080)) { while (wn>=4 && !(( *(uint32_t*)s | *(uint32_t*)s-0x01010101) & 0x80808080)) {
*ws++ = *s++; *ws++ = *s++;