From 5ecd1ea66330e16afb945c8c5c7bef4e95d7ca25 Mon Sep 17 00:00:00 2001 From: Christopher Faylor <me@cgf.cx> Date: Thu, 27 Jul 2006 03:32:51 +0000 Subject: [PATCH] * fhandler.cc (fhandler_base::read): Call get_readahead_into_buffer instead of duplicating it. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/fhandler.cc | 13 ++----------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 3b8ad6102..c75a91d73 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2006-07-26 Brian ford <Brian.Ford@FlightSafety.com> + + * fhandler.cc (fhandler_base::read): Call get_readahead_into_buffer + instead of duplicating it. + 2006-07-26 Corinna Vinschen <corinna@vinschen.de> * shared.cc (offsets): Define as offsets relative to cygwin_hmodule diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index d33b28d94..06bed1b46 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -716,17 +716,7 @@ void fhandler_base::read (void *in_ptr, size_t& len) { char *ptr = (char *) in_ptr; - ssize_t copied_chars = 0; - int c; - - while (len) - if ((c = get_readahead ()) < 0) - break; - else - { - ptr[copied_chars++] = (unsigned char) (c & 0xff); - len--; - } + ssize_t copied_chars = get_readahead_into_buffer (ptr, len); if (copied_chars && is_slow ()) { @@ -734,6 +724,7 @@ fhandler_base::read (void *in_ptr, size_t& len) goto out; } + len -= copied_chars; if (!len) { len = (size_t) copied_chars;