summaryrefslogtreecommitdiffstats
path: root/src/corelib/plugin
diff options
context:
space:
mode:
authormread <qt-info@nokia.com>2009-08-07 13:34:12 (GMT)
committermread <qt-info@nokia.com>2009-08-07 13:34:12 (GMT)
commit5a72890b7ce12815f9567316da867006cff73f39 (patch)
tree46c8c793f19274f9ed19678d1732d2123adbdf34 /src/corelib/plugin
parent0f6f1f841cea61cbb6905de92c2ca63bd369d55d (diff)
parentcc0a411e5e874aa224c26298a109973cb15ea291 (diff)
downloadQt-5a72890b7ce12815f9567316da867006cff73f39.zip
Qt-5a72890b7ce12815f9567316da867006cff73f39.tar.gz
Qt-5a72890b7ce12815f9567316da867006cff73f39.tar.bz2
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt-s60-public
Conflicts fixed: src/corelib/io/qdiriterator.cpp
Diffstat (limited to 'src/corelib/plugin')
-rw-r--r--src/corelib/plugin/qfactoryloader_p.h2
-rw-r--r--src/corelib/plugin/qlibrary.cpp13
-rw-r--r--src/corelib/plugin/qlibrary_unix.cpp22
-rw-r--r--src/corelib/plugin/qlibrary_win.cpp34
-rw-r--r--src/corelib/plugin/qplugin.h19
5 files changed, 32 insertions, 58 deletions
diff --git a/src/corelib/plugin/qfactoryloader_p.h b/src/corelib/plugin/qfactoryloader_p.h
index b646b4d..1717ac0 100644
--- a/src/corelib/plugin/qfactoryloader_p.h
+++ b/src/corelib/plugin/qfactoryloader_p.h
@@ -66,7 +66,7 @@ class QFactoryLoaderPrivate;
class Q_CORE_EXPORT QFactoryLoader : public QObject
{
Q_OBJECT
- Q_DECLARE_SCOPED_PRIVATE(QFactoryLoader)
+ Q_DECLARE_PRIVATE(QFactoryLoader)
public:
QFactoryLoader(const char *iid,
diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp
index 3f42311..265a5a2 100644
--- a/src/corelib/plugin/qlibrary.cpp
+++ b/src/corelib/plugin/qlibrary.cpp
@@ -637,11 +637,7 @@ bool QLibraryPrivate::isPlugin(QSettings *settings)
#endif
if (!pHnd) {
#ifdef Q_OS_WIN
- QT_WA({
- hTempModule = ::LoadLibraryExW((wchar_t*)QDir::toNativeSeparators(fileName).utf16(), 0, DONT_RESOLVE_DLL_REFERENCES);
- } , {
- temporary_load = load_sys();
- });
+ hTempModule = ::LoadLibraryEx((wchar_t*)QDir::toNativeSeparators(fileName).utf16(), 0, DONT_RESOLVE_DLL_REFERENCES);
#else
# if defined(Q_OS_SYMBIAN)
//Guard against accidentally trying to load non-plugin libraries by making sure the stub exists
@@ -659,7 +655,7 @@ bool QLibraryPrivate::isPlugin(QSettings *settings)
QtPluginQueryVerificationDataFunction qtPluginQueryVerificationDataFunction = hTempModule
? (QtPluginQueryVerificationDataFunction)
#ifdef Q_OS_WINCE
- ::GetProcAddressW(hTempModule, L"qt_plugin_query_verification_data")
+ ::GetProcAddress(hTempModule, L"qt_plugin_query_verification_data")
#else
::GetProcAddress(hTempModule, "qt_plugin_query_verification_data")
#endif
@@ -698,12 +694,15 @@ bool QLibraryPrivate::isPlugin(QSettings *settings)
#endif
}
+ // Qt 4.5 compatibility: stl doesn't affect binary compatibility
+ key.replace(" no-stl", "");
+
+#ifndef QT_NO_SETTINGS
QStringList queried;
queried << QString::number(qt_version,16)
<< QString::number((int)debug)
<< QLatin1String(key)
<< lastModified;
-#ifndef QT_NO_SETTINGS
settings->setValue(regkey, queried);
#endif
}
diff --git a/src/corelib/plugin/qlibrary_unix.cpp b/src/corelib/plugin/qlibrary_unix.cpp
index bdf6b78..462cfbf 100644
--- a/src/corelib/plugin/qlibrary_unix.cpp
+++ b/src/corelib/plugin/qlibrary_unix.cpp
@@ -58,7 +58,7 @@
QT_BEGIN_NAMESPACE
-#if !defined(QT_HPUX_LD)
+#if !defined(QT_HPUX_LD) && !defined(Q_OS_VXWORKS)
QT_BEGIN_INCLUDE_NAMESPACE
#include <dlfcn.h>
QT_END_INCLUDE_NAMESPACE
@@ -66,7 +66,9 @@ QT_END_INCLUDE_NAMESPACE
static QString qdlerror()
{
-#if !defined(QT_HPUX_LD)
+#if defined(Q_OS_VXWORKS)
+ const char *err = "VxWorks does not support dynamic libraries.";
+#elif !defined(QT_HPUX_LD)
const char *err = dlerror();
#else
const char *err = strerror(errno);
@@ -76,6 +78,8 @@ static QString qdlerror()
bool QLibraryPrivate::load_sys()
{
+ QString attempt;
+#if !defined(Q_OS_VXWORKS)
QFileInfo fi(fileName);
#if defined(Q_OS_SYMBIAN)
@@ -179,7 +183,6 @@ bool QLibraryPrivate::load_sys()
}
#endif
#endif // QT_HPUX_LD
- QString attempt;
bool retry = true;
for(int prefix = 0; retry && !pHnd && prefix < prefixes.size(); prefix++) {
for(int suffix = 0; retry && !pHnd && suffix < suffixes.size(); suffix++) {
@@ -227,7 +230,8 @@ bool QLibraryPrivate::load_sys()
attempt = str;
}
}
-# endif
+#endif
+#endif // Q_OS_VXWORKS
if (!pHnd) {
errorString = QLibrary::tr("Cannot load library %1: %2").arg(fileName).arg(qdlerror());
}
@@ -240,14 +244,16 @@ bool QLibraryPrivate::load_sys()
bool QLibraryPrivate::unload_sys()
{
-#if defined(QT_HPUX_LD)
+#if !defined(Q_OS_VXWORKS)
+# if defined(QT_HPUX_LD)
if (shl_unload((shl_t)pHnd)) {
-#else
+# else
if (dlclose(pHnd)) {
-#endif
+# endif
errorString = QLibrary::tr("Cannot unload library %1: %2").arg(fileName).arg(qdlerror());
return false;
}
+#endif
errorString.clear();
return true;
}
@@ -272,6 +278,8 @@ void* QLibraryPrivate::resolve_sys(const char* symbol)
void* address = 0;
if (shl_findsym((shl_t*)&pHnd, symbol, TYPE_UNDEFINED, &address) < 0)
address = 0;
+#elif defined(Q_OS_VXWORKS)
+ void *address = 0;
#else
void* address = dlsym(pHnd, symbol);
#endif
diff --git a/src/corelib/plugin/qlibrary_win.cpp b/src/corelib/plugin/qlibrary_win.cpp
index 43eeafa..847c0d2 100644
--- a/src/corelib/plugin/qlibrary_win.cpp
+++ b/src/corelib/plugin/qlibrary_win.cpp
@@ -67,30 +67,18 @@ bool QLibraryPrivate::load_sys()
//avoid 'Bad Image' message box
UINT oldmode = SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX);
- QT_WA({
- pHnd = LoadLibraryW((TCHAR*)QDir::toNativeSeparators(attempt).utf16());
- } , {
- pHnd = LoadLibraryA(QFile::encodeName(QDir::toNativeSeparators(attempt)).data());
- });
-
+ pHnd = LoadLibrary((wchar_t*)QDir::toNativeSeparators(attempt).utf16());
+
if (pluginState != IsAPlugin) {
#if defined(Q_OS_WINCE)
if (!pHnd && ::GetLastError() == ERROR_MOD_NOT_FOUND) {
QString secondAttempt = fileName;
- QT_WA({
- pHnd = LoadLibraryW((TCHAR*)QDir::toNativeSeparators(secondAttempt).utf16());
- } , {
- pHnd = LoadLibraryA(QFile::encodeName(QDir::toNativeSeparators(secondAttempt)).data());
- });
+ pHnd = LoadLibrary((wchar_t*)QDir::toNativeSeparators(secondAttempt).utf16());
}
#endif
if (!pHnd && ::GetLastError() == ERROR_MOD_NOT_FOUND) {
attempt += QLatin1String(".dll");
- QT_WA({
- pHnd = LoadLibraryW((TCHAR*)QDir::toNativeSeparators(attempt).utf16());
- } , {
- pHnd = LoadLibraryA(QFile::encodeName(QDir::toNativeSeparators(attempt)).data());
- });
+ pHnd = LoadLibrary((wchar_t*)QDir::toNativeSeparators(attempt).utf16());
}
}
@@ -100,15 +88,11 @@ bool QLibraryPrivate::load_sys()
}
if (pHnd) {
errorString.clear();
- QT_WA({
- TCHAR buffer[MAX_PATH + 1];
- ::GetModuleFileNameW(pHnd, buffer, MAX_PATH);
- attempt = QString::fromUtf16(reinterpret_cast<const ushort *>(&buffer));
- }, {
- char buffer[MAX_PATH + 1];
- ::GetModuleFileNameA(pHnd, buffer, MAX_PATH);
- attempt = QString::fromLocal8Bit(buffer);
- });
+
+ wchar_t buffer[MAX_PATH];
+ ::GetModuleFileName(pHnd, buffer, MAX_PATH);
+ attempt = QString::fromWCharArray(buffer);
+
const QDir dir = QFileInfo(fileName).dir();
const QString realfilename = attempt.mid(attempt.lastIndexOf(QLatin1Char('\\')) + 1);
if (dir.path() == QLatin1String("."))
diff --git a/src/corelib/plugin/qplugin.h b/src/corelib/plugin/qplugin.h
index ff2b412..233b4f9 100644
--- a/src/corelib/plugin/qplugin.h
+++ b/src/corelib/plugin/qplugin.h
@@ -63,21 +63,6 @@ typedef QObject *(*QtPluginInstanceFunction)();
void Q_CORE_EXPORT qRegisterStaticPluginInstanceFunction(QtPluginInstanceFunction function);
-struct qt_plugin_instance_deleter
-{
- qt_plugin_instance_deleter(QPointer<QObject> &instance)
- : instance_(instance)
- {
- }
-
- ~qt_plugin_instance_deleter()
- {
- delete instance_;
- }
-
- QPointer<QObject> &instance_;
-};
-
#define Q_IMPORT_PLUGIN(PLUGIN) \
extern QT_PREPEND_NAMESPACE(QObject) *qt_plugin_instance_##PLUGIN(); \
class Static##PLUGIN##PluginInstance{ \
@@ -91,10 +76,8 @@ struct qt_plugin_instance_deleter
#define Q_PLUGIN_INSTANCE(IMPLEMENTATION) \
{ \
static QT_PREPEND_NAMESPACE(QPointer)<QT_PREPEND_NAMESPACE(QObject)> _instance; \
- if (!_instance) { \
- static QT_PREPEND_NAMESPACE(qt_plugin_instance_deleter) deleter(_instance); \
+ if (!_instance) \
_instance = new IMPLEMENTATION; \
- } \
return _instance; \
}