Verified Commit 39d677f8 authored by Daniel Vrátil's avatar Daniel Vrátil 🤖
Browse files

Fix/pass more clang-tidy checks

parent 678781e3
......@@ -224,7 +224,7 @@ void ImapParserTest::testParseParenthesizedList()
// newline literal (based on itemappendtest bug)
input = "(foo {6}\n\n\nbar\n bla)";
consumed = ImapParser::parseParenthesizedList(input, result);
ImapParser::parseParenthesizedList(input, result);
}
void ImapParserTest::testParseNumber()
......
......@@ -108,7 +108,7 @@ void ItemAppendTest::testContent_data()
QTest::newRow("utf8") << utf8string.toUtf8();
QTest::newRow("newlines") << QByteArray("\nsome\n\nbreaked\ncontent\n\n");
QByteArray b;
QTest::newRow("big") << b.fill('a', 1u << 20);
QTest::newRow("big") << b.fill('a', 1U << 20);
QTest::newRow("bignull") << b.fill('\0', 1U << 20);
QTest::newRow("bigcr") << b.fill('\r', 1U << 20);
QTest::newRow("biglf") << b.fill('\n', 1U << 20);
......
......@@ -292,7 +292,7 @@ void ItemHydra::testPolymorphicPayloadWithTypedef()
void ItemHydra::testNullPointerPayload()
{
RudiPtr p((Rudi *)nullptr);
RudiPtr p(static_cast<Rudi *>(nullptr));
Item i;
i.setPayload(p);
QVERIFY(i.hasPayload());
......
......@@ -113,7 +113,7 @@ FakeAkonadiServer::FakeAkonadiServer()
FakeAkonadiServer::~FakeAkonadiServer()
{
quit();
FakeAkonadiServer::quit();
}
QString FakeAkonadiServer::basePath()
......
......@@ -199,7 +199,7 @@ public:
}
mItemSyncer->setDisableAutomaticDeliveryDone(mDisableAutomaticItemDeliveryDone);
mItemSyncer->setProperty("collection", QVariant::fromValue(q->currentCollection()));
connect(mItemSyncer, qOverload<KJob *, unsigned long>(&KJob::percent), this, &ResourceBasePrivate::slotPercent);
connect(mItemSyncer, qOverload<KJob *, unsigned long>(&KJob::percent), this, &ResourceBasePrivate::slotPercent); // NOLINT(google-runtime-int): ulong comes from KJob
connect(mItemSyncer, &KJob::result, this, &ResourceBasePrivate::slotItemSyncDone);
connect(mItemSyncer, &ItemSync::readyForNextBatch, q, &ResourceBase::retrieveNextItemSyncBatch);
}
......@@ -591,7 +591,6 @@ void ResourceBase::itemRetrieved(const Item &item)
return;
}
Item i(item);
const QSet<QByteArray> requestedParts = d->scheduler->currentTask().itemParts;
for (const QByteArray &part : requestedParts) {
if (!item.loadedPayloadParts().contains(part)) {
......@@ -599,7 +598,7 @@ void ResourceBase::itemRetrieved(const Item &item)
}
}
ItemModifyJob *job = new ItemModifyJob(i);
ItemModifyJob *job = new ItemModifyJob(item);
job->d_func()->setSilent(true);
// FIXME: remove once the item with which we call retrieveItem() has a revision number
job->disableRevisionCheck();
......@@ -768,7 +767,7 @@ void ResourceBase::collectionsRetrieved(const Collection::List &collections)
d->mCollectionSyncer = new CollectionSync(identifier());
d->mCollectionSyncer->setHierarchicalRemoteIds(d->mHierarchicalRid);
d->mCollectionSyncer->setKeepLocalChanges(d->mKeepLocalCollectionChanges);
connect(d->mCollectionSyncer, qOverload<KJob *, quint64>(&KJob::percent), d, &ResourceBasePrivate::slotPercent);
connect(d->mCollectionSyncer, qOverload<KJob *, unsigned long>(&KJob::percent), d, &ResourceBasePrivate::slotPercent); // NOLINT(google-runtime-int): ulong comes from KJob
connect(d->mCollectionSyncer, &KJob::result, d, &ResourceBasePrivate::slotCollectionSyncDone);
}
d->mCollectionSyncer->setRemoteCollections(collections);
......@@ -786,7 +785,7 @@ void ResourceBase::collectionsRetrievedIncremental(const Collection::List &chang
d->mCollectionSyncer = new CollectionSync(identifier());
d->mCollectionSyncer->setHierarchicalRemoteIds(d->mHierarchicalRid);
d->mCollectionSyncer->setKeepLocalChanges(d->mKeepLocalCollectionChanges);
connect(d->mCollectionSyncer, qOverload<KJob *, quint64>(&KJob::percent), d, &ResourceBasePrivate::slotPercent);
connect(d->mCollectionSyncer, qOverload<KJob *, unsigned long>(&KJob::percent), d, &ResourceBasePrivate::slotPercent); // NOLINT(google-runtime-int): ulong comes from KJob
connect(d->mCollectionSyncer, &KJob::result, d, &ResourceBasePrivate::slotCollectionSyncDone);
}
d->mCollectionSyncer->setRemoteCollections(changedCollections, removedCollections);
......@@ -802,7 +801,7 @@ void ResourceBase::setCollectionStreamingEnabled(bool enable)
if (!d->mCollectionSyncer) {
d->mCollectionSyncer = new CollectionSync(identifier());
d->mCollectionSyncer->setHierarchicalRemoteIds(d->mHierarchicalRid);
connect(d->mCollectionSyncer, qOverload<KJob *, quint64>(&KJob::percent), d, &ResourceBasePrivate::slotPercent);
connect(d->mCollectionSyncer, qOverload<KJob *, unsigned long>(&KJob::percent), d, &ResourceBasePrivate::slotPercent); // NOLINT(google-runtime-int): ulong comes from KJob
connect(d->mCollectionSyncer, &KJob::result, d, &ResourceBasePrivate::slotCollectionSyncDone);
}
d->mCollectionSyncer->setStreamingEnabled(enable);
......@@ -1348,12 +1347,12 @@ void ResourceBase::itemsRetrieved(const Item::List &items)
connect(trx, &KJob::result, d, &ResourceBasePrivate::slotItemSyncDone);
for (const Item &item : items) {
Q_ASSERT(item.parentCollection().isValid());
if (item.isValid()) {
if (item.isValid()) { // NOLINT(bugprone-branch-clone)
new ItemModifyJob(item, trx);
} else if (!item.remoteId().isEmpty()) {
auto *job = new ItemCreateJob(item, item.parentCollection(), trx);
job->setMerge(ItemCreateJob::RID);
} else { // NOLINT(bugprone-branch-clone)
} else {
// This should not happen, but just to be sure...
new ItemModifyJob(item, trx);
}
......@@ -1558,7 +1557,7 @@ void ResourceBase::tagsRetrieved(const Tag::List &tags, const QHash<QString, Ite
"Calling tagsRetrieved() although no tag retrieval is in progress");
if (!d->mTagSyncer) {
d->mTagSyncer = new TagSync(this);
connect(d->mTagSyncer, qOverload<KJob *, quint64>(&KJob::percent), d, &ResourceBasePrivate::slotPercent);
connect(d->mTagSyncer, qOverload<KJob *, unsigned long>(&KJob::percent), d, &ResourceBasePrivate::slotPercent); // NOLINT(google-runtime-int): ulong comes from KJob
connect(d->mTagSyncer, &KJob::result, d, &ResourceBasePrivate::slotTagSyncDone);
}
d->mTagSyncer->setFullTagList(tags);
......@@ -1589,7 +1588,7 @@ void ResourceBase::relationsRetrieved(const Relation::List &relations)
"Calling relationsRetrieved() although no relation retrieval is in progress");
if (!d->mRelationSyncer) {
d->mRelationSyncer = new RelationSync(this);
connect(d->mRelationSyncer, qOverload<KJob *, quint64>(&KJob::percent), d, &ResourceBasePrivate::slotPercent);
connect(d->mRelationSyncer, qOverload<KJob *, unsigned long>(&KJob::percent), d, &ResourceBasePrivate::slotPercent); // NOLINT(google-runtime-int): ulong comes from KJob
connect(d->mRelationSyncer, &KJob::result, d, &ResourceBasePrivate::slotRelationSyncDone);
}
d->mRelationSyncer->setRemoteRelations(relations);
......
......@@ -46,7 +46,7 @@ public:
QScopedPointer<KAboutData> aboutData;
QWidget *parentWidget = nullptr;
};
} // namespace
} // namespace Akonadi
using namespace Akonadi;
......
......@@ -40,7 +40,7 @@ public:
return service;
}
};
} // namespace
} // namespace Akonadi
using namespace Akonadi;
......
......@@ -64,7 +64,7 @@ static void assignCollectionPrivate(QSharedDataPointer<CollectionPrivate> &one,
// With a single-line assignment here, the parent collection would be deleted
// before it is assigned, and therefore the resulting object would point to
// uninitalized memory.
const QSharedDataPointer<CollectionPrivate> temp = other;
const QSharedDataPointer<CollectionPrivate> temp = other; // NOLINT(performance-unnecessary-copy-initialization): see above
one = temp;
}
......
......@@ -52,7 +52,7 @@ QString InvalidateCacheJobPrivate::jobDebuggingString() const
return QStringLiteral("Invalidate Cache from collection id: %1").arg(collection.id());
}
} // namespace
} // namespace Akonadi
void InvalidateCacheJobPrivate::collectionFetchResult(KJob *job)
{
......
......@@ -142,7 +142,7 @@ public:
* Returns the error string, if there has been an error, an empty
* string otherwise.
*/
Q_REQUIRED_RESULT QString errorString() const override;
Q_REQUIRED_RESULT QString errorString() const final;
Q_SIGNALS:
/**
......
......@@ -80,7 +80,7 @@ QModelIndex TagModelPrivate::indexForTag(const qint64 tagId) const
const Tag::Id parentId = tag.parent().id();
const int row = mChildTags.value(parentId).indexOf(tag);
if (row != -1) {
return q->createIndex(row, 0, (int) parentId);
return q->createIndex(row, 0, static_cast<int>(parentId));
}
return QModelIndex();
......
......@@ -283,12 +283,8 @@ void MonitorPrivate::checkBatchSupport(const Protocol::ChangeNotificationPtr &ms
needsSplit = isBatch && !batchSupported && hasListeners(&Monitor::itemChanged);
return;
case Protocol::ItemChangeNotification::ModifyTags:
// Tags were added after batch notifications, so they are always supported
batchSupported = true;
needsSplit = false;
return;
case Protocol::ItemChangeNotification::ModifyRelations:
// Relations were added after batch notifications, so they are always supported
// Tags and relations were added after batch notifications, so they are always supported
batchSupported = true;
needsSplit = false;
return;
......
......@@ -170,8 +170,8 @@ void TagSync::onCreateTagDone(KJob *job)
static bool containsByGidOrRid(const Item::List &items, const Item &key)
{
return std::any_of(items.cbegin(), items.cend(), [key](const Item &item) {
return ((!item.gid().isEmpty() && !key.gid.isEmpty()) && (item.gid() == key.gid()))
return std::any_of(items.cbegin(), items.cend(), [&key](const Item &item) {
return ((!item.gid().isEmpty() && !key.gid().isEmpty()) && (item.gid() == key.gid()))
|| (item.remoteId() == key.remoteId());
});
}
......
......@@ -30,7 +30,7 @@
class <xsl:value-of select="$className"/>::Private : public QSharedData
{
public:
Private() : QSharedData()
Private() : QSharedData() // NOLINT(readability-redundant-member-init)
<!-- BEGIN Variable Initializers - order as Variable Declarations below -->
<xsl:for-each select="column[@type = 'qint64' and @name != 'id']">
, <xsl:value-of select="@name"/>(<xsl:choose><xsl:when test="@default"><xsl:value-of select="@default"/></xsl:when><xsl:otherwise>0</xsl:otherwise></xsl:choose>)
......@@ -156,9 +156,7 @@ void <xsl:value-of select="$className"/>::Private::addToCache(const <xsl:value-o
<xsl:for-each select="column[@name != 'id']">
<xsl:call-template name="argument"/><xsl:if test="position() != last()">, </xsl:if>
</xsl:for-each>
) :
Entity(),
d(new Private)
) : d(new Private)
{
<xsl:for-each select="column[@name != 'id']">
d-&gt;<xsl:value-of select="@name"/> = <xsl:value-of select="@name"/>;
......@@ -618,7 +616,7 @@ bool <xsl:value-of select="$className"/>::insert(qint64* insertId)
bool <xsl:value-of select="$className"/>::hasPendingChanges() const
{
return false
return false // NOLINT(readability-redundant-member-init)
<xsl:for-each select="column[@name != 'id']">
|| d-&gt;<xsl:value-of select="@name"/>_changed
</xsl:for-each>;
......
......@@ -220,7 +220,7 @@ set<xsl:value-of select="$methodName"/>(<xsl:call-template name="argument"/>)
<!-- this indirection is required to prevent off-by-one access now that we skip the key column -->
int valueIndex = 0;
<xsl:for-each select="column">
const <xsl:call-template name="data-type"/> &value<xsl:value-of select="position()"/> =
const <xsl:call-template name="data-type"/> &amp;value<xsl:value-of select="position()"/> =
<xsl:choose>
<xsl:when test="@name=$key">
<xsl:value-of select="$key"/>;
......
......@@ -27,6 +27,7 @@
#include "collectioncreatejob.h"
#include "collectiondeletejob.h"
#include "collectiondialog.h"
#include "collectionpropertiespage.h"
#include "collectionutils.h"
#include "entitytreemodel.h"
#include "favoritecollectionsmodel.h"
......@@ -1708,6 +1709,7 @@ QAction *StandardActionManager::createAction(Type type)
}
Q_ASSERT(standardActionData[type].name);
Q_ASSERT(d->actionCollection);
d->actionCollection->addAction(QString::fromLatin1(standardActionData[type].name), action);
d->actions[type] = action;
if ((standardActionData[type].actionType == ActionWithAlternative) && (standardActionData[type + 1].actionType == ActionAlternative)) {
......@@ -1720,7 +1722,7 @@ QAction *StandardActionManager::createAction(Type type)
void StandardActionManager::createAllActions()
{
for (uint i = 0; i < LastType; ++i) {
createAction((Type)i);
createAction(static_cast<Type>(i));
}
}
......
......@@ -41,7 +41,7 @@ struct Q_DECL_HIDDEN TagManagementDialog::Private {
void readConfig() const;
Ui::TagManagementDialog ui;
QDialog * const q = nullptr;
QDialog * const q;
QDialogButtonBox *buttonBox = nullptr;
};
......@@ -56,7 +56,7 @@ void TagManagementDialog::Private::readConfig() const
KConfigGroup group(KSharedConfig::openConfig(), "TagManagementDialog");
const QSize sizeDialog = group.readEntry("Size", QSize(500, 400));
if (sizeDialog.isValid()) {
d->resize(sizeDialog);
q->resize(sizeDialog);
}
}
......
......@@ -40,7 +40,7 @@ public:
void writeConfig() const;
void readConfig() const;
QDialog * const q = nullptr;
QDialog * const q;
Ui::TagSelectionDialog ui;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment