| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |