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/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index c71fda5..f9865dc 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -27,6 +27,7 @@
#include "SkPictureRecorder.h"
#include "SkStream.h"
#include "SkSurface.h"
+#include "SkTemplates.h"
#include "SkTSort.h"
#include "SkTime.h"
#include "SkTypeface.h"
@@ -792,8 +793,8 @@
SkFILEStream stream(FLAGS_sequence[0]);
if (stream.isValid()) {
size_t len = stream.getLength();
- SkAutoMalloc storage(len + 1);
- char* buffer = (char*)storage.get();
+ SkAutoTMalloc<char> storage(len + 1);
+ char* buffer = storage.get();
stream.read(buffer, len);
buffer[len] = 0;