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

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

Issue 22862002: Write NULL as "" so readString() always returns a non-NULL string. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: len 0 Created 7 years, 4 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/core/SkWriter32.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 /* 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 161
162 /** 162 /**
163 * Write size bytes from src, and pad to 4 byte alignment with zeroes. 163 * Write size bytes from src, and pad to 4 byte alignment with zeroes.
164 */ 164 */
165 void writePad(const void* src, size_t size); 165 void writePad(const void* src, size_t size);
166 166
167 /** 167 /**
168 * Writes a string to the writer, which can be retrieved with 168 * Writes a string to the writer, which can be retrieved with
169 * SkReader32::readString(). 169 * SkReader32::readString().
170 * The length can be specified, or if -1 is passed, it will be computed by 170 * The length can be specified, or if -1 is passed, it will be computed by
171 * calling strlen(). The length must be < 0xFFFF 171 * calling strlen(). The length must be < max size_t.
172 *
173 * If you write NULL, it will be read as "".
172 */ 174 */
173 void writeString(const char* str, size_t len = (size_t)-1); 175 void writeString(const char* str, size_t len = (size_t)-1);
174 176
175 /** 177 /**
176 * Computes the size (aligned to multiple of 4) need to write the string 178 * Computes the size (aligned to multiple of 4) need to write the string
177 * in a call to writeString(). If the length is not specified, it will be 179 * in a call to writeString(). If the length is not specified, it will be
178 * computed by calling strlen(). 180 * computed by calling strlen().
179 */ 181 */
180 static size_t WriteStringSize(const char* str, size_t len = (size_t)-1); 182 static size_t WriteStringSize(const char* str, size_t len = (size_t)-1);
181 183
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 292
291 private: 293 private:
292 union { 294 union {
293 void* fPtrAlignment; 295 void* fPtrAlignment;
294 double fDoubleAlignment; 296 double fDoubleAlignment;
295 char fStorage[SIZE]; 297 char fStorage[SIZE];
296 } fData; 298 } fData;
297 }; 299 };
298 300
299 #endif 301 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkWriter32.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698