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

Unified Diff: src/images/SkImageDecoder_libico.cpp

Issue 1604963002: SkStream/Priv cleanups (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update header description Created 4 years, 11 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
« no previous file with comments | « src/images/SkImageDecoder_libbmp.cpp ('k') | src/images/SkImageDecoder_pkm.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/images/SkImageDecoder_libico.cpp
diff --git a/src/images/SkImageDecoder_libico.cpp b/src/images/SkImageDecoder_libico.cpp
index cb21b6906e9bd849e039339905d122cc01ef2ca0..93a875d4cbcd7b691a63d589f5a7faf0e4c8e272 100644
--- a/src/images/SkImageDecoder_libico.cpp
+++ b/src/images/SkImageDecoder_libico.cpp
@@ -6,6 +6,7 @@
*/
#include "SkColorPriv.h"
+#include "SkData.h"
#include "SkImageDecoder.h"
#include "SkStream.h"
#include "SkStreamPriv.h"
@@ -74,14 +75,18 @@ static int calculateRowBytesFor8888(int w, int bitCount)
SkImageDecoder::Result SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode)
{
- SkAutoMalloc autoMal;
- const size_t length = SkCopyStreamToStorage(&autoMal, stream);
+ SkAutoTUnref<SkData> data(SkCopyStreamToData(stream));
+ if (!data) {
+ return kFailure;
+ }
+
+ const size_t length = data->size();
// Check that the buffer is large enough to read the directory header
if (length < 6) {
return kFailure;
}
- unsigned char* buf = (unsigned char*)autoMal.get();
+ unsigned char* buf = (unsigned char*) data->data();
//these should always be the same - should i use for error checking? - what about files that have some
//incorrect values, but still decode properly?
« no previous file with comments | « src/images/SkImageDecoder_libbmp.cpp ('k') | src/images/SkImageDecoder_pkm.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698