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? |