aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
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 /tests
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 'tests')
-rw-r--r--tests/UtilsTest.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/tests/UtilsTest.cpp b/tests/UtilsTest.cpp
index 7e11f8478a..6f8ec914bc 100644
--- a/tests/UtilsTest.cpp
+++ b/tests/UtilsTest.cpp
@@ -177,7 +177,7 @@ static void test_utf16(skiatest::Reporter* reporter) {
size_t count2 = SkUTF16_CountUnichars(buf, 2 * sizeof(uint16_t));
REPORTER_ASSERT(reporter, count2 == 1);
const uint16_t* ptr = buf;
- SkUnichar c = SkUTF16_NextUnichar(&ptr);
+ SkUnichar c = SkUTF16_NextUnichar(&ptr, buf + SK_ARRAY_COUNT(buf));
REPORTER_ASSERT(reporter, c == gUni[i]);
REPORTER_ASSERT(reporter, ptr - buf == 2);
}
@@ -203,13 +203,12 @@ DEF_TEST(Utils, reporter) {
for (size_t i = 0; i < SK_ARRAY_COUNT(gTest); i++) {
const char* p = gTest[i].fUtf8;
- int n = SkUTF8_CountUnichars(p);
- SkUnichar u0 = SkUTF8_ToUnichar(gTest[i].fUtf8);
- SkUnichar u1 = SkUTF8_NextUnichar(&p);
+ const char* stop = p + strlen(p);
+ int n = SkUTF8_CountUnichars(p, strlen(p));
+ SkUnichar u1 = SkUTF8_NextUnichar(&p, stop);
REPORTER_ASSERT(reporter, n == 1);
- REPORTER_ASSERT(reporter, u0 == u1);
- REPORTER_ASSERT(reporter, u0 == gTest[i].fUni);
+ REPORTER_ASSERT(reporter, u1 == gTest[i].fUni);
REPORTER_ASSERT(reporter,
p - gTest[i].fUtf8 == (int)strlen(gTest[i].fUtf8));
}