aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/svg
diff options
context:
space:
mode:
authorGravatar Hal Canary <halcanary@google.com>2018-07-24 11:33:21 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-25 17:21:56 +0000
commit4014ba6ec7a7825495ac0a6ed591c5dadd30751d (patch)
tree7439f79dce6e1768d7cdf3e36d4952fd9ed8ef1b /src/svg
parentba5c439809fb2be3b1db159b29aeffaa39f786df (diff)
SkUtils: remove some versions of UTF routines.
Change-Id: Ib1f776ae472117c23d2145253adf25fceb412b32 Reviewed-on: https://skia-review.googlesource.com/143111 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
Diffstat (limited to 'src/svg')
-rw-r--r--src/svg/SkSVGDevice.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/svg/SkSVGDevice.cpp b/src/svg/SkSVGDevice.cpp
index c2a402f695..4a83a9c841 100644
--- a/src/svg/SkSVGDevice.cpp
+++ b/src/svg/SkSVGDevice.cpp
@@ -133,6 +133,7 @@ public:
int count = paint.countText(text, byteLen);
+ const char* stop = (const char*)text + byteLen;
switch(paint.getTextEncoding()) {
case SkPaint::kGlyphID_TextEncoding: {
SkASSERT(count * sizeof(uint16_t) == byteLen);
@@ -145,14 +146,14 @@ public:
case SkPaint::kUTF8_TextEncoding: {
const char* c8 = reinterpret_cast<const char*>(text);
for (int i = 0; i < count; ++i) {
- this->appendUnichar(SkUTF8_NextUnichar(&c8));
+ this->appendUnichar(SkUTF8_NextUnichar(&c8, stop));
}
SkASSERT(reinterpret_cast<const char*>(text) + byteLen == c8);
} break;
case SkPaint::kUTF16_TextEncoding: {
const uint16_t* c16 = reinterpret_cast<const uint16_t*>(text);
for (int i = 0; i < count; ++i) {
- this->appendUnichar(SkUTF16_NextUnichar(&c16));
+ this->appendUnichar(SkUTF16_NextUnichar(&c16, (const uint16_t*)stop));
}
SkASSERT(SkIsAlign2(byteLen));
SkASSERT(reinterpret_cast<const uint16_t*>(text) + (byteLen / 2) == c16);