all: fix gcc warnings and lints

This commit is contained in:
outfoxxed 2025-10-04 13:22:17 -07:00
parent b254f6dabc
commit e10747addd
No known key found for this signature in database
GPG key ID: 4C88A185FB89301E
11 changed files with 42 additions and 16 deletions

View file

@ -12,6 +12,9 @@ lint-ci:
lint-changed:
git diff --name-only HEAD | grep "^.*\.cpp\$" | parallel -j$(nproc) --no-notice --will-cite --tty --bar clang-tidy --load={{ env_var("TIDYFOX") }}
lint-staged:
git diff --staged --name-only HEAD | grep "^.*\.cpp\$" | parallel -j$(nproc) --no-notice --will-cite --tty --bar clang-tidy --load={{ env_var("TIDYFOX") }}
configure target='debug' *FLAGS='':
cmake -GNinja -B {{builddir}} \
-DCMAKE_BUILD_TYPE={{ if target == "debug" { "Debug" } else { "RelWithDebInfo" } }} \

View file

@ -313,8 +313,12 @@ void ThreadLogging::init() {
if (logMfd != -1) {
this->file = new QFile();
this->file->open(logMfd, QFile::ReadWrite, QFile::AutoCloseHandle);
if (this->file->open(logMfd, QFile::ReadWrite, QFile::AutoCloseHandle)) {
this->fileStream.setDevice(this->file);
} else {
qCCritical(logLogging) << "Failed to open early logging memfd.";
}
}
if (dlogMfd != -1) {
@ -322,7 +326,9 @@ void ThreadLogging::init() {
this->detailedFile = new QFile();
// buffered by WriteBuffer
this->detailedFile->open(dlogMfd, QFile::ReadWrite | QFile::Unbuffered, QFile::AutoCloseHandle);
if (this->detailedFile
->open(dlogMfd, QFile::ReadWrite | QFile::Unbuffered, QFile::AutoCloseHandle))
{
this->detailedWriter.setDevice(this->detailedFile);
if (!this->detailedWriter.writeHeader()) {
@ -331,6 +337,9 @@ void ThreadLogging::init() {
delete this->detailedFile;
this->detailedFile = nullptr;
}
} else {
qCCritical(logLogging) << "Failed to open early detailed logging memfd.";
}
}
// This connection is direct so it works while the event loop is destroyed between

View file

@ -77,7 +77,11 @@ void CrashHandler::setRelaunchInfo(const RelaunchInfo& info) {
}
QFile file;
file.open(this->d->infoFd, QFile::ReadWrite);
if (!file.open(this->d->infoFd, QFile::ReadWrite)) {
qCCritical(logCrashHandler
) << "Failed to open instance info memfd, crash recovery will not work.";
}
QDataStream ds(&file);
ds << info;

View file

@ -161,7 +161,10 @@ void qsCheckCrash(int argc, char** argv) {
auto infoFd = qEnvironmentVariable("__QUICKSHELL_CRASH_INFO_FD").toInt();
QFile file;
file.open(infoFd, QFile::ReadOnly, QFile::AutoCloseHandle);
if (!file.open(infoFd, QFile::ReadOnly, QFile::AutoCloseHandle)) {
qFatal() << "Failed to open instance info fd.";
}
file.seek(0);
auto ds = QDataStream(&file);

View file

@ -32,7 +32,10 @@ void checkCrashRelaunch(char** argv, QCoreApplication* coreApplication) {
auto lastInfoFd = lastInfoFdStr.toInt();
QFile file;
file.open(lastInfoFd, QFile::ReadOnly, QFile::AutoCloseHandle);
if (!file.open(lastInfoFd, QFile::ReadOnly, QFile::AutoCloseHandle)) {
qFatal() << "Failed to open crash info fd. Cannot restart.";
}
file.seek(0);
auto ds = QDataStream(&file);

View file

@ -100,7 +100,7 @@ MprisPlayer::MprisPlayer(const QString& address, QObject* parent): QObject(paren
} else return static_cast<qlonglong>(-1);
});
this->bLengthSupported.setBinding([this]() { return this->bInternalLength != -1; });
this->bLengthSupported.setBinding([this]() { return this->bInternalLength.value() != -1; });
this->bIsPlaying.setBinding([this]() {
return this->bPlaybackState == MprisPlaybackState::Playing;

View file

@ -73,7 +73,7 @@ UPowerDevice::UPowerDevice(QObject* parent): QObject(parent) {
return this->bType == UPowerDeviceType::Battery && this->bPowerSupply;
});
this->bHealthSupported.setBinding([this]() { return this->bHealthPercentage != 0; });
this->bHealthSupported.setBinding([this]() { return this->bHealthPercentage.value() != 0; });
}
void UPowerDevice::init(const QString& path) {

View file

@ -164,6 +164,7 @@ QString DBusDataTransform<PowerProfile::Enum>::toWire(Data data) {
case PowerProfile::PowerSaver: return QStringLiteral("power-saver");
case PowerProfile::Balanced: return QStringLiteral("balanced");
case PowerProfile::Performance: return QStringLiteral("performance");
default: qFatal() << "Attempted to convert invalid power profile" << data << "to wire format.";
}
}

View file

@ -28,9 +28,10 @@ WlrLayershell::WlrLayershell(QObject* parent): ProxyWindowBase(parent) {
case Qt::BottomEdge: return this->bImplicitHeight + margins.top;
case Qt::LeftEdge: return this->bImplicitWidth + margins.right;
case Qt::RightEdge: return this->bImplicitWidth + margins.left;
default: return 0;
}
}
return 0;
});
this->bcExclusionEdge.setBinding([this] { return this->bAnchors.value().exclusionEdge(); });

View file

@ -532,7 +532,7 @@ QString I3IpcEvent::eventToString(EventCode event) {
case EventCode::BarStateUpdate: return "bar_state_update"; break;
case EventCode::Input: return "input"; break;
case EventCode::Unknown: return "unknown"; break;
default: return "unknown"; break;
}
}

View file

@ -115,6 +115,8 @@ XPanelWindow::XPanelWindow(QObject* parent): ProxyWindowBase(parent) {
return 0;
}
}
return 0;
});
this->bcExclusionEdge.setBinding([this] { return this->bAnchors.value().exclusionEdge(); });