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

Side by Side Diff: src/core/SkString.cpp

Issue 14711011: Remove 16bit asserts and casts of string length. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 7 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 | 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 2006 The Android Open Source Project 3 * Copyright 2006 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 #include "SkString.h" 10 #include "SkString.h"
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 232
233 /////////////////////////////////////////////////////////////////////////////// 233 ///////////////////////////////////////////////////////////////////////////////
234 234
235 SkString::SkString() : fRec(const_cast<Rec*>(&gEmptyRec)) { 235 SkString::SkString() : fRec(const_cast<Rec*>(&gEmptyRec)) {
236 #ifdef SK_DEBUG 236 #ifdef SK_DEBUG
237 fStr = fRec->data(); 237 fStr = fRec->data();
238 #endif 238 #endif
239 } 239 }
240 240
241 SkString::SkString(size_t len) { 241 SkString::SkString(size_t len) {
242 SkASSERT(SkToU16(len) == len); // can't handle larger than 64K 242 fRec = AllocRec(NULL, len);
243
244 fRec = AllocRec(NULL, (U16CPU)len);
245 #ifdef SK_DEBUG 243 #ifdef SK_DEBUG
246 fStr = fRec->data(); 244 fStr = fRec->data();
247 #endif 245 #endif
248 } 246 }
249 247
250 SkString::SkString(const char text[]) { 248 SkString::SkString(const char text[]) {
251 size_t len = text ? strlen(text) : 0; 249 size_t len = text ? strlen(text) : 0;
252 250
253 fRec = AllocRec(text, (U16CPU)len); 251 fRec = AllocRec(text, len);
254 #ifdef SK_DEBUG 252 #ifdef SK_DEBUG
255 fStr = fRec->data(); 253 fStr = fRec->data();
256 #endif 254 #endif
257 } 255 }
258 256
259 SkString::SkString(const char text[], size_t len) { 257 SkString::SkString(const char text[], size_t len) {
260 fRec = AllocRec(text, (U16CPU)len); 258 fRec = AllocRec(text, len);
261 #ifdef SK_DEBUG 259 #ifdef SK_DEBUG
262 fStr = fRec->data(); 260 fStr = fRec->data();
263 #endif 261 #endif
264 } 262 }
265 263
266 SkString::SkString(const SkString& src) { 264 SkString::SkString(const SkString& src) {
267 src.validate(); 265 src.validate();
268 266
269 fRec = RefRec(src.fRec); 267 fRec = RefRec(src.fRec);
270 #ifdef SK_DEBUG 268 #ifdef SK_DEBUG
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 SkString SkStringPrintf(const char* format, ...) { 610 SkString SkStringPrintf(const char* format, ...) {
613 SkString formattedOutput; 611 SkString formattedOutput;
614 char buffer[kBufferSize]; 612 char buffer[kBufferSize];
615 ARGS_TO_BUFFER(format, buffer, kBufferSize); 613 ARGS_TO_BUFFER(format, buffer, kBufferSize);
616 formattedOutput.set(buffer); 614 formattedOutput.set(buffer);
617 return formattedOutput; 615 return formattedOutput;
618 } 616 }
619 617
620 #undef VSNPRINTF 618 #undef VSNPRINTF
621 #undef SNPRINTF 619 #undef SNPRINTF
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