ensure 4-byte alignment for storage, as SkWriterBuffer requires it
authorreed <reed@google.com>
Mon, 15 Dec 2014 14:41:02 +0000 (06:41 -0800)
committerCommit bot <commit-bot@chromium.org>
Mon, 15 Dec 2014 14:41:02 +0000 (06:41 -0800)
BUG=skia:3244

Review URL: https://codereview.chromium.org/805803002

tests/ImageIsOpaqueTest.cpp

index 6fdbc81..6d886d4 100644 (file)
@@ -17,8 +17,8 @@
 #include "SkWriteBuffer.h"
 
 static void test_flatten(skiatest::Reporter* reporter, const SkImageInfo& info) {
-    // just need a safe amount of storage
-    char storage[sizeof(SkImageInfo)*2];
+    // just need a safe amount of storage, but ensure that it is 4-byte aligned.
+    int32_t storage[(sizeof(SkImageInfo)*2) / sizeof(int32_t)];
     SkWriteBuffer wb(storage, sizeof(storage));
     info.flatten(wb);
     SkASSERT(wb.bytesWritten() < sizeof(storage));