loop in wxInputStream::Read() while there is data to read

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16856 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2002-08-29 22:10:02 +00:00
parent 0493ba1399
commit 9a76510b8a

View File

@@ -795,17 +795,30 @@ char wxInputStream::GetC()
wxInputStream& wxInputStream::Read(void *buf, size_t size) wxInputStream& wxInputStream::Read(void *buf, size_t size)
{ {
size_t retsize = GetWBack(buf, size); char *p = (char *)buf;
if (retsize == size) m_lastcount = 0;
{
m_lastcount = size; size_t read = GetWBack(buf, size);
m_lasterror = wxStream_NOERROR; for ( ;; )
return *this; {
} size -= read;
size -= retsize; m_lastcount += read;
buf = (char *)buf + retsize; p += read;
if ( !size )
{
// we read the requested amount of data
break;
}
read = OnSysRead(buf, size);
if ( !read )
{
// no more data available
break;
}
}
m_lastcount = OnSysRead(buf, size) + retsize;
return *this; return *this;
} }