From d65936200a2756e6619a109fa6fa673b91df802e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 26 Jun 2018 22:25:22 +0200 Subject: modernize C++ syntax No visible changes (hopefully). --- logic/pipeline.cpp | 6 +++--- logic/pipeline.hpp | 2 +- logic/shortcuts.cpp | 4 ++-- logic/win32-shortcuts.cpp | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'logic') diff --git a/logic/pipeline.cpp b/logic/pipeline.cpp index 7b4444c3..bf264315 100644 --- a/logic/pipeline.cpp +++ b/logic/pipeline.cpp @@ -130,7 +130,7 @@ Pose reltrans::apply_pipeline(reltrans_state state, const Pose& value, interp_timer.start(); - if (RC_phase + 1 != std::size(RC_phases) && + if (RC_phase + 1 < std::size(RC_phases) && interp_phase_timer.elapsed_seconds() > RC_time_deltas[RC_phase]) { RC_phase++; @@ -252,7 +252,7 @@ void emit_nan_check_msg(const char* text, const char* fun, int line) qDebug() << "nan check failed" << "for:" << text << "function:" << fun - << "line:" << line; + << "line:" << line ); } @@ -577,7 +577,7 @@ void pipeline::run() { qDebug() << "tracker: backlog interval overflow" << time_cast(backlog_time).count() << "ms"; - backlog_time = backlog_time.zero(); + backlog_time = ns::zero(); } backlog_time += ns(elapsed_nsecs - const_sleep_ms); diff --git a/logic/pipeline.hpp b/logic/pipeline.hpp index 4a676862..0b48d741 100644 --- a/logic/pipeline.hpp +++ b/logic/pipeline.hpp @@ -39,7 +39,7 @@ class reltrans // this implements smooth transition into reltrans mode // once not aiming anymore. see `apply_pipeline()'. Timer interp_phase_timer; - unsigned RC_phase; + unsigned RC_phase = 0; bool cur = false; bool in_zone = false; diff --git a/logic/shortcuts.cpp b/logic/shortcuts.cpp index 5ddefc1f..478036a2 100644 --- a/logic/shortcuts.cpp +++ b/logic/shortcuts.cpp @@ -130,14 +130,14 @@ void Shortcuts::reload(const t_keys& keys_) const auto& kk = keys_[i]; const key_opts& opts = std::get<0>(kk); const bool held = std::get<2>(kk); - auto fun = std::get<1>(kk); + auto const& fun = std::get<1>(kk); #ifdef _WIN32 K k; #else K k(nullptr); #endif bind_shortcut(k, opts, held); - keys.push_back(tt(k, [=](bool flag) { fun(flag); }, held)); + keys.emplace_back(k, [=](bool flag) { fun(flag); }, held); #ifndef _WIN32 const int idx = keys.size() - 1; diff --git a/logic/win32-shortcuts.cpp b/logic/win32-shortcuts.cpp index 2099ce09..170d16fe 100644 --- a/logic/win32-shortcuts.cpp +++ b/logic/win32-shortcuts.cpp @@ -119,7 +119,7 @@ static const win_key windows_key_sequences[] { { DIK_PAUSE, Qt::Key_Pause}, { DIK_NUMLOCK, Qt::Key_NumLock}, { DIK_CAPSLOCK, Qt::Key_CapsLock}, -#define mod(x, y) static_cast(x | y) +#define mod(x, y) static_cast((x) | (y)) { DIK_NUMPAD0, mod(Qt::Key_0, Qt::KeypadModifier)}, { DIK_NUMPAD0, mod(Qt::Key_0, Qt::KeypadModifier)}, { DIK_NUMPAD1, mod(Qt::Key_1, Qt::KeypadModifier)}, -- cgit v1.2.3