summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/API/JSStringRef.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/JavaScriptCore/API/JSStringRef.cpp')
-rw-r--r--Source/JavaScriptCore/API/JSStringRef.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/Source/JavaScriptCore/API/JSStringRef.cpp b/Source/JavaScriptCore/API/JSStringRef.cpp
index da1a3057a..7f2168dc2 100644
--- a/Source/JavaScriptCore/API/JSStringRef.cpp
+++ b/Source/JavaScriptCore/API/JSStringRef.cpp
@@ -47,9 +47,10 @@ JSStringRef JSStringCreateWithUTF8CString(const char* string)
Vector<UChar, 1024> buffer(length);
UChar* p = buffer.data();
bool sourceIsAllASCII;
+ const LChar* stringStart = reinterpret_cast<const LChar*>(string);
if (conversionOK == convertUTF8ToUTF16(&string, string + length, &p, p + length, &sourceIsAllASCII)) {
if (sourceIsAllASCII)
- return OpaqueJSString::create(reinterpret_cast<const LChar*>(string), length).leakRef();
+ return OpaqueJSString::create(stringStart, length).leakRef();
return OpaqueJSString::create(buffer.data(), p - buffer.data()).leakRef();
}
}