[frameworks/kio] /: Fix clang compilation warnings
Méven Car <[email protected]> Tue, 4 Aug 2026 16:08:56 +0000 (UTC)
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 81f6a9e33b7c6631d62a3cc16e6f388ff038f1da by Méven Car.
Committed on 04/08/2026 at 15:49.
Pushed by meven into branch 'master'.
Fix clang compilation warnings
- listjob: drop the unused Q_D in setDetails
- kfileplacesview: remove a no-op QRect::adjust whose sub-pixel args truncate to 0
- kfilewidget: cast the std::array size to int in the slider bounds assert to avoid a sign-compare
- kfileitemdelegate: drop unused parameter names
- renamedialog, threadtest, threadconnectionbackendtest: drop lambda captures of const values usable without capture
- widgetsopenorexecutefilehandler: drop unused lambda captures
- testtrash: mark dirListerContainsDisplayName maybe_unused, it is only used in the no-QtDBus build
M +1 -1 autotests/threadconnectionbackendtest.cpp
M +1 -1 autotests/threadtest.cpp
M +0 -1 src/core/listjob.cpp
M +0 -1 src/filewidgets/kfileplacesview.cpp
M +1 -1 src/filewidgets/kfilewidget.cpp
M +1 -1 src/kioworkers/trash/tests/testtrash.cpp
M +3 -3 src/widgets/kfileitemdelegate.cpp
M +1 -1 src/widgets/renamedialog.cpp
M +1 -1 src/widgets/widgetsopenorexecutefilehandler.cpp
https://invent.kde.org/frameworks/kio/-/commit/81f6a9e33b7c6631d62a3cc16e6f388ff038f1da
diff --git a/autotests/threadconnectionbackendtest.cpp b/autotests/threadconnectionbackendtest.cpp
index 3473e9cec2..433758e94a 100644
--- a/autotests/threadconnectionbackendtest.cpp
+++ b/autotests/threadconnectionbackendtest.cpp
@@ -176,7 +176,7 @@ void ThreadConnectionBackendTest::testManyTasksPreserveOrderUnderBackPressure()
// Produce far more than HighWaterMark from a separate thread so the producer actually
// blocks on back-pressure and resumes as the application drains. Order must be preserved.
const int total = 2000;
- QThread *workerThread = QThread::create([worker = workerBackend.get(), total] {
+ QThread *workerThread = QThread::create([worker = workerBackend.get()] {
for (int i = 0; i < total; ++i) {
worker->sendCommand(i, QByteArray::number(i));
}
diff --git a/autotests/threadtest.cpp b/autotests/threadtest.cpp
index 1a21f2940e..135bbe2b6f 100644
--- a/autotests/threadtest.cpp
+++ b/autotests/threadtest.cpp
@@ -106,7 +106,7 @@ void KIOThreadTest::asyncConcurrentCopying()
for (int i = 0; i < numFiles; ++i) {
auto *job = KIO::file_copy(QUrl::fromLocalFile(srcs.at(i)), QUrl::fromLocalFile(dests.at(i)), -1, KIO::HideProgressInfo);
job->setUiDelegate(nullptr);
- connect(job, &KJob::result, this, [&completedJobs, numFiles, &loop](KJob *j) {
+ connect(job, &KJob::result, this, [&completedJobs, &loop](KJob *j) {
QVERIFY(!j->error());
if (++completedJobs == numFiles) {
loop.quit();
diff --git a/src/core/listjob.cpp b/src/core/listjob.cpp
index 4a3a63c9ef..e57cbb63e1 100644
--- a/src/core/listjob.cpp
+++ b/src/core/listjob.cpp
@@ -288,7 +288,6 @@ void ListJob::setUnrestricted(bool unrestricted)
void ListJob::setDetails(KIO::StatDetails details)
{
- Q_D(ListJob);
addMetaData(QStringLiteral("details"), QString::number(details));
}
diff --git a/src/filewidgets/kfileplacesview.cpp b/src/filewidgets/kfileplacesview.cpp
index 697bd3395f..3e614f26e7 100644
--- a/src/filewidgets/kfileplacesview.cpp
+++ b/src/filewidgets/kfileplacesview.cpp
@@ -251,7 +251,6 @@ void KFilePlacesViewDelegate::paint(QPainter *painter, const QStyleOptionViewIte
const int radius = capacityBarHeight / 2;
QRect capacityBgRect(rectText.x(), rectText.bottom(), rectText.width(), capacityBarHeight);
- capacityBgRect.adjust(0.5, 0.5, -0.5, -0.5);
QRect capacityFillRect = capacityBgRect;
capacityFillRect.setWidth(capacityFillRect.width() * usedSpace);
diff --git a/src/filewidgets/kfilewidget.cpp b/src/filewidgets/kfilewidget.cpp
index f15c5f2947..86abbf219e 100644
--- a/src/filewidgets/kfilewidget.cpp
+++ b/src/filewidgets/kfilewidget.cpp
@@ -2276,7 +2276,7 @@ void KFileWidgetPrivate::slotDirOpIconSizeChanged(int size)
{
int sliderValue = m_iconSizeSlider->value();
short currentIconSliderSize = m_stdIconSizes[sliderValue];
- Q_ASSERT(sliderValue < m_stdIconSizes.size());
+ Q_ASSERT(sliderValue < static_cast<int>(m_stdIconSizes.size()));
if (size == currentIconSliderSize)
return;
if (std::abs(size - currentIconSliderSize) != 1) {
diff --git a/src/kioworkers/trash/tests/testtrash.cpp b/src/kioworkers/trash/tests/testtrash.cpp
index f50df33e3d..f2007a7616 100644
--- a/src/kioworkers/trash/tests/testtrash.cpp
+++ b/src/kioworkers/trash/tests/testtrash.cpp
@@ -321,7 +321,7 @@ static void createTestFile(const QString &path)
QVERIFY(QFile::exists(path));
}
-static bool dirListerContainsDisplayName(const KCoreDirLister &lister, const QString &displayName)
+[[maybe_unused]] static bool dirListerContainsDisplayName(const KCoreDirLister &lister, const QString &displayName)
{
const KFileItemList items = lister.items();
for (const KFileItem &item : items) {
diff --git a/src/widgets/kfileitemdelegate.cpp b/src/widgets/kfileitemdelegate.cpp
index 5122604e54..6402d825e8 100644
--- a/src/widgets/kfileitemdelegate.cpp
+++ b/src/widgets/kfileitemdelegate.cpp
@@ -117,7 +117,7 @@ private:
Margin *activeMargins;
};
-KFileItemDelegate::Private::Private(KFileItemDelegate *parent)
+KFileItemDelegate::Private::Private(KFileItemDelegate *)
: shadowColor(Qt::transparent)
, shadowOffset(1, 1)
, shadowBlur(2)
@@ -444,7 +444,7 @@ QSize KFileItemDelegate::Private::displaySizeHint(const QStyleOptionViewItem &op
return addMargin(size, TextMargin);
}
-QSize KFileItemDelegate::Private::decorationSizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
+QSize KFileItemDelegate::Private::decorationSizeHint(const QStyleOptionViewItem &option, const QModelIndex &) const
{
QSize iconSize = option.icon.actualSize(option.decorationSize);
if (!verticalLayout(option)) {
@@ -996,7 +996,7 @@ QIcon KFileItemDelegate::Private::decoration(const QStyleOptionViewItem &option,
return icon;
}
-QRect KFileItemDelegate::Private::labelRectangle(const QStyleOptionViewItem &option, const QModelIndex &index) const
+QRect KFileItemDelegate::Private::labelRectangle(const QStyleOptionViewItem &option, const QModelIndex &) const
{
QStyle *style = option.widget ? option.widget->style() : QApplication::style();
return style->subElementRect(QStyle::SE_ItemViewItemText, &option, option.widget);
diff --git a/src/widgets/renamedialog.cpp b/src/widgets/renamedialog.cpp
index 12509a9ad5..7d733163d6 100644
--- a/src/widgets/renamedialog.cpp
+++ b/src/widgets/renamedialog.cpp
@@ -132,7 +132,7 @@ static CompareFilesResult compareFiles(const QString &filepath, const QString &s
QByteArray buffer(bufferSize, 0);
QByteArray buffer2(bufferSize, 0);
- auto seekFillBuffer = [bufferSize](qint64 pos, QFile &f, QByteArray &buffer) {
+ auto seekFillBuffer = [](qint64 pos, QFile &f, QByteArray &buffer) {
auto ioresult = f.seek(pos);
if (ioresult) {
const int bytesRead = f.read(buffer.data(), bufferSize);
diff --git a/src/widgets/widgetsopenorexecutefilehandler.cpp b/src/widgets/widgetsopenorexecutefilehandler.cpp
index 08430df7f8..816c84e2fe 100644
--- a/src/widgets/widgetsopenorexecutefilehandler.cpp
+++ b/src/widgets/widgetsopenorexecutefilehandler.cpp
@@ -74,7 +74,7 @@ void KIO::WidgetsOpenOrExecuteFileHandler::promptUserOpenOrExecute(KJob *job, co
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->setModal(true);
- connect(dialog, &QDialog::finished, this, [this, dialog, mime](const int result) {
+ connect(dialog, &QDialog::finished, this, [this](const int result) {
if (result == ExecutableFileOpenDialog::Rejected) {
Q_EMIT canceled();
return;