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

Unified Diff: src/core/SkString.cpp

Issue 646213002: Eliminate one copy of replace_char() function. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: bad... Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: src/core/SkString.cpp
diff --git a/src/core/SkString.cpp b/src/core/SkString.cpp
index b43351599f114c0d7f0b3a1d2e179e3a26b3bca1..fb0c0ec2143f5ffb30dc01c54cbe2ecdb830a19e 100644
--- a/src/core/SkString.cpp
+++ b/src/core/SkString.cpp
@@ -628,6 +628,20 @@ void SkString::remove(size_t offset, size_t length) {
}
}
+void SkString::replace(SkUnichar oldChar, SkUnichar newChar) {
+ char buffer[kMaxBytesInUTF8Sequence];
+ size_t len = SkUTF8_FromUnichar(oldChar, buffer);
tfarina 2014/11/12 01:41:34 Mike, could you help me here? I'm getting the fol
+
+ if (len) {
+ }
+
+ for (size_t i = 0; i < size(); ++i) {
+ if (oldChar == this->operator[](i)) {
+ this->operator[](i) = newChar;
+ }
+ }
+}
+
void SkString::swap(SkString& other) {
this->validate();
other.validate();
« no previous file with comments | « include/core/SkString.h ('k') | tests/StringTest.cpp » ('j') | tests/StringTest.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698