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

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

Issue 1514923003: yet 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 SkASSERT(alignedSize >= 4); 179 SkASSERT(alignedSize >= 4);
180 p[alignedSize / 4 - 1] = 0; 180 p[alignedSize / 4 - 1] = 0;
181 } 181 }
182 return p; 182 return p;
183 } 183 }
184 184
185 /** 185 /**
186 * Write size bytes from src, and pad to 4 byte alignment with zeroes. 186 * Write size bytes from src, and pad to 4 byte alignment with zeroes.
187 */ 187 */
188 void writePad(const void* src, size_t size) { 188 void writePad(const void* src, size_t size) {
189 memcpy(this->reservePad(size), src, size); 189 sk_careful_memcpy(this->reservePad(size), src, size);
190 } 190 }
191 191
192 /** 192 /**
193 * Writes a string to the writer, which can be retrieved with 193 * Writes a string to the writer, which can be retrieved with
194 * SkReader32::readString(). 194 * SkReader32::readString().
195 * The length can be specified, or if -1 is passed, it will be computed by 195 * The length can be specified, or if -1 is passed, it will be computed by
196 * calling strlen(). The length must be < max size_t. 196 * calling strlen(). The length must be < max size_t.
197 * 197 *
198 * If you write NULL, it will be read as "". 198 * If you write NULL, it will be read as "".
199 */ 199 */
(...skipping 61 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