Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "SkAtomics.h" | 10 #include "SkAtomics.h" |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 370 fRec->fLength = SkToU32(len); | 370 fRec->fLength = SkToU32(len); |
| 371 } else if (1 == fRec->fRefCnt && (fRec->fLength >> 2) == (len >> 2)) { | 371 } else if (1 == fRec->fRefCnt && (fRec->fLength >> 2) == (len >> 2)) { |
| 372 // we have spare room in the current allocation, so don't alloc a larger one | 372 // we have spare room in the current allocation, so don't alloc a larger one |
| 373 char* p = this->writable_str(); | 373 char* p = this->writable_str(); |
| 374 if (text) { | 374 if (text) { |
| 375 memcpy(p, text, len); | 375 memcpy(p, text, len); |
| 376 } | 376 } |
| 377 p[len] = 0; | 377 p[len] = 0; |
| 378 fRec->fLength = SkToU32(len); | 378 fRec->fLength = SkToU32(len); |
| 379 } else { | 379 } else { |
| 380 SkString tmp(text, len); | 380 SkString tmp(text ? text : this->c_str(), len); |
|
bungeman-skia
2015/08/28 21:09:57
What is this for? If text is NULL here, shouldn't
reed1
2015/08/31 12:20:25
+1 -- seems like its an error (assert?) to pass NU
| |
| 381 this->swap(tmp); | 381 this->swap(tmp); |
| 382 } | 382 } |
| 383 } | 383 } |
| 384 | 384 |
| 385 void SkString::setUTF16(const uint16_t src[]) { | 385 void SkString::setUTF16(const uint16_t src[]) { |
| 386 int count = 0; | 386 int count = 0; |
| 387 | 387 |
| 388 while (src[count]) { | 388 while (src[count]) { |
| 389 count += 1; | 389 count += 1; |
| 390 } | 390 } |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 631 const size_t len = strcspn(str, delimiters); | 631 const size_t len = strcspn(str, delimiters); |
| 632 out->push_back().set(str, len); | 632 out->push_back().set(str, len); |
| 633 str += len; | 633 str += len; |
| 634 // Skip any delimiters. | 634 // Skip any delimiters. |
| 635 str += strspn(str, delimiters); | 635 str += strspn(str, delimiters); |
| 636 } | 636 } |
| 637 } | 637 } |
| 638 | 638 |
| 639 #undef VSNPRINTF | 639 #undef VSNPRINTF |
| 640 #undef SNPRINTF | 640 #undef SNPRINTF |
| OLD | NEW |