aboutsummaryrefslogtreecommitdiff
path: root/libio/wfileops.c
diff options
context:
space:
mode:
Diffstat (limited to 'libio/wfileops.c')
-rw-r--r--libio/wfileops.c42
1 files changed, 18 insertions, 24 deletions
diff --git a/libio/wfileops.c b/libio/wfileops.c
index 04a3f5e..e88c065 100644
--- a/libio/wfileops.c
+++ b/libio/wfileops.c
@@ -157,34 +157,28 @@ _IO_wfile_underflow (fp)
/* Maybe there is something left in the external buffer. */
if (fp->_IO_read_ptr < fp->_IO_read_end)
{
- /* Convert it. */
- size_t avail_bytes = fp->_IO_read_end - fp->_IO_read_ptr;
+ /* There is more in the external. Convert it. */
+ const char *read_stop = (const char *) fp->_IO_read_ptr;
- if (avail_bytes >= (*cd->__codecvt_do_max_length) (cd))
- {
- /* There is more in the external. */
- const char *read_stop = (const char *) fp->_IO_read_ptr;
-
- fp->_wide_data->_IO_last_state = fp->_wide_data->_IO_state;
- status = (*cd->__codecvt_do_in) (cd, &fp->_wide_data->_IO_state,
- fp->_IO_read_ptr, fp->_IO_read_end,
- &read_stop,
- fp->_wide_data->_IO_read_end,
- fp->_wide_data->_IO_buf_end,
- &fp->_wide_data->_IO_read_end);
+ fp->_wide_data->_IO_last_state = fp->_wide_data->_IO_state;
+ status = (*cd->__codecvt_do_in) (cd, &fp->_wide_data->_IO_state,
+ fp->_IO_read_ptr, fp->_IO_read_end,
+ &read_stop,
+ fp->_wide_data->_IO_read_end,
+ fp->_wide_data->_IO_buf_end,
+ &fp->_wide_data->_IO_read_end);
- fp->_IO_read_ptr = (char *) read_stop;
+ fp->_IO_read_ptr = (char *) read_stop;
- /* If we managed to generate some text return the next character. */
- if (fp->_wide_data->_IO_read_ptr < fp->_wide_data->_IO_read_end)
- return *fp->_wide_data->_IO_read_ptr;
+ /* If we managed to generate some text return the next character. */
+ if (fp->_wide_data->_IO_read_ptr < fp->_wide_data->_IO_read_end)
+ return *fp->_wide_data->_IO_read_ptr;
- if (status == __codecvt_error)
- {
- __set_errno (EILSEQ);
- fp->_flags |= _IO_ERR_SEEN;
- return WEOF;
- }
+ if (status == __codecvt_error)
+ {
+ __set_errno (EILSEQ);
+ fp->_flags |= _IO_ERR_SEEN;
+ return WEOF;
}
/* Move the remaining content of the read buffer to the beginning. */