summaryrefslogtreecommitdiff
path: root/libc/misc
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2003-08-18 21:14:27 +0000
committerManuel Novoa III <mjn3@codepoet.org>2003-08-18 21:14:27 +0000
commit30792221a919ccbdf3e214496451761ae20ec199 (patch)
tree5791a53bef07c0f63c4ed1c1ca63152af20ca373 /libc/misc
parent3e332011a806905ce35fc3af42118ad49d3978f5 (diff)
_wchar_utf8sntowcs and _wchar_wcsntoutf8s now set errno if EILSEQ.
Diffstat (limited to 'libc/misc')
-rw-r--r--libc/misc/wchar/wchar.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libc/misc/wchar/wchar.c b/libc/misc/wchar/wchar.c
index aa0c2735a..4fc96f430 100644
--- a/libc/misc/wchar/wchar.c
+++ b/libc/misc/wchar/wchar.c
@@ -89,6 +89,9 @@
* Aug 1, 2003
* Bug fix for mbrtowc.
*
+ * Aug 18, 2003
+ * Bug fix: _wchar_utf8sntowcs and _wchar_wcsntoutf8s now set errno if EILSEQ.
+ *
* Manuel
*/
@@ -446,6 +449,7 @@ size_t _wchar_utf8sntowcs(wchar_t *__restrict pwc, size_t wn,
}
goto DONE;
}
+ __set_errno(EILSEQ);
return (size_t) -1; /* We're in an error state. */
#endif
}
@@ -470,6 +474,7 @@ size_t _wchar_utf8sntowcs(wchar_t *__restrict pwc, size_t wn,
#else
ps->mask = mask;
ps->wc = 0xffffU;
+ __set_errno(EILSEQ);
return (size_t) -1; /* Illegal start byte! */
#endif
@@ -614,11 +619,13 @@ size_t _wchar_wcsntoutf8s(char *__restrict s, size_t n,
#endif
|| ( ((__uwchar_t)(wc - 0xd800U)) < (0xe000U - 0xd800U) )
) {
+ __set_errno(EILSEQ);
return (size_t) -1;
}
#else /* KUHN */
#if UTF_8_MAX_LEN != 3
if (wc > 0x7fffffffUL) { /* Value too large. */
+ __set_errno(EILSEQ);
return (size_t) -1;
}
#endif