From 6d40b2fcdbc2b66fcb0a62b48151035e3aa293d5 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 2 Feb 2019 00:50:04 +0100 Subject: api/plugin: add explicit to module_status error ctor --- logic/runtime-libraries.cpp | 33 ++++++++++++++++----------------- logic/runtime-libraries.hpp | 2 +- 2 files changed, 17 insertions(+), 18 deletions(-) (limited to 'logic') diff --git a/logic/runtime-libraries.cpp b/logic/runtime-libraries.cpp index 82a148fe..754f52cd 100644 --- a/logic/runtime-libraries.cpp +++ b/logic/runtime-libraries.cpp @@ -3,20 +3,21 @@ #include #include +#ifdef __clang__ +# pragma clang diagnostic ignored "-Wcomma" +#endif + runtime_libraries::runtime_libraries(QFrame* frame, dylibptr t, dylibptr p, dylibptr f) { + auto error = [](const QString& msg) { return module_status_mixin::error(msg); }; + module_status status = - module_status_mixin::error(tr("Library load failure")); + error(tr("Library load failure")); using namespace options; with_tracker_teardown sentinel; -#ifdef __clang__ -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wcomma" -#endif - pProtocol = make_dylib_instance(p); if (!pProtocol) @@ -27,8 +28,8 @@ runtime_libraries::runtime_libraries(QFrame* frame, dylibptr t, dylibptr p, dyli if(status = pProtocol->initialize(), !status.is_ok()) { - status = tr("Error occurred while loading protocol %1\n\n%2\n") - .arg(p->name, status.error); + status = error(tr("Error occurred while loading protocol %1\n\n%2\n") + .arg(p->name, status.error)); goto end; } @@ -50,22 +51,18 @@ runtime_libraries::runtime_libraries(QFrame* frame, dylibptr t, dylibptr p, dyli if (pFilter) if(status = pFilter->initialize(), !status.is_ok()) { - status = tr("Error occurred while loading filter %1\n\n%2\n") - .arg(f->name, status.error); + status = error(tr("Error occurred while loading filter %1\n\n%2\n") + .arg(f->name, status.error)); goto end; } if (status = pTracker->start_tracker(frame), !status.is_ok()) { - status = tr("Error occurred while loading tracker %1\n\n%2\n") - .arg(t->name, status.error); + status = error(tr("Error occurred while loading tracker %1\n\n%2\n") + .arg(t->name, status.error)); goto end; } -#ifdef __clang__ -# pragma clang diagnostic pop -#endif - correct = true; return; @@ -75,6 +72,8 @@ end: pProtocol = nullptr; if (!status.is_ok()) - QMessageBox::critical(nullptr, tr("Startup failure"), status.error, QMessageBox::Cancel, QMessageBox::NoButton); + QMessageBox::critical(nullptr, + tr("Startup failure"), status.error, + QMessageBox::Cancel, QMessageBox::NoButton); } diff --git a/logic/runtime-libraries.hpp b/logic/runtime-libraries.hpp index 08226c5d..8c7fedd1 100644 --- a/logic/runtime-libraries.hpp +++ b/logic/runtime-libraries.hpp @@ -12,7 +12,7 @@ #include "compat/tr.hpp" #include "export.hpp" -#include +class QFrame; class OTR_LOGIC_EXPORT runtime_libraries final : public TR { -- cgit v1.2.3