Fix release warnings

Also possibly fixes some undefined behaviour in release builds?
This commit is contained in:
pixl 2023-05-02 01:15:46 -04:00
parent 8a4e2cce81
commit a468861f7d
No known key found for this signature in database
GPG Key ID: 1866C148CD593B6E
8 changed files with 13 additions and 20 deletions

@ -1 +1 @@
Subproject commit 7bb0e46203d7b8122211cb362ed63aea5f8caeb4 Subproject commit 3b19a11e8adf5608c9facd6a4e93d8833cbc4e3f

View File

@ -42,7 +42,11 @@ Configuration::Configuration(std::string config_file) :
Config::operator=(get<Config>(_config.getRoot())); Config::operator=(get<Config>(_config.getRoot()));
if (!devices.has_value()) if (!devices.has_value())
devices = decltype(config::Config::devices)(); devices.emplace();
}
Configuration::Configuration() {
devices.emplace();
} }
void Configuration::save() { void Configuration::save() {

View File

@ -37,7 +37,7 @@ namespace logid {
public: public:
explicit Configuration(std::string config_file); explicit Configuration(std::string config_file);
Configuration() = default; Configuration();
// Reloading is not safe, references will be invalidated // Reloading is not safe, references will be invalidated
//void reload(); //void reload();

View File

@ -214,11 +214,6 @@ std::shared_ptr<ipcgull::node> Device::ipcNode() const {
return _ipc_node; return _ipc_node;
} }
/*config::Device& Device::config()
{
return _config;
}*/
config::Profile& Device::activeProfile() { config::Profile& Device::activeProfile() {
return _profile->second; return _profile->second;
} }
@ -270,15 +265,13 @@ config::Device& Device::_getConfig(
const std::string& name) { const std::string& name) {
static std::mutex config_mutex; static std::mutex config_mutex;
std::lock_guard<std::mutex> lock(config_mutex); std::lock_guard<std::mutex> lock(config_mutex);
auto& devices = manager->config()->devices; auto& devices = manager->config()->devices.value();
if (!devices.has_value())
devices = decltype(config::Config::devices)();
if (!devices.value().count(name)) { if (!devices.count(name)) {
devices.value().emplace(name, config::Device()); devices.emplace(name, config::Device());
} }
auto& device = devices.value().at(name); auto& device = devices.at(name);
if (std::holds_alternative<config::Profile>(device)) { if (std::holds_alternative<config::Profile>(device)) {
config::Device d; config::Device d;
d.profiles["default"] = std::get<config::Profile>(device); d.profiles["default"] = std::get<config::Profile>(device);

View File

@ -17,7 +17,6 @@
*/ */
#include <backend/hidpp10/ReceiverMonitor.h> #include <backend/hidpp10/ReceiverMonitor.h>
#include <cassert>
#include <util/task.h> #include <util/task.h>
#include <util/log.h> #include <util/log.h>

View File

@ -17,7 +17,6 @@
*/ */
#include <backend/hidpp20/features/ChangeHost.h> #include <backend/hidpp20/features/ChangeHost.h>
#include <backend/hidpp20/Device.h> #include <backend/hidpp20/Device.h>
#include <backend/hidpp20/Error.h>
using namespace logid::backend::hidpp20; using namespace logid::backend::hidpp20;

View File

@ -165,7 +165,7 @@ void IOMonitor::_interrupt() noexcept {
_interrupting = true; _interrupting = true;
uint64_t counter = 1; uint64_t counter = 1;
ssize_t ret = ::write(_event_fd, &counter, sizeof(counter)); [[maybe_unused]] ssize_t ret = ::write(_event_fd, &counter, sizeof(counter));
assert(ret == sizeof(counter)); assert(ret == sizeof(counter));
// Wait for the IO monitor to _stop // Wait for the IO monitor to _stop
@ -177,7 +177,7 @@ void IOMonitor::_continue() noexcept {
std::unique_lock<std::mutex> run_lock(_run_lock, std::try_to_lock); std::unique_lock<std::mutex> run_lock(_run_lock, std::try_to_lock);
uint64_t counter; uint64_t counter;
ssize_t ret = ::read(_event_fd, &counter, sizeof(counter)); [[maybe_unused]] ssize_t ret = ::read(_event_fd, &counter, sizeof(counter));
assert(ret != -1); assert(ret != -1);

View File

@ -3,12 +3,10 @@
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig> <busconfig>
<!-- Only root user can own the service -->
<policy user="root"> <policy user="root">
<allow own="pizza.pixl.LogiOps"/> <allow own="pizza.pixl.LogiOps"/>
</policy> </policy>
<!-- Allow anyone to invoke methods on server, except SetHostName -->
<policy context="default"> <policy context="default">
<allow send_destination="pizza.pixl.LogiOps"/> <allow send_destination="pizza.pixl.LogiOps"/>
<allow receive_sender="pizza.pixl.LogiOps"/> <allow receive_sender="pizza.pixl.LogiOps"/>