Bug 88310 - [Qt][Win] Fix UString related build problem in Source/WebCore/bridge/qt/qt_instance.cpp
Summary: [Qt][Win] Fix UString related build problem in Source/WebCore/bridge/qt/qt_in...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 420+
Hardware: All All
: P1 Blocker
Assignee: Csaba Osztrogonác
URL:
Keywords: Qt, QtTriaged
Depends on:
Blocks: 88300
  Show dependency treegraph
 
Reported: 2012-06-05 01:28 PDT by Csaba Osztrogonác
Modified: 2012-06-11 03:24 PDT (History)
4 users (show)

See Also:


Attachments
Patch (1.53 KB, patch)
2012-06-05 07:03 PDT, Csaba Osztrogonác
no flags Details | Formatted Diff | Diff
Patch (1.56 KB, patch)
2012-06-07 05:25 PDT, Csaba Osztrogonác
no flags Details | Formatted Diff | Diff
Patch (1.56 KB, patch)
2012-06-07 05:33 PDT, Csaba Osztrogonác
no flags Details | Formatted Diff | Diff
Patch (1.55 KB, patch)
2012-06-07 05:49 PDT, Csaba Osztrogonác
no flags Details | Formatted Diff | Diff
Patch (1.57 KB, patch)
2012-06-07 05:52 PDT, Csaba Osztrogonác
no flags Details | Formatted Diff | Diff
Patch (1.61 KB, patch)
2012-06-07 07:18 PDT, Csaba Osztrogonác
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Csaba Osztrogonác 2012-06-05 01:28:42 PDT
Source/WebCore/bridge/qt/qt_instance.cpp doesn't build
because of some UString related problem. (Details are coming soon.)
Comment 1 Csaba Osztrogonác 2012-06-05 06:17:08 PDT
Error log:
f:\WebKit\Source\WebCore\bridge\qt\qt_instance.cpp(242) : error C2665: 'JSC::UString::UString' : none of the 11 overloads could convert all the argument types
        f:\webkit\source\javascriptcore\runtime\UString.h(36): could be 'JSC::UString::UString(const UChar *,unsigned int)'
        f:\webkit\source\javascriptcore\runtime\UString.h(42): or       'JSC::UString::UString(const LChar *,unsigned int)'
        f:\webkit\source\javascriptcore\runtime\UString.h(43): or       'JSC::UString::UString(const char *,unsigned int)'
        while trying to match the argument list '(const ushort *, int)'

qt_instance.cpp: 
-----------------
240: #if HAVE(QT5)
241:     QString sig = QString::fromLatin1(method.methodSignature());
242:     array.add(Identifier(exec, UString(sig.utf16(), sig.length())));
243: #else
244:     array.add(Identifier(exec, method.signature()));
245: #endif

Qstring.utf16() returns with const ushort * on all platform, but it works
fine on Linux 32/64 bit too. Maybe the sizeof(ushort) is different on win.
Comment 2 Csaba Osztrogonác 2012-06-05 07:03:01 PDT
Created attachment 145782 [details]
Patch

It's only a speculative fix, I'm not sure if it is proper or not. Could you confirm if I'm on good or bad way?
Comment 3 Simon Hausmann 2012-06-05 14:17:01 PDT
Comment on attachment 145782 [details]
Patch

So what's happening here is that method.methodSignature() returns a QByteArray (latin1 encoded string), that is converted to a utf-16 encoded QString, which is then supposed to get converted to a UString - except that the compiler is confused.

Fortunately UString supports also latin1 encoded 8-bit strings, so I think the much simpler fix is to avoid conversion from 8-bit latin1 to utf-16 and instead construct the UString straight from 8-bit, i.e.
    QByteArray sig = method.methodSignature();
    .... UString(sig.constData(), sig.length());
Comment 4 Csaba Osztrogonác 2012-06-07 05:25:01 PDT
Created attachment 146260 [details]
Patch

fixed patch
Comment 5 Early Warning System Bot 2012-06-07 05:31:05 PDT
Comment on attachment 146260 [details]
Patch

Attachment 146260 [details] did not pass qt-wk2-ews (qt):
Output: http://queues.webkit.org/results/12913198
Comment 6 Csaba Osztrogonác 2012-06-07 05:33:58 PDT
Created attachment 146261 [details]
Patch

typo fixed
Comment 7 Early Warning System Bot 2012-06-07 05:40:09 PDT
Comment on attachment 146261 [details]
Patch

Attachment 146261 [details] did not pass qt-wk2-ews (qt):
Output: http://queues.webkit.org/results/12920154
Comment 8 Csaba Osztrogonác 2012-06-07 05:49:57 PDT
Created attachment 146264 [details]
Patch

typo fixed - 2nd attempt
Comment 9 Csaba Osztrogonác 2012-06-07 05:52:55 PDT
Created attachment 146265 [details]
Patch

typo fixed - 3rd attempt. It's not my day. :)
Comment 10 Early Warning System Bot 2012-06-07 06:06:27 PDT
Comment on attachment 146265 [details]
Patch

Attachment 146265 [details] did not pass qt-wk2-ews (qt):
Output: http://queues.webkit.org/results/12922134
Comment 11 Csaba Osztrogonác 2012-06-07 06:08:12 PDT
Comment on attachment 146265 [details]
Patch

It isn't my day. :( I'll try again once I'm in a better shape ...
Comment 12 Csaba Osztrogonác 2012-06-07 07:13:41 PDT
Kent updated this part of code after renaming by http://trac.webkit.org/changeset/116102 (and reviewed by Tor Arne)

96f2365cf4cebc074c3171878dcd25ce19ee7486 was "Rename QMetaMethod::signature() to methodSignature()" in Qt5/qtbase

I've lost the labyrinth of QString/QByteArray/latin1/utf8/utf16 things,
I can't fix it myself, I gave it up. :(

Could you guys pick up this bug?
Comment 13 Csaba Osztrogonác 2012-06-07 07:18:32 PDT
Created attachment 146285 [details]
Patch

It is my last attempt. I can't copy/paste anything today ... :-/
Comment 14 Csaba Osztrogonác 2012-06-11 03:24:44 PDT
Comment on attachment 146285 [details]
Patch

Clearing flags on attachment: 146285

Committed r119969: <http://trac.webkit.org/changeset/119969>
Comment 15 Csaba Osztrogonác 2012-06-11 03:24:52 PDT
All reviewed patches have been landed.  Closing bug.