mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
replace foreach macro with standard for each loop (#5485)
This commit is contained in:
parent
0cbad25385
commit
c148c8df7f
17 changed files with 31 additions and 31 deletions
|
|
@ -69,7 +69,7 @@ void ServerLogger::logMessage(const QString &message, void *caller)
|
|||
|
||||
if (!logFilters.trimmed().isEmpty()) {
|
||||
shouldWeSkipLine = true;
|
||||
foreach (QString logFilter, listlogFilters) {
|
||||
for (const QString &logFilter : listlogFilters) {
|
||||
if (message.contains(logFilter, Qt::CaseInsensitive)) {
|
||||
shouldWeSkipLine = false;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -375,7 +375,7 @@ bool AbstractServerSocketInterface::deckListHelper(int folderId, ServerInfo_Deck
|
|||
while (query->next())
|
||||
results[query->value(0).toInt()] = query->value(1).toString();
|
||||
|
||||
foreach (int key, results.keys()) {
|
||||
for (int key : results.keys()) {
|
||||
ServerInfo_DeckStorage_TreeItem *newItem = folder->add_items();
|
||||
newItem->set_id(key);
|
||||
newItem->set_name(results.value(key).toStdString());
|
||||
|
|
@ -840,7 +840,7 @@ Response::ResponseCode AbstractServerSocketInterface::cmdGetWarnList(const Comma
|
|||
#else
|
||||
QStringList warningsList = officialWarnings.split(",", QString::SkipEmptyParts);
|
||||
#endif
|
||||
foreach (QString warning, warningsList) {
|
||||
for (const QString &warning : warningsList) {
|
||||
re->add_warning(warning.toStdString());
|
||||
}
|
||||
re->set_user_name(nameFromStdString(cmd.user_name()).toStdString());
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ void QxtMailAttachment::setExtraHeaders(const QHash<QString, QString>& a)
|
|||
{
|
||||
QHash<QString, QString>& headers = qxt_d->extraHeaders;
|
||||
headers.clear();
|
||||
foreach(const QString& key, a.keys())
|
||||
for (const QString& key: a.keys())
|
||||
{
|
||||
headers[key.toLower()] = a[key];
|
||||
}
|
||||
|
|
@ -187,7 +187,7 @@ QByteArray QxtMailAttachment::mimeData()
|
|||
}
|
||||
|
||||
QByteArray rv = "Content-Type: " + qxt_d->contentType.toLatin1() + "\r\nContent-Transfer-Encoding: base64\r\n";
|
||||
foreach(const QString& r, qxt_d->extraHeaders.keys())
|
||||
for(const QString& r: qxt_d->extraHeaders.keys())
|
||||
{
|
||||
rv += qxt_fold_mime_header(r.toLatin1(), extraHeader(r));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ void QxtMailMessage::setExtraHeaders(const QHash<QString, QString> &a)
|
|||
{
|
||||
QHash<QString, QString> &headers = qxt_d->extraHeaders;
|
||||
headers.clear();
|
||||
foreach (const QString &key, a.keys()) {
|
||||
for (const QString &key : a.keys()) {
|
||||
headers[key.toLower()] = a[key];
|
||||
}
|
||||
}
|
||||
|
|
@ -219,7 +219,7 @@ QByteArray qxt_fold_mime_header(const QString &key, const QString &value, const
|
|||
line += prefix;
|
||||
if (!value.contains("=?") && isASCII(value)) {
|
||||
bool firstWord = true;
|
||||
foreach (const QByteArray &word, value.toLatin1().split(' ')) {
|
||||
for (const QByteArray &word : value.toLatin1().split(' ')) {
|
||||
if (line.size() > 78) {
|
||||
rv = rv + line + "\r\n";
|
||||
line.clear();
|
||||
|
|
@ -339,7 +339,7 @@ QByteArray QxtMailMessage::rfc2822() const
|
|||
}
|
||||
}
|
||||
|
||||
foreach (const QString &r, qxt_d->extraHeaders.keys()) {
|
||||
for (const QString &r : qxt_d->extraHeaders.keys()) {
|
||||
if ((r.toLower() == "content-type" || r.toLower() == "content-transfer-encoding") && attach.count()) {
|
||||
// Since we're in multipart mode, we'll be outputting this later
|
||||
continue;
|
||||
|
|
@ -463,7 +463,7 @@ QByteArray QxtMailMessage::rfc2822() const
|
|||
}
|
||||
|
||||
if (attach.count()) {
|
||||
foreach (const QString &filename, attach.keys()) {
|
||||
for (const QString &filename : attach.keys()) {
|
||||
rv += "--" + qxt_d->boundary + "\r\n";
|
||||
rv +=
|
||||
qxt_fold_mime_header("Content-Disposition", QDir(filename).dirName(), "attachment; filename=");
|
||||
|
|
|
|||
|
|
@ -273,7 +273,7 @@ void QxtSmtpPrivate::socketRead()
|
|||
void QxtSmtpPrivate::ehlo()
|
||||
{
|
||||
QByteArray address = "127.0.0.1";
|
||||
foreach (const QHostAddress &addr, QNetworkInterface::allAddresses()) {
|
||||
for (const QHostAddress &addr : QNetworkInterface::allAddresses()) {
|
||||
if (addr == QHostAddress::LocalHost || addr == QHostAddress::LocalHostIPv6)
|
||||
continue;
|
||||
address = addr.toString().toLatin1();
|
||||
|
|
@ -469,7 +469,7 @@ void QxtSmtpPrivate::sendNext()
|
|||
socket->write("mail from:<" + qxt_extract_address(msg.sender()) + ">\r\n");
|
||||
if (extensions.contains("PIPELINING")) // almost all do nowadays
|
||||
{
|
||||
foreach (const QString &rcpt, recipients) {
|
||||
for (const QString &rcpt : recipients) {
|
||||
socket->write("rcpt to:<" + qxt_extract_address(rcpt) + ">\r\n");
|
||||
}
|
||||
state = RcptAckPending;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue