all: fix gcc warnings

This commit is contained in:
outfoxxed 2024-11-05 13:31:24 -08:00
parent 92252c36a3
commit b528be9426
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
19 changed files with 57 additions and 22 deletions

View file

@ -85,7 +85,7 @@ void Notification::updateProperties(
qint32 expireTimeout
) {
auto urgency = hints.contains("urgency") ? hints.value("urgency").value<quint8>()
: NotificationUrgency::Normal;
: static_cast<quint8>(NotificationUrgency::Normal);
auto hasActionIcons = hints.value("action-icons").value<bool>();
auto resident = hints.value("resident").value<bool>();

View file

@ -17,8 +17,7 @@ namespace qs::service::pipewire {
class PwDevice;
constexpr const char TYPE_INTERFACE_Device[] = PW_TYPE_INTERFACE_Device; // NOLINT
class PwDevice: public PwBindable<pw_device, TYPE_INTERFACE_Device, PW_VERSION_DEVICE> {
class PwDevice: public PwBindable<pw_device, PW_TYPE_INTERFACE_Device, PW_VERSION_DEVICE> {
Q_OBJECT;
public:

View file

@ -35,8 +35,7 @@ public:
Q_INVOKABLE static QString toString(qs::service::pipewire::PwLinkState::Enum value);
};
constexpr const char TYPE_INTERFACE_Link[] = PW_TYPE_INTERFACE_Link; // NOLINT
class PwLink: public PwBindable<pw_link, TYPE_INTERFACE_Link, PW_VERSION_LINK> { // NOLINT
class PwLink: public PwBindable<pw_link, PW_TYPE_INTERFACE_Link, PW_VERSION_LINK> {
Q_OBJECT;
public:

View file

@ -11,9 +11,7 @@
namespace qs::service::pipewire {
constexpr const char TYPE_INTERFACE_Metadata[] = PW_TYPE_INTERFACE_Metadata; // NOLINT
class PwMetadata
: public PwBindable<pw_metadata, TYPE_INTERFACE_Metadata, PW_VERSION_METADATA> { // NOLINT
class PwMetadata: public PwBindable<pw_metadata, PW_TYPE_INTERFACE_Metadata, PW_VERSION_METADATA> {
Q_OBJECT;
public:

View file

@ -156,8 +156,7 @@ private:
PwNode* node;
};
constexpr const char TYPE_INTERFACE_Node[] = PW_TYPE_INTERFACE_Node; // NOLINT
class PwNode: public PwBindable<pw_node, TYPE_INTERFACE_Node, PW_VERSION_NODE> { // NOLINT
class PwNode: public PwBindable<pw_node, PW_TYPE_INTERFACE_Node, PW_VERSION_NODE> {
Q_OBJECT;
public:

View file

@ -429,7 +429,7 @@ void PwObjectTracker::setObjects(const QList<QObject*>& objects) {
// connect destroy
for (auto* object: objects) {
if (auto* pwObject = dynamic_cast<PwObjectRefIface*>(object)) {
if (dynamic_cast<PwObjectRefIface*>(object) != nullptr) {
QObject::connect(object, &QObject::destroyed, this, &PwObjectTracker::objectDestroyed);
}
}

View file

@ -63,6 +63,12 @@ void PwBindableObject::unref() {
if (this->refcount == 0) this->unbind();
}
void PwBindableObject::registryBind(const char* interface, quint32 version) {
// NOLINTNEXTLINE
auto* object = pw_registry_bind(this->registry->object, this->id, interface, version, 0);
this->object = static_cast<pw_proxy*>(object);
}
void PwBindableObject::bind() {
qCDebug(logRegistry) << "Bound object" << this;
this->bindHooks();

View file

@ -12,6 +12,7 @@
#include <qtmetamacros.h>
#include <qtypes.h>
#include "../../core/util.hpp"
#include "core.hpp"
namespace qs::service::pipewire {
@ -50,6 +51,7 @@ signals:
void destroying(PwBindableObject* self);
protected:
void registryBind(const char* interface, quint32 version);
virtual void bind();
void unbind();
virtual void bindHooks() {};
@ -62,7 +64,7 @@ protected:
QDebug operator<<(QDebug debug, const PwBindableObject* object);
template <typename T, const char* INTERFACE, quint32 VERSION>
template <typename T, StringLiteral INTERFACE, quint32 VERSION>
class PwBindable: public PwBindableObject {
public:
T* proxy() {
@ -72,9 +74,7 @@ public:
protected:
void bind() override {
if (this->object != nullptr) return;
auto* object =
pw_registry_bind(this->registry->object, this->id, INTERFACE, VERSION, 0); // NOLINT
this->object = static_cast<pw_proxy*>(object);
this->registryBind(INTERFACE, VERSION);
this->PwBindableObject::bind();
}