summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2017-07-06 07:01:04 +0200
committerMontel Laurent <[email protected]>2017-07-06 07:01:04 +0200
commitd858a9f8db5dc52ff5fc66338f6b4ffa5d1e9504 (patch)
tree79d016874074fccb289ae0ce0bed65ecd4942a78
parent67b90da613386ed0224653a9ba0dcb480e4634fc (diff)
Minor optimization
-rw-r--r--kioslave/src/smtp/capabilities.cpp6
-rw-r--r--kioslave/src/smtp/command.cpp28
-rw-r--r--kioslave/src/smtp/request.cpp6
-rw-r--r--kioslave/src/smtp/response.cpp2
-rw-r--r--kioslave/src/smtp/smtp.cpp2
5 files changed, 22 insertions, 22 deletions
diff --git a/kioslave/src/smtp/capabilities.cpp b/kioslave/src/smtp/capabilities.cpp
index 3cada1a..489a35c 100644
--- a/kioslave/src/smtp/capabilities.cpp
+++ b/kioslave/src/smtp/capabilities.cpp
@@ -46,7 +46,7 @@ Capabilities Capabilities::fromResponse(const Response &ehlo)
QCStringList l = ehlo.lines();
- for (QCStringList::const_iterator it = ++l.constBegin(); it != l.constEnd(); ++it) {
+ for (QCStringList::const_iterator it = ++l.constBegin(), end(l.constEnd()); it != end; ++it) {
c.add(QString::fromLatin1(*it));
}
@@ -106,8 +106,8 @@ QString Capabilities::createSpecialResponse(bool tls) const
QStringList Capabilities::saslMethodsQSL() const
{
QStringList result;
- for (QMap<QString, QStringList>::const_iterator it = mCapabilities.begin();
- it != mCapabilities.end(); ++it) {
+ for (QMap<QString, QStringList>::const_iterator it = mCapabilities.begin(), end(mCapabilities.end());
+ it != end; ++it) {
if (it.key() == QLatin1String("AUTH")) {
result += it.value();
} else if (it.key().startsWith(QLatin1String("AUTH="))) {
diff --git a/kioslave/src/smtp/command.cpp b/kioslave/src/smtp/command.cpp
index 7786774..60d0bb7 100644
--- a/kioslave/src/smtp/command.cpp
+++ b/kioslave/src/smtp/command.cpp
@@ -174,7 +174,7 @@ QByteArray StartTLSCommand::nextCommandLine(TransactionState *ts)
Q_UNUSED(ts)
mComplete = true;
mNeedResponse = true;
- return "STARTTLS\r\n";
+ return QByteArrayLiteral("STARTTLS\r\n");
}
bool StartTLSCommand::processResponse(const Response &r, TransactionState *ts)
@@ -266,7 +266,7 @@ bool AuthCommand::saslInteract(void *in)
//some mechanisms do not require username && pass, so don't need a popup
//window for getting this info
- for (; interact->id != SASL_CB_LIST_END; interact++) {
+ for (; interact->id != SASL_CB_LIST_END; ++interact) {
if (interact->id == SASL_CB_AUTHNAME
|| interact->id == SASL_CB_PASS) {
if (mAi->username.isEmpty() || mAi->password.isEmpty()) {
@@ -371,7 +371,7 @@ QByteArray AuthCommand::nextCommandLine(TransactionState *ts)
// qCDebug(SMTP_LOG) << "CC: '" << cmd << "'";
mComplete = (result == SASL_OK);
}
- cmd += "\r\n";
+ cmd += QByteArrayLiteral("\r\n");
return cmd;
}
@@ -414,14 +414,14 @@ QByteArray MailFromCommand::nextCommandLine(TransactionState *ts)
Q_UNUSED(ts)
mComplete = true;
mNeedResponse = true;
- QByteArray cmdLine = "MAIL FROM:<" + mAddr + '>';
+ QByteArray cmdLine = QByteArrayLiteral("MAIL FROM:<") + mAddr + '>';
if (m8Bit && haveCapability("8BITMIME")) {
- cmdLine += " BODY=8BITMIME";
+ cmdLine += QByteArrayLiteral(" BODY=8BITMIME");
}
if (mSize && haveCapability("SIZE")) {
- cmdLine += " SIZE=" + QByteArray().setNum(mSize);
+ cmdLine += QByteArrayLiteral(" SIZE=") + QByteArray().setNum(mSize);
}
- return cmdLine + "\r\n";
+ return cmdLine + QByteArrayLiteral("\r\n");
}
bool MailFromCommand::processResponse(const Response &r, TransactionState *ts)
@@ -446,7 +446,7 @@ QByteArray RcptToCommand::nextCommandLine(TransactionState *ts)
Q_UNUSED(ts)
mComplete = true;
mNeedResponse = true;
- return "RCPT TO:<" + mAddr + ">\r\n";
+ return QByteArrayLiteral("RCPT TO:<") + mAddr + QByteArrayLiteral(">\r\n");
}
bool RcptToCommand::processResponse(const Response &r, TransactionState *ts)
@@ -473,7 +473,7 @@ QByteArray DataCommand::nextCommandLine(TransactionState *ts)
mComplete = true;
mNeedResponse = true;
ts->setDataCommandIssued(true);
- return "DATA\r\n";
+ return QByteArrayLiteral("DATA\r\n");
}
void DataCommand::ungetCommandLine(const QByteArray &cmd, TransactionState *ts)
@@ -526,8 +526,8 @@ QByteArray TransferCommand::nextCommandLine(TransactionState *ts)
assert(!isComplete());
assert(!ts->failed());
- static const QByteArray dotCRLF = ".\r\n";
- static const QByteArray CRLFdotCRLF = "\r\n.\r\n";
+ static const QByteArray dotCRLF = QByteArrayLiteral(".\r\n");
+ static const QByteArray CRLFdotCRLF = QByteArrayLiteral("\r\n.\r\n");
if (!mUngetBuffer.isEmpty()) {
const QByteArray ret = mUngetBuffer;
@@ -619,7 +619,7 @@ QByteArray NoopCommand::nextCommandLine(TransactionState *ts)
Q_UNUSED(ts)
mComplete = true;
mNeedResponse = true;
- return "NOOP\r\n";
+ return QByteArrayLiteral("NOOP\r\n");
}
//
@@ -631,7 +631,7 @@ QByteArray RsetCommand::nextCommandLine(TransactionState *ts)
Q_UNUSED(ts)
mComplete = true;
mNeedResponse = true;
- return "RSET\r\n";
+ return QByteArrayLiteral("RSET\r\n");
}
//
@@ -643,6 +643,6 @@ QByteArray QuitCommand::nextCommandLine(TransactionState *ts)
Q_UNUSED(ts)
mComplete = true;
mNeedResponse = true;
- return "QUIT\r\n";
+ return QByteArrayLiteral("QUIT\r\n");
}
} // namespace KioSMTP
diff --git a/kioslave/src/smtp/request.cpp b/kioslave/src/smtp/request.cpp
index 6e6d73a..edbca5c 100644
--- a/kioslave/src/smtp/request.cpp
+++ b/kioslave/src/smtp/request.cpp
@@ -47,7 +47,7 @@ Request Request::fromURL(const QUrl &url)
#ifndef NDEBUG
qCDebug(SMTP_LOG) << "Parsing request from query:\n" << query.join(QLatin1Char('\n'));
#endif
- for (QStringList::const_iterator it = query.begin(); it != query.end(); ++it) {
+ for (QStringList::const_iterator it = query.begin(), end(query.end()); it != end; ++it) {
int equalsPos = (*it).indexOf(QLatin1Char('='));
if (equalsPos <= 0) {
continue;
@@ -177,10 +177,10 @@ QByteArray Request::headerFields(const QString &fromRealName) const
assert(hasFromAddress()); // should have been checked for by
// caller (MAIL FROM comes before DATA)
- QByteArray result = "From: " + formatFromAddress(fromRealName, fromAddress()) + "\r\n";
+ QByteArray result = QByteArrayLiteral("From: ") + formatFromAddress(fromRealName, fromAddress()) + QByteArrayLiteral("\r\n");
if (!subject().isEmpty()) {
- result += "Subject: " + formatSubject(subject()) + "\r\n";
+ result += QByteArrayLiteral("Subject: ") + formatSubject(subject()) + QByteArrayLiteral("\r\n");
}
if (!to().empty()) {
result += QByteArrayLiteral("To: ") + to().join(QStringLiteral(",\r\n\t") /* line folding */).toLatin1() + "\r\n";
diff --git a/kioslave/src/smtp/response.cpp b/kioslave/src/smtp/response.cpp
index b635bd1..c12f824 100644
--- a/kioslave/src/smtp/response.cpp
+++ b/kioslave/src/smtp/response.cpp
@@ -97,7 +97,7 @@ static QByteArray join(char sep, const QCStringList &list)
return QByteArray();
}
QByteArray result = list.front();
- for (QCStringList::const_iterator it = ++list.begin(); it != list.end(); ++it) {
+ for (QCStringList::const_iterator it = ++list.begin(), end(list.end()); it != end; ++it) {
result += sep + *it;
}
return result;
diff --git a/kioslave/src/smtp/smtp.cpp b/kioslave/src/smtp/smtp.cpp
index f57e6d2..180c721 100644
--- a/kioslave/src/smtp/smtp.cpp
+++ b/kioslave/src/smtp/smtp.cpp
@@ -235,7 +235,7 @@ void SMTPProtocol::put(const QUrl &url, int permissions, KIO::JobFlags flags)
// Loop through our To and CC recipients, and send the proper
// SMTP commands, for the benefit of the server.
const QStringList recipients = request.recipients();
- for (QStringList::const_iterator it = recipients.begin(); it != recipients.end(); ++it) {
+ for (QStringList::const_iterator it = recipients.begin(), end(recipients.end()); it != end; ++it) {
queueCommand(new RcptToCommand(m_sessionIface, (*it).toLatin1()));
}