summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2013-07-05 00:20:47 +0200
committerStanislaw Halik <sthalik@misaki.pl>2013-07-05 00:20:47 +0200
commit2061af6ad4af8416b8f11c2b2fd1802dade0e3e9 (patch)
tree5391637ba3f9226c3099e99c5d3535fe8c628e45
parent30fe442f524e91639e9d5f27d86c2edf290ab9c0 (diff)
Deal correctly with non-latin1 characters in directory name
-rw-r--r--facetracknoir/facetracknoir.cpp9
-rw-r--r--facetracknoir/global-settings.cpp4
-rw-r--r--facetracknoir/global-settings.h2
-rw-r--r--facetracknoir/main.cpp2
4 files changed, 7 insertions, 10 deletions
diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp
index aa072401..bb0cef11 100644
--- a/facetracknoir/facetracknoir.cpp
+++ b/facetracknoir/facetracknoir.cpp
@@ -1022,8 +1022,7 @@ void FaceTrackNoIR::createIconGroupBox()
QIcon icon;
QString longName;
QString str = protocols.at(i);
- QByteArray latin1 = str.toLatin1();
- DynamicLibrary* lib = new DynamicLibrary(latin1.constData());
+ DynamicLibrary* lib = new DynamicLibrary(str);
qDebug() << "Loading" << str;
std::cout.flush();
Metadata* meta;
@@ -1047,8 +1046,7 @@ void FaceTrackNoIR::createIconGroupBox()
QIcon icon;
QString longName;
QString str = trackers.at(i);
- QByteArray latin1 = str.toLatin1();
- DynamicLibrary* lib = new DynamicLibrary(latin1.constData());
+ DynamicLibrary* lib = new DynamicLibrary(str);
qDebug() << "Loading" << str;
std::cout.flush();
Metadata* meta;
@@ -1074,8 +1072,7 @@ void FaceTrackNoIR::createIconGroupBox()
QIcon icon;
QString fullName;
QString str = filters.at(i);
- QByteArray latin1 = str.toLatin1();
- DynamicLibrary* lib = new DynamicLibrary(latin1.constData());
+ DynamicLibrary* lib = new DynamicLibrary(str);
qDebug() << "Loading" << str;
std::cout.flush();
Metadata* meta;
diff --git a/facetracknoir/global-settings.cpp b/facetracknoir/global-settings.cpp
index 2ab08a9d..f605b591 100644
--- a/facetracknoir/global-settings.cpp
+++ b/facetracknoir/global-settings.cpp
@@ -88,7 +88,7 @@ SelectedLibraries::SelectedLibraries(IDynamicLibraryProvider* mainApp) :
correct = true;
}
-DynamicLibrary::DynamicLibrary(const char* filename)
+DynamicLibrary::DynamicLibrary(const QString& filename)
{
this->filename = filename;
QString fullPath = QCoreApplication::applicationDirPath() + "/" + this->filename;
@@ -98,7 +98,7 @@ DynamicLibrary::DynamicLibrary(const char* filename)
Constructor = (NULLARY_DYNAMIC_FUNCTION) handle->resolve(MAYBE_STDCALL_UNDERSCORE "GetConstructor" CALLING_CONVENTION_SUFFIX_VOID_FUNCTION);
Metadata = (METADATA_FUNCTION) handle->resolve(MAYBE_STDCALL_UNDERSCORE "GetMetadata" CALLING_CONVENTION_SUFFIX_VOID_FUNCTION);
#else
- QByteArray latin1 = fullPath.toLatin1();
+ QByteArray latin1 = QFile::encodeName(filename);
handle = dlopen(latin1.constData(), RTLD_NOW |
# ifdef __linux
RTLD_DEEPBIND
diff --git a/facetracknoir/global-settings.h b/facetracknoir/global-settings.h
index 62f00831..29a8da62 100644
--- a/facetracknoir/global-settings.h
+++ b/facetracknoir/global-settings.h
@@ -50,7 +50,7 @@ extern "C" typedef void* (CALLING_CONVENTION* SETTINGS_FUNCTION)(void);
class DynamicLibrary {
public:
- DynamicLibrary(const char* filename);
+ DynamicLibrary(const QString& filename);
virtual ~DynamicLibrary();
SETTINGS_FUNCTION Dialog;
NULLARY_DYNAMIC_FUNCTION Constructor;
diff --git a/facetracknoir/main.cpp b/facetracknoir/main.cpp
index 8ba437bf..fd0ca1cc 100644
--- a/facetracknoir/main.cpp
+++ b/facetracknoir/main.cpp
@@ -36,7 +36,7 @@
#if defined(_WIN32)
#include <windows.h>
-//#pragma comment(linker, "/SUBSYSTEM:windows /ENTRY:mainCRTStartup")
+//#pragma comment(linker, "/SUBSYSTEM:console /ENTRY:mainCRTStartup")
#endif
int main(int argc, char** argv)
{