diff options
author | Peter Varga <pvarga@inf.u-szeged.hu> | 2013-03-01 14:39:59 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-12 09:30:19 +0100 |
commit | 74878ba417e7db9fe8f68a55d69a3cc7ee804422 (patch) | |
tree | 761114160518a5407e554c214cd05a9cfaf627f0 /src/qml/qml/ftw/qhashedstring_p.h | |
parent | 687603406a1f548eec57b031aafe5bb31eaae278 (diff) |
Use official V8 string manipulation methods in QML
The QtJSBackend's String::GetCharacter and String::Equals methods are Qt
specific and they are not supported by official V8. These methods can be
replaced by more "V8-friendly" implementations in QtDeclarative. Thus
the mentioned methods can be removed from QtJSBackend to reduce the
difference between QtJSBackend and the official V8 source.
Change-Id: I5590ca62dc667e64a7f54a7e47a02d350ba0c077
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/qml/ftw/qhashedstring_p.h')
-rw-r--r-- | src/qml/qml/ftw/qhashedstring_p.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/qml/qml/ftw/qhashedstring_p.h b/src/qml/qml/ftw/qhashedstring_p.h index 5fc8443ecd..cdf0717e3a 100644 --- a/src/qml/qml/ftw/qhashedstring_p.h +++ b/src/qml/qml/ftw/qhashedstring_p.h @@ -262,8 +262,9 @@ public: inline uint16_t *utf16Data() const { return (uint16_t *)strData->data(); } inline bool equals(v8::Handle<v8::String> string) const { - return isQString()?string->Equals(utf16Data(), length): - string->Equals(cStrData(), length); + v8::Local<v8::String> data = isQString() ? v8::String::New(utf16Data(), length) + : v8::String::New(cStrData(), length); + return string->Equals(data); } inline bool symbolEquals(const QHashedV8String &string) const { @@ -1183,8 +1184,11 @@ QString QHashedV8String::toString() const QString result; result.reserve(m_hash.length); + v8::String::Value value(m_string); + Q_ASSERT(*value != NULL); + uint16_t* string = *value; for (int i = 0; i < m_hash.length; ++i) - result.append(m_string->GetCharacter(i)); + result.append(string[i]); return result; } |