summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/global/qglobal.h4
-rw-r--r--src/corelib/global/qlibraryinfo.cpp27
-rw-r--r--src/corelib/global/qlibraryinfo.h1
-rw-r--r--src/corelib/io/qdir.cpp2
-rw-r--r--src/corelib/io/qfilesystemengine_symbian.cpp4
-rw-r--r--src/corelib/io/qfilesystemengine_unix.cpp2
-rw-r--r--src/corelib/io/qfilesystemengine_win.cpp6
-rw-r--r--src/corelib/io/qfilesystementry.cpp31
-rw-r--r--src/corelib/io/qfilesystementry_p.h1
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp12
-rw-r--r--src/corelib/kernel/qcoreapplication_p.h1
-rw-r--r--src/corelib/plugin/qfactoryloader.cpp57
-rw-r--r--src/corelib/plugin/qlibrary.cpp215
-rw-r--r--src/corelib/plugin/qlibrary_p.h3
-rw-r--r--src/corelib/plugin/qplugin.h3
-rw-r--r--src/corelib/plugin/qpluginloader.cpp16
-rw-r--r--src/corelib/tools/qchar.cpp18
-rw-r--r--src/corelib/tools/qlist.cpp2
-rw-r--r--src/corelib/tools/qlist.h19
-rw-r--r--src/corelib/tools/qlocale.cpp38
-rw-r--r--src/corelib/tools/qlocale.h3
-rw-r--r--src/corelib/tools/qstring.cpp32
22 files changed, 192 insertions, 305 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index c3e85ac0b1..71d0c720e6 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -1182,10 +1182,6 @@ Q_DECL_CONSTEXPR inline const T &qBound(const T &min, const T &val, const T &max
class QDataStream;
-#ifndef QT_BUILD_KEY
-#define QT_BUILD_KEY "unspecified"
-#endif
-
#if defined(Q_WS_MAC)
# ifndef QMAC_QMENUBAR_NO_EVENT
# define QMAC_QMENUBAR_NO_EVENT
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
index 88f12ab1f7..d70c77afae 100644
--- a/src/corelib/global/qlibraryinfo.cpp
+++ b/src/corelib/global/qlibraryinfo.cpp
@@ -203,21 +203,6 @@ QLibraryInfo::licensedProducts()
}
/*!
- Returns a unique key identifying this build of Qt and its
- configurations. This key is not globally unique, rather only useful
- for establishing of two configurations are compatible. This can be
- used to compare with the \c QT_BUILD_KEY preprocessor symbol.
-
- \sa location()
-*/
-
-QString
-QLibraryInfo::buildKey()
-{
- return QString::fromLatin1(QT_BUILD_KEY);
-}
-
-/*!
\since 4.6
Returns the installation date for this build of Qt. The install date will
usually be the last time that Qt sources were configured.
@@ -514,18 +499,6 @@ void qt_core_boilerplate()
"Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).\n"
"Contact: Nokia Corporation (qt-info@nokia.com)\n"
"\n"
- "Build key: " QT_BUILD_KEY "\n"
- "Compat build key: "
-#ifdef QT_BUILD_KEY_COMPAT
- "| " QT_BUILD_KEY_COMPAT " "
-#endif
-#ifdef QT_BUILD_KEY_COMPAT2
- "| " QT_BUILD_KEY_COMPAT2 " "
-#endif
-#ifdef QT_BUILD_KEY_COMPAT3
- "| " QT_BUILD_KEY_COMPAT3 " "
-#endif
- "|\n"
"Build date: %s\n"
"Installation prefix: %s\n"
"Library path: %s\n"
diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h
index a8fb90968c..4dcd8e1e5e 100644
--- a/src/corelib/global/qlibraryinfo.h
+++ b/src/corelib/global/qlibraryinfo.h
@@ -59,7 +59,6 @@ public:
static QString licensee();
static QString licensedProducts();
- static QString buildKey();
#ifndef QT_NO_DATESTRING
static QDate buildDate();
#endif //QT_NO_DATESTRING
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index 3621deea28..731c485b34 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -190,7 +190,7 @@ inline void QDirPrivate::resolveAbsoluteEntry() const
QString absoluteName;
if (fileEngine.isNull()) {
- if (!dirEntry.isRelative()) {
+ if (!dirEntry.isRelative() && dirEntry.isClean()) {
absoluteDirEntry = dirEntry;
return;
}
diff --git a/src/corelib/io/qfilesystemengine_symbian.cpp b/src/corelib/io/qfilesystemengine_symbian.cpp
index 18c52cbb17..c8c1dfdc84 100644
--- a/src/corelib/io/qfilesystemengine_symbian.cpp
+++ b/src/corelib/io/qfilesystemengine_symbian.cpp
@@ -114,9 +114,7 @@ QFileSystemEntry QFileSystemEngine::absoluteName(const QFileSystemEntry &entry)
{
QString orig = entry.filePath();
const bool isAbsolute = entry.isAbsolute();
- const bool isDirty = (orig.contains(QLatin1String("/../")) || orig.contains(QLatin1String("/./")) ||
- orig.contains(QLatin1String("//")) ||
- orig.endsWith(QLatin1String("/..")) || orig.endsWith(QLatin1String("/.")));
+ const bool isDirty = !entry.isClean();
if (isAbsolute && !isDirty)
return entry;
diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp
index f1e0758bbe..966daba021 100644
--- a/src/corelib/io/qfilesystemengine_unix.cpp
+++ b/src/corelib/io/qfilesystemengine_unix.cpp
@@ -218,7 +218,7 @@ QFileSystemEntry QFileSystemEngine::canonicalName(const QFileSystemEntry &entry,
//static
QFileSystemEntry QFileSystemEngine::absoluteName(const QFileSystemEntry &entry)
{
- if (entry.isAbsolute())
+ if (entry.isAbsolute() && entry.isClean())
return entry;
QByteArray orig = entry.nativeFilePath();
diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp
index f704fc3e90..df34184091 100644
--- a/src/corelib/io/qfilesystemengine_win.cpp
+++ b/src/corelib/io/qfilesystemengine_win.cpp
@@ -508,11 +508,7 @@ QFileSystemEntry QFileSystemEngine::absoluteName(const QFileSystemEntry &entry)
if (!entry.isRelative()) {
#if !defined(Q_OS_WINCE)
- if (entry.isAbsolute()
- && !entry.filePath().contains(QLatin1String("/../"))
- && !entry.filePath().contains(QLatin1String("/./"))
- && !entry.filePath().endsWith(QLatin1String("/.."))
- && !entry.filePath().endsWith(QLatin1String("/."))) {
+ if (entry.isAbsolute() && entry.isClean()) {
ret = entry.filePath();
} else {
ret = QDir::fromNativeSeparators(nativeAbsoluteFilePath(entry.filePath()));
diff --git a/src/corelib/io/qfilesystementry.cpp b/src/corelib/io/qfilesystementry.cpp
index bb7cb4e6ab..2f37542f66 100644
--- a/src/corelib/io/qfilesystementry.cpp
+++ b/src/corelib/io/qfilesystementry.cpp
@@ -380,4 +380,35 @@ void QFileSystemEntry::findFileNameSeparators() const
}
}
+bool QFileSystemEntry::isClean() const
+{
+ resolveFilePath();
+ int dots = 0;
+ bool dotok = true; // checking for ".." or "." starts to relative paths
+ bool slashok = true;
+ for (QString::const_iterator iter = m_filePath.constBegin(); iter != m_filePath.constEnd(); iter++) {
+ if (*iter == QLatin1Char('/')) {
+ if (dots == 1 || dots == 2)
+ return false; // path contains "./" or "../"
+ if (!slashok)
+ return false; // path contains "//"
+ dots = 0;
+ dotok = true;
+ slashok = false;
+ } else if (dotok) {
+ slashok = true;
+ if (*iter == QLatin1Char('.')) {
+ dots++;
+ if (dots > 2)
+ dotok = false;
+ } else {
+ //path element contains a character other than '.', it's clean
+ dots = 0;
+ dotok = false;
+ }
+ }
+ }
+ return (dots != 1 && dots != 2); // clean if path doesn't end in . or ..
+}
+
QT_END_NAMESPACE
diff --git a/src/corelib/io/qfilesystementry_p.h b/src/corelib/io/qfilesystementry_p.h
index 34b083a03e..8d524c087e 100644
--- a/src/corelib/io/qfilesystementry_p.h
+++ b/src/corelib/io/qfilesystementry_p.h
@@ -91,6 +91,7 @@ public:
QString completeSuffix() const;
bool isAbsolute() const;
bool isRelative() const;
+ bool isClean() const;
#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
bool isDriveRoot() const;
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index d12391914b..7252a34a2d 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -266,18 +266,6 @@ bool QCoreApplicationPrivate::is_app_closing = false;
// initialized in qcoreapplication and in qtextstream autotest when setlocale is called.
Q_CORE_EXPORT bool qt_locale_initialized = false;
-
-/*
- Create an instance of Trolltech.conf. This ensures that the settings will not
- be thrown out of QSetting's cache for unused settings.
- */
-Q_GLOBAL_STATIC_WITH_ARGS(QSettings, staticTrolltechConf, (QSettings::UserScope, QLatin1String("Trolltech")))
-
-QSettings *QCoreApplicationPrivate::trolltechConf()
-{
- return staticTrolltechConf();
-}
-
Q_CORE_EXPORT uint qGlobalPostedEventsCount()
{
QThreadData *currentThreadData = QThreadData::current();
diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h
index 62026141a1..0914b24a16 100644
--- a/src/corelib/kernel/qcoreapplication_p.h
+++ b/src/corelib/kernel/qcoreapplication_p.h
@@ -141,7 +141,6 @@ public:
static uint attribs;
static inline bool testAttribute(uint flag) { return attribs & (1 << flag); }
static int app_compile_version;
- static QSettings *trolltechConf();
};
QT_END_NAMESPACE
diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp
index c8831e5ae5..c175dcfe1b 100644
--- a/src/corelib/plugin/qfactoryloader.cpp
+++ b/src/corelib/plugin/qfactoryloader.cpp
@@ -45,7 +45,6 @@
#include "qfactoryinterface.h"
#include "qmap.h"
#include <qdir.h>
-#include <qsettings.h>
#include <qdebug.h>
#include "qmutex.h"
#include "qplugin.h"
@@ -107,7 +106,6 @@ void QFactoryLoader::update()
#ifdef QT_SHARED
Q_D(QFactoryLoader);
QStringList paths = QCoreApplication::libraryPaths();
- QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
for (int i = 0; i < paths.count(); ++i) {
const QString &pluginDir = paths.at(i);
// Already loaded, skip it...
@@ -127,7 +125,7 @@ void QFactoryLoader::update()
qDebug() << "QFactoryLoader::QFactoryLoader() looking at" << fileName;
}
library = QLibraryPrivate::findOrCreate(QFileInfo(fileName).canonicalFilePath());
- if (!library->isPlugin(&settings)) {
+ if (!library->isPlugin()) {
if (qt_debug_component()) {
qDebug() << library->errorString;
qDebug() << " not a plugin";
@@ -135,45 +133,26 @@ void QFactoryLoader::update()
library->release();
continue;
}
- QString regkey = QString::fromLatin1("Qt Factory Cache %1.%2/%3:/%4")
- .arg((QT_VERSION & 0xff0000) >> 16)
- .arg((QT_VERSION & 0xff00) >> 8)
- .arg(QLatin1String(d->iid))
- .arg(fileName);
- QStringList reg, keys;
- reg = settings.value(regkey).toStringList();
- if (reg.count() && library->lastModified == reg[0]) {
- keys = reg;
- keys.removeFirst();
- } else {
- if (!library->loadPlugin()) {
- if (qt_debug_component()) {
- qDebug() << library->errorString;
- qDebug() << " could not load";
- }
- library->release();
- continue;
- }
- QObject *instance = library->instance();
- if (!instance) {
- library->release();
- // ignore plugins that have a valid signature but cannot be loaded.
- continue;
+ QStringList keys;
+ if (!library->loadPlugin()) {
+ if (qt_debug_component()) {
+ qDebug() << library->errorString;
+ qDebug() << " could not load";
}
- QFactoryInterface *factory = qobject_cast<QFactoryInterface*>(instance);
- if (instance && factory && instance->qt_metacast(d->iid))
- keys = factory->keys();
- if (keys.isEmpty())
- library->unload();
- reg.clear();
- reg << library->lastModified;
- reg += keys;
- settings.setValue(regkey, reg);
+ library->release();
+ continue;
}
- if (qt_debug_component()) {
- qDebug() << "keys" << keys;
+ QObject *instance = library->instance();
+ if (!instance) {
+ library->release();
+ // ignore plugins that have a valid signature but cannot be loaded.
+ continue;
}
-
+ QFactoryInterface *factory = qobject_cast<QFactoryInterface*>(instance);
+ if (instance && factory && instance->qt_metacast(d->iid))
+ keys = factory->keys();
+ if (keys.isEmpty())
+ library->unload();
if (keys.isEmpty()) {
library->release();
continue;
diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp
index 45515f32e1..580dc37bd2 100644
--- a/src/corelib/plugin/qlibrary.cpp
+++ b/src/corelib/plugin/qlibrary.cpp
@@ -50,8 +50,6 @@
#include <qfileinfo.h>
#include <qmutex.h>
#include <qmap.h>
-#include <qsettings.h>
-#include <qdatetime.h>
#include <private/qcoreapplication_p.h>
#ifdef Q_OS_MAC
# include <private/qcore_mac_p.h>
@@ -250,7 +248,7 @@ static int qt_tokenize(const char *s, ulong s_len, ulong *advance,
/*
returns true if the string s was correctly parsed, false otherwise.
*/
-static bool qt_parse_pattern(const char *s, uint *version, bool *debug, QByteArray *key)
+static bool qt_parse_pattern(const char *s, uint *version, bool *debug)
{
bool ret = true;
@@ -282,10 +280,6 @@ static bool qt_parse_pattern(const char *s, uint *version, bool *debug, QByteArr
}
} else if (qstrncmp("debug", pinfo.results[0], pinfo.lengths[0]) == 0) {
*debug = qstrncmp("true", pinfo.results[1], pinfo.lengths[1]) == 0;
- } else if (qstrncmp("buildkey", pinfo.results[0],
- pinfo.lengths[0]) == 0){
- // save buildkey
- *key = QByteArray(pinfo.results[1], pinfo.lengths[1]);
}
} while (parse == 1 && parselen > 0);
@@ -337,11 +331,11 @@ static long qt_find_pattern(const char *s, ulong s_len,
we can get the verification data without have to actually load the library.
This lets us detect mismatches more safely.
- Returns false if version/key information is not present, or if the
+ Returns false if version information is not present, or if the
information could not be read.
- Returns true if version/key information is present and successfully read.
+ Returns true if version information is present and successfully read.
*/
-static bool qt_unix_query(const QString &library, uint *version, bool *debug, QByteArray *key, QLibraryPrivate *lib = 0)
+static bool qt_unix_query(const QString &library, uint *version, bool *debug, QLibraryPrivate *lib = 0)
{
QFile file(library);
if (!file.open(QIODevice::ReadOnly)) {
@@ -396,7 +390,7 @@ static bool qt_unix_query(const QString &library, uint *version, bool *debug, QB
#endif // defined(Q_OF_ELF) && defined(Q_CC_GNU)
bool ret = false;
if (pos >= 0)
- ret = qt_parse_pattern(filedata + pos, version, debug, key);
+ ret = qt_parse_pattern(filedata + pos, version, debug);
if (!ret && lib)
lib->errorString = QLibrary::tr("Plugin verification data mismatch in '%1'").arg(library);
@@ -636,7 +630,7 @@ typedef const char * __stdcall (*QtPluginQueryVerificationDataFunction)();
typedef const char * (*QtPluginQueryVerificationDataFunction)();
#endif
-bool qt_get_verificationdata(QtPluginQueryVerificationDataFunction pfn, uint *qt_version, bool *debug, QByteArray *key, bool *exceptionThrown)
+bool qt_get_verificationdata(QtPluginQueryVerificationDataFunction pfn, uint *qt_version, bool *debug, bool *exceptionThrown)
{
*exceptionThrown = false;
const char *szData = 0;
@@ -649,10 +643,10 @@ bool qt_get_verificationdata(QtPluginQueryVerificationDataFunction pfn, uint *qt
#else
szData = pfn();
#endif
- return qt_parse_pattern(szData, qt_version, debug, key);
+ return qt_parse_pattern(szData, qt_version, debug);
}
-bool QLibraryPrivate::isPlugin(QSettings *settings)
+bool QLibraryPrivate::isPlugin()
{
errorString.clear();
if (pluginState != MightBeAPlugin)
@@ -660,7 +654,6 @@ bool QLibraryPrivate::isPlugin(QSettings *settings)
#ifndef QT_NO_PLUGIN_CHECK
bool debug = !QLIBRARY_AS_DEBUG;
- QByteArray key;
bool success = false;
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
@@ -677,141 +670,88 @@ bool QLibraryPrivate::isPlugin(QSettings *settings)
}
#endif
- QFileInfo fileinfo(fileName);
-
-#ifndef QT_NO_DATESTRING
- lastModified = fileinfo.lastModified().toString(Qt::ISODate);
-#endif
- QString regkey = QString::fromLatin1("Qt Plugin Cache %1.%2.%3/%4")
- .arg((QT_VERSION & 0xff0000) >> 16)
- .arg((QT_VERSION & 0xff00) >> 8)
- .arg(QLIBRARY_AS_DEBUG ? QLatin1String("debug") : QLatin1String("false"))
- .arg(fileName);
-#ifdef Q_WS_MAC
- // On Mac, add the application arch to the reg key in order to
- // cache plugin information separately for each arch. This prevents
- // Qt from wrongly caching plugin load failures when the archs
- // don't match.
-#if defined(__x86_64__)
- regkey += QLatin1String("-x86_64");
-#elif defined(__i386__)
- regkey += QLatin1String("-i386");
-#elif defined(__ppc64__)
- regkey += QLatin1String("-ppc64");
-#elif defined(__ppc__)
- regkey += QLatin1String("-ppc");
-#endif
-#endif // Q_WS_MAC
-
- QStringList reg;
-#ifndef QT_NO_SETTINGS
- if (!settings) {
- settings = QCoreApplicationPrivate::trolltechConf();
- }
- reg = settings->value(regkey).toStringList();
-#endif
- if (reg.count() == 4 && lastModified == reg.at(3)) {
- qt_version = reg.at(0).toUInt(0, 16);
- debug = bool(reg.at(1).toInt());
- key = reg.at(2).toLatin1();
- success = qt_version != 0;
- } else {
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(Q_OS_SYMBIAN)
- if (!pHnd) {
- // use unix shortcut to avoid loading the library
- success = qt_unix_query(fileName, &qt_version, &debug, &key, this);
- } else
+ if (!pHnd) {
+ // use unix shortcut to avoid loading the library
+ success = qt_unix_query(fileName, &qt_version, &debug, this);
+ } else
#endif
- {
- bool retryLoadLibrary = false; // Only used on Windows with MS compiler.(false in other cases)
- do {
- bool temporary_load = false;
+ {
+ bool retryLoadLibrary = false; // Only used on Windows with MS compiler.(false in other cases)
+ do {
+ bool temporary_load = false;
#ifdef Q_OS_WIN
- HMODULE hTempModule = 0;
+ HMODULE hTempModule = 0;
#endif
- if (!pHnd) {
+ if (!pHnd) {
#ifdef Q_OS_WIN
- DWORD dwFlags = (retryLoadLibrary) ? 0: DONT_RESOLVE_DLL_REFERENCES;
- //avoid 'Bad Image' message box
- UINT oldmode = SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX);
- hTempModule = ::LoadLibraryEx((wchar_t*)QDir::toNativeSeparators(fileName).utf16(), 0, dwFlags);
- SetErrorMode(oldmode);
+ DWORD dwFlags = (retryLoadLibrary) ? 0: DONT_RESOLVE_DLL_REFERENCES;
+ //avoid 'Bad Image' message box
+ UINT oldmode = SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX);
+ hTempModule = ::LoadLibraryEx((wchar_t*)QDir::toNativeSeparators(fileName).utf16(), 0, dwFlags);
+ SetErrorMode(oldmode);
#else
# if defined(Q_OS_SYMBIAN)
- //Guard against accidentally trying to load non-plugin libraries by making sure the stub exists
- if (fileinfo.exists())
+ //Guard against accidentally trying to load non-plugin libraries by making sure the stub exists
+ if (fileinfo.exists())
# endif
- temporary_load = load_sys();
+ temporary_load = load_sys();
#endif
- }
+ }
#ifdef Q_OS_WIN
- QtPluginQueryVerificationDataFunction qtPluginQueryVerificationDataFunction = hTempModule ? (QtPluginQueryVerificationDataFunction)
+ QtPluginQueryVerificationDataFunction qtPluginQueryVerificationDataFunction = hTempModule ? (QtPluginQueryVerificationDataFunction)
#ifdef Q_OS_WINCE
- ::GetProcAddress(hTempModule, L"qt_plugin_query_verification_data")
+ ::GetProcAddress(hTempModule, L"qt_plugin_query_verification_data")
#else
- ::GetProcAddress(hTempModule, "qt_plugin_query_verification_data")
+ ::GetProcAddress(hTempModule, "qt_plugin_query_verification_data")
#endif
- : (QtPluginQueryVerificationDataFunction) resolve("qt_plugin_query_verification_data");
+ : (QtPluginQueryVerificationDataFunction) resolve("qt_plugin_query_verification_data");
#else
- QtPluginQueryVerificationDataFunction qtPluginQueryVerificationDataFunction = NULL;
+ QtPluginQueryVerificationDataFunction qtPluginQueryVerificationDataFunction = NULL;
# if defined(Q_OS_SYMBIAN)
- if (temporary_load) {
- qtPluginQueryVerificationDataFunction = (QtPluginQueryVerificationDataFunction) resolve("qt_plugin_query_verification_data");
- // If resolving with function name failed (i.e. not STDDLL), try resolving using known ordinal
- if (!qtPluginQueryVerificationDataFunction)
- qtPluginQueryVerificationDataFunction = (QtPluginQueryVerificationDataFunction) resolve("1");
- }
-# else
+ if (temporary_load) {
qtPluginQueryVerificationDataFunction = (QtPluginQueryVerificationDataFunction) resolve("qt_plugin_query_verification_data");
+ // If resolving with function name failed (i.e. not STDDLL), try resolving using known ordinal
+ if (!qtPluginQueryVerificationDataFunction)
+ qtPluginQueryVerificationDataFunction = (QtPluginQueryVerificationDataFunction) resolve("1");
+ }
+# else
+ qtPluginQueryVerificationDataFunction = (QtPluginQueryVerificationDataFunction) resolve("qt_plugin_query_verification_data");
# endif
#endif
- bool exceptionThrown = false;
- bool ret = qt_get_verificationdata(qtPluginQueryVerificationDataFunction,
- &qt_version, &debug, &key, &exceptionThrown);
- if (!exceptionThrown) {
- if (!ret) {
- qt_version = 0;
- key = "unknown";
- if (temporary_load)
- unload_sys();
- } else {
- success = true;
- }
- retryLoadLibrary = false;
+ bool exceptionThrown = false;
+ bool ret = qt_get_verificationdata(qtPluginQueryVerificationDataFunction,
+ &qt_version, &debug, &exceptionThrown);
+ if (!exceptionThrown) {
+ if (!ret) {
+ qt_version = 0;
+ if (temporary_load)
+ unload_sys();
+ } else {
+ success = true;
}
+ retryLoadLibrary = false;
+ }
#ifdef QT_USE_MS_STD_EXCEPTION
- else {
- // An exception was thrown when calling qt_plugin_query_verification_data().
- // This usually happens when plugin is compiled with the /clr compiler flag,
- // & will only work if the dependencies are loaded & DLLMain() is called.
- // LoadLibrary() will do this, try once with this & if it fails dont load.
- retryLoadLibrary = !retryLoadLibrary;
- }
+ else {
+ // An exception was thrown when calling qt_plugin_query_verification_data().
+ // This usually happens when plugin is compiled with the /clr compiler flag,
+ // & will only work if the dependencies are loaded & DLLMain() is called.
+ // LoadLibrary() will do this, try once with this & if it fails dont load.
+ retryLoadLibrary = !retryLoadLibrary;
+ }
#endif
#ifdef Q_OS_WIN
- if (hTempModule) {
- BOOL ok = ::FreeLibrary(hTempModule);
- if (ok) {
- hTempModule = 0;
- }
-
+ if (hTempModule) {
+ BOOL ok = ::FreeLibrary(hTempModule);
+ if (ok) {
+ hTempModule = 0;
}
-#endif
- } while(retryLoadLibrary); // Will be 'false' in all cases other than when an
- // exception is thrown(will happen only when using a MS compiler)
- }
-
- // 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;
- settings->setValue(regkey, queried);
+ }
#endif
+ } while (retryLoadLibrary); // Will be 'false' in all cases other than when an
+ // exception is thrown(will happen only when using a MS compiler)
}
if (!success) {
@@ -840,31 +780,6 @@ bool QLibraryPrivate::isPlugin(QSettings *settings)
.arg((qt_version&0xff00) >> 8)
.arg(qt_version&0xff)
.arg(debug ? QLatin1String("debug") : QLatin1String("release"));
- } else if (key != QT_BUILD_KEY
- // we may have some compatibility keys, try them too:
-#ifdef QT_BUILD_KEY_COMPAT
- && key != QT_BUILD_KEY_COMPAT
-#endif
-#ifdef QT_BUILD_KEY_COMPAT2
- && key != QT_BUILD_KEY_COMPAT2
-#endif
-#ifdef QT_BUILD_KEY_COMPAT3
- && key != QT_BUILD_KEY_COMPAT3
-#endif
- ) {
- if (qt_debug_component()) {
- qWarning("In %s:\n"
- " Plugin uses incompatible Qt library\n"
- " expected build key \"%s\", got \"%s\"",
- (const char*) QFile::encodeName(fileName),
- QT_BUILD_KEY,
- key.isEmpty() ? "<null>" : (const char *) key);
- }
- errorString = QLibrary::tr("The plugin '%1' uses incompatible Qt library."
- " Expected build key \"%2\", got \"%3\"")
- .arg(fileName)
- .arg(QLatin1String(QT_BUILD_KEY))
- .arg(key.isEmpty() ? QLatin1String("<null>") : QLatin1String((const char *) key));
#ifndef QT_NO_DEBUG_PLUGIN_CHECK
} else if(debug != QLIBRARY_AS_DEBUG) {
//don't issue a qWarning since we will hopefully find a non-debug? --Sam
diff --git a/src/corelib/plugin/qlibrary_p.h b/src/corelib/plugin/qlibrary_p.h
index c6804955d9..15825c699f 100644
--- a/src/corelib/plugin/qlibrary_p.h
+++ b/src/corelib/plugin/qlibrary_p.h
@@ -68,7 +68,6 @@ QT_BEGIN_NAMESPACE
bool qt_debug_component();
-class QSettings;
class QLibraryPrivate
{
public:
@@ -99,7 +98,7 @@ public:
QString errorString;
QLibrary::LoadHints loadHints;
- bool isPlugin(QSettings *settings = 0);
+ bool isPlugin();
private:
diff --git a/src/corelib/plugin/qplugin.h b/src/corelib/plugin/qplugin.h
index 40e6e66de3..52661671b5 100644
--- a/src/corelib/plugin/qplugin.h
+++ b/src/corelib/plugin/qplugin.h
@@ -117,8 +117,7 @@ void Q_CORE_EXPORT qRegisterStaticPluginInstanceFunction(QtPluginInstanceFunctio
static const char qt_plugin_verification_data[] = \
"pattern=""QT_PLUGIN_VERIFICATION_DATA""\n" \
"version="QT_VERSION_STR"\n" \
- "debug="QPLUGIN_DEBUG_STR"\n" \
- "buildkey="QT_BUILD_KEY;
+ "debug="QPLUGIN_DEBUG_STR;
# if defined (Q_OF_ELF) && defined (Q_CC_GNU)
# define Q_PLUGIN_VERIFICATION_SECTION \
diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp
index bbb64e42e7..591e36e20a 100644
--- a/src/corelib/plugin/qpluginloader.cpp
+++ b/src/corelib/plugin/qpluginloader.cpp
@@ -98,22 +98,6 @@ QT_BEGIN_NAMESPACE
every instance has called unload(). Right before the unloading
happen, the root component will also be deleted.
- In order to speed up loading and validation of plugins, some of
- the information that is collected during loading is cached in
- persistent memory (through QSettings). For instance, the result
- of a load operation (e.g. succeeded or failed) is stored in the
- cache, so that subsequent load operations don't try to load an
- invalid plugin. However, if the "last modified" timestamp of
- a plugin has changed, the plugin's cache entry is invalidated
- and the plugin is reloaded regardless of the values in the cache
- entry. The cache entry is then updated with the new result of the
- load operation.
-
- This also means that the timestamp must be updated each time the
- plugin or any dependent resources (such as a shared library) is
- updated, since the dependent resources might influence the result
- of loading a plugin.
-
See \l{How to Create Qt Plugins} for more information about
how to make your application extensible through plugins.
diff --git a/src/corelib/tools/qchar.cpp b/src/corelib/tools/qchar.cpp
index 736bc63b11..b68da9def4 100644
--- a/src/corelib/tools/qchar.cpp
+++ b/src/corelib/tools/qchar.cpp
@@ -1402,7 +1402,8 @@ static void decomposeHelper(QString *str, bool canonical, QChar::UnicodeVersion
ucs4 = QChar::surrogateToUcs4(high, ucs4);
}
}
- if (QChar::unicodeVersion(ucs4) > version)
+ const QChar::UnicodeVersion v = QChar::unicodeVersion(ucs4);
+ if (v > version || v == QChar::Unicode_Unassigned)
continue;
int length;
int tag;
@@ -1462,7 +1463,7 @@ static ushort ligatureHelper(ushort u1, ushort u2)
return 0;
}
-static void composeHelper(QString *str, int from)
+static void composeHelper(QString *str, QChar::UnicodeVersion version, int from)
{
QString &s = *str;
@@ -1482,7 +1483,14 @@ static void composeHelper(QString *str, int from)
++pos;
}
}
- int combining = QChar::combiningClass(uc);
+ const QUnicodeTables::Properties *p = qGetProp(uc);
+ if (p->unicodeVersion > version || p->unicodeVersion == QChar::Unicode_Unassigned) {
+ starter = -1; // to prevent starter == pos - 1
+ lastCombining = 0;
+ ++pos;
+ continue;
+ }
+ int combining = p->combiningClass;
if (starter == pos - 1 || combining > lastCombining) {
// allowed to form ligature with S
QChar ligature = ligatureHelper(s.at(starter).unicode(), uc);
@@ -1529,7 +1537,7 @@ static void canonicalOrderHelper(QString *str, QChar::UnicodeVersion version, in
ushort c2 = 0;
{
const QUnicodeTables::Properties *p = qGetProp(u2);
- if ((QChar::UnicodeVersion)p->unicodeVersion <= version)
+ if (p->unicodeVersion <= version && p->unicodeVersion != QChar::Unicode_Unassigned)
c2 = p->combiningClass;
}
if (c2 == 0) {
@@ -1540,7 +1548,7 @@ static void canonicalOrderHelper(QString *str, QChar::UnicodeVersion version, in
ushort c1 = 0;
{
const QUnicodeTables::Properties *p = qGetProp(u1);
- if ((QChar::UnicodeVersion)p->unicodeVersion <= version)
+ if (p->unicodeVersion <= version && p->unicodeVersion != QChar::Unicode_Unassigned)
c1 = p->combiningClass;
}
diff --git a/src/corelib/tools/qlist.cpp b/src/corelib/tools/qlist.cpp
index e0b69d4361..4c04385033 100644
--- a/src/corelib/tools/qlist.cpp
+++ b/src/corelib/tools/qlist.cpp
@@ -181,7 +181,7 @@ void **QListData::append()
}
// ensures that enough space is available to append the list
-void **QListData::append2(const QListData& l)
+void **QListData::append(const QListData& l)
{
return append(l.d->end - l.d->begin);
}
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index f8f62cc8b2..b4c35b8d35 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -79,9 +79,6 @@ struct Q_CORE_EXPORT QListData {
Data *detach(int alloc);
Data *detach_grow(int *i, int n);
- Data *detach(); // remove in 5.0
- Data *detach2(); // remove in 5.0
- Data *detach3(); // remove in 5.0
void realloc(int alloc);
static Data shared_null;
Data *d;
@@ -89,7 +86,6 @@ struct Q_CORE_EXPORT QListData {
void **append(int n);
void **append();
void **append(const QListData &l);
- void **append2(const QListData &l); // remove in 5.0
void **prepend();
void **insert(int i);
void remove(int i);
@@ -338,7 +334,7 @@ private:
Node *detach_helper_grow(int i, int n);
void detach_helper(int alloc);
void detach_helper();
- void free(QListData::Data *d);
+ void dealloc(QListData::Data *d);
void node_construct(Node *n, const T &t);
void node_destruct(Node *n);
@@ -426,7 +422,7 @@ Q_INLINE_TEMPLATE QList<T> &QList<T>::operator=(const QList<T> &l)
QListData::Data *o = l.d;
o->ref.ref();
if (!d->ref.deref())
- free(d);
+ dealloc(d);
d = o;
if (!d->sharable)
detach_helper();
@@ -683,7 +679,7 @@ Q_OUTOFLINE_TEMPLATE typename QList<T>::Node *QList<T>::detach_helper_grow(int i
}
if (!x->ref.deref())
- free(x);
+ dealloc(x);
return reinterpret_cast<Node *>(p.begin() + i);
}
@@ -702,7 +698,7 @@ Q_OUTOFLINE_TEMPLATE void QList<T>::detach_helper(int alloc)
}
if (!x->ref.deref())
- free(x);
+ dealloc(x);
}
template <typename T>
@@ -715,7 +711,7 @@ template <typename T>
Q_OUTOFLINE_TEMPLATE QList<T>::~QList()
{
if (!d->ref.deref())
- free(d);
+ dealloc(d);
}
template <typename T>
@@ -736,9 +732,8 @@ Q_OUTOFLINE_TEMPLATE bool QList<T>::operator==(const QList<T> &l) const
return true;
}
-// ### Qt 5: rename freeData() to avoid confusion with std::free()
template <typename T>
-Q_OUTOFLINE_TEMPLATE void QList<T>::free(QListData::Data *data)
+Q_OUTOFLINE_TEMPLATE void QList<T>::dealloc(QListData::Data *data)
{
node_destruct(reinterpret_cast<Node *>(data->array + data->begin),
reinterpret_cast<Node *>(data->array + data->end));
@@ -802,7 +797,7 @@ Q_OUTOFLINE_TEMPLATE QList<T> &QList<T>::operator+=(const QList<T> &l)
} else {
Node *n = (d->ref != 1)
? detach_helper_grow(INT_MAX, l.size())
- : reinterpret_cast<Node *>(p.append2(l.p));
+ : reinterpret_cast<Node *>(p.append(l.p));
QT_TRY {
node_copy(n, reinterpret_cast<Node *>(p.end()),
reinterpret_cast<Node *>(l.p.begin()));
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index 63ffae4e2b..d2bb752c6d 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -89,6 +89,8 @@ Q_GLOBAL_STATIC(QLocalePrivate, globalLocalePrivate)
#ifdef QT_USE_ICU
extern bool qt_initIcu(const QString &localeName);
+extern bool qt_u_strToUpper(const QString &str, QString *out, const QLocale &locale);
+extern bool qt_u_strToLower(const QString &str, QString *out, const QLocale &locale);
#endif
/******************************************************************************
@@ -2171,6 +2173,42 @@ Qt::LayoutDirection QLocale::textDirection() const
return Qt::LeftToRight;
}
+/*!
+ \since 4.8
+
+ Returns an uppercase copy of \a str.
+*/
+QString QLocale::toUpper(const QString &str) const
+{
+#ifdef QT_USE_ICU
+ {
+ QString result;
+ if (qt_u_strToUpper(str, &result, *this))
+ return result;
+ // else fall through and use Qt's toUpper
+ }
+#endif
+ return str.toUpper();
+}
+
+/*!
+ \since 4.8
+
+ Returns a lowercase copy of \a str.
+*/
+QString QLocale::toLower(const QString &str) const
+{
+#ifdef QT_USE_ICU
+ {
+ QString result;
+ if (qt_u_strToLower(str, &result, *this))
+ return result;
+ // else fall through and use Qt's toUpper
+ }
+#endif
+ return str.toLower();
+}
+
/*!
\since 4.5
diff --git a/src/corelib/tools/qlocale.h b/src/corelib/tools/qlocale.h
index 8a5d526e8d..55dd55b984 100644
--- a/src/corelib/tools/qlocale.h
+++ b/src/corelib/tools/qlocale.h
@@ -724,6 +724,9 @@ public:
Qt::LayoutDirection textDirection() const;
+ QString toUpper(const QString &str) const;
+ QString toLower(const QString &str) const;
+
QString currencySymbol(CurrencySymbolFormat = CurrencySymbol) const;
QString toCurrencyString(qlonglong, const QString &symbol = QString()) const;
QString toCurrencyString(qulonglong, const QString &symbol = QString()) const;
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 9ce5eead8c..c56c050f76 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -105,8 +105,6 @@ QTextCodec *QString::codecForCStrings;
#ifdef QT_USE_ICU
// qlocale_icu.cpp
extern bool qt_ucol_strcoll(const QChar *source, int sourceLength, const QChar *target, int targetLength, int *result);
-extern bool qt_u_strToUpper(const QString &str, QString *out, const QLocale &locale);
-extern bool qt_u_strToLower(const QString &str, QString *out, const QLocale &locale);
#endif
@@ -4878,7 +4876,10 @@ QString QString::rightJustified(int width, QChar fill, bool truncate) const
\snippet doc/src/snippets/qstring/main.cpp 75
- \sa toUpper()
+ The case conversion will always happen in the 'C' locale. For locale dependent
+ case folding use QLocale::toLower()
+
+ \sa toUpper(), QLocale::toLower()
*/
QString QString::toLower() const
@@ -4889,15 +4890,6 @@ QString QString::toLower() const
if (!d->size)
return *this;
-#ifdef QT_USE_ICU
- {
- QString result;
- if (qt_u_strToLower(*this, &result, QLocale()))
- return result;
- // else fall through and use Qt's toUpper
- }
-#endif
-
const ushort *e = d->data() + d->size;
// this avoids one out of bounds check in the loop
@@ -4978,7 +4970,10 @@ QString QString::toCaseFolded() const
\snippet doc/src/snippets/qstring/main.cpp 81
- \sa toLower()
+ The case conversion will always happen in the 'C' locale. For locale dependent
+ case folding use QLocale::toUpper()
+
+ \sa toLower(), QLocale::toLower()
*/
QString QString::toUpper() const
@@ -4989,15 +4984,6 @@ QString QString::toUpper() const
if (!d->size)
return *this;
-#ifdef QT_USE_ICU
- {
- QString result;
- if (qt_u_strToUpper(*this, &result, QLocale()))
- return result;
- // else fall through and use Qt's toUpper
- }
-#endif
-
const ushort *e = d->data() + d->size;
// this avoids one out of bounds check in the loop
@@ -6244,7 +6230,7 @@ void qt_string_normalize(QString *data, QString::NormalizationForm mode, QChar::
if (mode == QString::NormalizationForm_D || mode == QString::NormalizationForm_KD)
return;
- composeHelper(data, from);
+ composeHelper(data, version, from);
}