diff options
Diffstat (limited to 'src/corelib')
43 files changed, 179 insertions, 250 deletions
diff --git a/src/corelib/codecs/qiconvcodec.cpp b/src/corelib/codecs/qiconvcodec.cpp index e4fb359f2c..d6362b6fbc 100644 --- a/src/corelib/codecs/qiconvcodec.cpp +++ b/src/corelib/codecs/qiconvcodec.cpp @@ -43,7 +43,6 @@ QT_REQUIRE_CONFIG(iconv); #include "qiconvcodec_p.h" #include "qtextcodec_p.h" -#include <qlibrary.h> #include <qdebug.h> #include <qthreadstorage.h> diff --git a/src/corelib/configure.json b/src/corelib/configure.json index 4fbc51a09c..c6c5c93ddb 100644 --- a/src/corelib/configure.json +++ b/src/corelib/configure.json @@ -56,6 +56,9 @@ }, { "libs": "-licuin -licuuc -licudt", "condition": "config.win32 && features.shared" }, { "libs": "-licui18n -licuuc -licudata", "condition": "!config.win32" } + ], + "use": [ + { "lib": "libdl", "condition": "features.dlopen" } ] }, "journald": { @@ -74,10 +77,10 @@ ] }, "libdl": { - "label": "dlopen() in libdl", - "export": "", + "label": "dlopen()", "test": "unix/dlopen", "sources": [ + "", "-ldl" ] }, @@ -131,11 +134,6 @@ "type": "compile", "test": "unix/cloexec" }, - "dlopen": { - "label": "dlopen() in libc", - "type": "compile", - "test": "unix/dlopen" - }, "eventfd": { "label": "eventfd", "type": "compile", @@ -211,12 +209,8 @@ }, "dlopen": { "label": "dlopen()", - "condition": "tests.dlopen || libs.libdl" - }, - "libdl": { - "label": "dlopen() in libdl", - "condition": "!tests.dlopen && libs.libdl", - "output": [ { "type": "privateConfig", "negative": true } ] + "condition": "config.unix && libs.libdl", + "output": [ "privateFeature" ] }, "doubleconversion": { "label": "DoubleConversion", diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h index 1c806e0774..bda8ad7916 100644 --- a/src/corelib/global/qconfig-bootstrapped.h +++ b/src/corelib/global/qconfig-bootstrapped.h @@ -71,9 +71,9 @@ #define QT_FEATURE_iconv -1 #define QT_FEATURE_icu -1 #define QT_FEATURE_journald -1 -#define QT_NO_LIBRARY #define QT_FEATURE_library -1 #define QT_NO_QOBJECT +#define QT_FEATURE_process -1 #define QT_NO_SYSTEMLOCALE #define QT_FEATURE_slog2 -1 #define QT_FEATURE_syslog -1 diff --git a/src/corelib/io/forkfd_qt.cpp b/src/corelib/io/forkfd_qt.cpp index 141efeb08c..dce0ebb4da 100644 --- a/src/corelib/io/forkfd_qt.cpp +++ b/src/corelib/io/forkfd_qt.cpp @@ -39,7 +39,6 @@ // these might be defined via precompiled headers #include <QtCore/qatomic.h> -#include "qprocess_p.h" #define FORKFD_NO_SPAWNFD diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri index 78416cdf5e..b0cac59f42 100644 --- a/src/corelib/io/io.pri +++ b/src/corelib/io/io.pri @@ -22,8 +22,6 @@ HEADERS += \ io/qlockfile.h \ io/qlockfile_p.h \ io/qnoncontiguousbytedevice_p.h \ - io/qprocess.h \ - io/qprocess_p.h \ io/qtextstream.h \ io/qtextstream_p.h \ io/qtemporarydir.h \ @@ -72,7 +70,6 @@ SOURCES += \ io/qiodevice.cpp \ io/qlockfile.cpp \ io/qnoncontiguousbytedevice.cpp \ - io/qprocess.cpp \ io/qstorageinfo.cpp \ io/qtextstream.cpp \ io/qtemporarydir.cpp \ @@ -96,6 +93,19 @@ SOURCES += \ io/qloggingcategory.cpp \ io/qloggingregistry.cpp +qtConfig(processenvironment) { + SOURCES += \ + io/qprocess.cpp + HEADERS += \ + io/qprocess.h \ + io/qprocess_p.h + + win32:!winrt: \ + SOURCES += io/qprocess_win.cpp + else: unix: \ + SOURCES += io/qprocess_unix.cpp +} + win32 { SOURCES += io/qfsfileengine_win.cpp SOURCES += io/qlockfile_win.cpp @@ -112,7 +122,6 @@ win32 { io/qwinoverlappedionotifier_p.h SOURCES += \ - io/qprocess_win.cpp \ io/qsettings_win.cpp \ io/qstandardpaths_win.cpp \ io/qstorageinfo_win.cpp \ @@ -132,7 +141,6 @@ win32 { io/qfsfileengine_unix.cpp \ io/qfilesystemengine_unix.cpp \ io/qlockfile_unix.cpp \ - io/qprocess_unix.cpp \ io/qfilesystemiterator_unix.cpp !integrity:!uikit { diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp index 90708b0473..b1e218de9c 100644 --- a/src/corelib/io/qfilesystemengine_win.cpp +++ b/src/corelib/io/qfilesystemengine_win.cpp @@ -152,14 +152,15 @@ QT_BEGIN_NAMESPACE Q_CORE_EXPORT int qt_ntfs_permission_lookup = 0; #if defined(Q_OS_WINRT) -// As none of the functions we try to resolve do exist on WinRT -// we use QT_NO_LIBRARY to shorten everything up a little bit. -# ifndef QT_NO_LIBRARY -# define QT_NO_LIBRARY 1 -# endif +// As none of the functions we try to resolve do exist on WinRT we +// avoid library loading on WinRT in general to shorten everything +// up a little bit. +# define QT_FEATURE_fslibs -1 +#else +# define QT_FEATURE_fslibs QT_FEATURE_library #endif // Q_OS_WINRT -#if !defined(QT_NO_LIBRARY) +#if QT_CONFIG(fslibs) QT_BEGIN_INCLUDE_NAMESPACE typedef DWORD (WINAPI *PtrGetNamedSecurityInfoW)(LPWSTR, SE_OBJECT_TYPE, SECURITY_INFORMATION, PSID*, PSID*, PACL*, PACL*, PSECURITY_DESCRIPTOR*); static PtrGetNamedSecurityInfoW ptrGetNamedSecurityInfoW = 0; @@ -267,7 +268,7 @@ static void resolveLibs() ptrGetUserProfileDirectoryW = (PtrGetUserProfileDirectoryW)GetProcAddress(userenvHnd, "GetUserProfileDirectoryW"); } } -#endif // QT_NO_LIBRARY +#endif // QT_CONFIG(fslibs) typedef DWORD (WINAPI *PtrNetShareEnum)(LPWSTR, DWORD, LPBYTE*, DWORD, LPDWORD, LPDWORD, LPDWORD); static PtrNetShareEnum ptrNetShareEnum = 0; @@ -337,7 +338,7 @@ static QString readSymLink(const QFileSystemEntry &link) free(rdb); CloseHandle(handle); -#if !defined(QT_NO_LIBRARY) +#if QT_CONFIG(fslibs) resolveLibs(); QRegExp matchVolName(QLatin1String("^Volume\\{([a-z]|[0-9]|-)+\\}\\\\"), Qt::CaseInsensitive); if (matchVolName.indexIn(result) == 0) { @@ -347,7 +348,7 @@ static QString readSymLink(const QFileSystemEntry &link) if (GetVolumePathNamesForVolumeName(reinterpret_cast<LPCWSTR>(volumeName.utf16()), buffer, MAX_PATH, &len) != 0) result.replace(0,matchVolName.matchedLength(), QString::fromWCharArray(buffer)); } -#endif // !Q_OS_WINRT +#endif // QT_CONFIG(fslibs) } #else Q_UNUSED(link); @@ -357,7 +358,7 @@ static QString readSymLink(const QFileSystemEntry &link) static QString readLink(const QFileSystemEntry &link) { -#if !defined(QT_NO_LIBRARY) +#if QT_CONFIG(fslibs) QString ret; bool neededCoInit = false; @@ -396,7 +397,7 @@ static QString readLink(const QFileSystemEntry &link) #else Q_UNUSED(link); return QString(); -#endif // QT_NO_LIBRARY +#endif // QT_CONFIG(fslibs) } static bool uncShareExists(const QString &server) @@ -629,7 +630,7 @@ QByteArray QFileSystemEngine::id(const QFileSystemEntry &entry) QString QFileSystemEngine::owner(const QFileSystemEntry &entry, QAbstractFileEngine::FileOwner own) { QString name; -#if !defined(QT_NO_LIBRARY) +#if QT_CONFIG(fslibs) extern int qt_ntfs_permission_lookup; if((qt_ntfs_permission_lookup > 0) && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)) { resolveLibs(); @@ -679,7 +680,7 @@ QString QFileSystemEngine::owner(const QFileSystemEntry &entry, QAbstractFileEng bool QFileSystemEngine::fillPermissions(const QFileSystemEntry &entry, QFileSystemMetaData &data, QFileSystemMetaData::MetaDataFlags what) { -#if !defined(QT_NO_LIBRARY) +#if QT_CONFIG(fslibs) if((qt_ntfs_permission_lookup > 0) && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)) { resolveLibs(); if(ptrGetNamedSecurityInfoW && ptrBuildTrusteeWithSidW && ptrGetEffectiveRightsFromAclW) { @@ -1143,7 +1144,7 @@ QString QFileSystemEngine::rootPath() QString QFileSystemEngine::homePath() { QString ret; -#if !defined(QT_NO_LIBRARY) +#if QT_CONFIG(fslibs) resolveLibs(); if (ptrGetUserProfileDirectoryW) { HANDLE hnd = ::GetCurrentProcess(); diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index a7fd50df83..ab651ead79 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -589,7 +589,7 @@ bool QFSFileEnginePrivate::doStat(QFileSystemMetaData::MetaDataFlags flags) cons bool QFSFileEngine::link(const QString &newName) { #if !defined(Q_OS_WINRT) -# if !defined(QT_NO_LIBRARY) +# if QT_CONFIG(library) bool ret = false; QString linkName = newName; @@ -630,10 +630,10 @@ bool QFSFileEngine::link(const QString &newName) CoUninitialize(); return ret; -# else // QT_NO_LIBRARY +# else // QT_CONFIG(library) Q_UNUSED(newName); return false; -# endif // QT_NO_LIBRARY +# endif // QT_CONFIG(library) #else // !Q_OS_WINRT Q_UNUSED(newName); Q_UNIMPLEMENTED(); diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index c27484acbe..c0ec35ff32 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -99,8 +99,6 @@ QT_END_NAMESPACE #include <private/qcore_unix_p.h> #endif -#if QT_CONFIG(processenvironment) - QT_BEGIN_NAMESPACE /*! @@ -430,8 +428,6 @@ void QProcessEnvironment::insert(const QProcessEnvironment &e) d->insert(*e.d); } -#endif // QT_CONFIG(processenvironment) - #if QT_CONFIG(process) void QProcessPrivate::Channel::clear() @@ -2605,9 +2601,8 @@ QString QProcess::nullDevice() \sa QProcess::pid() */ +#endif // QT_CONFIG(process) + QT_END_NAMESPACE #include "moc_qprocess.cpp" - -#endif // QT_NO_PROCESS - diff --git a/src/corelib/io/qprocess.h b/src/corelib/io/qprocess.h index 37e71aef5d..19157bdd02 100644 --- a/src/corelib/io/qprocess.h +++ b/src/corelib/io/qprocess.h @@ -46,12 +46,12 @@ #include <functional> +QT_REQUIRE_CONFIG(processenvironment); + QT_BEGIN_NAMESPACE class QProcessPrivate; -#if QT_CONFIG(processenvironment) - #if !defined(Q_OS_WIN) || defined(Q_CLANG_QDOC) typedef qint64 Q_PID; #else @@ -105,8 +105,6 @@ private: Q_DECLARE_SHARED(QProcessEnvironment) -#endif // QT_CONFIG(processenvironment) - #if QT_CONFIG(process) class Q_CORE_EXPORT QProcess : public QIODevice @@ -302,7 +300,7 @@ private: friend class QProcessManager; }; -#endif // QT_NO_PROCESS +#endif // QT_CONFIG(process) QT_END_NAMESPACE diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h index 92b747f6ba..6e0630eb66 100644 --- a/src/corelib/io/qprocess_p.h +++ b/src/corelib/io/qprocess_p.h @@ -57,6 +57,9 @@ #include "QtCore/qhash.h" #include "QtCore/qshareddata.h" #include "private/qiodevice_p.h" + +QT_REQUIRE_CONFIG(processenvironment); + #ifdef Q_OS_UNIX #include <QtCore/private/qorderedmutexlocker_p.h> #endif @@ -78,8 +81,6 @@ class QWindowsPipeWriter; class QWinEventNotifier; class QTimer; -#if QT_CONFIG(processenvironment) - #ifdef Q_OS_WIN class QProcEnvKey : public QString { @@ -233,8 +234,6 @@ template<> Q_INLINE_TEMPLATE void QSharedDataPointer<QProcessEnvironmentPrivate> d = x; } -#endif // QT_CONFIG(processenvironment) - #if QT_CONFIG(process) class QProcessPrivate : public QIODevicePrivate @@ -390,7 +389,7 @@ public: void setErrorAndEmit(QProcess::ProcessError error, const QString &description = QString()); }; -#endif // QT_NO_PROCESS +#endif // QT_CONFIG(process) QT_END_NAMESPACE diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index deca5c50ff..795229419c 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -119,7 +119,7 @@ QT_END_NAMESPACE QT_BEGIN_NAMESPACE -#if QT_CONFIG(processenvironment) && !defined(Q_OS_DARWIN) +#if !defined(Q_OS_DARWIN) QProcessEnvironment QProcessEnvironment::systemEnvironment() { @@ -138,7 +138,7 @@ QProcessEnvironment QProcessEnvironment::systemEnvironment() return env; } -#endif // QT_CONFIG(processenvironment) && !defined(Q_OS_DARWIN) +#endif // !defined(Q_OS_DARWIN) #if QT_CONFIG(process) @@ -1040,6 +1040,6 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a return success; } -#endif // QT_NO_PROCESS +#endif // QT_CONFIG(process) QT_END_NAMESPACE diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp index aa69e9e1db..329d1842f0 100644 --- a/src/corelib/io/qprocess_win.cpp +++ b/src/corelib/io/qprocess_win.cpp @@ -62,8 +62,6 @@ QT_BEGIN_NAMESPACE -#if QT_CONFIG(processenvironment) - QProcessEnvironment QProcessEnvironment::systemEnvironment() { QProcessEnvironment env; @@ -86,8 +84,6 @@ QProcessEnvironment QProcessEnvironment::systemEnvironment() return env; } -#endif // QT_CONFIG(processenvironment) - #if QT_CONFIG(process) static void qt_create_pipe(Q_PIPE *pipe, bool isInputPipe) @@ -895,6 +891,6 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a return success; } -#endif // QT_NO_PROCESS +#endif // QT_CONFIG(process) QT_END_NAMESPACE diff --git a/src/corelib/io/qwindowspipewriter_p.h b/src/corelib/io/qwindowspipewriter_p.h index 5a0d04855f..c43e986f34 100644 --- a/src/corelib/io/qwindowspipewriter_p.h +++ b/src/corelib/io/qwindowspipewriter_p.h @@ -156,4 +156,4 @@ private: QT_END_NAMESPACE -#endif // QT_NO_PROCESS +#endif // QWINDOWSPIPEWRITER_P_H diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp index 3faa8e1441..0c87dd5659 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.cpp +++ b/src/corelib/itemmodels/qabstractitemmodel.cpp @@ -3071,7 +3071,7 @@ void QAbstractItemModel::endRemoveColumns() When reimplementing a subclass, this method simplifies moving entities in your model. This method is responsible for moving persistent indexes in the model, which you would otherwise be - required to do yourself. Using beginMoveRows and endMoveRows + required to do yourself. Using beginMoveColumns and endMoveColumns is an alternative to emitting layoutAboutToBeChanged and layoutChanged directly along with changePersistentIndex. diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h index 80058d9115..8f37aec6e2 100644 --- a/src/corelib/kernel/qcore_unix_p.h +++ b/src/corelib/kernel/qcore_unix_p.h @@ -300,7 +300,7 @@ static inline int qt_safe_close(int fd) #define QT_CLOSE qt_safe_close // - VxWorks & iOS/tvOS/watchOS don't have processes -#if !defined(Q_OS_VXWORKS) && !defined(QT_NO_PROCESS) +#if QT_CONFIG(process) static inline int qt_safe_execve(const char *filename, char *const argv[], char *const envp[]) { @@ -329,7 +329,7 @@ static inline pid_t qt_safe_waitpid(pid_t pid, int *status, int options) EINTR_LOOP(ret, ::waitpid(pid, status, options)); return ret; } -#endif // Q_OS_VXWORKS +#endif // QT_CONFIG(process) #if !defined(_POSIX_MONOTONIC_CLOCK) # define _POSIX_MONOTONIC_CLOCK -1 diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 0ac49c5019..e4b1562b8b 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -376,7 +376,7 @@ struct QCoreApplicationData { bool applicationNameSet; // true if setApplicationName was called bool applicationVersionSet; // true if setApplicationVersion was called -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) QScopedPointer<QStringList> app_libpaths; QScopedPointer<QStringList> manual_libpaths; #endif @@ -569,7 +569,7 @@ void QCoreApplicationPrivate::checkReceiverThread(QObject *receiver) void QCoreApplicationPrivate::appendApplicationPathToLibraryPaths() { -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) QStringList *app_libpaths = coreappdata()->app_libpaths.data(); if (!app_libpaths) coreappdata()->app_libpaths.reset(app_libpaths = new QStringList); @@ -773,7 +773,7 @@ void QCoreApplicationPrivate::init() QLoggingRegistry::instance()->init(); -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) // Reset the lib paths, so that they will be recomputed, taking the availability of argv[0] // into account. If necessary, recompute right away and replay the manual changes on top of the // new lib paths. @@ -872,7 +872,7 @@ QCoreApplication::~QCoreApplication() QCoreApplicationPrivate::eventDispatcher = 0; #endif -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) coreappdata()->app_libpaths.reset(); coreappdata()->manual_libpaths.reset(); #endif @@ -2479,7 +2479,7 @@ QString QCoreApplication::applicationVersion() return coreappdata() ? coreappdata()->applicationVersion : QString(); } -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) Q_GLOBAL_STATIC_WITH_ARGS(QMutex, libraryPathMutex, (QMutex::Recursive)) @@ -2691,7 +2691,7 @@ void QCoreApplication::removeLibraryPath(const QString &path) QFactoryLoader::refreshAll(); } -#endif //QT_NO_LIBRARY +#endif // QT_CONFIG(library) #ifndef QT_NO_QOBJECT diff --git a/src/corelib/kernel/qcoreapplication.h b/src/corelib/kernel/qcoreapplication.h index a22e1c4f9e..5e10136dc5 100644 --- a/src/corelib/kernel/qcoreapplication.h +++ b/src/corelib/kernel/qcoreapplication.h @@ -141,12 +141,12 @@ public: static QString applicationFilePath(); static qint64 applicationPid(); -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) static void setLibraryPaths(const QStringList &); static QStringList libraryPaths(); static void addLibraryPath(const QString &); static void removeLibraryPath(const QString &); -#endif // QT_NO_LIBRARY +#endif // QT_CONFIG(library) #ifndef QT_NO_TRANSLATION static bool installTranslator(QTranslator * messageFile); diff --git a/src/corelib/kernel/qtimer.h b/src/corelib/kernel/qtimer.h index d3b1fd6a18..6e61ca10cb 100644 --- a/src/corelib/kernel/qtimer.h +++ b/src/corelib/kernel/qtimer.h @@ -168,7 +168,7 @@ public: Q_ALWAYS_INLINE void setInterval(std::chrono::milliseconds value) { - setInterval(value.count()); + setInterval(int(value.count())); } Q_ALWAYS_INLINE diff --git a/src/corelib/plugin/plugin.pri b/src/corelib/plugin/plugin.pri index 473480eb55..a0e0d76044 100644 --- a/src/corelib/plugin/plugin.pri +++ b/src/corelib/plugin/plugin.pri @@ -1,38 +1,37 @@ # Qt core library plugin module HEADERS += \ - plugin/qfactoryinterface.h \ - plugin/qpluginloader.h \ - plugin/qlibrary.h \ - plugin/qlibrary_p.h \ - plugin/qplugin.h \ - plugin/quuid.h \ - plugin/qfactoryloader_p.h \ - plugin/qsystemlibrary_p.h \ - plugin/qelfparser_p.h \ - plugin/qmachparser_p.h + plugin/qfactoryinterface.h \ + plugin/qpluginloader.h \ + plugin/qplugin.h \ + plugin/quuid.h \ + plugin/qfactoryloader_p.h SOURCES += \ - plugin/qfactoryinterface.cpp \ - plugin/qpluginloader.cpp \ - plugin/qfactoryloader.cpp \ - plugin/quuid.cpp \ - plugin/qlibrary.cpp \ - plugin/qelfparser_p.cpp \ - plugin/qmachparser.cpp + plugin/qfactoryinterface.cpp \ + plugin/qpluginloader.cpp \ + plugin/qfactoryloader.cpp \ + plugin/quuid.cpp win32 { - SOURCES += \ - plugin/qlibrary_win.cpp \ - plugin/qsystemlibrary.cpp + HEADERS += plugin/qsystemlibrary_p.h + SOURCES += plugin/qsystemlibrary.cpp } -unix { - SOURCES += plugin/qlibrary_unix.cpp -} +qtConfig(library) { + HEADERS += \ + plugin/qlibrary.h \ + plugin/qlibrary_p.h \ + plugin/qelfparser_p.h \ + plugin/qmachparser_p.h -integrity { - SOURCES += plugin/qlibrary_unix.cpp -} + SOURCES += \ + plugin/qlibrary.cpp \ + plugin/qelfparser_p.cpp \ + plugin/qmachparser.cpp + + unix: SOURCES += plugin/qlibrary_unix.cpp + else: SOURCES += plugin/qlibrary_win.cpp -!no-libdl: LIBS_PRIVATE += $$QMAKE_LIBS_DYNLOAD + qtConfig(dlopen): QMAKE_USE_PRIVATE += libdl +} diff --git a/src/corelib/plugin/qelfparser_p.cpp b/src/corelib/plugin/qelfparser_p.cpp index 0a219d1251..7a42b0d023 100644 --- a/src/corelib/plugin/qelfparser_p.cpp +++ b/src/corelib/plugin/qelfparser_p.cpp @@ -39,7 +39,6 @@ #include "qelfparser_p.h" -#ifndef QT_NO_LIBRARY #if defined (Q_OF_ELF) && defined(Q_CC_GNU) #include "qlibrary_p.h" @@ -237,4 +236,3 @@ int QElfParser::parse(const char *dataStart, ulong fdlen, const QString &library QT_END_NAMESPACE #endif // defined(Q_OF_ELF) && defined(Q_CC_GNU) -#endif // QT_NO_LIBRARY diff --git a/src/corelib/plugin/qelfparser_p.h b/src/corelib/plugin/qelfparser_p.h index bcda19e8b5..3e73c5d149 100644 --- a/src/corelib/plugin/qelfparser_p.h +++ b/src/corelib/plugin/qelfparser_p.h @@ -54,7 +54,8 @@ #include <qendian.h> #include <private/qglobal_p.h> -#ifndef QT_NO_LIBRARY +QT_REQUIRE_CONFIG(library); + #if defined (Q_OF_ELF) && defined(Q_CC_GNU) QT_BEGIN_NAMESPACE @@ -101,6 +102,5 @@ public: QT_END_NAMESPACE #endif // defined(Q_OF_ELF) && defined(Q_CC_GNU) -#endif // QT_NO_LIBRARY #endif // QELFPARSER_P_H diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp index b8e18cc9a8..21f1007d5b 100644 --- a/src/corelib/plugin/qfactoryloader.cpp +++ b/src/corelib/plugin/qfactoryloader.cpp @@ -62,7 +62,7 @@ class QFactoryLoaderPrivate : public QObjectPrivate public: QFactoryLoaderPrivate(){} QByteArray iid; -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) ~QFactoryLoaderPrivate(); mutable QMutex mutex; QList<QLibraryPrivate*> libraryList; @@ -73,7 +73,7 @@ public: #endif }; -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) Q_GLOBAL_STATIC(QList<QFactoryLoader *>, qt_factory_loaders) @@ -232,7 +232,7 @@ void QFactoryLoader::refreshAll() } } -#endif // QT_NO_LIBRARY +#endif // QT_CONFIG(library) QFactoryLoader::QFactoryLoader(const char *iid, const QString &suffix, @@ -242,7 +242,7 @@ QFactoryLoader::QFactoryLoader(const char *iid, moveToThread(QCoreApplicationPrivate::mainThread()); Q_D(QFactoryLoader); d->iid = iid; -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) d->cs = cs; d->suffix = suffix; @@ -259,7 +259,7 @@ QList<QJsonObject> QFactoryLoader::metaData() const { Q_D(const QFactoryLoader); QList<QJsonObject> metaData; -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) QMutexLocker locker(&d->mutex); for (int i = 0; i < d->libraryList.size(); ++i) metaData.append(d->libraryList.at(i)->metaData); @@ -281,7 +281,7 @@ QObject *QFactoryLoader::instance(int index) const if (index < 0) return 0; -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) QMutexLocker lock(&d->mutex); if (index < d->libraryList.size()) { QLibraryPrivate *library = d->libraryList.at(index); diff --git a/src/corelib/plugin/qfactoryloader_p.h b/src/corelib/plugin/qfactoryloader_p.h index 70a934c976..7be18942ae 100644 --- a/src/corelib/plugin/qfactoryloader_p.h +++ b/src/corelib/plugin/qfactoryloader_p.h @@ -60,7 +60,9 @@ #include "QtCore/qjsondocument.h" #include "QtCore/qmap.h" #include "QtCore/qendian.h" +#if QT_CONFIG(library) #include "private/qlibrary_p.h" +#endif QT_BEGIN_NAMESPACE @@ -84,7 +86,7 @@ public: const QString &suffix = QString(), Qt::CaseSensitivity = Qt::CaseSensitive); -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) ~QFactoryLoader(); void update(); @@ -93,7 +95,7 @@ public: #if defined(Q_OS_UNIX) && !defined (Q_OS_MAC) QLibraryPrivate *library(const QString &key) const; #endif // Q_OS_UNIX && !Q_OS_MAC -#endif // !QT_NO_LIBRARY +#endif // QT_CONFIG(library) QMultiMap<int, QString> keyMap() const; int indexOf(const QString &needle) const; diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index a4a654cd88..6421e7c5d8 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -40,8 +40,6 @@ #include "qplatformdefs.h" #include "qlibrary.h" -#ifndef QT_NO_LIBRARY - #include "qfactoryloader_p.h" #include "qlibrary_p.h" #include <qstringlist.h> @@ -1131,5 +1129,3 @@ bool qt_debug_component() } QT_END_NAMESPACE - -#endif // QT_NO_LIBRARY diff --git a/src/corelib/plugin/qlibrary.h b/src/corelib/plugin/qlibrary.h index 2b91fa4007..89be52aac3 100644 --- a/src/corelib/plugin/qlibrary.h +++ b/src/corelib/plugin/qlibrary.h @@ -42,9 +42,9 @@ #include <QtCore/qobject.h> -QT_BEGIN_NAMESPACE +QT_REQUIRE_CONFIG(library); -#ifndef QT_NO_LIBRARY +QT_BEGIN_NAMESPACE class QLibraryPrivate; @@ -99,8 +99,6 @@ private: Q_DECLARE_OPERATORS_FOR_FLAGS(QLibrary::LoadHints) -#endif //QT_NO_LIBRARY - QT_END_NAMESPACE #endif //QLIBRARY_H diff --git a/src/corelib/plugin/qlibrary_p.h b/src/corelib/plugin/qlibrary_p.h index 7147ff6ca2..3f650501c8 100644 --- a/src/corelib/plugin/qlibrary_p.h +++ b/src/corelib/plugin/qlibrary_p.h @@ -62,10 +62,9 @@ # include "QtCore/qt_windows.h" #endif -QT_BEGIN_NAMESPACE - -#ifndef QT_NO_LIBRARY +QT_REQUIRE_CONFIG(library); +QT_BEGIN_NAMESPACE bool qt_debug_component(); @@ -130,8 +129,6 @@ private: friend class QLibraryStore; }; -#endif // QT_NO_LIBRARY - QT_END_NAMESPACE #endif // QLIBRARY_P_H diff --git a/src/corelib/plugin/qlibrary_unix.cpp b/src/corelib/plugin/qlibrary_unix.cpp index 3553763bcd..3c4fbaf348 100644 --- a/src/corelib/plugin/qlibrary_unix.cpp +++ b/src/corelib/plugin/qlibrary_unix.cpp @@ -44,8 +44,6 @@ #include <qcoreapplication.h> #include <private/qfilesystementry_p.h> -#ifndef QT_NO_LIBRARY - #ifdef Q_OS_MAC # include <private/qcore_mac_p.h> #endif @@ -308,5 +306,3 @@ QFunctionPointer QLibraryPrivate::resolve_sys(const char* symbol) } QT_END_NAMESPACE - -#endif // QT_NO_LIBRARY diff --git a/src/corelib/plugin/qlibrary_win.cpp b/src/corelib/plugin/qlibrary_win.cpp index 48aa0cdbb6..a4d3f67c27 100644 --- a/src/corelib/plugin/qlibrary_win.cpp +++ b/src/corelib/plugin/qlibrary_win.cpp @@ -44,8 +44,6 @@ #include "qfileinfo.h" #include <private/qfilesystementry_p.h> -#ifndef QT_NO_LIBRARY - #include <qt_windows.h> QT_BEGIN_NAMESPACE @@ -174,5 +172,3 @@ QFunctionPointer QLibraryPrivate::resolve_sys(const char* symbol) return QFunctionPointer(address); } QT_END_NAMESPACE - -#endif // QT_NO_LIBRARY diff --git a/src/corelib/plugin/qmachparser.cpp b/src/corelib/plugin/qmachparser.cpp index a599fbcb23..f506a6a6b1 100644 --- a/src/corelib/plugin/qmachparser.cpp +++ b/src/corelib/plugin/qmachparser.cpp @@ -39,7 +39,7 @@ #include "qmachparser_p.h" -#if defined(Q_OF_MACH_O) && !defined(QT_NO_LIBRARY) +#if defined(Q_OF_MACH_O) #include <qendian.h> #include "qlibrary_p.h" diff --git a/src/corelib/plugin/qmachparser_p.h b/src/corelib/plugin/qmachparser_p.h index ff7eaadb70..3884c92797 100644 --- a/src/corelib/plugin/qmachparser_p.h +++ b/src/corelib/plugin/qmachparser_p.h @@ -54,7 +54,8 @@ #include <qendian.h> #include <private/qglobal_p.h> -#ifndef QT_NO_LIBRARY +QT_REQUIRE_CONFIG(library); + #if defined(Q_OF_MACH_O) QT_BEGIN_NAMESPACE @@ -72,6 +73,5 @@ public: QT_END_NAMESPACE #endif // defined(Q_OF_ELF) && defined(Q_CC_GNU) -#endif // QT_NO_LIBRARY #endif // QMACHPARSER_P_H diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp index 6723877ad5..dbd3bee556 100644 --- a/src/corelib/plugin/qpluginloader.cpp +++ b/src/corelib/plugin/qpluginloader.cpp @@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) /*! \class QPluginLoader @@ -417,7 +417,7 @@ QLibrary::LoadHints QPluginLoader::loadHints() const return d ? d->loadHints() : QLibrary::LoadHints(); } -#endif // QT_NO_LIBRARY +#endif // QT_CONFIG(library) typedef QVector<QStaticPlugin> StaticPluginList; Q_GLOBAL_STATIC(StaticPluginList, staticPluginList) diff --git a/src/corelib/plugin/qpluginloader.h b/src/corelib/plugin/qpluginloader.h index 5dca59c271..80b10f76bf 100644 --- a/src/corelib/plugin/qpluginloader.h +++ b/src/corelib/plugin/qpluginloader.h @@ -40,12 +40,15 @@ #ifndef QPLUGINLOADER_H #define QPLUGINLOADER_H +#include <QtCore/qglobal.h> +#if QT_CONFIG(library) #include <QtCore/qlibrary.h> +#endif #include <QtCore/qplugin.h> QT_BEGIN_NAMESPACE -#ifndef QT_NO_LIBRARY +#if QT_CONFIG(library) class QLibraryPrivate; class QJsonObject; @@ -93,7 +96,7 @@ public: static QVector<QStaticPlugin> staticPlugins(); }; -#endif // QT_NO_LIBRARY +#endif // QT_CONFIG(library) QT_END_NAMESPACE diff --git a/src/corelib/thread/qfutureinterface.h b/src/corelib/thread/qfutureinterface.h index 559d26e231..7b12f51e3e 100644 --- a/src/corelib/thread/qfutureinterface.h +++ b/src/corelib/thread/qfutureinterface.h @@ -159,7 +159,7 @@ public: ~QFutureInterface() { if (!derefT()) - resultStore().clear(); + resultStoreBase().template clear<T>(); } static QFutureInterface canceledResult() @@ -169,7 +169,7 @@ public: { other.refT(); if (!derefT()) - resultStore().clear(); + resultStoreBase().template clear<T>(); QFutureInterfaceBase::operator=(other); return *this; } @@ -184,11 +184,6 @@ public: inline const T &resultReference(int index) const; inline const T *resultPointer(int index) const; inline QList<T> results(); -private: - QtPrivate::ResultStore<T> &resultStore() - { return static_cast<QtPrivate::ResultStore<T> &>(resultStoreBase()); } - const QtPrivate::ResultStore<T> &resultStore() const - { return static_cast<const QtPrivate::ResultStore<T> &>(resultStoreBase()); } }; template <typename T> @@ -199,15 +194,14 @@ inline void QFutureInterface<T>::reportResult(const T *result, int index) return; } - QtPrivate::ResultStore<T> &store = resultStore(); - + QtPrivate::ResultStoreBase &store = resultStoreBase(); if (store.filterMode()) { const int resultCountBefore = store.count(); - store.addResult(index, result); + store.addResult<T>(index, result); this->reportResultsReady(resultCountBefore, resultCountBefore + store.count()); } else { - const int insertIndex = store.addResult(index, result); + const int insertIndex = store.addResult<T>(index, result); this->reportResultsReady(insertIndex, insertIndex + 1); } } @@ -226,7 +220,7 @@ inline void QFutureInterface<T>::reportResults(const QVector<T> &_results, int b return; } - QtPrivate::ResultStore<T> &store = resultStore(); + auto &store = resultStoreBase(); if (store.filterMode()) { const int resultCountBefore = store.count(); @@ -250,14 +244,14 @@ template <typename T> inline const T &QFutureInterface<T>::resultReference(int index) const { QMutexLocker lock(mutex()); - return resultStore().resultAt(index).value(); + return resultStoreBase().resultAt(index).template value<T>(); } template <typename T> inline const T *QFutureInterface<T>::resultPointer(int index) const { QMutexLocker lock(mutex()); - return resultStore().resultAt(index).pointer(); + return resultStoreBase().resultAt(index).template pointer<T>(); } template <typename T> @@ -272,9 +266,9 @@ inline QList<T> QFutureInterface<T>::results() QList<T> res; QMutexLocker lock(mutex()); - QtPrivate::ResultIterator<T> it = resultStore().begin(); - while (it != resultStore().end()) { - res.append(it.value()); + QtPrivate::ResultIteratorBase it = resultStoreBase().begin(); + while (it != resultStoreBase().end()) { + res.append(it.value<T>()); ++it; } diff --git a/src/corelib/thread/qresultstore.cpp b/src/corelib/thread/qresultstore.cpp index aa7ec02d6e..9a6fcec678 100644 --- a/src/corelib/thread/qresultstore.cpp +++ b/src/corelib/thread/qresultstore.cpp @@ -98,6 +98,12 @@ bool ResultIteratorBase::canIncrementVectorIndex() const ResultStoreBase::ResultStoreBase() : insertIndex(0), resultCount(0), m_filterMode(false), filteredResults(0) { } +ResultStoreBase::~ResultStoreBase() +{ + // QFutureInterface's dtor must delete the contents of m_results. + Q_ASSERT(m_results.isEmpty()); +} + void ResultStoreBase::setFilterMode(bool enable) { m_filterMode = enable; diff --git a/src/corelib/thread/qresultstore.h b/src/corelib/thread/qresultstore.h index 56cfcb6ed6..be9f632557 100644 --- a/src/corelib/thread/qresultstore.h +++ b/src/corelib/thread/qresultstore.h @@ -93,20 +93,14 @@ public: protected: QMap<int, ResultItem>::const_iterator mapIterator; int m_vectorIndex; -}; - -template <typename T> -class ResultIterator : public ResultIteratorBase -{ public: - ResultIterator(const ResultIteratorBase &base) - : ResultIteratorBase(base) { } - + template <typename T> const T &value() const { - return *pointer(); + return *pointer<T>(); } + template <typename T> const T *pointer() const { if (mapIterator.value().isVector()) @@ -130,7 +124,7 @@ public: ResultIteratorBase resultAt(int index) const; bool contains(int index) const; int count() const; - virtual ~ResultStoreBase() { } + virtual ~ResultStoreBase(); protected: int insertResultItem(int index, ResultItem &resultItem); @@ -147,64 +141,44 @@ protected: QMap<int, ResultItem> pendingResults; int filteredResults; -}; - -template <typename T> -class ResultStore : public ResultStoreBase -{ public: - ResultStore() { } - - ResultStore(const ResultStoreBase &base) - : ResultStoreBase(base) { } - - int addResult(int index, const T *result) + template <typename T> + int addResult(int index, const T *result) { if (result == 0) - return ResultStoreBase::addResult(index, result); + return addResult(index, static_cast<void *>(nullptr)); else - return ResultStoreBase::addResult(index, new T(*result)); + return addResult(index, static_cast<void *>(new T(*result))); } + template <typename T> int addResults(int index, const QVector<T> *results) { - return ResultStoreBase::addResults(index, new QVector<T>(*results), results->count(), results->count()); + return addResults(index, new QVector<T>(*results), results->count(), results->count()); } + template <typename T> int addResults(int index, const QVector<T> *results, int totalCount) { if (m_filterMode == true && results->count() != totalCount && 0 == results->count()) - return ResultStoreBase::addResults(index, 0, 0, totalCount); + return addResults(index, 0, 0, totalCount); else - return ResultStoreBase::addResults(index, new QVector<T>(*results), results->count(), totalCount); + return addResults(index, new QVector<T>(*results), results->count(), totalCount); } int addCanceledResult(int index) { - return addResult(index, 0); + return addResult(index, static_cast<void *>(nullptr)); } + template <typename T> int addCanceledResults(int index, int _count) { QVector<T> empty; return addResults(index, &empty, _count); } - ResultIterator<T> begin() const - { - return static_cast<ResultIterator<T> >(ResultStoreBase::begin()); - } - - ResultIterator<T> end() const - { - return static_cast<ResultIterator<T> >(ResultStoreBase::end()); - } - - ResultIterator<T> resultAt(int index) const - { - return static_cast<ResultIterator<T> >(ResultStoreBase::resultAt(index)); - } - + template <typename T> void clear() { QMap<int, ResultItem>::const_iterator mapIterator = m_results.constBegin(); @@ -218,12 +192,6 @@ public: resultCount = 0; m_results.clear(); } - - ~ResultStore() - { - clear(); - } - }; } // namespace QtPrivate diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 01ed3cea5b..e9f740b7c5 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -2853,6 +2853,9 @@ inline bool QDateTime::Data::isShort() const { bool b = quintptr(d) & QDateTimePrivate::ShortData; + // sanity check: + Q_ASSERT(b || (d->m_status & QDateTimePrivate::ShortData) == 0); + // even if CanBeSmall = false, we have short data for a default-constructed // QDateTime object. But it's unlikely. if (CanBeSmall) @@ -3678,7 +3681,7 @@ void QDateTime::setMSecsSinceEpoch(qint64 msecs) d.data.status = status; } else { d.detach(); - d->m_status = status; + d->m_status = status & ~QDateTimePrivate::ShortData; d->m_msecs = msecs; } diff --git a/src/corelib/tools/qdatetimeparser.cpp b/src/corelib/tools/qdatetimeparser.cpp index d66416207b..c8aa4fbc89 100644 --- a/src/corelib/tools/qdatetimeparser.cpp +++ b/src/corelib/tools/qdatetimeparser.cpp @@ -49,7 +49,7 @@ //#define QDATETIMEPARSER_DEBUG #if defined (QDATETIMEPARSER_DEBUG) && !defined(QT_NO_DEBUG_STREAM) -# define QDTPDEBUG qDebug() << QString("%1:%2").arg(__FILE__).arg(__LINE__) +# define QDTPDEBUG qDebug() # define QDTPDEBUGN qDebug #else # define QDTPDEBUG if (false) qDebug() @@ -1325,39 +1325,16 @@ int QDateTimeParser::findDay(const QString &str1, int startDay, int sectionIndex } const QLocale l = locale(); for (int day=startDay; day<=7; ++day) { - const QString str2 = l.dayName(day, sn.count == 4 ? QLocale::LongFormat : QLocale::ShortFormat); - - if (str1.startsWith(str2.toLower())) { - if (used) - *used = str2.size(); - if (usedDay) { - *usedDay = str2; - } - return day; - } - if (context == FromString) - continue; + const QString dayName = l.dayName(day, sn.count == 4 ? QLocale::LongFormat : QLocale::ShortFormat); + const QString str2 = dayName.toLower(); const int limit = qMin(str1.size(), str2.size()); - bool found = true; - for (int i=0; i<limit; ++i) { - if (str1.at(i) != str2.at(i) && !str1.at(i).isSpace()) { - if (i > bestCount) { - bestCount = i; - bestMatch = day; - } - found = false; - break; - } - - } - if (found) { - if (used) - *used = limit; - if (usedDay) - *usedDay = str2; - - return day; + int i = 0; + while (i < limit && str1.at(i) == str2.at(i)) + ++i; + if (i > bestCount) { + bestCount = i; + bestMatch = day; } } if (usedDay && bestMatch != -1) { diff --git a/src/corelib/tools/qharfbuzz.cpp b/src/corelib/tools/qharfbuzz.cpp index fdd861690d..a3e266ccd2 100644 --- a/src/corelib/tools/qharfbuzz.cpp +++ b/src/corelib/tools/qharfbuzz.cpp @@ -40,7 +40,9 @@ #include "qharfbuzz_p.h" #include "qunicodetables_p.h" +#if QT_CONFIG(library) #include "qlibrary.h" +#endif QT_USE_NAMESPACE @@ -70,7 +72,7 @@ HB_UChar16 HB_GetMirroredChar(HB_UChar16 ch) void (*HB_Library_Resolve(const char *library, int version, const char *symbol))() { -#ifdef QT_NO_LIBRARY +#if !QT_CONFIG(library) Q_UNUSED(library); Q_UNUSED(version); Q_UNUSED(symbol); diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index f861c1e71c..e2706de9ee 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -895,7 +895,7 @@ Q_OUTOFLINE_TEMPLATE int QList<T>::removeAll(const T &_t) *n++ = *i; } - int removedCount = e - n; + int removedCount = int(e - n); d->end -= removedCount; return removedCount; } diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index ae4befcb9c..47d64c0df6 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -2117,8 +2117,8 @@ QList<QLocale> QLocale::matchingLocales(QLocale::Language language, && (language == QLocale::AnyLanguage || data->m_language_id == uint(language))) { if ((script == QLocale::AnyScript || data->m_script_id == uint(script)) && (country == QLocale::AnyCountry || data->m_country_id == uint(country))) { - QLocale locale(*QLocalePrivate::create(data)); - result.append(locale); + result.append(QLocale(*(data->m_language_id == C ? c_private() + : QLocalePrivate::create(data)))); } ++data; } diff --git a/src/corelib/tools/qlocale_icu.cpp b/src/corelib/tools/qlocale_icu.cpp index 0066e95d88..afe0aae583 100644 --- a/src/corelib/tools/qlocale_icu.cpp +++ b/src/corelib/tools/qlocale_icu.cpp @@ -38,7 +38,6 @@ ****************************************************************************/ #include "qglobal.h" -#include "qlibrary.h" #include "qdebug.h" #include "qlocale_p.h" #include "qmutex.h" diff --git a/src/corelib/tools/qrect.h b/src/corelib/tools/qrect.h index f973cf3494..4030cccbd5 100644 --- a/src/corelib/tools/qrect.h +++ b/src/corelib/tools/qrect.h @@ -662,12 +662,18 @@ Q_DECL_CONSTEXPR inline QRectF::QRectF(const QRect &r) Q_DECL_NOTHROW { } +QT_WARNING_PUSH +QT_WARNING_DISABLE_CLANG("-Wfloat-equal") +QT_WARNING_DISABLE_GCC("-Wfloat-equal") + Q_DECL_CONSTEXPR inline bool QRectF::isNull() const Q_DECL_NOTHROW { return w == 0. && h == 0.; } Q_DECL_CONSTEXPR inline bool QRectF::isEmpty() const Q_DECL_NOTHROW { return w <= 0. || h <= 0.; } +QT_WARNING_POP + Q_DECL_CONSTEXPR inline bool QRectF::isValid() const Q_DECL_NOTHROW { return w > 0. && h > 0.; } diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index c69d27bbf9..ab5a2944bf 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -692,7 +692,7 @@ typename QVector<T>::iterator QVector<T>::insert(iterator before, size_type n, c { Q_ASSERT_X(isValidIterator(before), "QVector::insert", "The specified iterator argument 'before' is invalid"); - int offset = std::distance(d->begin(), before); + const auto offset = std::distance(d->begin(), before); if (n != 0) { const T copy(t); if (!isDetached() || d->size + n > int(d->alloc)) @@ -728,7 +728,7 @@ typename QVector<T>::iterator QVector<T>::erase(iterator abegin, iterator aend) Q_ASSERT_X(isValidIterator(abegin), "QVector::erase", "The specified iterator argument 'abegin' is invalid"); Q_ASSERT_X(isValidIterator(aend), "QVector::erase", "The specified iterator argument 'aend' is invalid"); - const int itemsToErase = aend - abegin; + const auto itemsToErase = aend - abegin; if (!itemsToErase) return abegin; @@ -737,7 +737,7 @@ typename QVector<T>::iterator QVector<T>::erase(iterator abegin, iterator aend) Q_ASSERT(aend <= d->end()); Q_ASSERT(abegin <= aend); - const int itemsUntouched = abegin - d->begin(); + const auto itemsUntouched = abegin - d->begin(); // FIXME we could do a proper realloc, which copy constructs only needed data. // FIXME we are about to delete data - maybe it is good time to shrink? @@ -766,7 +766,7 @@ typename QVector<T>::iterator QVector<T>::erase(iterator abegin, iterator aend) memmove(static_cast<void *>(abegin), static_cast<void *>(aend), (d->size - itemsToErase - itemsUntouched) * sizeof(T)); } - d->size -= itemsToErase; + d->size -= int(itemsToErase); } return d->begin() + itemsUntouched; } |