Changeset 82059 in webkit


Ignore:
Timestamp:
Mar 27, 2011 12:18:55 AM (13 years ago)
Author:
benjamin.poulain@nokia.com
Message:

2011-03-27 Benjamin Poulain <benjamin.poulain@nokia.com>

Reviewed by Andreas Kling.

[Qt] QtWebKit will not compile with QT_ASCII_CAST_WARNINGS enabled
https://bugs.webkit.org/show_bug.cgi?id=57087

Use explicit conversion for string to avoid depending on the default codec
installed by the user code.

  • Api/qwebkitversion.cpp: (qWebKitVersion):
  • Api/qwebpage.cpp: (QWebPagePrivate::dynamicPropertyChangeEvent): (QWebPage::javaScriptConsoleMessage):
  • WebCoreSupport/DumpRenderTreeSupportQt.cpp: (convertToPropertyName): (DumpRenderTreeSupportQt::setEditingBehavior): (DumpRenderTreeSupportQt::plainText):
  • WebCoreSupport/EditorClientQt.cpp: (dumpRange):
  • WebCoreSupport/FrameLoaderClientQt.cpp: (drtDescriptionSuitableForTestResult): (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction):
  • WebCoreSupport/InspectorClientQt.cpp: (WebCore::InspectorClientQt::openInspectorFrontend):
  • WebCoreSupport/InspectorServerQt.cpp: (WebCore::parseWebSocketChallengeNumber): (WebCore::InspectorServerRequestHandlerQt::tcpReadyRead):
Location:
trunk/Source/WebKit/qt
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/qt/Api/qwebkitversion.cpp

    r59456 r82059  
    4141QString qWebKitVersion()
    4242{
    43     return QString("%1.%2").arg(WEBKIT_MAJOR_VERSION).arg(WEBKIT_MINOR_VERSION);
     43    return QString::fromLatin1("%1.%2").arg(WEBKIT_MAJOR_VERSION).arg(WEBKIT_MINOR_VERSION);
    4444}
    4545
  • trunk/Source/WebKit/qt/Api/qwebpage.cpp

    r81600 r82059  
    11691169        QString p = q->property("_q_RepaintThrottlingPreset").toString();
    11701170        for(int i = 0; i < sizeof(presets) / sizeof(presets[0]); i++) {
    1171             if(p == presets[i].name) {
     1171            if (p == QLatin1String(presets[i].name)) {
    11721172                FrameView::setRepaintThrottlingDeferredRepaintDelay(
    11731173                        presets[i].deferredRepaintDelay);
     
    20742074    // At this point DRT's WebPage has already been destroyed
    20752075    if (QWebPagePrivate::drtRun) {
    2076         if (message == "PLUGIN: NPP_Destroy")
     2076        if (message == QLatin1String("PLUGIN: NPP_Destroy"))
    20772077            fprintf (stdout, "CONSOLE MESSAGE: line %d: %s\n", lineNumber, message.toUtf8().constData());
    20782078    }
  • trunk/Source/WebKit/qt/ChangeLog

    r82034 r82059  
     12011-03-27  Benjamin Poulain  <benjamin.poulain@nokia.com>
     2
     3        Reviewed by Andreas Kling.
     4
     5        [Qt] QtWebKit will not compile with QT_ASCII_CAST_WARNINGS enabled
     6        https://bugs.webkit.org/show_bug.cgi?id=57087
     7
     8        Use explicit conversion for string to avoid depending on the default codec
     9        installed by the user code.
     10
     11        * Api/qwebkitversion.cpp:
     12        (qWebKitVersion):
     13        * Api/qwebpage.cpp:
     14        (QWebPagePrivate::dynamicPropertyChangeEvent):
     15        (QWebPage::javaScriptConsoleMessage):
     16        * WebCoreSupport/DumpRenderTreeSupportQt.cpp:
     17        (convertToPropertyName):
     18        (DumpRenderTreeSupportQt::setEditingBehavior):
     19        (DumpRenderTreeSupportQt::plainText):
     20        * WebCoreSupport/EditorClientQt.cpp:
     21        (dumpRange):
     22        * WebCoreSupport/FrameLoaderClientQt.cpp:
     23        (drtDescriptionSuitableForTestResult):
     24        (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction):
     25        * WebCoreSupport/InspectorClientQt.cpp:
     26        (WebCore::InspectorClientQt::openInspectorFrontend):
     27        * WebCoreSupport/InspectorServerQt.cpp:
     28        (WebCore::parseWebSocketChallengeNumber):
     29        (WebCore::InspectorServerRequestHandlerQt::tcpReadyRead):
     30
    1312011-03-26  Andreas Kling  <kling@webkit.org>
    232
  • trunk/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp

    r81309 r82059  
    532532static QString convertToPropertyName(const QString& name)
    533533{
    534     QStringList parts = name.split('-');
     534    QStringList parts = name.split(QLatin1Char('-'));
    535535    QString camelCaseName;
    536536    for (int j = 0; j < parts.count(); ++j) {
     
    627627    WebCore::EditingBehaviorType coreEditingBehavior;
    628628
    629     if (editingBehavior == "win")
     629    if (editingBehavior == QLatin1String("win"))
    630630        coreEditingBehavior = EditingWindowsBehavior;
    631     else if (editingBehavior == "mac")
     631    else if (editingBehavior == QLatin1String("mac"))
    632632        coreEditingBehavior = EditingMacBehavior;
    633     else if (editingBehavior == "unix")
     633    else if (editingBehavior == QLatin1String("unix"))
    634634        coreEditingBehavior = EditingUnixBehavior;
    635635    else {
     
    924924{
    925925    QMap<QString, QVariant> map = range.toMap();
    926     QVariant startContainer  = map.value("startContainer");
     926    QVariant startContainer  = map.value(QLatin1String("startContainer"));
    927927    map = startContainer.toMap();
    928928
    929     return map.value("innerText").toString();
     929    return map.value(QLatin1String("innerText")).toString();
    930930}
    931931
  • trunk/Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp

    r81965 r82059  
    7777    WebCore::ExceptionCode code;
    7878
    79     QString str = QString("range from %1 of %2 to %3 of %4")
    80         .arg(range->startOffset(code)).arg(dumpPath(range->startContainer(code)))
    81         .arg(range->endOffset(code)).arg(dumpPath(range->endContainer(code)));
     79    QString str = QString::fromLatin1("range from %1 of %2 to %3 of %4")
     80            .arg(range->startOffset(code)).arg(dumpPath(range->startContainer(code)))
     81            .arg(range->endOffset(code)).arg(dumpPath(range->endContainer(code)));
    8282
    8383    return str;
  • trunk/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp

    r82034 r82059  
    123123        return _url.string();
    124124    // Remove the leading path from file urls
    125     return QString(_url.string()).replace(WebCore::FrameLoaderClientQt::dumpResourceLoadCallbacksPath, "").mid(1);
     125    return QString(_url.string()).remove(WebCore::FrameLoaderClientQt::dumpResourceLoadCallbacksPath).mid(1);
    126126}
    127127
     
    151151    QString result;
    152152    if (exception) {
    153         result.append("ERROR");
     153        result.append(QLatin1String("ERROR"));
    154154        return result;
    155155    }
    156156    if (!node) {
    157         result.append("NULL");
     157        result.append(QLatin1String("NULL"));
    158158        return result;
    159159    }
     
    161161    RefPtr<WebCore::Node> parent = node->parentNode();
    162162    if (parent) {
    163         result.append(" > ");
     163        result.append(QLatin1String(" > "));
    164164        result.append(drtDescriptionSuitableForTestResult(parent, 0));
    165165    }
     
    12301230        printf("Policy delegate: attempt to load %s with navigation type '%s'%s\n",
    12311231               qPrintable(drtDescriptionSuitableForTestResult(request.url())), navigationTypeToString(action.type()),
    1232                (node) ? qPrintable(QString(" originating from " + drtDescriptionSuitableForTestResult(node, 0))) : "");
     1232               (node) ? qPrintable(QString::fromLatin1(" originating from ") + drtDescriptionSuitableForTestResult(node, 0)) : "");
    12331233
    12341234        if (policyDelegatePermissive)
  • trunk/Source/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp

    r81762 r82059  
    141141        QString settingKey(settingStoragePrefix + QString(name));
    142142        qsettings.setValue(settingKey, valueToStore);
    143         qsettings.setValue(settingKey + settingStorageTypeSuffix, QVariant::typeToName(valueToStore.type()));
     143        qsettings.setValue(settingKey + settingStorageTypeSuffix, QLatin1String(QVariant::typeToName(valueToStore.type())));
    144144#endif // QT_NO_SETTINGS
    145145    }
     
    221221#endif
    222222    if (!inspectorUrl.isValid())
    223         inspectorUrl = QUrl("qrc:/webkit/inspector/inspector.html");
     223        inspectorUrl = QUrl(QLatin1String("qrc:/webkit/inspector/inspector.html"));
    224224
    225225#ifndef QT_NO_PROPERTIES
  • trunk/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp

    r77950 r82059  
    7474    for (int i = 0; i < field.size(); i++) {
    7575        QChar c = field[i];
    76         if (c == (QChar)' ') {
     76        if (c == QLatin1Char(' '))
    7777            numSpaces++;
    78         } else if ((c >= (QChar)'0') && (c <= (QChar)'9')) {
    79             nString.append((QChar)c);
    80         }
     78        else if ((c >= QLatin1Char('0')) && (c <= QLatin1Char('9')))
     79            nString.append(c);
    8180    }
    8281    quint32 num = nString.toLong();
     
    196195                m_contentType = header.contentType().toLatin1();
    197196                m_contentLength = header.contentLength();
    198                 if (header.hasKey("Upgrade") && (header.value("Upgrade") == QLatin1String("WebSocket")))
     197                if (header.hasKey(QLatin1String("Upgrade")) && (header.value(QLatin1String("Upgrade")) == QLatin1String("WebSocket")))
    199198                    isWebSocket = true;
    200199
     
    205204
    206205    if (m_endOfHeaders) {
    207         QStringList pathAndQuery = m_path.split("?");
     206        QStringList pathAndQuery = m_path.split(QLatin1Char('?'));
    208207        m_path = pathAndQuery[0];
    209         QStringList words = m_path.split(QString::fromLatin1("/"));
     208        QStringList words = m_path.split(QLatin1Char('/'));
    210209
    211210        if (isWebSocket) {
     
    217216                QByteArray key3 = m_tcpConnection->read(8);
    218217
    219                 quint32 number1 = parseWebSocketChallengeNumber(header.value("Sec-WebSocket-Key1"));
    220                 quint32 number2 = parseWebSocketChallengeNumber(header.value("Sec-WebSocket-Key2"));
     218                quint32 number1 = parseWebSocketChallengeNumber(header.value(QLatin1String("Sec-WebSocket-Key1")));
     219                quint32 number2 = parseWebSocketChallengeNumber(header.value(QLatin1String("Sec-WebSocket-Key2")));
    221220
    222221                char responseData[16];
     
    224223                QByteArray response(responseData, sizeof(responseData));
    225224
    226                 QHttpResponseHeader responseHeader(101, "WebSocket Protocol Handshake", 1, 1);
    227                 responseHeader.setValue("Upgrade", header.value("Upgrade"));
    228                 responseHeader.setValue("Connection", header.value("Connection"));
    229                 responseHeader.setValue("Sec-WebSocket-Origin", header.value("Origin"));
    230                 responseHeader.setValue("Sec-WebSocket-Location", ("ws://" + header.value("Host") + m_path));
     225                QHttpResponseHeader responseHeader(101, QLatin1String("WebSocket Protocol Handshake"), 1, 1);
     226                responseHeader.setValue(QLatin1String("Upgrade"), header.value(QLatin1String("Upgrade")));
     227                responseHeader.setValue(QLatin1String("Connection"), header.value(QLatin1String("Connection")));
     228                responseHeader.setValue(QLatin1String("Sec-WebSocket-Origin"), header.value(QLatin1String("Origin")));
     229                responseHeader.setValue(QLatin1String("Sec-WebSocket-Location"), (QLatin1String("ws://") + header.value(QLatin1String("Host")) + m_path));
    231230                responseHeader.setContentLength(response.size());
    232231                m_tcpConnection->write(responseHeader.toString().toLatin1());
     
    260259
    261260        // If no path is specified, generate an index page.
    262         if ((m_path == "") || (m_path == "/")) {
    263             QString indexHtml = "<html><head><title>Remote Web Inspector</title></head><body><ul>\n";
     261        if (m_path.isEmpty() || (m_path == QString(QLatin1Char('/')))) {
     262            QString indexHtml = QLatin1String("<html><head><title>Remote Web Inspector</title></head><body><ul>\n");
    264263            for (QMap<int, InspectorClientQt* >::const_iterator it = m_server->m_inspectorClients.begin();
    265264                 it != m_server->m_inspectorClients.end();
    266265                 ++it) {
    267                 indexHtml.append(QString("<li><a href=\"/webkit/inspector/inspector.html?page=%1\">%2</li>\n")
     266                indexHtml.append(QString::fromLatin1("<li><a href=\"/webkit/inspector/inspector.html?page=%1\">%2</li>\n")
    268267                                 .arg(it.key())
    269268                                 .arg(it.value()->m_inspectedWebPage->mainFrame()->url().toString()));
    270269            }
    271             indexHtml.append("</ul></body></html>");
     270            indexHtml.append(QLatin1String("</ul></body></html>"));
    272271            response = indexHtml.toLatin1();
    273272        } else {
    274             QString path = QString(":%1").arg(m_path);
     273            QString path = QString::fromLatin1(":%1").arg(m_path);
    275274            QFile file(path);
    276275            // It seems that there should be an enum or define for these status codes somewhere in Qt or WebKit,
Note: See TracChangeset for help on using the changeset viewer.