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 { try {
auto& timeout = root["io_timeout"]; auto& timeout = root["io_timeout"];
if(timeout.isNumber()) { if(timeout.isNumber()) {
auto t = timeout.getType();
if(timeout.getType() == Setting::TypeFloat) if(timeout.getType() == Setting::TypeFloat)
_io_timeout = duration_cast<milliseconds>( _io_timeout = duration_cast<milliseconds>(
duration<double, std::milli>(timeout)); duration<double, std::milli>(timeout));

View File

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

View File

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

View File

@ -17,15 +17,13 @@
*/ */
#include "ToggleHiresScroll.h" #include "ToggleHiresScroll.h"
#include "../Device.h" #include "../Device.h"
#include "../util/log.h"
#include "../util/task.h" #include "../util/task.h"
#include "../backend/hidpp20/features/ReprogControls.h" #include "../backend/hidpp20/features/ReprogControls.h"
using namespace logid::actions; using namespace logid::actions;
using namespace logid::backend; using namespace logid::backend;
ToggleHiresScroll::ToggleHiresScroll(Device *dev, libconfig::Setting &config) : ToggleHiresScroll::ToggleHiresScroll(Device *dev) : Action (dev)
Action (dev), _config (dev, config)
{ {
_hires_scroll = _device->getFeature<features::HiresScroll>("hiresscroll"); _hires_scroll = _device->getFeature<features::HiresScroll>("hiresscroll");
if(!_hires_scroll) if(!_hires_scroll)
@ -57,8 +55,3 @@ uint8_t ToggleHiresScroll::reprogFlags() const
{ {
return hidpp20::ReprogControls::TemporaryDiverted; 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 class ToggleHiresScroll : public Action
{ {
public: public:
ToggleHiresScroll(Device* dev, libconfig::Setting& config); explicit ToggleHiresScroll(Device* dev);
virtual void press(); virtual void press();
virtual void release(); virtual void release();
virtual uint8_t reprogFlags() const; virtual uint8_t reprogFlags() const;
class Config : public Action::Config
{
public:
explicit Config(Device* device, libconfig::Setting& root);
};
protected: protected:
Config _config;
std::shared_ptr<features::HiresScroll> _hires_scroll; std::shared_ptr<features::HiresScroll> _hires_scroll;
}; };
}} }}

View File

@ -23,8 +23,7 @@
using namespace logid::actions; using namespace logid::actions;
using namespace logid::backend; using namespace logid::backend;
ToggleSmartShift::ToggleSmartShift(Device *dev, libconfig::Setting &config) : ToggleSmartShift::ToggleSmartShift(Device *dev) : Action (dev)
Action (dev), _config (dev, config)
{ {
_smartshift = _device->getFeature<features::SmartShift>("smartshift"); _smartshift = _device->getFeature<features::SmartShift>("smartshift");
if(!_smartshift) if(!_smartshift)
@ -57,8 +56,3 @@ uint8_t ToggleSmartShift::reprogFlags() const
{ {
return hidpp20::ReprogControls::TemporaryDiverted; 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 class ToggleSmartShift : public Action
{ {
public: public:
ToggleSmartShift(Device* dev, libconfig::Setting& config); explicit ToggleSmartShift(Device* dev);
virtual void press(); virtual void press();
virtual void release(); virtual void release();
virtual uint8_t reprogFlags() const; virtual uint8_t reprogFlags() const;
class Config : public Action::Config
{
public:
explicit Config(Device* device, libconfig::Setting& root);
};
protected: protected:
Config _config;
std::shared_ptr<features::SmartShift> _smartshift; 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) void ReprogControls::setControlReporting(uint8_t cid, ControlInfo info)
{ {
// This function does not exist pre-v4 and cannot be emulated, ignore. // 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( std::set<uint16_t> ReprogControls::divertedButtonEvent(

View File

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