Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(493)

Unified Diff: src/images/SkImageDecoder_libwebp.cpp

Issue 22861028: Handle SkStream::rewind properly. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/images/SkImageDecoder_libwebp.cpp
diff --git a/src/images/SkImageDecoder_libwebp.cpp b/src/images/SkImageDecoder_libwebp.cpp
index 9f1116e5d5bbbd51c8e168f12d8db99d585f07f6..ef2ee6aa62a8db0c018a55e528cd79fdbf08afa9 100644
--- a/src/images/SkImageDecoder_libwebp.cpp
+++ b/src/images/SkImageDecoder_libwebp.cpp
@@ -199,7 +199,10 @@ static bool webp_idecode(SkStream* stream, WebPDecoderConfig* config) {
return false;
}
- stream->rewind();
+ if (!stream->rewind()) {
+ SkDEBUGF(("Failed to rewind webp stream!"));
djsollen 2013/08/22 19:59:18 should we always print this?
scroggo 2013/08/23 21:14:07 Any reason not to? This will tell the caller that
djsollen 2013/08/25 17:47:19 I agree that we should print this always. That i
scroggo 2013/08/26 16:37:47 Ah, now I understand your comment. I didn't know t
+ return false;
+ }
const size_t readBufferSize = stream->hasLength() ?
SkTMin(stream->getLength(), WEBP_IDECODE_BUFFER_SZ) : WEBP_IDECODE_BUFFER_SZ;
SkAutoMalloc srcStorage(readBufferSize);
@@ -311,7 +314,11 @@ bool SkWEBPImageDecoder::onBuildTileIndex(SkStream* stream,
return false;
}
- stream->rewind();
+ if (!stream->rewind()) {
+ SkDEBUGF(("Failed to rewind webp stream!"));
+ return false;
+ }
+
*width = origWidth;
*height = origHeight;

Powered by Google App Engine
This is Rietveld 408576698