From 30792221a919ccbdf3e214496451761ae20ec199 Mon Sep 17 00:00:00 2001 From: Manuel Novoa III Date: Mon, 18 Aug 2003 21:14:27 +0000 Subject: _wchar_utf8sntowcs and _wchar_wcsntoutf8s now set errno if EILSEQ. --- libc/misc/wchar/wchar.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'libc') 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 -- cgit v1.2.3