From 455ca63d2b5117f846e26cb5208f45f14e81b826 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 22 Oct 2014 14:18:15 +0200 Subject: typo in type name, whitespace --- opentrack/plugin-support.cpp | 43 +++++++++++++++++++++++-------------------- opentrack/plugin-support.h | 4 ++-- 2 files changed, 25 insertions(+), 22 deletions(-) (limited to 'opentrack') diff --git a/opentrack/plugin-support.cpp b/opentrack/plugin-support.cpp index ec56b1e1..33d71420 100644 --- a/opentrack/plugin-support.cpp +++ b/opentrack/plugin-support.cpp @@ -16,14 +16,17 @@ SelectedLibraries::~SelectedLibraries() template static ptr make_instance(ptr lib) { - ptr ret = nullptr; - if (lib && lib->Constructor) + ptr ret; + if (lib != nullptr && lib->Constructor) + { + qDebug() << "dylib" << (lib ? lib->filename : "") << "ptr" << (intptr_t) lib->Constructor; + fflush(stderr); ret = ptr(reinterpret_cast(reinterpret_cast(lib->Constructor)())); - //qDebug() << "lib" << (lib ? lib->filename : "") << "ptr" << (intptr_t)ret.get(); + } return ret; } -SelectedLibraries::SelectedLibraries(QFrame* frame, dylibtr t, dylibtr p, dylibtr f) : +SelectedLibraries::SelectedLibraries(QFrame* frame, dylibptr t, dylibptr p, dylibptr f) : pTracker(nullptr), pFilter(nullptr), pProtocol(nullptr), @@ -32,10 +35,10 @@ SelectedLibraries::SelectedLibraries(QFrame* frame, dylibtr t, dylibtr p, dylibt pTracker = make_instance(t); pProtocol = make_instance(p); pFilter = make_instance(f); - - if (!pTracker|| !pProtocol) + + if (!pTracker || !pProtocol) { - qDebug() << "load failure tracker" << (intptr_t)pTracker.get() << "protocol" << (intptr_t)pProtocol.get(); + qDebug() << "dylib load failure"; return; } @@ -45,7 +48,7 @@ SelectedLibraries::SelectedLibraries(QFrame* frame, dylibtr t, dylibtr p, dylibt qDebug() << "protocol load failure"; return; } - + pTracker->start_tracker(frame); correct = true; @@ -86,11 +89,11 @@ QList> dylib::enum_libraries() BASE "tracker" SUFF, BASE "proto" SUFF }; const Type filters_t[] = { Filter, Tracker, Protocol }; - + QDir settingsDir( QCoreApplication::applicationDirPath() ); - + QList> ret; - + for (int i = 0; i < 3; i++) { QString filter = filters_n[i]; @@ -110,7 +113,7 @@ QList> dylib::enum_libraries() ret.push_back(lib); } } - + return ret; } @@ -123,12 +126,12 @@ dylib::dylib(const QString& filename, Type t) : // otherwise dlopen opens the calling executable if (filename.size() == 0) return; - + this->filename = filename; #if defined(_WIN32) QString fullPath = QCoreApplication::applicationDirPath() + "/" + this->filename; handle = new QLibrary(fullPath); - + struct _foo { static bool die(QLibrary*& l, bool failp) { @@ -141,18 +144,18 @@ dylib::dylib(const QString& filename, Type t) : return failp; } }; - + if (_foo::die(handle, !handle->load())) return; - + Dialog = (CTOR_FUNPTR) handle->resolve("GetDialog"); if (_foo::die(handle, !Dialog)) return; - + Constructor = (CTOR_FUNPTR) handle->resolve("GetConstructor"); if (_foo::die(handle, !Constructor)) return; - + Meta = (METADATA_FUNPTR) handle->resolve("GetMetadata"); if (_foo::die(handle, !Meta)) return; @@ -199,9 +202,9 @@ dylib::dylib(const QString& filename, Type t) : (void) _foo::err(handle); } #endif - + auto m = ptr(Meta()); - + icon = m->icon(); name = m->name(); } diff --git a/opentrack/plugin-support.h b/opentrack/plugin-support.h index 238aeb53..2c66f1d5 100644 --- a/opentrack/plugin-support.h +++ b/opentrack/plugin-support.h @@ -40,11 +40,11 @@ private: }; struct SelectedLibraries { - using dylibtr = ptr; + using dylibptr = ptr; ptr pTracker; ptr pFilter; ptr pProtocol; - SelectedLibraries(QFrame* frame, dylibtr t, dylibtr p, dylibtr f); + SelectedLibraries(QFrame* frame, dylibptr t, dylibptr p, dylibptr f); SelectedLibraries() : pTracker(nullptr), pFilter(nullptr), pProtocol(nullptr), correct(false) {} ~SelectedLibraries(); bool correct; -- cgit v1.2.3