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

Side by Side Diff: include/core/SkWriter32.h

Issue 1510223003: another memcpy -> sk_careful_memcpy (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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | 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 /* 2 /*
3 * Copyright 2008 The Android Open Source Project 3 * Copyright 2008 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #ifndef SkWriter32_DEFINED 10 #ifndef SkWriter32_DEFINED
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 void writeMul4(const void* values, size_t size) { 158 void writeMul4(const void* values, size_t size) {
159 this->write(values, size); 159 this->write(values, size);
160 } 160 }
161 161
162 /** 162 /**
163 * Write size bytes from values. size must be a multiple of 4, though 163 * Write size bytes from values. size must be a multiple of 4, though
164 * values need not be 4-byte aligned. 164 * values need not be 4-byte aligned.
165 */ 165 */
166 void write(const void* values, size_t size) { 166 void write(const void* values, size_t size) {
167 SkASSERT(SkAlign4(size) == size); 167 SkASSERT(SkAlign4(size) == size);
168 memcpy(this->reserve(size), values, size); 168 sk_careful_memcpy(this->reserve(size), values, size);
169 } 169 }
170 170
171 /** 171 /**
172 * Reserve size bytes. Does not need to be 4 byte aligned. The remaining sp ace (if any) will be 172 * Reserve size bytes. Does not need to be 4 byte aligned. The remaining sp ace (if any) will be
173 * filled in with zeroes. 173 * filled in with zeroes.
174 */ 174 */
175 uint32_t* reservePad(size_t size) { 175 uint32_t* reservePad(size_t size) {
176 size_t alignedSize = SkAlign4(size); 176 size_t alignedSize = SkAlign4(size);
177 uint32_t* p = this->reserve(alignedSize); 177 uint32_t* p = this->reserve(alignedSize);
178 if (alignedSize != size) { 178 if (alignedSize != size) {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 union { 261 union {
262 void* fPtrAlignment; 262 void* fPtrAlignment;
263 double fDoubleAlignment; 263 double fDoubleAlignment;
264 char fStorage[SIZE]; 264 char fStorage[SIZE];
265 } fData; 265 } fData;
266 266
267 typedef SkWriter32 INHERITED; 267 typedef SkWriter32 INHERITED;
268 }; 268 };
269 269
270 #endif 270 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698