From: Thiago Macieira Date: Wed, 2 May 2012 14:32:26 +0000 (+0200) Subject: Change remaining uses of {to,from}Ascii to {to,from}Latin1 [QtNetwork] X-Git-Tag: 071012110112~1212 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dd5b373d41f99f06efd1a927a3323abada4fd6ef;p=profile%2Fivi%2Fqtbase.git Change remaining uses of {to,from}Ascii to {to,from}Latin1 [QtNetwork] This operation should be a no-op anyway, since at this point in time, the fromAscii and toAscii functions simply call their fromLatin1 and toLatin1 counterparts. Task-number: QTBUG-21872 Change-Id: I94cc301ea75cc689bcb6e2d417120cf14e36808d Reviewed-by: Lars Knoll Reviewed-by: Shane Kearns Reviewed-by: Richard J. Moore --- diff --git a/examples/network/dnslookup/dnslookup.cpp b/examples/network/dnslookup/dnslookup.cpp index 90cf914..7bd75a9 100644 --- a/examples/network/dnslookup/dnslookup.cpp +++ b/examples/network/dnslookup/dnslookup.cpp @@ -137,7 +137,7 @@ void DnsManager::showResults() foreach (const QDnsTextRecord &record, dns->textRecords()) { QStringList values; foreach (const QByteArray &ba, record.values()) - values << "\"" + QString::fromAscii(ba) + "\""; + values << "\"" + QString::fromLatin1(ba) + "\""; printf("%s\t%i\tIN\tTXT\t%s\n", qPrintable(record.name()), record.timeToLive(), qPrintable(values.join(" "))); } diff --git a/src/network/access/qftp.cpp b/src/network/access/qftp.cpp index a504157..d1d1c78 100644 --- a/src/network/access/qftp.cpp +++ b/src/network/access/qftp.cpp @@ -938,7 +938,7 @@ void QFtpPI::readyRead() while (commandSocket.canReadLine()) { // read line with respect to line continuation - QString line = QString::fromAscii(commandSocket.readLine()); + QString line = QString::fromLatin1(commandSocket.readLine()); if (replyText.isEmpty()) { if (line.length() < 3) { // protocol error @@ -970,7 +970,7 @@ void QFtpPI::readyRead() replyText += line; if (!commandSocket.canReadLine()) return; - line = QString::fromAscii(commandSocket.readLine()); + line = QString::fromLatin1(commandSocket.readLine()); lineLeft4 = line.left(4); } replyText += line.mid(4); // strip reply code 'xyz ' diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index 95b81c4..21802e4 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -300,15 +300,15 @@ void QHttpNetworkConnectionPrivate::prepareRequest(HttpMessagePair &messagePair) // one always. value = request.headerField("accept-language"); if (value.isEmpty()) { - QString systemLocale = QLocale::system().name().replace(QChar::fromAscii('_'),QChar::fromAscii('-')); + QString systemLocale = QLocale::system().name().replace(QChar::fromLatin1('_'),QChar::fromLatin1('-')); QString acceptLanguage; if (systemLocale == QLatin1String("C")) - acceptLanguage = QString::fromAscii("en,*"); + acceptLanguage = QString::fromLatin1("en,*"); else if (systemLocale.startsWith(QLatin1String("en-"))) - acceptLanguage = QString::fromAscii("%1,*").arg(systemLocale); + acceptLanguage = QString::fromLatin1("%1,*").arg(systemLocale); else - acceptLanguage = QString::fromAscii("%1,en,*").arg(systemLocale); - request.setHeaderField("Accept-Language", acceptLanguage.toAscii()); + acceptLanguage = QString::fromLatin1("%1,en,*").arg(systemLocale); + request.setHeaderField("Accept-Language", acceptLanguage.toLatin1()); } // set the User Agent @@ -322,9 +322,9 @@ void QHttpNetworkConnectionPrivate::prepareRequest(HttpMessagePair &messagePair) QByteArray host; if (add.setAddress(hostName)) { if (add.protocol() == QAbstractSocket::IPv6Protocol) - host = "[" + hostName.toAscii() + "]";//format the ipv6 in the standard way + host = "[" + hostName.toLatin1() + "]";//format the ipv6 in the standard way else - host = hostName.toAscii(); + host = hostName.toLatin1(); } else { host = QUrl::toAce(hostName); diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index d193449..cb9bc52 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -1545,7 +1545,7 @@ QString QSslSocketBackendPrivate::getErrorsFromOpenSsl() if (! errorString.isEmpty()) errorString.append(QLatin1String(", ")); const char *error = q_ERR_error_string(errNum, NULL); - errorString.append(QString::fromAscii(error)); // error is ascii according to man ERR_error_string + errorString.append(QString::fromLatin1(error)); // error is ascii according to man ERR_error_string } return errorString; } diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 90cecba..23b00da 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -5783,9 +5783,9 @@ public slots: client->readAll(); client->write("HTTP/1.0 200 OK\n"); if (serverSendsContentLength) - client->write(QString("Content-Length: " + QString::number(dataSize) + "\n").toAscii()); + client->write(QString("Content-Length: " + QString::number(dataSize) + "\n").toLatin1()); if (chunkedEncoding) - client->write(QString("Transfer-Encoding: chunked\n").toAscii()); + client->write(QString("Transfer-Encoding: chunked\n").toLatin1()); client->write("Connection: close\n\n"); } @@ -5796,7 +5796,7 @@ public slots: // chunked encoding: we have to send a last "empty" chunk if (chunkedEncoding) - client->write(QString("0\r\n\r\n").toAscii()); + client->write(QString("0\r\n\r\n").toLatin1()); client->disconnectFromHost(); server.close(); @@ -5810,9 +5810,9 @@ public slots: QByteArray data(amount, '@'); if (chunkedEncoding) { - client->write(QString(QString("%1").arg(amount,0,16).toUpper() + "\r\n").toAscii()); + client->write(QString(QString("%1").arg(amount,0,16).toUpper() + "\r\n").toLatin1()); client->write(data.constData(), amount); - client->write(QString("\r\n").toAscii()); + client->write(QString("\r\n").toLatin1()); } else { client->write(data.constData(), amount); } @@ -5922,7 +5922,7 @@ void tst_QNetworkReply::getFromHttpIntoBufferCanReadLine() { QString header("HTTP/1.0 200 OK\r\nContent-Length: 7\r\n\r\nxxx\nxxx"); - MiniHttpServer server(header.toAscii()); + MiniHttpServer server(header.toLatin1()); server.doClose = true; QNetworkRequest request(QUrl("http://localhost:" + QString::number(server.serverPort()))); @@ -5992,10 +5992,10 @@ void tst_QNetworkReply::qtbug12908compressedHttpReply() // dd if=/dev/zero of=qtbug-12908 bs=16384 count=1 && gzip qtbug-12908 && base64 -w 0 qtbug-12908.gz QString encodedFile("H4sICDdDaUwAA3F0YnVnLTEyOTA4AO3BMQEAAADCoPVPbQwfoAAAAAAAAAAAAAAAAAAAAIC3AYbSVKsAQAAA"); - QByteArray decodedFile = QByteArray::fromBase64(encodedFile.toAscii()); + QByteArray decodedFile = QByteArray::fromBase64(encodedFile.toLatin1()); QCOMPARE(decodedFile.size(), 63); - MiniHttpServer server(header.toAscii() + decodedFile); + MiniHttpServer server(header.toLatin1() + decodedFile); server.doClose = true; QNetworkRequest request(QUrl("http://localhost:" + QString::number(server.serverPort()))); @@ -6015,10 +6015,10 @@ void tst_QNetworkReply::compressedHttpReplyBrokenGzip() // dd if=/dev/zero of=qtbug-12908 bs=16384 count=1 && gzip qtbug-12908 && base64 -w 0 qtbug-12908.gz // Then change "BMQ" to "BMX" QString encodedFile("H4sICDdDaUwAA3F0YnVnLTEyOTA4AO3BMXEAAADCoPVPbQwfoAAAAAAAAAAAAAAAAAAAAIC3AYbSVKsAQAAA"); - QByteArray decodedFile = QByteArray::fromBase64(encodedFile.toAscii()); + QByteArray decodedFile = QByteArray::fromBase64(encodedFile.toLatin1()); QCOMPARE(decodedFile.size(), 63); - MiniHttpServer server(header.toAscii() + decodedFile); + MiniHttpServer server(header.toLatin1() + decodedFile); server.doClose = true; QNetworkRequest request(QUrl("http://localhost:" + QString::number(server.serverPort()))); diff --git a/tests/auto/network/bearer/qnetworksession/lackey/main.cpp b/tests/auto/network/bearer/qnetworksession/lackey/main.cpp index c454ba3..54b4568 100644 --- a/tests/auto/network/bearer/qnetworksession/lackey/main.cpp +++ b/tests/auto/network/bearer/qnetworksession/lackey/main.cpp @@ -123,7 +123,7 @@ int main(int argc, char** argv) session = new QNetworkSession(config); QString output = QString("Starting session for %1\n").arg(config.identifier()); - oopSocket.write(output.toAscii()); + oopSocket.write(output.toLatin1()); oopSocket.waitForBytesWritten(); session->open(); session->waitForOpened(); @@ -141,7 +141,7 @@ int main(int argc, char** argv) } QString output = QString("Started session for %1\n").arg(session->configuration().identifier()); - oopSocket.write(output.toAscii()); + oopSocket.write(output.toLatin1()); oopSocket.waitForBytesWritten(); oopSocket.waitForReadyRead(); diff --git a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp index cab3d56..3060e51 100644 --- a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp +++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp @@ -1036,12 +1036,12 @@ void tst_QUdpSocket::multicastTtlOption_data() addresses += QHostAddress(QHostAddress::AnyIPv6); foreach (const QHostAddress &address, addresses) { - QTest::newRow(QString("%1 0").arg(address.toString()).toAscii()) << address << 0 << 0; - QTest::newRow(QString("%1 1").arg(address.toString()).toAscii()) << address << 1 << 1; - QTest::newRow(QString("%1 2").arg(address.toString()).toAscii()) << address << 2 << 2; - QTest::newRow(QString("%1 128").arg(address.toString()).toAscii()) << address << 128 << 128; - QTest::newRow(QString("%1 255").arg(address.toString()).toAscii()) << address << 255 << 255; - QTest::newRow(QString("%1 1024").arg(address.toString()).toAscii()) << address << 1024 << 1; + QTest::newRow(QString("%1 0").arg(address.toString()).toLatin1()) << address << 0 << 0; + QTest::newRow(QString("%1 1").arg(address.toString()).toLatin1()) << address << 1 << 1; + QTest::newRow(QString("%1 2").arg(address.toString()).toLatin1()) << address << 2 << 2; + QTest::newRow(QString("%1 128").arg(address.toString()).toLatin1()) << address << 128 << 128; + QTest::newRow(QString("%1 255").arg(address.toString()).toLatin1()) << address << 255 << 255; + QTest::newRow(QString("%1 1024").arg(address.toString()).toLatin1()) << address << 1024 << 1; } } @@ -1077,13 +1077,13 @@ void tst_QUdpSocket::multicastLoopbackOption_data() addresses += QHostAddress(QHostAddress::AnyIPv6); foreach (const QHostAddress &address, addresses) { - QTest::newRow(QString("%1 0").arg(address.toString()).toAscii()) << address << 0 << 0; - QTest::newRow(QString("%1 1").arg(address.toString()).toAscii()) << address << 1 << 1; - QTest::newRow(QString("%1 2").arg(address.toString()).toAscii()) << address << 2 << 1; - QTest::newRow(QString("%1 0 again").arg(address.toString()).toAscii()) << address << 0 << 0; - QTest::newRow(QString("%1 2 again").arg(address.toString()).toAscii()) << address << 2 << 1; - QTest::newRow(QString("%1 0 last time").arg(address.toString()).toAscii()) << address << 0 << 0; - QTest::newRow(QString("%1 1 again").arg(address.toString()).toAscii()) << address << 1 << 1; + QTest::newRow(QString("%1 0").arg(address.toString()).toLatin1()) << address << 0 << 0; + QTest::newRow(QString("%1 1").arg(address.toString()).toLatin1()) << address << 1 << 1; + QTest::newRow(QString("%1 2").arg(address.toString()).toLatin1()) << address << 2 << 1; + QTest::newRow(QString("%1 0 again").arg(address.toString()).toLatin1()) << address << 0 << 0; + QTest::newRow(QString("%1 2 again").arg(address.toString()).toLatin1()) << address << 2 << 1; + QTest::newRow(QString("%1 0 last time").arg(address.toString()).toLatin1()) << address << 0 << 0; + QTest::newRow(QString("%1 1 again").arg(address.toString()).toLatin1()) << address << 1 << 1; } } @@ -1164,7 +1164,7 @@ void tst_QUdpSocket::setMulticastInterface_data() QList interfaces = QNetworkInterface::allInterfaces(); foreach (const QNetworkInterface &iface, interfaces) { foreach (const QNetworkAddressEntry &entry, iface.addressEntries()) { - QTest::newRow(QString("%1:%2").arg(iface.name()).arg(entry.ip().toString()).toAscii()) + QTest::newRow(QString("%1:%2").arg(iface.name()).arg(entry.ip().toString()).toLatin1()) << iface << entry.ip(); } diff --git a/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp index 93299c2..2383d82 100644 --- a/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp +++ b/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp @@ -383,7 +383,7 @@ void tst_QSslCertificate::subjectAlternativeNames() else QFAIL("unsupported alternative name type"); QString entry = QString("%1:%2").arg(type).arg(it.value()); - QVERIFY(fileContents.contains(entry.toAscii())); + QVERIFY(fileContents.contains(entry.toLatin1())); } // verify that each entry in fileContents is present in subjAltNames diff --git a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp index d647747..7736ce5 100644 --- a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -386,9 +386,9 @@ public slots: client->readAll(); client->write("HTTP/1.0 200 OK\n"); if (serverSendsContentLength) - client->write(QString("Content-Length: " + QString::number(dataSize) + "\n").toAscii()); + client->write(QString("Content-Length: " + QString::number(dataSize) + "\n").toLatin1()); if (chunkedEncoding) - client->write(QString("Transfer-Encoding: chunked\n").toAscii()); + client->write(QString("Transfer-Encoding: chunked\n").toLatin1()); client->write("Connection: close\n\n"); } @@ -399,7 +399,7 @@ public slots: // chunked encoding: we have to send a last "empty" chunk if (chunkedEncoding) - client->write(QString("0\r\n\r\n").toAscii()); + client->write(QString("0\r\n\r\n").toLatin1()); client->disconnectFromHost(); server.close(); @@ -413,9 +413,9 @@ public slots: QByteArray data(amount, '@'); if (chunkedEncoding) { - client->write(QString(QString("%1").arg(amount,0,16).toUpper() + "\r\n").toAscii()); + client->write(QString(QString("%1").arg(amount,0,16).toUpper() + "\r\n").toLatin1()); client->write(data.constData(), amount); - client->write(QString("\r\n").toAscii()); + client->write(QString("\r\n").toLatin1()); } else { client->write(data.constData(), amount); } diff --git a/tests/manual/bearerex/datatransferer.cpp b/tests/manual/bearerex/datatransferer.cpp index 648a466..8ca4779 100644 --- a/tests/manual/bearerex/datatransferer.cpp +++ b/tests/manual/bearerex/datatransferer.cpp @@ -115,7 +115,7 @@ void DataTransfererQTcp::readyRead() // QDataStream in(&m_qsocket); QByteArray array = m_qsocket.readAll(); - QString data = QString::fromAscii(array); + QString data = QString::fromLatin1(array); // in >> data;