| 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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 } | 249 } |
| 250 } | 250 } |
| 251 #endif | 251 #endif |
| 252 | 252 |
| 253 /////////////////////////////////////////////////////////////////////////////// | 253 /////////////////////////////////////////////////////////////////////////////// |
| 254 | 254 |
| 255 SkString::SkString() : fRec(const_cast<Rec*>(&gEmptyRec)) { | 255 SkString::SkString() : fRec(const_cast<Rec*>(&gEmptyRec)) { |
| 256 } | 256 } |
| 257 | 257 |
| 258 SkString::SkString(size_t len) { | 258 SkString::SkString(size_t len) { |
| 259 fRec = AllocRec(NULL, len); | 259 fRec = AllocRec(nullptr, len); |
| 260 } | 260 } |
| 261 | 261 |
| 262 SkString::SkString(const char text[]) { | 262 SkString::SkString(const char text[]) { |
| 263 size_t len = text ? strlen(text) : 0; | 263 size_t len = text ? strlen(text) : 0; |
| 264 | 264 |
| 265 fRec = AllocRec(text, len); | 265 fRec = AllocRec(text, len); |
| 266 } | 266 } |
| 267 | 267 |
| 268 SkString::SkString(const char text[], size_t len) { | 268 SkString::SkString(const char text[], size_t len) { |
| 269 fRec = AllocRec(text, len); | 269 fRec = AllocRec(text, len); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 288 | 288 |
| 289 bool SkString::equals(const SkString& src) const { | 289 bool SkString::equals(const SkString& src) const { |
| 290 return fRec == src.fRec || this->equals(src.c_str(), src.size()); | 290 return fRec == src.fRec || this->equals(src.c_str(), src.size()); |
| 291 } | 291 } |
| 292 | 292 |
| 293 bool SkString::equals(const char text[]) const { | 293 bool SkString::equals(const char text[]) const { |
| 294 return this->equals(text, text ? strlen(text) : 0); | 294 return this->equals(text, text ? strlen(text) : 0); |
| 295 } | 295 } |
| 296 | 296 |
| 297 bool SkString::equals(const char text[], size_t len) const { | 297 bool SkString::equals(const char text[], size_t len) const { |
| 298 SkASSERT(len == 0 || text != NULL); | 298 SkASSERT(len == 0 || text != nullptr); |
| 299 | 299 |
| 300 return fRec->fLength == len && !memcmp(fRec->data(), text, len); | 300 return fRec->fLength == len && !memcmp(fRec->data(), text, len); |
| 301 } | 301 } |
| 302 | 302 |
| 303 SkString& SkString::operator=(const SkString& src) { | 303 SkString& SkString::operator=(const SkString& src) { |
| 304 this->validate(); | 304 this->validate(); |
| 305 | 305 |
| 306 if (fRec != src.fRec) { | 306 if (fRec != src.fRec) { |
| 307 SkString tmp(src); | 307 SkString tmp(src); |
| 308 this->swap(tmp); | 308 this->swap(tmp); |
| (...skipping 322 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 |