Index: src/codec/SkBmpCodec.cpp |
diff --git a/src/codec/SkBmpCodec.cpp b/src/codec/SkBmpCodec.cpp |
index 191c2ad8009cbc39e713a2a56452e632a7e84012..a5ec44f36d2e05558bc959a337cef4e94df2065e 100644 |
--- a/src/codec/SkBmpCodec.cpp |
+++ b/src/codec/SkBmpCodec.cpp |
@@ -56,12 +56,10 @@ enum BmpInputFormat { |
/* |
* Checks the start of the stream to see if the image is a bitmap |
*/ |
-bool SkBmpCodec::IsBmp(SkStream* stream) { |
+bool SkBmpCodec::IsBmp(const char* buffer, size_t bytesRead) { |
// TODO: Support "IC", "PT", "CI", "CP", "BA" |
const char bmpSig[] = { 'B', 'M' }; |
- char buffer[sizeof(bmpSig)]; |
- return stream->read(buffer, sizeof(bmpSig)) == sizeof(bmpSig) && |
- !memcmp(buffer, bmpSig, sizeof(bmpSig)); |
+ return bytesRead >= sizeof(bmpSig) && !memcmp(buffer, bmpSig, sizeof(bmpSig)); |
} |
/* |