summaryrefslogtreecommitdiff
path: root/deps/v8/test/cctest/unicode-helpers.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/test/cctest/unicode-helpers.cc')
-rw-r--r--deps/v8/test/cctest/unicode-helpers.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/deps/v8/test/cctest/unicode-helpers.cc b/deps/v8/test/cctest/unicode-helpers.cc
index 524e5936fc..1a74e0ca94 100644
--- a/deps/v8/test/cctest/unicode-helpers.cc
+++ b/deps/v8/test/cctest/unicode-helpers.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "test/cctest/unicode-helpers.h"
+#include "src/unicode-inl.h"
int Ucs2CharLength(unibrow::uchar c) {
if (c == unibrow::Utf8::kIncomplete || c == unibrow::Utf8::kBufferEmpty) {
@@ -19,10 +20,9 @@ int Utf8LengthHelper(const char* s) {
unibrow::Utf8::State state = unibrow::Utf8::State::kAccept;
int length = 0;
- size_t i = 0;
- while (s[i] != '\0') {
- unibrow::uchar tmp =
- unibrow::Utf8::ValueOfIncremental(s[i], &i, &state, &buffer);
+ const uint8_t* c = reinterpret_cast<const uint8_t*>(s);
+ while (*c != '\0') {
+ unibrow::uchar tmp = unibrow::Utf8::ValueOfIncremental(&c, &state, &buffer);
length += Ucs2CharLength(tmp);
}
unibrow::uchar tmp = unibrow::Utf8::ValueOfIncrementalFinish(&state);