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

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

Issue 1317913005: whitelist fallback typefaces (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix compiler bugs Created 5 years, 3 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
« no previous file with comments | « src/core/SkPictureData.cpp ('k') | src/core/SkTypeface.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 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
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
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
OLDNEW
« no previous file with comments | « src/core/SkPictureData.cpp ('k') | src/core/SkTypeface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698