Fix compiler warnings

This commit is contained in:
pixl 2020-07-10 04:20:15 -04:00
parent d478ef3309
commit 41049deb35
No known key found for this signature in database
GPG Key ID: 1866C148CD593B6E
9 changed files with 12 additions and 37 deletions

View File

@ -70,7 +70,6 @@ Configuration::Configuration(const std::string& config_file)
try {
auto& timeout = root["io_timeout"];
if(timeout.isNumber()) {
auto t = timeout.getType();
if(timeout.getType() == Setting::TypeFloat)
_io_timeout = duration_cast<milliseconds>(
duration<double, std::milli>(timeout));

View File

@ -50,9 +50,9 @@ std::shared_ptr<Action> Action::makeAction(Device *device, libconfig::Setting
if(type == "keypress")
return std::make_shared<KeypressAction>(device, setting);
else if(type == "togglesmartshift")
return std::make_shared<ToggleSmartShift>(device, setting);
return std::make_shared<ToggleSmartShift>(device);
else if(type == "togglehiresscroll")
return std::make_shared<ToggleHiresScroll>(device, setting);
return std::make_shared<ToggleHiresScroll>(device);
else
throw InvalidAction(type);

View File

@ -52,6 +52,8 @@ namespace actions {
virtual void release() = 0;
virtual void move(int16_t x, int16_t y)
{
// Suppress unused warning
(void)x; (void)y;
}
virtual bool pressed()

View File

@ -17,15 +17,13 @@
*/
#include "ToggleHiresScroll.h"
#include "../Device.h"
#include "../util/log.h"
#include "../util/task.h"
#include "../backend/hidpp20/features/ReprogControls.h"
using namespace logid::actions;
using namespace logid::backend;
ToggleHiresScroll::ToggleHiresScroll(Device *dev, libconfig::Setting &config) :
Action (dev), _config (dev, config)
ToggleHiresScroll::ToggleHiresScroll(Device *dev) : Action (dev)
{
_hires_scroll = _device->getFeature<features::HiresScroll>("hiresscroll");
if(!_hires_scroll)
@ -56,9 +54,4 @@ void ToggleHiresScroll::release()
uint8_t ToggleHiresScroll::reprogFlags() const
{
return hidpp20::ReprogControls::TemporaryDiverted;
}
ToggleHiresScroll::Config::Config(Device *device, libconfig::Setting &root) :
Action::Config(device)
{
}

View File

@ -27,20 +27,13 @@ namespace actions
class ToggleHiresScroll : public Action
{
public:
ToggleHiresScroll(Device* dev, libconfig::Setting& config);
explicit ToggleHiresScroll(Device* dev);
virtual void press();
virtual void release();
virtual uint8_t reprogFlags() const;
class Config : public Action::Config
{
public:
explicit Config(Device* device, libconfig::Setting& root);
};
protected:
Config _config;
std::shared_ptr<features::HiresScroll> _hires_scroll;
};
}}

View File

@ -23,8 +23,7 @@
using namespace logid::actions;
using namespace logid::backend;
ToggleSmartShift::ToggleSmartShift(Device *dev, libconfig::Setting &config) :
Action (dev), _config (dev, config)
ToggleSmartShift::ToggleSmartShift(Device *dev) : Action (dev)
{
_smartshift = _device->getFeature<features::SmartShift>("smartshift");
if(!_smartshift)
@ -56,9 +55,4 @@ void ToggleSmartShift::release()
uint8_t ToggleSmartShift::reprogFlags() const
{
return hidpp20::ReprogControls::TemporaryDiverted;
}
ToggleSmartShift::Config::Config(Device *device, libconfig::Setting &root) :
Action::Config(device)
{
}

View File

@ -27,20 +27,13 @@ namespace actions {
class ToggleSmartShift : public Action
{
public:
ToggleSmartShift(Device* dev, libconfig::Setting& config);
explicit ToggleSmartShift(Device* dev);
virtual void press();
virtual void release();
virtual uint8_t reprogFlags() const;
class Config : public Action::Config
{
public:
explicit Config(Device* device, libconfig::Setting& root);
};
protected:
Config _config;
std::shared_ptr<features::SmartShift> _smartshift;
};
}}

View File

@ -116,6 +116,7 @@ ReprogControls::ControlInfo ReprogControls::getControlReporting(uint16_t cid)
void ReprogControls::setControlReporting(uint8_t cid, ControlInfo info)
{
// This function does not exist pre-v4 and cannot be emulated, ignore.
(void)cid; (void)info; // Suppress unused warnings
}
std::set<uint16_t> ReprogControls::divertedButtonEvent(

View File

@ -42,13 +42,13 @@ namespace logid
workqueue* _parent;
std::size_t _worker_number;
std::unique_ptr<thread> _thread;
std::mutex _busy;
std::mutex _run_lock;
std::atomic<bool> _continue_run;
std::condition_variable _queue_cv;
std::unique_ptr<thread> _thread;
std::mutex _busy;
mutex_queue<std::shared_ptr<task>> _queue;
};
}