SkStream::read() only returns 0 at end.
All implementations behave this way, so respect it. BUG=skia:2936 Review URL: https://codereview.chromium.org/888703002
This commit is contained in:
parent
19d8f9f173
commit
65df6edf63
@ -59,10 +59,8 @@ static bool webp_parse_header(SkStream* stream, int* width, int* height, int* al
|
|||||||
unsigned char* dst = buffer + totalBytesRead;
|
unsigned char* dst = buffer + totalBytesRead;
|
||||||
const size_t bytesRead = stream->read(dst, bytesToRead);
|
const size_t bytesRead = stream->read(dst, bytesToRead);
|
||||||
if (0 == bytesRead) {
|
if (0 == bytesRead) {
|
||||||
// Could not read any bytes. Check to see if we are at the end (exit
|
SkASSERT(stream->isAtEnd());
|
||||||
// condition), and continue reading if not. Important for streams
|
break;
|
||||||
// that do not have all the data ready.
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
bytesToRead -= bytesRead;
|
bytesToRead -= bytesRead;
|
||||||
totalBytesRead += bytesRead;
|
totalBytesRead += bytesRead;
|
||||||
|
Loading…
Reference in New Issue
Block a user