Fix cppcheck reported issues (#333)

Fixes: https://github.com/microsoft/PowerToys/issues/266
This commit is contained in:
Bartosz Sosnowski
2019-09-11 12:38:20 +02:00
committed by GitHub
parent 12cd7bb49f
commit 8ac6db8b5a
19 changed files with 34 additions and 36 deletions

View File

@@ -2,7 +2,7 @@
#include "animation.h"
Animation::Animation(double duration, double start, double stop) :
start_value(start), end_value(stop), duration(duration), start(std::chrono::high_resolution_clock::now()) { }
duration(duration), start_value(start), end_value(stop), start(std::chrono::high_resolution_clock::now()) { }
void Animation::reset() {
start = std::chrono::high_resolution_clock::now();
@@ -21,7 +21,7 @@ static double ease_out_expo(double t) {
return 1 - pow(2, -8 * t);
}
double Animation::apply_animation_function(double t, AnimFunctions apply_function) const {
double Animation::apply_animation_function(double t, AnimFunctions apply_function) {
switch (apply_function) {
case EASE_OUT_EXPO:
return ease_out_expo(t);

View File

@@ -25,7 +25,7 @@ public:
double value(AnimFunctions apply_function) const;
bool done() const;
private:
double apply_animation_function(double t, AnimFunctions apply_function) const;
static double apply_animation_function(double t, AnimFunctions apply_function);
std::chrono::high_resolution_clock::time_point start;
double start_value, end_value, duration;
};

View File

@@ -7,5 +7,5 @@ private:
public:
static HRESULT GetScreenDPIForWindow(HWND hwnd, UINT & dpi_x, UINT & dpi_y);
static void Convert(HMONITOR monitor_handle, int &width, int &high);
static void Convert(HMONITOR monitor_handle, int &width, int &height);
};

View File

@@ -23,9 +23,9 @@ static BOOL CALLBACK get_displays_enum_cb_with_toolbar(HMONITOR monitor, HDC hdc
return true;
};
std::vector<MonitorInfo> MonitorInfo::GetMonitors(bool include_toolbars) {
std::vector<MonitorInfo> MonitorInfo::GetMonitors(bool include_toolbar) {
std::vector<MonitorInfo> monitors;
EnumDisplayMonitors(NULL, NULL, include_toolbars ? get_displays_enum_cb_with_toolbar : get_displays_enum_cb, reinterpret_cast<LPARAM>(&monitors));
EnumDisplayMonitors(NULL, NULL, include_toolbar ? get_displays_enum_cb_with_toolbar : get_displays_enum_cb, reinterpret_cast<LPARAM>(&monitors));
std::sort(begin(monitors), end(monitors), [](const MonitorInfo& lhs, const MonitorInfo& rhs) {
return lhs.rect < rhs.rect;
});

View File

@@ -79,7 +79,7 @@ bool Tasklist::update_buttons(std::vector<TasklistButton>& buttons) {
continue; // skip buttons from the same app
button.keynum = buttons.back().keynum + 1;
buttons.push_back(std::move(button));
if (button.keynum == 10)
if (buttons.back().keynum == 10)
break; // no more than 10 buttons
}
}