// Author: Vadim Zeitlin
// Modified by:
// Created: 29/01/98
-// RCS-ID: $Id$
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
{
wxCHECK_MSG( str, false, wxS("Output string must be non-NULL") );
- size_t length = wx_truncate_cast(size_t, Length());
+ ssize_t length = Length();
wxCHECK_MSG( (wxFileOffset)length == Length(), false, wxT("huge file not supported") );
wxCharBuffer buf(length);
char* p = buf.data();
for ( ;; )
{
- static const unsigned READSIZE = 4096;
+ static const ssize_t READSIZE = 4096;
ssize_t nread = Read(p, length > READSIZE ? READSIZE : length);
if ( nread == wxInvalidOffset )
return false;
p += nread;
+ if ( length <= nread )
+ break;
+
+ length -= nread;
}
*p = 0;
{
wxLogSysError(_("can't determine if the end of file is reached on descriptor %d"), m_fd);
}
- else if ( iRc != 1 )
- {
- wxFAIL_MSG(wxT("invalid eof() return value."));
- }
return true;
}