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

Side by Side Diff: tests/Writer32Test.cpp

Issue 805543002: DM warning-free on win64 (Closed) Base URL: https://skia.googlesource.com/skia.git@w64
Patch Set: Created 6 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 unified diff | Download patch
« no previous file with comments | « tests/SkBase64Test.cpp ('k') | third_party/ktx/ktx.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkRandom.h" 8 #include "SkRandom.h"
9 #include "SkReader32.h" 9 #include "SkReader32.h"
10 #include "SkWriter32.h" 10 #include "SkWriter32.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 *ptr++ = rand.nextU(); 156 *ptr++ = rand.nextU();
157 } 157 }
158 158
159 // Write the random data to the writer at different lengths for 159 // Write the random data to the writer at different lengths for
160 // different alignments. 160 // different alignments.
161 for (size_t len = 0; len < dataSize; len++) { 161 for (size_t len = 0; len < dataSize; len++) {
162 writer->writePad(originalData.get(), len); 162 writer->writePad(originalData.get(), len);
163 } 163 }
164 } 164 }
165 165
166 uint32_t totalBytes = writer->bytesWritten(); 166 size_t totalBytes = writer->bytesWritten();
167 167
168 SkAutoMalloc readStorage(totalBytes); 168 SkAutoMalloc readStorage(totalBytes);
169 writer->flatten(readStorage.get()); 169 writer->flatten(readStorage.get());
170 170
171 SkReader32 reader; 171 SkReader32 reader;
172 reader.setMemory(readStorage.get(), totalBytes); 172 reader.setMemory(readStorage.get(), totalBytes);
173 173
174 for (size_t len = 0; len < dataSize; len++) { 174 for (size_t len = 0; len < dataSize; len++) {
175 const char* readPtr = static_cast<const char*>(reader.skip(len)); 175 const char* readPtr = static_cast<const char*>(reader.skip(len));
176 // Ensure that the data read is the same as what was written. 176 // Ensure that the data read is the same as what was written.
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 SkAutoDataUnref snapshot(writer.snapshotAsData()); 305 SkAutoDataUnref snapshot(writer.snapshotAsData());
306 // check the snapshot still points to the same data as the writer 306 // check the snapshot still points to the same data as the writer
307 REPORTER_ASSERT(reporter, writer.contiguousArray() == beforeData); 307 REPORTER_ASSERT(reporter, writer.contiguousArray() == beforeData);
308 REPORTER_ASSERT(reporter, snapshot->data() == beforeData); 308 REPORTER_ASSERT(reporter, snapshot->data() == beforeData);
309 REPORTER_ASSERT(reporter, snapshot->size() == writer.bytesWritten()); 309 REPORTER_ASSERT(reporter, snapshot->size() == writer.bytesWritten());
310 // write more data that would fit in the buffer 310 // write more data that would fit in the buffer
311 writer.write(array, sizeof(array)); 311 writer.write(array, sizeof(array));
312 // test it triggered COW anyway 312 // test it triggered COW anyway
313 REPORTER_ASSERT(reporter, writer.contiguousArray() != beforeData); 313 REPORTER_ASSERT(reporter, writer.contiguousArray() != beforeData);
314 } 314 }
OLDNEW
« no previous file with comments | « tests/SkBase64Test.cpp ('k') | third_party/ktx/ktx.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698