* strfuncs.cc (sys_cp_wcstombs): save and restore previous errno value.
(sys_cp_mbstowcs): Ditto.
This commit is contained in:
parent
0e6edb13c6
commit
4dff3fed7d
|
@ -1,3 +1,9 @@
|
|||
2009-05-08 Corinna Vinschen <corinna@vinschen.de>
|
||||
IWAMURO Motonori <deenheart@gmail.com>
|
||||
|
||||
* strfuncs.cc (sys_cp_wcstombs): save and restore previous errno value.
|
||||
(sys_cp_mbstowcs): Ditto.
|
||||
|
||||
2009-05-08 IWAMURO Motonori <deenheart@gmail.com>
|
||||
|
||||
* strfuncs.cc (sys_cp_wcstombs): Set errno to 0 before converting
|
||||
|
|
|
@ -416,6 +416,7 @@ sys_cp_wcstombs (wctomb_p f_wctomb, char *charset, char *dst, size_t len,
|
|||
wchar_t *pwcs = (wchar_t *) src;
|
||||
size_t n = 0;
|
||||
mbstate_t ps;
|
||||
save_errno save;
|
||||
|
||||
memset (&ps, 0, sizeof ps);
|
||||
if (dst == NULL)
|
||||
|
@ -432,7 +433,6 @@ sys_cp_wcstombs (wctomb_p f_wctomb, char *charset, char *dst, size_t len,
|
|||
ASCII SO; UTF-8 representation of invalid char. */
|
||||
if (bytes == -1 && *charset != 'U'/*TF-8*/)
|
||||
{
|
||||
_REENT->_errno = 0;
|
||||
buf[0] = 0x0e; /* ASCII SO */
|
||||
bytes = __utf8_wctomb (_REENT, buf + 1, pw, charset, &ps);
|
||||
if (bytes == -1)
|
||||
|
@ -523,6 +523,7 @@ sys_cp_mbstowcs (mbtowc_p f_mbtowc, char *charset, wchar_t *dst, size_t dlen,
|
|||
size_t len = dlen;
|
||||
int bytes;
|
||||
mbstate_t ps;
|
||||
save_errno save;
|
||||
|
||||
memset (&ps, 0, sizeof ps);
|
||||
if (dst == NULL)
|
||||
|
|
Loading…
Reference in New Issue