diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-05-28 08:27:50 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-05-28 08:31:07 (GMT) |
commit | f390f9b51cf8686e9ed44f13a33c7349b9e96a09 (patch) | |
tree | 162c768769713a7215bca64daf8f2bdc75c9fbee /src/network | |
parent | 0bb0699d403b7541472a72a4057ecf0ca366a7cd (diff) | |
download | Qt-f390f9b51cf8686e9ed44f13a33c7349b9e96a09.zip Qt-f390f9b51cf8686e9ed44f13a33c7349b9e96a09.tar.gz Qt-f390f9b51cf8686e9ed44f13a33c7349b9e96a09.tar.bz2 |
improved string operations all over the place
used character operations whenever possible
better usage of QLatin1String
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/access/qhttpnetworkrequest.cpp | 4 | ||||
-rw-r--r-- | src/network/access/qnetworkaccessfilebackend.cpp | 2 | ||||
-rw-r--r-- | src/network/access/qnetworkcookie.cpp | 2 | ||||
-rw-r--r-- | src/network/kernel/qauthenticator.cpp | 4 | ||||
-rw-r--r-- | src/network/kernel/qhostaddress.cpp | 2 | ||||
-rw-r--r-- | src/network/kernel/qnetworkinterface.cpp | 2 | ||||
-rw-r--r-- | src/network/socket/qabstractsocket.cpp | 6 | ||||
-rw-r--r-- | src/network/socket/qlocalsocket.cpp | 4 | ||||
-rw-r--r-- | src/network/socket/qsocks5socketengine.cpp | 14 | ||||
-rw-r--r-- | src/network/ssl/qsslcertificate.cpp | 16 | ||||
-rw-r--r-- | src/network/ssl/qsslcipher.cpp | 2 | ||||
-rw-r--r-- | src/network/ssl/qsslkey.cpp | 2 | ||||
-rw-r--r-- | src/network/ssl/qsslsocket.cpp | 16 | ||||
-rw-r--r-- | src/network/ssl/qsslsocket_openssl.cpp | 2 |
14 files changed, 39 insertions, 39 deletions
diff --git a/src/network/access/qhttpnetworkrequest.cpp b/src/network/access/qhttpnetworkrequest.cpp index 7df68fc..b9b9d84 100644 --- a/src/network/access/qhttpnetworkrequest.cpp +++ b/src/network/access/qhttpnetworkrequest.cpp @@ -127,11 +127,11 @@ QByteArray QHttpNetworkRequestPrivate::header(const QHttpNetworkRequest &request { QByteArray ba = request.d->methodName(); QByteArray uri = request.d->uri(throughProxy); - ba += " " + uri; + ba += ' ' + uri; QString majorVersion = QString::number(request.majorVersion()); QString minorVersion = QString::number(request.minorVersion()); - ba += " HTTP/" + majorVersion.toLatin1() + "." + minorVersion.toLatin1() + "\r\n"; + ba += " HTTP/" + majorVersion.toLatin1() + '.' + minorVersion.toLatin1() + "\r\n"; QList<QPair<QByteArray, QByteArray> > fields = request.header(); QList<QPair<QByteArray, QByteArray> >::const_iterator it = fields.constBegin(); diff --git a/src/network/access/qnetworkaccessfilebackend.cpp b/src/network/access/qnetworkaccessfilebackend.cpp index 6374fde..d905b70 100644 --- a/src/network/access/qnetworkaccessfilebackend.cpp +++ b/src/network/access/qnetworkaccessfilebackend.cpp @@ -109,7 +109,7 @@ void QNetworkAccessFileBackend::open() QString fileName = url.toLocalFile(); if (fileName.isEmpty()) { if (url.scheme() == QLatin1String("qrc")) - fileName = QLatin1String(":") + url.path(); + fileName = QLatin1Char(':') + url.path(); else fileName = url.toString(QUrl::RemoveAuthority | QUrl::RemoveFragment | QUrl::RemoveQuery); } diff --git a/src/network/access/qnetworkcookie.cpp b/src/network/access/qnetworkcookie.cpp index 67df526..29bf042 100644 --- a/src/network/access/qnetworkcookie.cpp +++ b/src/network/access/qnetworkcookie.cpp @@ -1026,7 +1026,7 @@ QList<QNetworkCookie> QNetworkCookiePrivate::parseSetCookieHeaderLine(const QByt #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug s, const QNetworkCookie &cookie) { - s.nospace() << "QNetworkCookie(" << cookie.toRawForm(QNetworkCookie::Full) << ")"; + s.nospace() << "QNetworkCookie(" << cookie.toRawForm(QNetworkCookie::Full) << ')'; return s.space(); } #endif diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp index 33795aa..b672765 100644 --- a/src/network/kernel/qauthenticator.cpp +++ b/src/network/kernel/qauthenticator.cpp @@ -511,13 +511,13 @@ QByteArray QAuthenticatorPrivate::digestMd5Response(const QByteArray &challenge, credentials += "uri=\"" + path + "\", "; if (!opaque.isEmpty()) credentials += "opaque=\"" + opaque + "\", "; - credentials += "response=\"" + response + "\""; + credentials += "response=\"" + response + '\"'; if (!options.value("algorithm").isEmpty()) credentials += ", algorithm=" + options.value("algorithm"); if (!options.value("qop").isEmpty()) { credentials += ", qop=" + qop + ", "; credentials += "nc=" + nonceCountString + ", "; - credentials += "cnonce=\"" + cnonce + "\""; + credentials += "cnonce=\"" + cnonce + '\"'; } return credentials; diff --git a/src/network/kernel/qhostaddress.cpp b/src/network/kernel/qhostaddress.cpp index b225c17..c2fb690 100644 --- a/src/network/kernel/qhostaddress.cpp +++ b/src/network/kernel/qhostaddress.cpp @@ -1078,7 +1078,7 @@ QPair<QHostAddress, int> QHostAddress::parseSubnet(const QString &subnet) #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug d, const QHostAddress &address) { - d.maybeSpace() << "QHostAddress(" << address.toString() << ")"; + d.maybeSpace() << "QHostAddress(" << address.toString() << ')'; return d.space(); } #endif diff --git a/src/network/kernel/qnetworkinterface.cpp b/src/network/kernel/qnetworkinterface.cpp index 960999e..f12b0c0 100644 --- a/src/network/kernel/qnetworkinterface.cpp +++ b/src/network/kernel/qnetworkinterface.cpp @@ -594,7 +594,7 @@ static inline QDebug operator<<(QDebug debug, const QNetworkAddressEntry &entry) debug.nospace() << ", netmask = " << entry.netmask(); if (!entry.broadcast().isNull()) debug.nospace() << ", broadcast = " << entry.broadcast(); - debug.nospace() << ")"; + debug.nospace() << ')'; return debug.space(); } diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 4bb12e6..2d37e2e 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -852,7 +852,7 @@ void QAbstractSocketPrivate::_q_startConnecting(const QHostInfo &hostInfo) if (i != 0) s += ", "; s += addresses.at(i).toString(); } - s += "}"; + s += '}'; qDebug("QAbstractSocketPrivate::_q_startConnecting(hostInfo == %s)", s.toLatin1().constData()); #endif @@ -2596,7 +2596,7 @@ Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, QAbstractSocket::SocketError er debug << "QAbstractSocket::ProxyProtocolError"; break; default: - debug << "QAbstractSocket::SocketError(" << int(error) << ")"; + debug << "QAbstractSocket::SocketError(" << int(error) << ')'; break; } return debug; @@ -2627,7 +2627,7 @@ Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, QAbstractSocket::SocketState st debug << "QAbstractSocket::ClosingState"; break; default: - debug << "QAbstractSocket::SocketState(" << int(state) << ")"; + debug << "QAbstractSocket::SocketState(" << int(state) << ')'; break; } return debug; diff --git a/src/network/socket/qlocalsocket.cpp b/src/network/socket/qlocalsocket.cpp index 327bfc6..9411130 100644 --- a/src/network/socket/qlocalsocket.cpp +++ b/src/network/socket/qlocalsocket.cpp @@ -468,7 +468,7 @@ QDebug operator<<(QDebug debug, QLocalSocket::LocalSocketError error) debug << "QLocalSocket::UnknownSocketError"; break; default: - debug << "QLocalSocket::SocketError(" << int(error) << ")"; + debug << "QLocalSocket::SocketError(" << int(error) << ')'; break; } return debug; @@ -490,7 +490,7 @@ QDebug operator<<(QDebug debug, QLocalSocket::LocalSocketState state) debug << "QLocalSocket::ClosingState"; break; default: - debug << "QLocalSocket::SocketState(" << int(state) << ")"; + debug << "QLocalSocket::SocketState(" << int(state) << ')'; break; } return debug; diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp index c41e32d..40d86ac 100644 --- a/src/network/socket/qsocks5socketengine.cpp +++ b/src/network/socket/qsocks5socketengine.cpp @@ -153,7 +153,7 @@ static inline QString dump(const QByteArray &) { return QString(); } */ static bool qt_socks5_set_host_address_and_port(const QHostAddress &address, quint16 port, QByteArray *pBuf) { - QSOCKS5_DEBUG << "setting [" << address << ":" << port << "]"; + QSOCKS5_DEBUG << "setting [" << address << ':' << port << ']'; union { quint16 port; @@ -186,7 +186,7 @@ static bool qt_socks5_set_host_address_and_port(const QHostAddress &address, qui */ static bool qt_socks5_set_host_name_and_port(const QString &hostname, quint16 port, QByteArray *pBuf) { - QSOCKS5_DEBUG << "setting [" << hostname << ":" << port << "]"; + QSOCKS5_DEBUG << "setting [" << hostname << ':' << port << ']'; QByteArray encodedHostName = QUrl::toAce(hostname); QByteArray &buf = *pBuf; @@ -265,7 +265,7 @@ static bool qt_socks5_get_host_address_and_port(const QByteArray &buf, QHostAddr } if (ret) { - QSOCKS5_DEBUG << "got [" << address << ":" << port << "]"; + QSOCKS5_DEBUG << "got [" << address << ':' << port << ']'; *pAddress = address; *pPort = port; *pPos = pos; @@ -1124,7 +1124,7 @@ bool QSocks5SocketEngine::connectInternal() bool QSocks5SocketEngine::connectToHost(const QHostAddress &address, quint16 port) { Q_D(QSocks5SocketEngine); - QSOCKS5_DEBUG << "connectToHost" << address << ":" << port; + QSOCKS5_DEBUG << "connectToHost" << address << ':' << port; setPeerAddress(address); setPeerPort(port); @@ -1379,7 +1379,7 @@ bool QSocks5SocketEngine::bind(const QHostAddress &address, quint16 port) //### reset and error return false; } - QSOCKS5_DEBUG << "udp actual address and port" << d->localAddress << ":" << d->localPort; + QSOCKS5_DEBUG << "udp actual address and port" << d->localAddress << ':' << d->localPort; return true; #endif // QT_NO_UDPSOCKET } @@ -1478,7 +1478,7 @@ qint64 QSocks5SocketEngine::bytesAvailable() const qint64 QSocks5SocketEngine::read(char *data, qint64 maxlen) { Q_D(QSocks5SocketEngine); - QSOCKS5_Q_DEBUG << "read( , maxlen = " << maxlen << ")"; + QSOCKS5_Q_DEBUG << "read( , maxlen = " << maxlen << ')'; if (d->mode == QSocks5SocketEnginePrivate::ConnectMode) { if (d->connectData->readBuffer.size() == 0) { if (d->data->controlSocket->state() == QAbstractSocket::UnconnectedState) { @@ -1766,7 +1766,7 @@ void QSocks5SocketEngine::setReadNotificationEnabled(bool enable) { Q_D(QSocks5SocketEngine); - QSOCKS5_Q_DEBUG << "setReadNotificationEnabled(" << enable << ")"; + QSOCKS5_Q_DEBUG << "setReadNotificationEnabled(" << enable << ')'; bool emitSignal = false; if (!d->readNotificationEnabled diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index 7b554dc..7ee0f07 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -766,16 +766,16 @@ QDebug operator<<(QDebug debug, const QSslCertificate &certificate) { debug << "QSslCertificate(" << certificate.version() - << "," << certificate.serialNumber() - << "," << certificate.digest().toBase64() - << "," << certificate.issuerInfo(QSslCertificate::Organization) - << "," << certificate.subjectInfo(QSslCertificate::Organization) - << "," << certificate.alternateSubjectNames() + << ',' << certificate.serialNumber() + << ',' << certificate.digest().toBase64() + << ',' << certificate.issuerInfo(QSslCertificate::Organization) + << ',' << certificate.subjectInfo(QSslCertificate::Organization) + << ',' << certificate.alternateSubjectNames() #ifndef QT_NO_TEXTSTREAM - << "," << certificate.effectiveDate() - << "," << certificate.expiryDate() + << ',' << certificate.effectiveDate() + << ',' << certificate.expiryDate() #endif - << ")"; + << ')'; return debug; } QDebug operator<<(QDebug debug, QSslCertificate::SubjectInfo info) diff --git a/src/network/ssl/qsslcipher.cpp b/src/network/ssl/qsslcipher.cpp index 7fec2df..696db1e 100644 --- a/src/network/ssl/qsslcipher.cpp +++ b/src/network/ssl/qsslcipher.cpp @@ -231,7 +231,7 @@ QDebug operator<<(QDebug debug, const QSslCipher &cipher) debug << "QSslCipher(name=" << qPrintable(cipher.name()) << ", bits=" << cipher.usedBits() << ", proto=" << qPrintable(cipher.protocolString()) - << ")"; + << ')'; return debug; } #endif diff --git a/src/network/ssl/qsslkey.cpp b/src/network/ssl/qsslkey.cpp index 8d550c0..6dbdc29 100644 --- a/src/network/ssl/qsslkey.cpp +++ b/src/network/ssl/qsslkey.cpp @@ -460,7 +460,7 @@ QDebug operator<<(QDebug debug, const QSslKey &key) << (key.type() == QSsl::PublicKey ? "PublicKey" : "PrivateKey") << ", " << (key.algorithm() == QSsl::Rsa ? "RSA" : "DSA") << ", " << key.length() - << ")"; + << ')'; return debug; } #endif diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 92054a4..16033b6 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -442,8 +442,8 @@ bool QSslSocket::setSocketDescriptor(int socketDescriptor, SocketState state, Op { Q_D(QSslSocket); #ifdef QSSLSOCKET_DEBUG - qDebug() << "QSslSocket::setSocketDescriptor(" << socketDescriptor << "," - << state << "," << openMode << ")"; + qDebug() << "QSslSocket::setSocketDescriptor(" << socketDescriptor << ',' + << state << ',' << openMode << ')'; #endif if (!d->plainSocket) d->createPlainSocket(openMode); @@ -1608,7 +1608,7 @@ void QSslSocket::connectToHostImplementation(const QString &hostName, quint16 po #ifdef QSSLSOCKET_DEBUG qDebug() << "QSslSocket::connectToHostImplementation(" - << hostName << "," << port << "," << openMode << ")"; + << hostName << ',' << port << ',' << openMode << ')'; #endif if (!d->plainSocket) { #ifdef QSSLSOCKET_DEBUG @@ -1682,7 +1682,7 @@ qint64 QSslSocket::readData(char *data, qint64 maxlen) } while (!d->readBuffer.isEmpty() && readBytes < maxlen); } #ifdef QSSLSOCKET_DEBUG - qDebug() << "QSslSocket::readData(" << (void *)data << "," << maxlen << ") ==" << readBytes; + qDebug() << "QSslSocket::readData(" << (void *)data << ',' << maxlen << ") ==" << readBytes; #endif return readBytes; } @@ -1694,7 +1694,7 @@ qint64 QSslSocket::writeData(const char *data, qint64 len) { Q_D(QSslSocket); #ifdef QSSLSOCKET_DEBUG - qDebug() << "QSslSocket::writeData(" << (void *)data << "," << len << ")"; + qDebug() << "QSslSocket::writeData(" << (void *)data << ',' << len << ')'; #endif if (d->mode == UnencryptedMode && !d->autoStartHandshake) return d->plainSocket->write(data, len); @@ -1999,7 +1999,7 @@ void QSslSocketPrivate::_q_stateChangedSlot(QAbstractSocket::SocketState state) { Q_Q(QSslSocket); #ifdef QSSLSOCKET_DEBUG - qDebug() << "QSslSocket::_q_stateChangedSlot(" << state << ")"; + qDebug() << "QSslSocket::_q_stateChangedSlot(" << state << ')'; #endif q->setSocketState(state); emit q->stateChanged(state); @@ -2012,7 +2012,7 @@ void QSslSocketPrivate::_q_errorSlot(QAbstractSocket::SocketError error) { Q_Q(QSslSocket); #ifdef QSSLSOCKET_DEBUG - qDebug() << "QSslSocket::_q_errorSlot(" << error << ")"; + qDebug() << "QSslSocket::_q_errorSlot(" << error << ')'; qDebug() << "\tstate =" << q->state(); qDebug() << "\terrorString =" << q->errorString(); #endif @@ -2047,7 +2047,7 @@ void QSslSocketPrivate::_q_bytesWrittenSlot(qint64 written) { Q_Q(QSslSocket); #ifdef QSSLSOCKET_DEBUG - qDebug() << "QSslSocket::_q_bytesWrittenSlot(" << written << ")"; + qDebug() << "QSslSocket::_q_bytesWrittenSlot(" << written << ')'; #endif if (mode == QSslSocket::UnencryptedMode) diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 32b02c5..4017c4d 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -276,7 +276,7 @@ init_context: if (first) first = false; else - cipherString.append(":"); + cipherString.append(':'); cipherString.append(cipher.name().toLatin1()); } |