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()));
if (!devices.has_value())
devices = decltype(config::Config::devices)();
devices.emplace();
}
Configuration::Configuration() {
devices.emplace();
}
void Configuration::save() {

View File

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

View File

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

View File

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

View File

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

View File

@ -165,7 +165,7 @@ void IOMonitor::_interrupt() noexcept {
_interrupting = true;
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));
// 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);
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);

View File

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