summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2014-10-22 14:18:15 +0200
committerStanislaw Halik <sthalik@misaki.pl>2014-10-22 14:18:15 +0200
commit455ca63d2b5117f846e26cb5208f45f14e81b826 (patch)
tree8724d681f58e2fe25bf8286f2e305faa87b96fbe
parentab5c47113710843c94e7ad2135d2094b68c1fe51 (diff)
typo in type name, whitespace
-rw-r--r--opentrack/plugin-support.cpp43
-rw-r--r--opentrack/plugin-support.h4
2 files changed, 25 insertions, 22 deletions
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<typename t>
static ptr<t> make_instance(ptr<dylib> lib)
{
- ptr<t> ret = nullptr;
- if (lib && lib->Constructor)
+ ptr<t> ret;
+ if (lib != nullptr && lib->Constructor)
+ {
+ qDebug() << "dylib" << (lib ? lib->filename : "<null>") << "ptr" << (intptr_t) lib->Constructor;
+ fflush(stderr);
ret = ptr<t>(reinterpret_cast<t*>(reinterpret_cast<CTOR_FUNPTR>(lib->Constructor)()));
- //qDebug() << "lib" << (lib ? lib->filename : "<null>") << "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<ITracker>(t);
pProtocol = make_instance<IProtocol>(p);
pFilter = make_instance<IFilter>(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<ptr<dylib>> dylib::enum_libraries()
BASE "tracker" SUFF,
BASE "proto" SUFF };
const Type filters_t[] = { Filter, Tracker, Protocol };
-
+
QDir settingsDir( QCoreApplication::applicationDirPath() );
-
+
QList<ptr<dylib>> ret;
-
+
for (int i = 0; i < 3; i++)
{
QString filter = filters_n[i];
@@ -110,7 +113,7 @@ QList<ptr<dylib>> 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<Metadata>(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<dylib>;
+ using dylibptr = ptr<dylib>;
ptr<ITracker> pTracker;
ptr<IFilter> pFilter;
ptr<IProtocol> 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;