aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Writer32Test.cpp
diff options
context:
space:
mode:
authorGravatar scroggo <scroggo@google.com>2015-12-10 10:44:13 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-12-10 10:44:13 -0800
commit565901db954c231840750ea955ed31b820b9ade8 (patch)
tree376c6355e252cd946babb6a267adba2e016efab4 /tests/Writer32Test.cpp
parent9907371f0a79776d90b68d534aeb44eb46acafe5 (diff)
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
Diffstat (limited to 'tests/Writer32Test.cpp')
-rw-r--r--tests/Writer32Test.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/tests/Writer32Test.cpp b/tests/Writer32Test.cpp
index 5849d731ef..39ae79cff6 100644
--- a/tests/Writer32Test.cpp
+++ b/tests/Writer32Test.cpp
@@ -144,16 +144,13 @@ static void test2(skiatest::Reporter* reporter, SkWriter32* writer) {
static void testWritePad(skiatest::Reporter* reporter, SkWriter32* writer) {
// Create some random data to write.
- const size_t dataSize = 10<<2;
- SkASSERT(SkIsAlign4(dataSize));
+ const size_t dataSize = 10;
- SkAutoMalloc originalData(dataSize);
+ SkAutoTMalloc<uint32_t> originalData(dataSize);
{
SkRandom rand(0);
- uint32_t* ptr = static_cast<uint32_t*>(originalData.get());
- uint32_t* stop = ptr + (dataSize>>2);
- while (ptr < stop) {
- *ptr++ = rand.nextU();
+ for (size_t i = 0; i < dataSize; i++) {
+ originalData[(int) i] = rand.nextU();
}
// Write the random data to the writer at different lengths for