Index: third_party/WebKit/Source/platform/v8_inspector/V8DebuggerScript.cpp |
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerScript.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerScript.cpp |
index edb2fcdc7d333d4f46a0c2cdb91979f97421279c..f9390f086932f4f6f35f70a6c36e43cb356aa15a 100644 |
--- a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerScript.cpp |
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerScript.cpp |
@@ -15,7 +15,8 @@ static const LChar hexDigits[17] = "0123456789ABCDEF"; |
static void appendUnsignedAsHex(unsigned number, String16Builder* destination) |
{ |
for (size_t i = 0; i < 8; ++i) { |
- destination->append(hexDigits[number & 0xF]); |
+ UChar c = hexDigits[number & 0xF]; |
+ destination->append(c); |
number >>= 4; |
} |
} |
@@ -36,17 +37,18 @@ static String16 calculateHash(const String16& str) |
size_t current = 0; |
const uint32_t* data = nullptr; |
+ size_t sizeInBytes = sizeof(UChar) * str.length(); |
data = reinterpret_cast<const uint32_t*>(str.characters16()); |
- for (size_t i = 0; i < str.sizeInBytes() / 4; i += 4) { |
+ for (size_t i = 0; i < sizeInBytes / 4; i += 4) { |
uint32_t v = data[i]; |
uint64_t xi = v * randomOdd[current] & 0x7FFFFFFF; |
hashes[current] = (hashes[current] + zi[current] * xi) % prime[current]; |
zi[current] = (zi[current] * random[current]) % prime[current]; |
current = current == hashesSize - 1 ? 0 : current + 1; |
} |
- if (str.sizeInBytes() % 4) { |
+ if (sizeInBytes % 4) { |
uint32_t v = 0; |
- for (size_t i = str.sizeInBytes() - str.sizeInBytes() % 4; i < str.sizeInBytes(); ++i) { |
+ for (size_t i = sizeInBytes - sizeInBytes % 4; i < sizeInBytes; ++i) { |
v <<= 8; |
v |= reinterpret_cast<const uint8_t*>(data)[i]; |
} |
@@ -69,7 +71,7 @@ V8DebuggerScript::V8DebuggerScript(v8::Isolate* isolate, v8::Local<v8::Object> o |
{ |
v8::Local<v8::Value> idValue = object->Get(toV8StringInternalized(isolate, "id")); |
DCHECK(!idValue.IsEmpty() && idValue->IsInt32()); |
- m_id = String16::fromInteger(idValue->Int32Value()); |
+ m_id = protocol::string16FromInteger(idValue->Int32Value()); |
m_url = toProtocolStringWithTypeCheck(object->Get(toV8StringInternalized(isolate, "name"))); |
m_sourceURL = toProtocolStringWithTypeCheck(object->Get(toV8StringInternalized(isolate, "sourceURL"))); |