+bool wxInputStream::ReadAll(void *buffer_, size_t size)
+{
+ char* buffer = static_cast<char*>(buffer_);
+
+ size_t totalCount = 0;
+
+ for ( ;; )
+ {
+ const size_t lastCount = Read(buffer, size).LastRead();
+
+ // There is no point in continuing looping if we can't read anything at
+ // all.
+ if ( !lastCount )
+ break;
+
+ totalCount += lastCount;
+
+ // ... Or if an error occurred on the stream.
+ if ( !IsOk() )
+ break;
+
+ // Return successfully if we read exactly the requested number of
+ // bytes (normally the ">" case should never occur and so we could use
+ // "==" test, but be safe and avoid overflowing size even in case of
+ // bugs in LastRead()).
+ if ( lastCount >= size )
+ {
+ size = 0;
+ break;
+ }
+
+ // Advance the buffer before trying to read the rest of data.
+ size -= lastCount;
+ buffer += lastCount;
+ }
+
+ m_lastcount = totalCount;
+
+ return size == 0;
+}
+