Reviewed by eseidel.
The old solution was slow & does not work correctly.
Move the QString -> DeprecatedString conversion into
DeprectedString.cpp, to be able to access allocateHandle().
* platform/DeprecatedString.cpp:
(WebCore::DeprecatedString::DeprecatedString):
* platform/qt/StringQt.cpp:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@16121
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-08-30 Nikolas Zimmermann <zimmermann@kde.org>
+
+ Reviewed by eseidel.
+
+ The old solution was slow & does not work correctly.
+ Move the QString -> DeprecatedString conversion into
+ DeprectedString.cpp, to be able to access allocateHandle().
+
+ * platform/DeprecatedString.cpp:
+ (WebCore::DeprecatedString::DeprecatedString):
+ * platform/qt/StringQt.cpp:
+
2006-08-30 Nikolas Zimmermann <zimmermann@kde.org>
Reviewed/landed by Adam.
#include <windows.h>
#endif
+#if PLATFORM(QT)
+#include <QString>
+#endif
+
using namespace std;
using namespace KJS;
}
}
+#if PLATFORM(QT)
+DeprecatedString::DeprecatedString(const QString& str)
+{
+ if (str.isNull()) {
+ internalData.deref();
+ dataHandle = makeSharedNullHandle();
+ dataHandle[0]->ref();
+ } else {
+ dataHandle = allocateHandle();
+ *dataHandle = &internalData;
+ internalData.initialize(reinterpret_cast<const DeprecatedChar*>(str.data()), str.length());
+ }
+}
+#endif
+
DeprecatedString::operator Identifier() const
{
if (isNull())
}
// DeprecatedString conversions
-DeprecatedString::DeprecatedString(const QString& qstr)
-{
- if (qstr.isNull()) {
- (*this) = DeprecatedString::null;
- } else {
- QByteArray utf8Data = qstr.toUtf8();
- (*this) = DeprecatedString::fromUtf8(utf8Data.data(), utf8Data.length());
- }
-}
-
DeprecatedString::operator QString() const
{
return QString(reinterpret_cast<const QChar*>(unicode()), length());