summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/arch/qatomic_gcc.h2
-rw-r--r--src/corelib/arch/qatomic_ia64.h4
-rw-r--r--src/corelib/codecs/qtextcodec.cpp6
-rw-r--r--src/corelib/global/qglobal.h16
-rw-r--r--src/corelib/global/qlibraryinfo.cpp204
-rw-r--r--src/corelib/global/qlibraryinfo.h20
-rw-r--r--src/corelib/global/qtypeinfo.h8
-rw-r--r--src/corelib/io/qfilesystemengine_unix.cpp18
-rw-r--r--src/corelib/io/qfilesystemwatcher_polling_p.h1
-rw-r--r--src/corelib/io/qsettings.cpp6
-rw-r--r--src/corelib/io/qstandardpaths_unix.cpp1
-rw-r--r--src/corelib/json/qjsonarray.cpp1
-rw-r--r--src/corelib/json/qjsondocument.cpp1
-rw-r--r--src/corelib/json/qjsonobject.cpp1
-rw-r--r--src/corelib/kernel/qcoreevent.h6
-rw-r--r--src/corelib/kernel/qeventdispatcher_win_p.h3
-rw-r--r--src/corelib/kernel/qmetatype.h22
-rw-r--r--src/corelib/kernel/qobject.cpp10
-rw-r--r--src/corelib/kernel/qobject_p.h11
-rw-r--r--src/corelib/kernel/qobjectdefs.h12
-rw-r--r--src/corelib/kernel/qvariant.cpp2
-rw-r--r--src/corelib/thread/qbasicatomic.h4
-rw-r--r--src/corelib/thread/qgenericatomic.h6
-rw-r--r--src/corelib/tools/qbytearray.cpp6
-rw-r--r--src/corelib/tools/qbytearray.h12
-rw-r--r--src/corelib/tools/qcryptographichash.h2
-rw-r--r--src/corelib/tools/qlocale.h1
-rw-r--r--src/corelib/tools/qlocale_p.h2
-rw-r--r--src/corelib/tools/qlocale_unix.cpp2
-rw-r--r--src/corelib/tools/qpair.h16
-rw-r--r--src/corelib/tools/qscopedvaluerollback.h2
-rw-r--r--src/corelib/tools/qstring.cpp46
-rw-r--r--src/corelib/tools/qstring.h16
-rw-r--r--src/corelib/tools/qstringbuilder.h16
-rw-r--r--src/corelib/tools/qstringmatcher.h2
-rw-r--r--src/corelib/xml/qxmlstream.h14
36 files changed, 254 insertions, 248 deletions
diff --git a/src/corelib/arch/qatomic_gcc.h b/src/corelib/arch/qatomic_gcc.h
index 225a7809eb..9edb74fa73 100644
--- a/src/corelib/arch/qatomic_gcc.h
+++ b/src/corelib/arch/qatomic_gcc.h
@@ -84,7 +84,7 @@ template <typename T> struct QAtomicOps: QGenericAtomicOps<QAtomicOps<T> >
typedef T Type;
#ifndef __ia64__
- static T loadAcquire(T &_q_value)
+ static T loadAcquire(const T &_q_value)
{
T tmp = _q_value;
__sync_synchronize();
diff --git a/src/corelib/arch/qatomic_ia64.h b/src/corelib/arch/qatomic_ia64.h
index d82ad12223..5108751f2a 100644
--- a/src/corelib/arch/qatomic_ia64.h
+++ b/src/corelib/arch/qatomic_ia64.h
@@ -143,9 +143,9 @@ template <int size> struct QBasicAtomicOps: QGenericAtomicOps<QBasicAtomicOps<si
static void orderedMemoryFence();
template <typename T> static inline
- T loadAcquire(T &_q_value)
+ T loadAcquire(const T &_q_value)
{
- return *static_cast<volatile T *>(&_q_value);
+ return *static_cast<const volatile T *>(&_q_value);
}
template <typename T> static inline
diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp
index 4cfdfe5966..f6f0cd8699 100644
--- a/src/corelib/codecs/qtextcodec.cpp
+++ b/src/corelib/codecs/qtextcodec.cpp
@@ -111,7 +111,7 @@ static bool qisalnum(register char c)
static bool nameMatch(const QByteArray &name, const QByteArray &test)
{
// if they're the same, return a perfect score
- if (qstricmp(name, test) == 0)
+ if (qstricmp(name.constData(), test.constData()) == 0)
return true;
const char *n = name.constData();
@@ -510,7 +510,7 @@ static QTextCodec * ru_RU_hack(const char * i) {
koi8r, latin5, i);
}
#if !defined(QT_NO_SETLOCALE)
- setlocale(LC_CTYPE, origlocale);
+ setlocale(LC_CTYPE, origlocale.constData());
#endif
return ru_RU_codec;
@@ -648,7 +648,7 @@ static void setupLocaleMapper()
else if (try_locale_list(pt_154locales, lang))
localeMapper = QTextCodec::codecForName("PT 154");
else if (try_locale_list(probably_koi8_rlocales, lang))
- localeMapper = ru_RU_hack(lang);
+ localeMapper = ru_RU_hack(lang.constData());
}
}
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 5fbc8cdd19..99328d52ac 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -578,16 +578,6 @@ class QDataStream;
# else
# define Q_SVG_EXPORT Q_DECL_IMPORT
# endif
-# if defined(QT_BUILD_QTQUICK1_LIB)
-# define Q_QTQUICK1_EXPORT Q_DECL_EXPORT
-# else
-# define Q_QTQUICK1_EXPORT Q_DECL_IMPORT
-# endif
-# if defined(QT_BUILD_DECLARATIVE_LIB)
-# define Q_DECLARATIVE_EXPORT Q_DECL_EXPORT
-# else
-# define Q_DECLARATIVE_EXPORT Q_DECL_IMPORT
-# endif
# if defined(QT_BUILD_OPENGL_LIB)
# define Q_OPENGL_EXPORT Q_DECL_EXPORT
# else
@@ -648,8 +638,6 @@ class QDataStream;
# define Q_SQL_EXPORT Q_DECL_IMPORT
# define Q_NETWORK_EXPORT Q_DECL_IMPORT
# define Q_SVG_EXPORT Q_DECL_IMPORT
-# define Q_DECLARATIVE_EXPORT Q_DECL_IMPORT
-# define Q_QTQUICK1_EXPORT Q_DECL_IMPORT
# define Q_CANVAS_EXPORT Q_DECL_IMPORT
# define Q_OPENGL_EXPORT Q_DECL_IMPORT
# define Q_MULTIMEDIA_EXPORT Q_DECL_IMPORT
@@ -682,8 +670,6 @@ class QDataStream;
# define Q_SQL_EXPORT Q_DECL_EXPORT
# define Q_NETWORK_EXPORT Q_DECL_EXPORT
# define Q_SVG_EXPORT Q_DECL_EXPORT
-# define Q_DECLARATIVE_EXPORT Q_DECL_EXPORT
-# define Q_QTQUICK1_EXPORT Q_DECL_EXPORT
# define Q_OPENGL_EXPORT Q_DECL_EXPORT
# define Q_MULTIMEDIA_EXPORT Q_DECL_EXPORT
# define Q_OPENVG_EXPORT Q_DECL_EXPORT
@@ -702,8 +688,6 @@ class QDataStream;
# define Q_SQL_EXPORT
# define Q_NETWORK_EXPORT
# define Q_SVG_EXPORT
-# define Q_DECLARATIVE_EXPORT
-# define Q_QTQUICK1_EXPORT
# define Q_OPENGL_EXPORT
# define Q_MULTIMEDIA_EXPORT
# define Q_OPENVG_EXPORT
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
index c871675334..4caacece2d 100644
--- a/src/corelib/global/qlibraryinfo.cpp
+++ b/src/corelib/global/qlibraryinfo.cpp
@@ -46,11 +46,7 @@
#include "qlibraryinfo.h"
#include "qscopedpointer.h"
-#if defined(QT_BUILD_QMAKE) || defined(QT_BOOTSTRAPPED)
-# define BOOTSTRAPPING
-#endif
-
-#ifdef BOOTSTRAPPING
+#ifdef QT_BUILD_QMAKE
QT_BEGIN_NAMESPACE
extern QString qmake_libraryInfoFile();
QT_END_NAMESPACE
@@ -97,7 +93,7 @@ public:
QLibrarySettings::QLibrarySettings()
: settings(QLibraryInfoPrivate::findConfiguration())
{
-#ifndef BOOTSTRAPPING
+#ifndef QT_BUILD_QMAKE
qAddPostRoutine(QLibraryInfoPrivate::cleanup);
#endif
}
@@ -105,7 +101,7 @@ QLibrarySettings::QLibrarySettings()
QSettings *QLibraryInfoPrivate::findConfiguration()
{
QString qtconfig = QLatin1String(":/qt/etc/qt.conf");
-#ifdef BOOTSTRAPPING
+#ifdef QT_BUILD_QMAKE
if(!QFile::exists(qtconfig))
qtconfig = qmake_libraryInfoFile();
#else
@@ -152,6 +148,8 @@ QSettings *QLibraryInfoPrivate::findConfiguration()
\sa QSysInfo, {Using qt.conf}
*/
+#ifndef QT_BUILD_QMAKE
+
/*! \internal
You cannot create a QLibraryInfo, instead only the static functions are available to query
@@ -214,135 +212,82 @@ QLibraryInfo::isDebugBuild()
return false;
}
+#endif // QT_BUILD_QMAKE
+
+static const struct {
+ char key[14], value[13];
+} qtConfEntries[] = {
+ { "Prefix", "" },
+ { "Documentation", "doc" },
+ { "Headers", "include" },
+ { "Libraries", "lib" },
+ { "Binaries", "bin" },
+ { "Plugins", "plugins" },
+ { "Imports", "imports" },
+ { "Data", "" },
+ { "Translations", "translations" },
+ { "Examples", "" },
+ { "Tests", "tests" },
+#ifdef QT_BUILD_QMAKE
+ { "Sysroot", "" },
+ { "HostPrefix", "" },
+ { "HostBinaries", "bin" },
+ { "HostData", "" },
+#endif
+};
+
/*!
Returns the location specified by \a loc.
*/
-
QString
QLibraryInfo::location(LibraryLocation loc)
{
+#ifdef QT_BUILD_QMAKE
+ QString ret = rawLocation(loc);
+
+ // Automatically prepend the sysroot to target paths
+ if (loc < SysrootPath || loc > LastHostPath) {
+ QString sysroot = rawLocation(SysrootPath);
+ if (!sysroot.isEmpty() && ret.length() > 2 && ret.at(1) == QLatin1Char(':')
+ && (ret.at(2) == QLatin1Char('/') || ret.at(2) == QLatin1Char('\\')))
+ ret.replace(0, 2, sysroot); // Strip out the drive on Windows targets
+ else
+ ret.prepend(sysroot);
+ }
+
+ return ret;
+}
+
+QString
+QLibraryInfo::rawLocation(LibraryLocation loc)
+{
+#else
+# define rawLocation location
+#endif
QString ret;
if(!QLibraryInfoPrivate::configuration()) {
const char *path = 0;
- switch (loc) {
-#ifdef QT_CONFIGURE_PREFIX_PATH
- case PrefixPath:
- path = QT_CONFIGURE_PREFIX_PATH;
- break;
-#endif
-#ifdef QT_CONFIGURE_DOCUMENTATION_PATH
- case DocumentationPath:
- path = QT_CONFIGURE_DOCUMENTATION_PATH;
- break;
-#endif
-#ifdef QT_CONFIGURE_HEADERS_PATH
- case HeadersPath:
- path = QT_CONFIGURE_HEADERS_PATH;
- break;
-#endif
-#ifdef QT_CONFIGURE_LIBRARIES_PATH
- case LibrariesPath:
- path = QT_CONFIGURE_LIBRARIES_PATH;
- break;
-#endif
-#ifdef QT_CONFIGURE_BINARIES_PATH
- case BinariesPath:
- path = QT_CONFIGURE_BINARIES_PATH;
- break;
-#endif
-#ifdef QT_CONFIGURE_PLUGINS_PATH
- case PluginsPath:
- path = QT_CONFIGURE_PLUGINS_PATH;
- break;
-#endif
-#ifdef QT_CONFIGURE_IMPORTS_PATH
- case ImportsPath:
- path = QT_CONFIGURE_IMPORTS_PATH;
- break;
-#endif
-#ifdef QT_CONFIGURE_DATA_PATH
- case DataPath:
- path = QT_CONFIGURE_DATA_PATH;
- break;
-#endif
-#ifdef QT_CONFIGURE_TRANSLATIONS_PATH
- case TranslationsPath:
- path = QT_CONFIGURE_TRANSLATIONS_PATH;
- break;
-#endif
-#ifdef QT_CONFIGURE_SETTINGS_PATH
- case SettingsPath:
+ if (loc >= 0 && loc < sizeof(qt_configure_prefix_path_strs)/sizeof(qt_configure_prefix_path_strs[0]))
+ path = qt_configure_prefix_path_strs[loc] + 12;
+#ifndef Q_OS_WIN // On Windows we use the registry
+ else if (loc == SettingsPath)
path = QT_CONFIGURE_SETTINGS_PATH;
- break;
#endif
-#ifdef QT_CONFIGURE_EXAMPLES_PATH
- case ExamplesPath:
- path = QT_CONFIGURE_EXAMPLES_PATH;
- break;
-#endif
-#ifdef QT_CONFIGURE_TESTS_PATH
- case TestsPath:
- path = QT_CONFIGURE_TESTS_PATH;
- break;
-#endif
- default:
- break;
- }
if (path)
ret = QString::fromLocal8Bit(path);
} else {
QString key;
QString defaultValue;
- switch(loc) {
- case PrefixPath:
- key = QLatin1String("Prefix");
- break;
- case DocumentationPath:
- key = QLatin1String("Documentation");
- defaultValue = QLatin1String("doc");
- break;
- case HeadersPath:
- key = QLatin1String("Headers");
- defaultValue = QLatin1String("include");
- break;
- case LibrariesPath:
- key = QLatin1String("Libraries");
- defaultValue = QLatin1String("lib");
- break;
- case BinariesPath:
- key = QLatin1String("Binaries");
- defaultValue = QLatin1String("bin");
- break;
- case PluginsPath:
- key = QLatin1String("Plugins");
- defaultValue = QLatin1String("plugins");
- break;
- case ImportsPath:
- key = QLatin1String("Imports");
- defaultValue = QLatin1String("imports");
- break;
- case DataPath:
- key = QLatin1String("Data");
- break;
- case TranslationsPath:
- key = QLatin1String("Translations");
- defaultValue = QLatin1String("translations");
- break;
- case SettingsPath:
- key = QLatin1String("Settings");
- break;
- case ExamplesPath:
- key = QLatin1String("Examples");
- break;
- case TestsPath:
- key = QLatin1String("Tests");
- defaultValue = QLatin1String("tests");
- break;
- default:
- break;
+ if (loc >= 0 && loc < sizeof(qtConfEntries)/sizeof(qtConfEntries[0])) {
+ key = QLatin1String(qtConfEntries[loc].key);
+ defaultValue = QLatin1String(qtConfEntries[loc].value);
}
+#ifndef Q_OS_WIN // On Windows we use the registry
+ else if (loc == SettingsPath)
+ key = QLatin1String("Settings");
+#endif
if(!key.isNull()) {
QSettings *config = QLibraryInfoPrivate::configuration();
@@ -366,11 +311,19 @@ QLibraryInfo::location(LibraryLocation loc)
if (QDir::isRelativePath(ret)) {
QString baseDir;
- if (loc == PrefixPath) {
- // we make the prefix path absolute to the executable's directory
-#ifdef BOOTSTRAPPING
+#ifdef QT_BUILD_QMAKE
+ if (loc == HostPrefixPath || loc == PrefixPath) {
+ // We make the prefix path absolute to the executable's directory.
+ // loc == PrefixPath while a sysroot is set would make no sense here.
baseDir = QFileInfo(qmake_libraryInfoFile()).absolutePath();
+ } else if (loc == SysrootPath) {
+ // The sysroot is bare
+ return ret;
+ } else if (loc > SysrootPath && loc <= LastHostPath) {
+ // We make any other host path absolute to the host prefix directory.
+ baseDir = rawLocation(HostPrefixPath);
#else
+ if (loc == PrefixPath) {
if (QCoreApplication::instance()) {
#ifdef Q_OS_MAC
CFBundleRef bundleRef = CFBundleGetMainBundle();
@@ -382,6 +335,7 @@ QLibraryInfo::location(LibraryLocation loc)
}
}
#endif
+ // We make the prefix path absolute to the executable's directory.
baseDir = QCoreApplication::applicationDirPath();
} else {
baseDir = QDir::currentPath();
@@ -389,7 +343,7 @@ QLibraryInfo::location(LibraryLocation loc)
#endif
} else {
// we make any other path absolute to the prefix directory
- baseDir = location(PrefixPath);
+ baseDir = rawLocation(PrefixPath);
}
ret = QDir::cleanPath(baseDir + QLatin1Char('/') + ret);
}
@@ -413,9 +367,9 @@ QLibraryInfo::location(LibraryLocation loc)
\value ImportsPath The location of installed QML extensions to import.
\value DataPath The location of general Qt data.
\value TranslationsPath The location of translation information for Qt strings.
- \value SettingsPath The location for Qt settings.
\value ExamplesPath The location for examples upon install.
\value TestsPath The location of installed Qt testcases.
+ \value SettingsPath The location for Qt settings. Not applicable on Windows.
\sa location()
*/
@@ -443,9 +397,9 @@ void qt_core_boilerplate()
"Library path: %s\n"
"Include path: %s\n",
qt_configure_installation + 12,
- qt_configure_prefix_path_str + 12,
- qt_configure_libraries_path_str + 12,
- qt_configure_headers_path_str + 12);
+ qt_configure_prefix_path_strs[QT_PREPEND_NAMESPACE(QLibraryInfo)::PrefixPath] + 12,
+ qt_configure_prefix_path_strs[QT_PREPEND_NAMESPACE(QLibraryInfo)::LibrariesPath] + 12,
+ qt_configure_prefix_path_strs[QT_PREPEND_NAMESPACE(QLibraryInfo)::HeadersPath] + 12);
QT_PREPEND_NAMESPACE(qDumpCPUFeatures)();
diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h
index 66f3d40792..d180e63198 100644
--- a/src/corelib/global/qlibraryinfo.h
+++ b/src/corelib/global/qlibraryinfo.h
@@ -66,20 +66,32 @@ public:
enum LibraryLocation
{
- PrefixPath,
+ PrefixPath = 0,
DocumentationPath,
HeadersPath,
LibrariesPath,
BinariesPath,
PluginsPath,
+ ImportsPath,
DataPath,
TranslationsPath,
- SettingsPath,
ExamplesPath,
- ImportsPath,
- TestsPath
+ TestsPath,
+ // Insert new values above this line
+#ifdef QT_BUILD_QMAKE
+ // These are not subject to binary compatibility constraints
+ SysrootPath,
+ HostPrefixPath,
+ HostBinariesPath,
+ HostDataPath,
+ LastHostPath = HostDataPath,
+#endif
+ SettingsPath = 100
};
static QString location(LibraryLocation); // ### Qt 5: consider renaming it to path()
+#ifdef QT_BUILD_QMAKE
+ static QString rawLocation(LibraryLocation);
+#endif
private:
QLibraryInfo();
diff --git a/src/corelib/global/qtypeinfo.h b/src/corelib/global/qtypeinfo.h
index 6297b35b9c..1c08bbe1cf 100644
--- a/src/corelib/global/qtypeinfo.h
+++ b/src/corelib/global/qtypeinfo.h
@@ -49,15 +49,12 @@ QT_BEGIN_NAMESPACE
/*
QTypeInfo - type trait functionality
- qIsDetached - data sharing functionality
*/
/*
The catch-all template.
*/
-template <typename T> inline bool qIsDetached(T &) { return true; }
-
template <typename T>
class QTypeInfo
{
@@ -161,6 +158,10 @@ public: \
template<> \
Q_DECLARE_TYPEINFO_BODY(TYPE, FLAGS)
+/* Specialize QTypeInfo for QFlags<T> */
+template<typename T> class QFlags;
+template<typename T>
+Q_DECLARE_TYPEINFO_BODY(QFlags<T>, Q_PRIMITIVE_TYPE);
/*
Specialize a shared type with:
@@ -184,7 +185,6 @@ QT_BEGIN_NAMESPACE
#endif
#define Q_DECLARE_SHARED(TYPE) \
-template <> inline bool qIsDetached<TYPE>(TYPE &t) { return t.isDetached(); } \
template <> inline void qSwap<TYPE>(TYPE &value1, TYPE &value2) \
{ qSwap(value1.data_ptr(), value2.data_ptr()); } \
Q_DECLARE_SHARED_STL(TYPE)
diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp
index 5e466e480d..e8ff6107ce 100644
--- a/src/corelib/io/qfilesystemengine_unix.cpp
+++ b/src/corelib/io/qfilesystemengine_unix.cpp
@@ -476,12 +476,12 @@ bool QFileSystemEngine::createDirectory(const QFileSystemEntry &entry, bool crea
slash = dirName.length();
}
if (slash) {
- QByteArray chunk = QFile::encodeName(dirName.left(slash));
+ const QByteArray chunk = QFile::encodeName(dirName.left(slash));
QT_STATBUF st;
- if (QT_STAT(chunk, &st) != -1) {
+ if (QT_STAT(chunk.constData(), &st) != -1) {
if ((st.st_mode & S_IFMT) != S_IFDIR)
return false;
- } else if (QT_MKDIR(chunk, 0777) != 0) {
+ } else if (QT_MKDIR(chunk.constData(), 0777) != 0) {
return false;
}
}
@@ -492,7 +492,7 @@ bool QFileSystemEngine::createDirectory(const QFileSystemEntry &entry, bool crea
if (dirName.endsWith(QLatin1Char('/')))
dirName.chop(1);
#endif
- return (QT_MKDIR(QFile::encodeName(dirName), 0777) == 0);
+ return (QT_MKDIR(QFile::encodeName(dirName).constData(), 0777) == 0);
}
//static
@@ -501,12 +501,12 @@ bool QFileSystemEngine::removeDirectory(const QFileSystemEntry &entry, bool remo
if (removeEmptyParents) {
QString dirName = QDir::cleanPath(entry.filePath());
for (int oldslash = 0, slash=dirName.length(); slash > 0; oldslash = slash) {
- QByteArray chunk = QFile::encodeName(dirName.left(slash));
+ const QByteArray chunk = QFile::encodeName(dirName.left(slash));
QT_STATBUF st;
- if (QT_STAT(chunk, &st) != -1) {
+ if (QT_STAT(chunk.constData(), &st) != -1) {
if ((st.st_mode & S_IFMT) != S_IFDIR)
return false;
- if (::rmdir(chunk) != 0)
+ if (::rmdir(chunk.constData()) != 0)
return oldslash != 0;
} else {
return false;
@@ -515,7 +515,7 @@ bool QFileSystemEngine::removeDirectory(const QFileSystemEntry &entry, bool remo
}
return true;
}
- return rmdir(QFile::encodeName(entry.filePath())) == 0;
+ return rmdir(QFile::encodeName(entry.filePath()).constData()) == 0;
}
//static
@@ -623,7 +623,7 @@ QString QFileSystemEngine::tempPath()
bool QFileSystemEngine::setCurrentPath(const QFileSystemEntry &path)
{
int r;
- r = QT_CHDIR(path.nativeFilePath());
+ r = QT_CHDIR(path.nativeFilePath().constData());
return r >= 0;
}
diff --git a/src/corelib/io/qfilesystemwatcher_polling_p.h b/src/corelib/io/qfilesystemwatcher_polling_p.h
index 14f6345412..e50082c6d3 100644
--- a/src/corelib/io/qfilesystemwatcher_polling_p.h
+++ b/src/corelib/io/qfilesystemwatcher_polling_p.h
@@ -58,6 +58,7 @@
#include <QtCore/qdatetime.h>
#include <QtCore/qdir.h>
#include <QtCore/qtimer.h>
+#include <QtCore/qhash.h>
#include "qfilesystemwatcher_p.h"
diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp
index e4d90e000a..1ec0390235 100644
--- a/src/corelib/io/qsettings.cpp
+++ b/src/corelib/io/qsettings.cpp
@@ -1752,10 +1752,10 @@ bool QConfFileSettingsPrivate::readIniFile(const QByteArray &data,
iniSection = iniSection.trimmed();
- if (qstricmp(iniSection, "general") == 0) {
+ if (qstricmp(iniSection.constData(), "general") == 0) {
currentSection.clear();
} else {
- if (qstricmp(iniSection, "%general") == 0) {
+ if (qstricmp(iniSection.constData(), "%general") == 0) {
currentSection = QLatin1String(iniSection.constData() + 1);
} else {
currentSection.clear();
@@ -1912,7 +1912,7 @@ bool QConfFileSettingsPrivate::writeIniFile(QIODevice &device, const ParsedSetti
if (realSection.isEmpty()) {
realSection = "[General]";
- } else if (qstricmp(realSection, "general") == 0) {
+ } else if (qstricmp(realSection.constData(), "general") == 0) {
realSection = "[%General]";
} else {
realSection.prepend('[');
diff --git a/src/corelib/io/qstandardpaths_unix.cpp b/src/corelib/io/qstandardpaths_unix.cpp
index 62c846738e..5499751751 100644
--- a/src/corelib/io/qstandardpaths_unix.cpp
+++ b/src/corelib/io/qstandardpaths_unix.cpp
@@ -42,6 +42,7 @@
#include "qstandardpaths.h"
#include <qdir.h>
#include <qfile.h>
+#include <qhash.h>
#include <qtextstream.h>
#include <qcoreapplication.h>
#include <private/qfilesystemengine_p.h>
diff --git a/src/corelib/json/qjsonarray.cpp b/src/corelib/json/qjsonarray.cpp
index cdf9192b27..433a68105d 100644
--- a/src/corelib/json/qjsonarray.cpp
+++ b/src/corelib/json/qjsonarray.cpp
@@ -44,6 +44,7 @@
#include <qjsonarray.h>
#include <qjsonvalue.h>
#include <qstringlist.h>
+#include <qvariant.h>
#include <qdebug.h>
#include "qjsonwriter_p.h"
diff --git a/src/corelib/json/qjsondocument.cpp b/src/corelib/json/qjsondocument.cpp
index 8a7fa760ae..c2204bf696 100644
--- a/src/corelib/json/qjsondocument.cpp
+++ b/src/corelib/json/qjsondocument.cpp
@@ -44,6 +44,7 @@
#include <qjsonvalue.h>
#include <qjsonarray.h>
#include <qstringlist.h>
+#include <qvariant.h>
#include <qdebug.h>
#include "qjsonwriter_p.h"
#include "qjsonparser_p.h"
diff --git a/src/corelib/json/qjsonobject.cpp b/src/corelib/json/qjsonobject.cpp
index a854f73c7e..cfe71e8959 100644
--- a/src/corelib/json/qjsonobject.cpp
+++ b/src/corelib/json/qjsonobject.cpp
@@ -44,6 +44,7 @@
#include <qjsonarray.h>
#include <qstringlist.h>
#include <qdebug.h>
+#include <qvariant.h>
#include "qjson_p.h"
#include "qjsonwriter_p.h"
diff --git a/src/corelib/kernel/qcoreevent.h b/src/corelib/kernel/qcoreevent.h
index 1f36f9c9c8..cac89f2b13 100644
--- a/src/corelib/kernel/qcoreevent.h
+++ b/src/corelib/kernel/qcoreevent.h
@@ -288,7 +288,7 @@ public:
MaxUser = 65535 // last user event id
};
- QEvent(Type type);
+ explicit QEvent(Type type);
virtual ~QEvent();
inline Type type() const { return static_cast<Type>(t); }
inline bool spontaneous() const { return spont; }
@@ -330,7 +330,7 @@ private:
class Q_CORE_EXPORT QTimerEvent : public QEvent
{
public:
- QTimerEvent( int timerId );
+ explicit QTimerEvent( int timerId );
~QTimerEvent();
int timerId() const { return id; }
protected:
@@ -355,7 +355,7 @@ protected:
class Q_CORE_EXPORT QDynamicPropertyChangeEvent : public QEvent
{
public:
- QDynamicPropertyChangeEvent(const QByteArray &name);
+ explicit QDynamicPropertyChangeEvent(const QByteArray &name);
~QDynamicPropertyChangeEvent();
inline QByteArray propertyName() const { return n; }
diff --git a/src/corelib/kernel/qeventdispatcher_win_p.h b/src/corelib/kernel/qeventdispatcher_win_p.h
index c404967e6a..565f1ef4b3 100644
--- a/src/corelib/kernel/qeventdispatcher_win_p.h
+++ b/src/corelib/kernel/qeventdispatcher_win_p.h
@@ -55,6 +55,7 @@
#include "QtCore/qabstracteventdispatcher.h"
#include "QtCore/qt_windows.h"
+#include "QtCore/qhash.h"
#include "qabstracteventdispatcher_p.h"
@@ -130,7 +131,7 @@ struct WinTimerInfo { // internal timer info
class QZeroTimerEvent : public QTimerEvent
{
public:
- inline QZeroTimerEvent(int timerId)
+ explicit inline QZeroTimerEvent(int timerId)
: QTimerEvent(timerId)
{ t = QEvent::ZeroTimerEvent; }
};
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h
index beb7294abd..f969875455 100644
--- a/src/corelib/kernel/qmetatype.h
+++ b/src/corelib/kernel/qmetatype.h
@@ -565,6 +565,7 @@ template <class T> class QSet;
template <class T> class QSharedPointer;
template <class T1, class T2> class QMap;
template <class T1, class T2> class QHash;
+template <class T1, class T2> struct QPair;
typedef QList<QVariant> QVariantList;
typedef QMap<QString, QVariant> QVariantMap;
typedef QHash<QString, QVariant> QVariantHash;
@@ -586,6 +587,23 @@ struct QMetaTypeId< SINGLE_ARG_TEMPLATE<T> > \
} \
};
+#define Q_DECLARE_METATYPE_TEMPLATE_2ARG(DOUBLE_ARG_TEMPLATE) \
+template<typename T, typename U> \
+struct QMetaTypeId< DOUBLE_ARG_TEMPLATE<T, U> > \
+{ \
+ enum { \
+ Defined = QMetaTypeId2<T>::Defined && QMetaTypeId2<U>::Defined \
+ }; \
+ static int qt_metatype_id() \
+ { \
+ static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); \
+ if (!metatype_id.load()) \
+ metatype_id.storeRelease(qRegisterMetaType< DOUBLE_ARG_TEMPLATE<T, U> >( QByteArray(QByteArray(#DOUBLE_ARG_TEMPLATE "<") + QMetaType::typeName(qMetaTypeId<T>()) + ", " + QMetaType::typeName(qMetaTypeId<U>()) + ">").constData(), \
+ reinterpret_cast< DOUBLE_ARG_TEMPLATE<T, U> *>(quintptr(-1)))); \
+ return metatype_id.loadAcquire(); \
+ } \
+};
+
Q_DECLARE_METATYPE_TEMPLATE_1ARG(QList)
Q_DECLARE_METATYPE_TEMPLATE_1ARG(QVector)
Q_DECLARE_METATYPE_TEMPLATE_1ARG(QQueue)
@@ -594,6 +612,10 @@ Q_DECLARE_METATYPE_TEMPLATE_1ARG(QSet)
Q_DECLARE_METATYPE_TEMPLATE_1ARG(QSharedPointer)
Q_DECLARE_METATYPE_TEMPLATE_1ARG(QLinkedList)
+Q_DECLARE_METATYPE_TEMPLATE_2ARG(QHash)
+Q_DECLARE_METATYPE_TEMPLATE_2ARG(QMap)
+Q_DECLARE_METATYPE_TEMPLATE_2ARG(QPair)
+
inline QMetaType::QMetaType(const ExtensionFlag extensionFlags, const QMetaTypeInterface *info,
Creator creator,
Deleter deleter,
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 530ddb3f13..19440e9368 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -69,6 +69,16 @@
QT_BEGIN_NAMESPACE
+struct QObjectPrivate::ExtraData
+{
+ ExtraData() {}
+#ifndef QT_NO_USERDATA
+ QVector<QObjectUserData *> userData;
+#endif
+ QList<QByteArray> propertyNames;
+ QList<QVariant> propertyValues;
+};
+
static int DIRECT_CONNECTION_ONLY = 0;
static int *queuedConnectionTypes(const QList<QByteArray> &typeNames)
diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h
index 710aa630d9..c8edadce9d 100644
--- a/src/corelib/kernel/qobject_p.h
+++ b/src/corelib/kernel/qobject_p.h
@@ -60,7 +60,6 @@
#include "QtCore/qlist.h"
#include "QtCore/qvector.h"
#include "QtCore/qreadwritelock.h"
-#include "QtCore/qvariant.h"
QT_BEGIN_NAMESPACE
@@ -98,16 +97,8 @@ class Q_CORE_EXPORT QObjectPrivate : public QObjectData
{
Q_DECLARE_PUBLIC(QObject)
+ struct ExtraData;
public:
- struct ExtraData
- {
- ExtraData() {}
-#ifndef QT_NO_USERDATA
- QVector<QObjectUserData *> userData;
-#endif
- QList<QByteArray> propertyNames;
- QList<QVariant> propertyValues;
- };
typedef void (*StaticMetaCallFunction)(QObject *, QMetaObject::Call, int, void **);
struct Connection
diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h
index 15daf223b9..4b3829b53e 100644
--- a/src/corelib/kernel/qobjectdefs.h
+++ b/src/corelib/kernel/qobjectdefs.h
@@ -210,16 +210,16 @@ Q_CORE_EXPORT const char *qFlagLocation(const char *method);
#ifndef QT_NO_DEBUG
# define QLOCATION "\0" __FILE__ ":" QTOSTRING(__LINE__)
# ifndef QT_NO_KEYWORDS
-# define METHOD(a) qFlagLocation("0"#a QLOCATION)
+# define METHOD(a) qFlagLocation("0" QTOSTRING(a) QLOCATION)
# endif
-# define SLOT(a) qFlagLocation("1"#a QLOCATION)
-# define SIGNAL(a) qFlagLocation("2"#a QLOCATION)
+# define SLOT(a) qFlagLocation("1" QTOSTRING(a) QLOCATION)
+# define SIGNAL(a) qFlagLocation("2" QTOSTRING(a) QLOCATION)
#else
# ifndef QT_NO_KEYWORDS
-# define METHOD(a) "0"#a
+# define METHOD(a) "0" QTOSTRING(a)
# endif
-# define SLOT(a) "1"#a
-# define SIGNAL(a) "2"#a
+# define SLOT(a) "1" QTOSTRING(a)
+# define SIGNAL(a) "2" QTOSTRING(a)
#endif
#define QMETHOD_CODE 0 // member type codes
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index 4f3e4f8b4e..029a261faf 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -1696,7 +1696,7 @@ void QVariant::load(QDataStream &s)
if (typeId == QVariant::UserType) {
QByteArray name;
s >> name;
- typeId = QMetaType::type(name);
+ typeId = QMetaType::type(name.constData());
if (!typeId) {
s.setStatus(QDataStream::ReadCorruptData);
return;
diff --git a/src/corelib/thread/qbasicatomic.h b/src/corelib/thread/qbasicatomic.h
index 96338c62dc..01a69dbd8b 100644
--- a/src/corelib/thread/qbasicatomic.h
+++ b/src/corelib/thread/qbasicatomic.h
@@ -136,7 +136,7 @@ public:
// Atomic API, implemented in qatomic_XXX.h
- T loadAcquire() { return Ops::loadAcquire(_q_value); }
+ T loadAcquire() const { return Ops::loadAcquire(_q_value); }
void storeRelease(T newValue) { Ops::storeRelease(_q_value, newValue); }
static bool isReferenceCountingNative() { return Ops::isReferenceCountingNative(); }
@@ -206,7 +206,7 @@ public:
void store(Type newValue) { _q_value = newValue; }
// Atomic API, implemented in qatomic_XXX.h
- Type loadAcquire() { return Ops::loadAcquire(_q_value); }
+ Type loadAcquire() const { return Ops::loadAcquire(_q_value); }
void storeRelease(Type newValue) { Ops::storeRelease(_q_value, newValue); }
static bool isTestAndSetNative() { return Ops::isTestAndSetNative(); }
diff --git a/src/corelib/thread/qgenericatomic.h b/src/corelib/thread/qgenericatomic.h
index f4d5e2f8d9..34c040c39b 100644
--- a/src/corelib/thread/qgenericatomic.h
+++ b/src/corelib/thread/qgenericatomic.h
@@ -85,7 +85,7 @@ template <typename BaseClass> struct QGenericAtomicOps
static void orderedMemoryFence() { }
template <typename T> static inline always_inline
- T load(T &_q_value)
+ T load(const T &_q_value)
{
return _q_value;
}
@@ -97,9 +97,9 @@ template <typename BaseClass> struct QGenericAtomicOps
}
template <typename T> static inline always_inline
- T loadAcquire(T &_q_value)
+ T loadAcquire(const T &_q_value)
{
- T tmp = *static_cast<volatile T *>(&_q_value);
+ T tmp = *static_cast<const volatile T *>(&_q_value);
BaseClass::acquireMemoryFence();
return tmp;
}
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp
index 445fe5cd81..b6719c9536 100644
--- a/src/corelib/tools/qbytearray.cpp
+++ b/src/corelib/tools/qbytearray.cpp
@@ -343,7 +343,7 @@ int qstrcmp(const QByteArray &str1, const QByteArray &str2)
{
int l1 = str1.length();
int l2 = str2.length();
- int ret = memcmp(str1, str2, qMin(l1, l2));
+ int ret = memcmp(str1.constData(), str2.constData(), qMin(l1, l2));
if (ret != 0)
return ret;
@@ -995,6 +995,8 @@ QByteArray &QByteArray::operator=(const char *str)
/*! \fn QByteArray::operator const char *() const
\fn QByteArray::operator const void *() const
+ \obsolete Use constData() instead.
+
Returns a pointer to the data stored in the byte array. The
pointer can be used to access the bytes that compose the array.
The data is '\\0'-terminated. The pointer remains valid as long
@@ -2751,7 +2753,7 @@ QDataStream &operator<<(QDataStream &out, const QByteArray &ba)
out << (quint32)0xffffffff;
return out;
}
- return out.writeBytes(ba, ba.size());
+ return out.writeBytes(ba.constData(), ba.size());
}
/*! \relates QByteArray
diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h
index 8202097da5..09c43988fd 100644
--- a/src/corelib/tools/qbytearray.h
+++ b/src/corelib/tools/qbytearray.h
@@ -207,8 +207,10 @@ public:
void squeeze();
#ifndef QT_NO_CAST_FROM_BYTEARRAY
- operator const char *() const;
- operator const void *() const;
+#if QT_DEPRECATED_SINCE(5, 0)
+ QT_DEPRECATED operator const char *() const { return constData(); }
+ QT_DEPRECATED operator const void *() const { return constData(); }
+#endif
#endif
char *data();
const char *data() const;
@@ -415,12 +417,6 @@ inline char QByteArray::operator[](uint i) const
inline bool QByteArray::isEmpty() const
{ return d->size == 0; }
-#ifndef QT_NO_CAST_FROM_BYTEARRAY
-inline QByteArray::operator const char *() const
-{ return d->data(); }
-inline QByteArray::operator const void *() const
-{ return d->data(); }
-#endif
inline char *QByteArray::data()
{ detach(); return d->data(); }
inline const char *QByteArray::data() const
diff --git a/src/corelib/tools/qcryptographichash.h b/src/corelib/tools/qcryptographichash.h
index 2bfc03373a..6ebe389faf 100644
--- a/src/corelib/tools/qcryptographichash.h
+++ b/src/corelib/tools/qcryptographichash.h
@@ -65,7 +65,7 @@ public:
Sha512
};
- QCryptographicHash(Algorithm method);
+ explicit QCryptographicHash(Algorithm method);
~QCryptographicHash();
void reset();
diff --git a/src/corelib/tools/qlocale.h b/src/corelib/tools/qlocale.h
index c029f627b2..2ecd934100 100644
--- a/src/corelib/tools/qlocale.h
+++ b/src/corelib/tools/qlocale.h
@@ -42,7 +42,6 @@
#ifndef QLOCALE_H
#define QLOCALE_H
-#include <QtCore/qvariant.h>
#include <QtCore/qstring.h>
#include <QtCore/qobjectdefs.h>
diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h
index c6902ca206..ad7c9706c4 100644
--- a/src/corelib/tools/qlocale_p.h
+++ b/src/corelib/tools/qlocale_p.h
@@ -55,7 +55,7 @@
#include "QtCore/qstring.h"
#include "QtCore/qvarlengtharray.h"
-#include "QtCore/qmetatype.h"
+#include "QtCore/qvariant.h"
#include "qlocale.h"
diff --git a/src/corelib/tools/qlocale_unix.cpp b/src/corelib/tools/qlocale_unix.cpp
index 6ace96f771..f2876912b4 100644
--- a/src/corelib/tools/qlocale_unix.cpp
+++ b/src/corelib/tools/qlocale_unix.cpp
@@ -98,7 +98,7 @@ QLocale QSystemLocale::fallbackLocale() const
lang = qgetenv("LC_NUMERIC");
if (lang.isEmpty())
lang = qgetenv("LANG");
- return QLocale(QLatin1String(lang));
+ return QLocale(QString::fromLatin1(lang));
}
QVariant QSystemLocale::query(QueryType type, QVariant in) const
diff --git a/src/corelib/tools/qpair.h b/src/corelib/tools/qpair.h
index 5df33a4e9d..4dc28f2d26 100644
--- a/src/corelib/tools/qpair.h
+++ b/src/corelib/tools/qpair.h
@@ -63,6 +63,22 @@ struct QPair
T2 second;
};
+// mark QPair<T1,T2> as complex/movable/primitive depending on the
+// typeinfos of the constituents:
+template<class T1, class T2>
+class QTypeInfo< QPair<T1, T2> >
+{
+public:
+ enum {
+ isComplex = QTypeInfo<T1>::isComplex || QTypeInfo<T2>::isComplex,
+ isStatic = QTypeInfo<T1>::isStatic || QTypeInfo<T2>::isStatic,
+ isLarge = sizeof(QPair<T1, T2>) > sizeof(void*),
+ isPointer = false,
+ isDummy = false,
+ sizeOf = sizeof(QPair<T1, T2>)
+ };
+};
+
template <class T1, class T2>
Q_INLINE_TEMPLATE bool operator==(const QPair<T1, T2> &p1, const QPair<T1, T2> &p2)
{ return p1.first == p2.first && p1.second == p2.second; }
diff --git a/src/corelib/tools/qscopedvaluerollback.h b/src/corelib/tools/qscopedvaluerollback.h
index 23d2d9eda0..d53cabd315 100644
--- a/src/corelib/tools/qscopedvaluerollback.h
+++ b/src/corelib/tools/qscopedvaluerollback.h
@@ -51,7 +51,7 @@ template <typename T>
class QScopedValueRollback
{
public:
- QScopedValueRollback(T &var) :
+ explicit QScopedValueRollback(T &var) :
varRef(var)
{
oldValue = varRef;
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 45ccfb8aea..083abcbaad 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -2132,7 +2132,8 @@ QString &QString::replace(QChar c, const QLatin1String &after, Qt::CaseSensitivi
/*!
- Returns true if string \a other is equal to this string; otherwise
+ \relates QString
+ Returns true if string \a s1 is equal to string \a s2; otherwise
returns false.
The comparison is based exclusively on the numeric Unicode values of
@@ -2140,12 +2141,12 @@ QString &QString::replace(QChar c, const QLatin1String &after, Qt::CaseSensitivi
expect. Consider sorting user-interface strings with
localeAwareCompare().
*/
-bool QString::operator==(const QString &other) const
+bool operator==(const QString &s1, const QString &s2)
{
- if (d->size != other.d->size)
+ if (s1.d->size != s2.d->size)
return false;
- return qMemEquals(d->data(), other.d->data(), d->size);
+ return qMemEquals(s1.d->data(), s2.d->data(), s1.d->size);
}
/*!
@@ -2200,17 +2201,18 @@ bool QString::operator==(const QLatin1String &other) const
*/
/*!
- Returns true if this string is lexically less than string \a
- other; otherwise returns false.
+ \relates QString
+ Returns true if string \a s1 is lexically less than string
+ \a s2; otherwise returns false.
The comparison is based exclusively on the numeric Unicode values
of the characters and is very fast, but is not what a human would
expect. Consider sorting user-interface strings using the
QString::localeAwareCompare() function.
*/
-bool QString::operator<(const QString &other) const
+bool operator<(const QString &s1, const QString &s2)
{
- return ucstrcmp(constData(), length(), other.constData(), other.length()) < 0;
+ return ucstrcmp(s1.constData(), s1.length(), s2.constData(), s2.length()) < 0;
}
/*!
@@ -2261,10 +2263,11 @@ bool QString::operator<(const QLatin1String &other) const
go through QObject::tr(), for example.
*/
-/*! \fn bool QString::operator<=(const QString &other) const
+/*! \fn bool operator<=(const QString &s1, const QString &s2)
+ \relates QString
- Returns true if this string is lexically less than or equal to
- string \a other; otherwise returns false.
+ Returns true if string \a s1 is lexically less than or equal to
+ string \a s2; otherwise returns false.
The comparison is based exclusively on the numeric Unicode values
of the characters and is very fast, but is not what a human would
@@ -2304,10 +2307,11 @@ bool QString::operator<(const QLatin1String &other) const
go through QObject::tr(), for example.
*/
-/*! \fn bool QString::operator>(const QString &other) const
+/*! \fn bool operator>(const QString &s1, const QString &s2)
+ \relates QString
- Returns true if this string is lexically greater than string \a
- other; otherwise returns false.
+ Returns true if string \a s1 is lexically greater than string \a
+ s2; otherwise returns false.
The comparison is based exclusively on the numeric Unicode values
of the characters and is very fast, but is not what a human would
@@ -2363,10 +2367,11 @@ bool QString::operator>(const QLatin1String &other) const
for example.
*/
-/*! \fn bool QString::operator>=(const QString &other) const
+/*! \fn bool operator>=(const QString &s1, const QString &s2)
+ \relates QString
- Returns true if this string is lexically greater than or equal to
- string \a other; otherwise returns false.
+ Returns true if string \a s1 is lexically greater than or equal to
+ string \a s2; otherwise returns false.
The comparison is based exclusively on the numeric Unicode values
of the characters and is very fast, but is not what a human would
@@ -2406,9 +2411,10 @@ bool QString::operator>(const QLatin1String &other) const
for example.
*/
-/*! \fn bool QString::operator!=(const QString &other) const
+/*! \fn bool operator!=(const QString &s1, const QString &s2)
+ \relates QString
- Returns true if this string is not equal to string \a other;
+ Returns true if string \a s1 is not equal to string \a s2;
otherwise returns false.
The comparison is based exclusively on the numeric Unicode values
@@ -4727,7 +4733,7 @@ int QString::localeAwareCompare_helper(const QChar *data1, int length1,
} // else fall through
# endif
// declared in <string.h>
- int delta = strcoll(toLocal8Bit_helper(data1, length1), toLocal8Bit_helper(data2, length2));
+ int delta = strcoll(toLocal8Bit_helper(data1, length1).constData(), toLocal8Bit_helper(data2, length2).constData());
if (delta == 0)
delta = ucstrcmp(data1, length1, data2, length2);
return delta;
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h
index b1ade85a30..6fc86fc04b 100644
--- a/src/corelib/tools/qstring.h
+++ b/src/corelib/tools/qstring.h
@@ -417,6 +417,10 @@ public:
{
return fromLocal8Bit_helper(str, (str && size == -1) ? int(strlen(str)) : size);
}
+ static inline QString fromAscii(const QByteArray &str) { return fromAscii(str.data(), str.size()); }
+ static inline QString fromLatin1(const QByteArray &str) { return fromLatin1(str.data(), str.size()); }
+ static inline QString fromUtf8(const QByteArray &str) { return fromUtf8(str.data(), str.size()); }
+ static inline QString fromLocal8Bit(const QByteArray &str) { return fromLocal8Bit(str.data(), str.size()); }
static QString fromUtf16(const ushort *, int size = -1);
static QString fromUcs4(const uint *, int size = -1);
static QString fromRawData(const QChar *, int size);
@@ -482,12 +486,12 @@ public:
static QString number(qulonglong, int base=10);
static QString number(double, char f='g', int prec=6);
- bool operator==(const QString &s) const;
- bool operator<(const QString &s) const;
- inline bool operator>(const QString &s) const { return s < *this; }
- inline bool operator!=(const QString &s) const { return !operator==(s); }
- inline bool operator<=(const QString &s) const { return !operator>(s); }
- inline bool operator>=(const QString &s) const { return !operator<(s); }
+ friend Q_CORE_EXPORT bool operator==(const QString &s1, const QString &s2);
+ friend Q_CORE_EXPORT bool operator<(const QString &s1, const QString &s2);
+ friend inline bool operator>(const QString &s1, const QString &s2) { return s2 < s1; }
+ friend inline bool operator!=(const QString &s1, const QString &s2) { return !(s1 == s2); }
+ friend inline bool operator<=(const QString &s1, const QString &s2) { return !(s1 > s2); }
+ friend inline bool operator>=(const QString &s1, const QString &s2) { return !(s1 < s2); }
bool operator==(const QLatin1String &s) const;
bool operator<(const QLatin1String &s) const;
diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h
index 4c963185ad..e34425be7e 100644
--- a/src/corelib/tools/qstringbuilder.h
+++ b/src/corelib/tools/qstringbuilder.h
@@ -45,12 +45,6 @@
#include <QtCore/qstring.h>
#include <QtCore/qbytearray.h>
-#if defined(Q_CC_GNU) && !defined(Q_CC_INTEL)
-# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ == 0)
-# include <QtCore/qmap.h>
-# endif
-#endif
-
#include <string.h>
QT_BEGIN_HEADER
@@ -173,6 +167,16 @@ template <> struct QConcatenable<QChar> : private QAbstractConcatenable
{ *out++ = c; }
};
+template <> struct QConcatenable<QChar::SpecialCharacter> : private QAbstractConcatenable
+{
+ typedef QChar::SpecialCharacter type;
+ typedef QString ConvertTo;
+ enum { ExactSize = true };
+ static int size(const QChar::SpecialCharacter) { return 1; }
+ static inline void appendTo(const QChar::SpecialCharacter c, QChar *&out)
+ { *out++ = c; }
+};
+
template <> struct QConcatenable<QCharRef> : private QAbstractConcatenable
{
typedef QCharRef type;
diff --git a/src/corelib/tools/qstringmatcher.h b/src/corelib/tools/qstringmatcher.h
index a9b2a7c371..3f614f732c 100644
--- a/src/corelib/tools/qstringmatcher.h
+++ b/src/corelib/tools/qstringmatcher.h
@@ -55,7 +55,7 @@ class Q_CORE_EXPORT QStringMatcher
{
public:
QStringMatcher();
- QStringMatcher(const QString &pattern,
+ explicit QStringMatcher(const QString &pattern,
Qt::CaseSensitivity cs = Qt::CaseSensitive);
QStringMatcher(const QChar *uc, int len,
Qt::CaseSensitivity cs = Qt::CaseSensitive);
diff --git a/src/corelib/xml/qxmlstream.h b/src/corelib/xml/qxmlstream.h
index 3a9ddfd990..90382c7fe5 100644
--- a/src/corelib/xml/qxmlstream.h
+++ b/src/corelib/xml/qxmlstream.h
@@ -248,10 +248,10 @@ public:
QXmlStreamReader();
- QXmlStreamReader(QIODevice *device);
- QXmlStreamReader(const QByteArray &data);
- QXmlStreamReader(const QString &data);
- QXmlStreamReader(const char * data);
+ explicit QXmlStreamReader(QIODevice *device);
+ explicit QXmlStreamReader(const QByteArray &data);
+ explicit QXmlStreamReader(const QString &data);
+ explicit QXmlStreamReader(const char * data);
~QXmlStreamReader();
void setDevice(QIODevice *device);
@@ -361,9 +361,9 @@ class Q_CORE_EXPORT QXmlStreamWriter
QDOC_PROPERTY(int autoFormattingIndent READ autoFormattingIndent WRITE setAutoFormattingIndent)
public:
QXmlStreamWriter();
- QXmlStreamWriter(QIODevice *device);
- QXmlStreamWriter(QByteArray *array);
- QXmlStreamWriter(QString *string);
+ explicit QXmlStreamWriter(QIODevice *device);
+ explicit QXmlStreamWriter(QByteArray *array);
+ explicit QXmlStreamWriter(QString *string);
~QXmlStreamWriter();
void setDevice(QIODevice *device);