From 5e473a71467d30b51faadb7b5ae4305abc0a16d7 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 9 Aug 2001 00:11:12 +0000 Subject: update. * libio/wfileops.c (_IO_wfile_underflow): Remove incorrect test for possible conversion using __codecvt_do_in. * libio/Makefile (tests): Add tst-fgetws. * libio/tst-fgetws.c: New file. * libio/iofgetws.c: Use _IO_ferror_unlocked macros instead of coding the test here. --- libio/wfileops.c | 42 ++++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 24 deletions(-) (limited to 'libio/wfileops.c') diff --git a/libio/wfileops.c b/libio/wfileops.c index 04a3f5e64f..e88c0654e5 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. */ -- cgit 1.4.1