Fix small bug where we enter an infinite loop after we finish reading a file.

This commit is contained in:
Pavel Krajcevski 2013-01-27 14:02:39 -05:00
parent 7049dc3077
commit 40a0947649

View File

@ -204,7 +204,7 @@ unsigned char *ImageFile::ReadFileData(const CHAR *filename) {
uint64 totalBytesLeft = fileSize;
uint32 bytesToRead = uint32(std::min(totalBytesLeft, uint64(1 << 31)));
int32 bytesRead;
while((bytesRead = fstr.Read(rawData, uint32(fileSize))) >= 0) {
while((bytesRead = fstr.Read(rawData, uint32(fileSize))) > 0) {
totalBytesRead += bytesRead;
totalBytesLeft -= bytesRead;
}