for (; len && (k = mbrtowc (&wc, s, len, &mbstate)); s += k, len -= k) {
if (k == (size_t) (-1) || k == (size_t) (-2)) {
k = (k == (size_t) (-1)) ? 1 : len;
for (; len && (k = mbrtowc (&wc, s, len, &mbstate)); s += k, len -= k) {
if (k == (size_t) (-1) || k == (size_t) (-2)) {
k = (k == (size_t) (-1)) ? 1 : len;