Skip to content

Commit 271f45c

Browse files
committed
Fix coverity warnings
IB-7929 Signed-off-by: Raul Metsma <[email protected]>
1 parent 4729b35 commit 271f45c

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

client/Utils.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ namespace {
3131
std::exception_ptr exception;
3232
std::invoke_result_t<F,Args...> result{};
3333
QEventLoop l;
34-
// c++20 ... args == std::forward<Args>(args)
35-
std::thread([&, function = std::forward<F>(function)]{
34+
std::thread([&, function = std::forward<F>(function), ...args = std::forward<Args>(args)]{
3635
try {
3736
result = std::invoke(function, args...);
3837
} catch(...) {
@@ -51,14 +50,14 @@ namespace {
5150
QEventLoop l;
5251
using result_t = typename std::invoke_result_t<F,Args...>;
5352
if constexpr (std::is_void_v<result_t>) {
54-
QMetaObject::invokeMethod(qApp, [&, function = std::forward<F>(function)] {
53+
QMetaObject::invokeMethod(qApp, [&, function = std::forward<F>(function), ...args = std::forward<Args>(args)] {
5554
std::invoke(function, args...);
5655
l.exit();
5756
}, Qt::QueuedConnection);
5857
l.exec();
5958
} else {
6059
result_t result{};
61-
QMetaObject::invokeMethod(qApp, [&, function = std::forward<F>(function)] {
60+
QMetaObject::invokeMethod(qApp, [&, function = std::forward<F>(function), ...args = std::forward<Args>(args)] {
6261
result = std::invoke(function, args...);
6362
l.exit();
6463
}, Qt::QueuedConnection);

client/effects/FadeInNotification.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,17 @@ constexpr QRect adjustHeight(QRect rect, int height) noexcept
3636
FadeInNotification::FadeInNotification(QWidget *parent, QRect rect, Type type, const QString &label)
3737
: QLabel(parent)
3838
{
39-
auto bgcolor = [type] {
39+
auto bgcolor = [type]() -> QString {
4040
switch(type) {
41-
case FadeInNotification::Success: return QStringLiteral("#218123");
42-
case FadeInNotification::Warning: return QStringLiteral("#FBAE38");
43-
case FadeInNotification::Error: return QStringLiteral("#AD2A45");
44-
case FadeInNotification::Default: return QStringLiteral("#2F70B6");
41+
case Success: return QStringLiteral("#218123");
42+
case Warning: return QStringLiteral("#FBAE38");
43+
case Error: return QStringLiteral("#AD2A45");
44+
case Default: return QStringLiteral("#2F70B6");
4545
default: return QStringLiteral("none");
4646
}
4747
}();
48-
auto fgcolor = [type] {
49-
return type == FadeInNotification::Warning ? QStringLiteral("#07142A") : QStringLiteral("#FFFFFF");
48+
auto fgcolor = [type]() -> QString {
49+
return type == Warning ? QStringLiteral("#07142A") : QStringLiteral("#FFFFFF");
5050
}();
5151
setStyleSheet(QStringLiteral("color: %1; background-color: %2;").arg(fgcolor, bgcolor));
5252
setFocusPolicy(Qt::TabFocus);

client/effects/FadeInNotification.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class FadeInNotification final: public QLabel
2828

2929
public:
3030
using ms = std::chrono::milliseconds;
31-
enum Type {
31+
enum Type : quint8 {
3232
Success,
3333
Warning,
3434
Error,

0 commit comments

Comments
 (0)