From ee584fefbfc67549ae0a8bf6f421b6840cf455de Mon Sep 17 00:00:00 2001 From: pixel Date: Fri, 30 Apr 2004 08:21:36 +0000 Subject: WHOOPS --- lib/Handle.cc | 11 ++++++++++- lib/Input.cc | 15 ++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/lib/Handle.cc b/lib/Handle.cc index 199aa4b..fe58b48 100644 --- a/lib/Handle.cc +++ b/lib/Handle.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: Handle.cc,v 1.68 2003-12-27 13:36:48 pixel Exp $ */ +/* $Id: Handle.cc,v 1.69 2004-04-30 08:21:36 pixel Exp $ */ #include #include @@ -423,6 +423,15 @@ ssize_t Handle::uread(void * buf, size_t count) { itell += err; return err; } else { +#if defined (_WIN32) && !defined (NO_HFILE) + if (hFile) { + DWORD rcount; + if (!ReadFile(hFile, buf, count, &rcount, 0)) { + // Error.. + } + itell += count = rcount; + } else +#endif itell += count = ::read(h, buf, count); return count; } diff --git a/lib/Input.cc b/lib/Input.cc index 22a688d..cf44385 100644 --- a/lib/Input.cc +++ b/lib/Input.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: Input.cc,v 1.42 2004-01-23 02:21:01 pixel Exp $ */ +/* $Id: Input.cc,v 1.43 2004-04-30 08:21:36 pixel Exp $ */ #include #include @@ -110,9 +110,18 @@ Input::Input(const String & no) throw (GeneralException) : #ifdef __linux__ if (S_ISREG(s.st_mode)) { #endif - size = seek(0, SEEK_END); +#if 0 +#if defined (_WIN32) && !defined (NO_HFILE) + if (hFile) { + GetFileSize(hFile, (LPDWORD)&size); + } else +#endif +#endif + { + size = seek(0, SEEK_END); + seek(0, SEEK_SET); + } #ifdef __linux__ - seek(0, SEEK_SET); } #endif } else { -- cgit v1.2.3