aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Montel <[email protected]>2018-01-11 22:52:25 +0100
committerLaurent Montel <[email protected]>2018-01-11 22:52:44 +0100
commit154679b9ff4763f9f51afbb319a2279fddb8411f (patch)
treea0f245ed786c7e72eafd7f1269b969892e988175
parentaed8169dd9dd00af9fe14d2582040c29fef98f3a (diff)
minor optimization
-rw-r--r--src/server/storage/datastore.cpp11
-rw-r--r--src/server/storage/itemretriever.cpp4
2 files changed, 8 insertions, 7 deletions
diff --git a/src/server/storage/datastore.cpp b/src/server/storage/datastore.cpp
index 2a8f1da..cfd3453 100644
--- a/src/server/storage/datastore.cpp
+++ b/src/server/storage/datastore.cpp
@@ -264,7 +264,7 @@ bool DataStore::setItemsFlags(const PimItem::List &items, const QVector<Flag> &f
}
}
- Q_FOREACH (const Flag &flag, flags) {
+ for (const Flag &flag : flags) {
if (!itemFlags.contains(flag)) {
addedFlags << flag.name().toLatin1();
insIds << item.id();
@@ -656,7 +656,7 @@ bool DataStore::removeTags(const Tag::List &tags, bool silent)
QSet<qint64> removedTags;
removedTagsIds.reserve(tags.count());
removedTags.reserve(tags.count());
- Q_FOREACH (const Tag &tag, tags) {
+ for (const Tag &tag : tags) {
removedTagsIds << tag.id();
removedTags << tag.id();
}
@@ -1014,7 +1014,7 @@ QMap<Entity::Id, QList<PimItem> > DataStore::virtualCollections(const PimItem::L
} else {
QVariantList ids;
ids.reserve(items.count());
- Q_FOREACH (const PimItem &item, items) {
+ for (const PimItem &item : items) {
ids << item.id();
}
qb.addValueCondition(CollectionPimItemRelation::rightFullColumnName(), Query::In, ids);
@@ -1313,7 +1313,7 @@ QSqlQuery DataStore::retryLastTransaction(bool rollbackFirst)
for (auto q = m_transactionQueries.begin(), qEnd = m_transactionQueries.end(); q != qEnd; ++q) {
QSqlQuery query(database());
query.prepare(q->query);
- for (int i = 0; i < q->boundValues.count(); ++i) {
+ for (int i = 0, total = q->boundValues.count(); i < total; ++i) {
query.bindValue(QLatin1Char(':') + QString::number(i), q->boundValues.at(i));
}
@@ -1443,7 +1443,8 @@ bool DataStore::commitTransaction()
if (m_transactionLevel == 1) {
QSqlDriver *driver = m_database.driver();
- QElapsedTimer timer; timer.start();
+ QElapsedTimer timer;
+ timer.start();
driver->commitTransaction();
StorageDebugger::instance()->removeTransaction(reinterpret_cast<qint64>(this),
true, timer.elapsed(),
diff --git a/src/server/storage/itemretriever.cpp b/src/server/storage/itemretriever.cpp
index 2afeff6..f4f3d5c 100644
--- a/src/server/storage/itemretriever.cpp
+++ b/src/server/storage/itemretriever.cpp
@@ -356,7 +356,7 @@ bool ItemRetriever::exec()
try {
// Request is deleted inside ItemRetrievalManager, so we need to take
// a copy here
- const auto ids = request->ids;
+ //const auto ids = request->ids;
ItemRetrievalManager::instance()->requestItemDelivery(request);
} catch (const ItemRetrieverException &e) {
qCCritical(AKONADISERVER_LOG) << e.type() << ": " << e.what();
@@ -408,7 +408,7 @@ void ItemRetriever::verifyCache()
}
if (!qb.exec()) {
- mLastError = "Unable to query parts.";
+ mLastError = QByteArrayLiteral("Unable to query parts.");
throw ItemRetrieverException(mLastError);
}