Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Unified Diff: tests/Writer32Test.cpp

Issue 1516833003: Switch SkAutoMalloc to SkAutoTMalloc to avoid cast (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/images/SkImageDecoder_libjpeg.cpp ('K') | « tests/TextureCompressionTest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/Writer32Test.cpp
diff --git a/tests/Writer32Test.cpp b/tests/Writer32Test.cpp
index 5849d731efba39ed0e83c82d22ef6a3e8f00ae0c..82f662f5f8ed9a0acd4ad2f016b20fb5da546e00 100644
--- a/tests/Writer32Test.cpp
+++ b/tests/Writer32Test.cpp
@@ -144,16 +144,14 @@ 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();
+ uint32_t* const ptr = originalData.get();
mtklein 2015/12/10 16:00:03 It's fairly rare that we make const pointers. Thi
scroggo 2015/12/10 16:26:45 Oh, right; I meant to just use SkAutoTMalloc::oper
+ for (size_t i = 0; i < dataSize; i++) {
+ ptr[i] = rand.nextU();
}
// Write the random data to the writer at different lengths for
« src/images/SkImageDecoder_libjpeg.cpp ('K') | « tests/TextureCompressionTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698