Switch SkAutoMalloc to SkAutoTMalloc to avoid cast
Make SkAutoTMalloc's interface look more like SkAutoMalloc:
- add free(), which does what you expect
- make reset() return a pointer fPtr
No public API changes (SkAutoTMalloc is in include/private)
BUG=skia:2148
Review URL: https://codereview.chromium.org/1516833003
diff --git a/src/images/SkImageDecoder_libwebp.cpp b/src/images/SkImageDecoder_libwebp.cpp
index 07ff83d..5253577 100644
--- a/src/images/SkImageDecoder_libwebp.cpp
+++ b/src/images/SkImageDecoder_libwebp.cpp
@@ -201,8 +201,8 @@
}
const size_t readBufferSize = stream->hasLength() ?
SkTMin(stream->getLength(), WEBP_IDECODE_BUFFER_SZ) : WEBP_IDECODE_BUFFER_SZ;
- SkAutoMalloc srcStorage(readBufferSize);
- unsigned char* input = (uint8_t*)srcStorage.get();
+ SkAutoTMalloc<unsigned char> srcStorage(readBufferSize);
+ unsigned char* input = srcStorage.get();
if (nullptr == input) {
WebPIDelete(idec);
WebPFreeDecBuffer(&config->output);