diff options
Diffstat (limited to 'src/corelib/io')
25 files changed, 48 insertions, 89 deletions
diff --git a/src/corelib/io/qabstractfileengine_p.h b/src/corelib/io/qabstractfileengine_p.h index 4a7fe7bff5..c88b66c7ce 100644 --- a/src/corelib/io/qabstractfileengine_p.h +++ b/src/corelib/io/qabstractfileengine_p.h @@ -193,7 +193,7 @@ public: uchar *address; }; - virtual bool extension(Extension extension, const ExtensionOption *option = 0, ExtensionReturn *output = 0); + virtual bool extension(Extension extension, const ExtensionOption *option = nullptr, ExtensionReturn *output = nullptr); virtual bool supportsExtension(Extension extension) const; // Factory diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h index 91fde75fa5..f9dc4203db 100644 --- a/src/corelib/io/qdebug.h +++ b/src/corelib/io/qdebug.h @@ -116,7 +116,7 @@ public: inline QDebug(const QDebug &o):stream(o.stream) { ++stream->ref; } inline QDebug &operator=(const QDebug &other); ~QDebug(); - inline void swap(QDebug &other) Q_DECL_NOTHROW { qSwap(stream, other.stream); } + inline void swap(QDebug &other) noexcept { qSwap(stream, other.stream); } QDebug &resetFormat(); @@ -161,9 +161,7 @@ public: inline QDebug &operator<<(QLatin1String t) { putByteArray(t.latin1(), t.size(), ContainsLatin1); return maybeSpace(); } inline QDebug &operator<<(const QByteArray & t) { putByteArray(t.constData(), t.size(), ContainsBinary); return maybeSpace(); } inline QDebug &operator<<(const void * t) { stream->ts << t; return maybeSpace(); } -#ifdef Q_COMPILER_NULLPTR inline QDebug &operator<<(std::nullptr_t) { stream->ts << "(nullptr)"; return maybeSpace(); } -#endif inline QDebug &operator<<(QTextStreamFunction f) { stream->ts << f; return *this; diff --git a/src/corelib/io/qdir.h b/src/corelib/io/qdir.h index 9abb833ab1..45a40995f8 100644 --- a/src/corelib/io/qdir.h +++ b/src/corelib/io/qdir.h @@ -109,11 +109,9 @@ public: QT_DEPRECATED_X("Use QDir::setPath() instead") QDir &operator=(const QString &path); #endif -#ifdef Q_COMPILER_RVALUE_REFS - QDir &operator=(QDir &&other) Q_DECL_NOTHROW { swap(other); return *this; } -#endif + QDir &operator=(QDir &&other) noexcept { swap(other); return *this; } - void swap(QDir &other) Q_DECL_NOTHROW + void swap(QDir &other) noexcept { qSwap(d_ptr, other.d_ptr); } void setPath(const QString &path); @@ -190,7 +188,7 @@ public: static QFileInfoList drives(); - Q_DECL_CONSTEXPR static inline QChar listSeparator() Q_DECL_NOTHROW + Q_DECL_CONSTEXPR static inline QChar listSeparator() noexcept { #if defined(Q_OS_WIN) return QLatin1Char(';'); diff --git a/src/corelib/io/qfileinfo.h b/src/corelib/io/qfileinfo.h index baea18fab1..111517325d 100644 --- a/src/corelib/io/qfileinfo.h +++ b/src/corelib/io/qfileinfo.h @@ -67,11 +67,9 @@ public: ~QFileInfo(); QFileInfo &operator=(const QFileInfo &fileinfo); -#ifdef Q_COMPILER_RVALUE_REFS - QFileInfo &operator=(QFileInfo &&other) Q_DECL_NOTHROW { swap(other); return *this; } -#endif + QFileInfo &operator=(QFileInfo &&other) noexcept { swap(other); return *this; } - void swap(QFileInfo &other) Q_DECL_NOTHROW + void swap(QFileInfo &other) noexcept { qSwap(d_ptr, other.d_ptr); } bool operator==(const QFileInfo &fileinfo) const; diff --git a/src/corelib/io/qfileinfo_p.h b/src/corelib/io/qfileinfo_p.h index e4b28f4519..36f440812f 100644 --- a/src/corelib/io/qfileinfo_p.h +++ b/src/corelib/io/qfileinfo_p.h @@ -80,7 +80,7 @@ public: }; inline QFileInfoPrivate() - : QSharedData(), fileEngine(0), + : QSharedData(), fileEngine(nullptr), cachedFlags(0), isDefaultConstructed(true), cache_enabled(true), fileFlags(0), fileSize(0) diff --git a/src/corelib/io/qfilesystemengine_p.h b/src/corelib/io/qfilesystemengine_p.h index 09ec2d6a10..e44837747c 100644 --- a/src/corelib/io/qfilesystemengine_p.h +++ b/src/corelib/io/qfilesystemengine_p.h @@ -130,7 +130,7 @@ public: static bool removeFile(const QFileSystemEntry &entry, QSystemError &error); static bool setPermissions(const QFileSystemEntry &entry, QFile::Permissions permissions, QSystemError &error, - QFileSystemMetaData *data = 0); + QFileSystemMetaData *data = nullptr); // unused, therefore not implemented static bool setFileTime(const QFileSystemEntry &entry, const QDateTime &newDate, diff --git a/src/corelib/io/qfilesystemmetadata_p.h b/src/corelib/io/qfilesystemmetadata_p.h index 4d2a5acb9b..81f4b3ba13 100644 --- a/src/corelib/io/qfilesystemmetadata_p.h +++ b/src/corelib/io/qfilesystemmetadata_p.h @@ -76,7 +76,7 @@ class Q_AUTOTEST_EXPORT QFileSystemMetaData { public: QFileSystemMetaData() - : knownFlagsMask(0), + : knownFlagsMask(nullptr), size_(-1) { } @@ -184,7 +184,7 @@ public: void clear() { - knownFlagsMask = 0; + knownFlagsMask = nullptr; } void clearFlags(MetaDataFlags flags = AllMetaDataFlags) diff --git a/src/corelib/io/qfilesystemwatcher_fsevents.mm b/src/corelib/io/qfilesystemwatcher_fsevents.mm index f594fad803..fb3b6f86fd 100644 --- a/src/corelib/io/qfilesystemwatcher_fsevents.mm +++ b/src/corelib/io/qfilesystemwatcher_fsevents.mm @@ -407,7 +407,7 @@ QStringList QFseventsFileSystemWatcherEngine::addPaths(const QStringList &paths, stopStream(); if (!startStream()) { // ok, something went wrong, let's try to restore the previous state - watchingState = qMove(oldState); + watchingState = std::move(oldState); // and because we don't know which path caused the issue (if any), fail on all of them p = paths; @@ -474,7 +474,7 @@ QStringList QFseventsFileSystemWatcherEngine::removePaths(const QStringList &pat if (needsRestart) { if (!restartStream()) { - watchingState = qMove(oldState); + watchingState = std::move(oldState); startStream(); } } diff --git a/src/corelib/io/qfilesystemwatcher_win.cpp b/src/corelib/io/qfilesystemwatcher_win.cpp index 66985f8982..7f4f9d345b 100644 --- a/src/corelib/io/qfilesystemwatcher_win.cpp +++ b/src/corelib/io/qfilesystemwatcher_win.cpp @@ -108,7 +108,11 @@ public: // Call from QFileSystemWatcher::addPaths() to set up notifications on drives void addPath(const QString &path); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + bool nativeEventFilter(const QByteArray &, void *messageIn, qintptr *) override; +#else bool nativeEventFilter(const QByteArray &, void *messageIn, long *) override; +#endif signals: void driveAdded(); @@ -255,7 +259,11 @@ inline void QWindowsRemovableDriveListener::handleDbtDriveArrivalRemoval(const M } } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +bool QWindowsRemovableDriveListener::nativeEventFilter(const QByteArray &, void *messageIn, qintptr *) +#else bool QWindowsRemovableDriveListener::nativeEventFilter(const QByteArray &, void *messageIn, long *) +#endif { const MSG *msg = reinterpret_cast<const MSG *>(messageIn); if (msg->message == WM_DEVICECHANGE) { diff --git a/src/corelib/io/qfsfileengine_p.h b/src/corelib/io/qfsfileengine_p.h index 6b091a8eef..0f416f4886 100644 --- a/src/corelib/io/qfsfileengine_p.h +++ b/src/corelib/io/qfsfileengine_p.h @@ -115,7 +115,7 @@ public: virtual bool isUnnamedFile() const { return false; } - bool extension(Extension extension, const ExtensionOption *option = 0, ExtensionReturn *output = 0) override; + bool extension(Extension extension, const ExtensionOption *option = nullptr, ExtensionReturn *output = nullptr) override; bool supportsExtension(Extension extension) const override; //FS only!! diff --git a/src/corelib/io/qloggingcategory.h b/src/corelib/io/qloggingcategory.h index 91e3144300..5825095729 100644 --- a/src/corelib/io/qloggingcategory.h +++ b/src/corelib/io/qloggingcategory.h @@ -111,8 +111,6 @@ private: #define Q_DECLARE_LOGGING_CATEGORY(name) \ extern const QLoggingCategory &name(); -#if defined(Q_COMPILER_VARIADIC_MACROS) || defined(Q_MOC_RUN) - #define Q_LOGGING_CATEGORY(name, ...) \ const QLoggingCategory &name() \ { \ @@ -148,39 +146,6 @@ private: for (bool qt_category_enabled = category().isCriticalEnabled(); qt_category_enabled; qt_category_enabled = false) \ QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC, category().categoryName()).critical(__VA_ARGS__) -#else // defined(Q_COMPILER_VARIADIC_MACROS) || defined(Q_MOC_RUN) - -// Optional msgType argument not supported -#define Q_LOGGING_CATEGORY(name, string) \ - const QLoggingCategory &name() \ - { \ - static const QLoggingCategory category(string); \ - return category; \ - } - -// check for enabled category inside QMessageLogger. -#if !defined(QT_NO_DEBUG_OUTPUT) -# define qCDebug qDebug -#else -# define qCDebug(category) QT_NO_QDEBUG_MACRO() -#endif - -#if !defined(QT_NO_INFO_OUTPUT) -# define qCInfo qInfo -#else -# define qCInfo(category) QT_NO_QDEBUG_MACRO() -#endif - -#if !defined(QT_NO_WARNING_OUTPUT) -# define qCWarning qWarning -#else -# define qCWarning(category) QT_NO_QDEBUG_MACRO() -#endif - -#define qCCritical qCritical - -#endif // Q_COMPILER_VARIADIC_MACROS || defined(Q_MOC_RUN) - QT_END_NAMESPACE #endif // QLOGGINGCATEGORY_H diff --git a/src/corelib/io/qnoncontiguousbytedevice.cpp b/src/corelib/io/qnoncontiguousbytedevice.cpp index beca6ccbf7..d1806aa12b 100644 --- a/src/corelib/io/qnoncontiguousbytedevice.cpp +++ b/src/corelib/io/qnoncontiguousbytedevice.cpp @@ -534,7 +534,7 @@ QNonContiguousByteDevice* QNonContiguousByteDeviceFactory::create(QSharedPointer */ QSharedPointer<QNonContiguousByteDevice> QNonContiguousByteDeviceFactory::createShared(QSharedPointer<QRingBuffer> ringBuffer) { - return QSharedPointer<QNonContiguousByteDeviceRingBufferImpl>::create(qMove(ringBuffer)); + return QSharedPointer<QNonContiguousByteDeviceRingBufferImpl>::create(std::move(ringBuffer)); } /*! diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index d5d67d86f3..c7635cc7b4 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -42,6 +42,7 @@ #include <qdebug.h> #include <qdir.h> +#include <qscopedvaluerollback.h> #if defined(Q_OS_WIN) #include <qtimer.h> #endif @@ -1062,9 +1063,8 @@ bool QProcessPrivate::tryReadFromChannel(Channel *channel) if (currentReadChannel == channelIdx) { didRead = true; if (!emittedReadyRead) { - emittedReadyRead = true; + QScopedValueRollback<bool> guard(emittedReadyRead, true); emit q->readyRead(); - emittedReadyRead = false; } } emit q->channelReadyRead(int(channelIdx)); diff --git a/src/corelib/io/qprocess.h b/src/corelib/io/qprocess.h index a2e3c01f7c..9fda5fba11 100644 --- a/src/corelib/io/qprocess.h +++ b/src/corelib/io/qprocess.h @@ -72,12 +72,10 @@ public: QProcessEnvironment(); QProcessEnvironment(const QProcessEnvironment &other); ~QProcessEnvironment(); -#ifdef Q_COMPILER_RVALUE_REFS - QProcessEnvironment &operator=(QProcessEnvironment && other) Q_DECL_NOTHROW { swap(other); return *this; } -#endif + QProcessEnvironment &operator=(QProcessEnvironment && other) noexcept { swap(other); return *this; } QProcessEnvironment &operator=(const QProcessEnvironment &other); - void swap(QProcessEnvironment &other) Q_DECL_NOTHROW { qSwap(d, other.d); } + void swap(QProcessEnvironment &other) noexcept { qSwap(d, other.d); } bool operator==(const QProcessEnvironment &other) const; inline bool operator!=(const QProcessEnvironment &other) const diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h index aa7ecbe91d..1bc63240fe 100644 --- a/src/corelib/io/qprocess_p.h +++ b/src/corelib/io/qprocess_p.h @@ -247,7 +247,7 @@ public: // if you add "= 4" here, increase the number of bits below }; - Channel() : process(0), notifier(0), type(Normal), closed(false), append(false) + Channel() : process(nullptr), notifier(nullptr), type(Normal), closed(false), append(false) { pipe[0] = INVALID_Q_PIPE; pipe[1] = INVALID_Q_PIPE; diff --git a/src/corelib/io/qresource_p.h b/src/corelib/io/qresource_p.h index 7451de8809..fedf95bb33 100644 --- a/src/corelib/io/qresource_p.h +++ b/src/corelib/io/qresource_p.h @@ -108,7 +108,7 @@ public: Iterator *beginEntryList(QDir::Filters filters, const QStringList &filterNames) override; Iterator *endEntryList() override; - bool extension(Extension extension, const ExtensionOption *option = 0, ExtensionReturn *output = 0) override; + bool extension(Extension extension, const ExtensionOption *option = nullptr, ExtensionReturn *output = nullptr) override; bool supportsExtension(Extension extension) const override; }; diff --git a/src/corelib/io/qstorageinfo.h b/src/corelib/io/qstorageinfo.h index 4ab7a353ef..237e68d2a1 100644 --- a/src/corelib/io/qstorageinfo.h +++ b/src/corelib/io/qstorageinfo.h @@ -62,11 +62,9 @@ public: ~QStorageInfo(); QStorageInfo &operator=(const QStorageInfo &other); -#ifdef Q_COMPILER_RVALUE_REFS - QStorageInfo &operator=(QStorageInfo &&other) Q_DECL_NOTHROW { swap(other); return *this; } -#endif + QStorageInfo &operator=(QStorageInfo &&other) noexcept { swap(other); return *this; } - inline void swap(QStorageInfo &other) Q_DECL_NOTHROW + inline void swap(QStorageInfo &other) noexcept { qSwap(d, other.d); } void setPath(const QString &path); diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 6d82981fd6..b4090f710e 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -4159,7 +4159,7 @@ QList<QUrl> QUrl::fromStringList(const QStringList &urls, ParsingMode mode) \relates QHash \since 5.0 */ -uint qHash(const QUrl &url, uint seed) Q_DECL_NOTHROW +uint qHash(const QUrl &url, uint seed) noexcept { if (!url.d) return qHash(-1, seed); // the hash of an unset port (-1) diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h index 5062ef7905..94269e4369 100644 --- a/src/corelib/io/qurl.h +++ b/src/corelib/io/qurl.h @@ -119,7 +119,7 @@ class QTypeInfo<QUrlTwoFlags<E1, E2> > : public QTypeInfoMerger<QUrlTwoFlags<E1, class QUrl; // qHash is a friend, but we can't use default arguments for friends (ยง8.3.6.4) -Q_CORE_EXPORT uint qHash(const QUrl &url, uint seed = 0) Q_DECL_NOTHROW; +Q_CORE_EXPORT uint qHash(const QUrl &url, uint seed = 0) noexcept; class Q_CORE_EXPORT QUrl { @@ -182,15 +182,13 @@ public: QUrl(const QString &url, ParsingMode mode = TolerantMode); QUrl &operator=(const QString &url); #endif -#ifdef Q_COMPILER_RVALUE_REFS - QUrl(QUrl &&other) Q_DECL_NOTHROW : d(other.d) + QUrl(QUrl &&other) noexcept : d(other.d) { other.d = nullptr; } - inline QUrl &operator=(QUrl &&other) Q_DECL_NOTHROW + inline QUrl &operator=(QUrl &&other) noexcept { qSwap(d, other.d); return *this; } -#endif ~QUrl(); - inline void swap(QUrl &other) Q_DECL_NOTHROW { qSwap(d, other.d); } + inline void swap(QUrl &other) noexcept { qSwap(d, other.d); } void setUrl(const QString &url, ParsingMode mode = TolerantMode); QString url(FormattingOptions options = FormattingOptions(PrettyDecoded)) const; @@ -361,7 +359,7 @@ public: static QList<QUrl> fromStringList(const QStringList &uris, ParsingMode mode = TolerantMode); static void setIdnWhitelist(const QStringList &); - friend Q_CORE_EXPORT uint qHash(const QUrl &url, uint seed) Q_DECL_NOTHROW; + friend Q_CORE_EXPORT uint qHash(const QUrl &url, uint seed) noexcept; private: QUrlPrivate *d; diff --git a/src/corelib/io/qurl_p.h b/src/corelib/io/qurl_p.h index 1b9237e58a..e75de32e03 100644 --- a/src/corelib/io/qurl_p.h +++ b/src/corelib/io/qurl_p.h @@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE // in qurlrecode.cpp extern Q_AUTOTEST_EXPORT int qt_urlRecode(QString &appendTo, const QChar *begin, const QChar *end, - QUrl::ComponentFormattingOptions encoding, const ushort *tableModifications = 0); + QUrl::ComponentFormattingOptions encoding, const ushort *tableModifications = nullptr); // in qurlidna.cpp enum AceLeadingDot { AllowLeadingDot, ForbidLeadingDot }; diff --git a/src/corelib/io/qurlquery.cpp b/src/corelib/io/qurlquery.cpp index 10c3f836c8..d76107abfd 100644 --- a/src/corelib/io/qurlquery.cpp +++ b/src/corelib/io/qurlquery.cpp @@ -434,7 +434,7 @@ bool QUrlQuery::operator ==(const QUrlQuery &other) const Returns the hash value for \a key, using \a seed to seed the calculation. */ -uint qHash(const QUrlQuery &key, uint seed) Q_DECL_NOTHROW +uint qHash(const QUrlQuery &key, uint seed) noexcept { if (const QUrlQueryPrivate *d = key.d) { QtPrivate::QHashCombine hash; diff --git a/src/corelib/io/qurlquery.h b/src/corelib/io/qurlquery.h index e3688aae2c..89d0f88059 100644 --- a/src/corelib/io/qurlquery.h +++ b/src/corelib/io/qurlquery.h @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE -Q_CORE_EXPORT uint qHash(const QUrlQuery &key, uint seed = 0) Q_DECL_NOTHROW; +Q_CORE_EXPORT uint qHash(const QUrlQuery &key, uint seed = 0) noexcept; class QUrlQueryPrivate; class Q_CORE_EXPORT QUrlQuery @@ -70,16 +70,14 @@ public: QUrlQuery(const QUrlQuery &other); QUrlQuery &operator=(const QUrlQuery &other); -#ifdef Q_COMPILER_RVALUE_REFS - QUrlQuery &operator=(QUrlQuery &&other) Q_DECL_NOTHROW { swap(other); return *this; } -#endif + QUrlQuery &operator=(QUrlQuery &&other) noexcept { swap(other); return *this; } ~QUrlQuery(); bool operator==(const QUrlQuery &other) const; bool operator!=(const QUrlQuery &other) const { return !(*this == other); } - void swap(QUrlQuery &other) Q_DECL_NOTHROW { qSwap(d, other.d); } + void swap(QUrlQuery &other) noexcept { qSwap(d, other.d); } bool isEmpty() const; bool isDetached() const; @@ -111,7 +109,7 @@ public: private: friend class QUrl; - friend Q_CORE_EXPORT uint qHash(const QUrlQuery &key, uint seed) Q_DECL_NOTHROW; + friend Q_CORE_EXPORT uint qHash(const QUrlQuery &key, uint seed) noexcept; QSharedDataPointer<QUrlQueryPrivate> d; public: typedef QSharedDataPointer<QUrlQueryPrivate> DataPtr; diff --git a/src/corelib/io/qurlrecode.cpp b/src/corelib/io/qurlrecode.cpp index 443ae18b21..f23480c755 100644 --- a/src/corelib/io/qurlrecode.cpp +++ b/src/corelib/io/qurlrecode.cpp @@ -692,7 +692,7 @@ qt_urlRecode(QString &appendTo, const QChar *begin, const QChar *end, } // qstring.cpp -bool qt_is_ascii(const char *&ptr, const char *end) Q_DECL_NOTHROW; +bool qt_is_ascii(const char *&ptr, const char *end) noexcept; /*! \internal diff --git a/src/corelib/io/qwindowspipereader.cpp b/src/corelib/io/qwindowspipereader.cpp index 15c9f52cf3..1f03ac5d5a 100644 --- a/src/corelib/io/qwindowspipereader.cpp +++ b/src/corelib/io/qwindowspipereader.cpp @@ -40,6 +40,7 @@ #include "qwindowspipereader_p.h" #include "qiodevice_p.h" #include <qelapsedtimer.h> +#include <qscopedvaluerollback.h> QT_BEGIN_NAMESPACE @@ -301,9 +302,8 @@ void QWindowsPipeReader::emitPendingReadyRead() { if (readyReadPending) { readyReadPending = false; - inReadyRead = true; + QScopedValueRollback<bool> guard(inReadyRead, true); emit readyRead(); - inReadyRead = false; } } diff --git a/src/corelib/io/qwindowspipewriter.cpp b/src/corelib/io/qwindowspipewriter.cpp index 92e8b6db52..32536f495b 100644 --- a/src/corelib/io/qwindowspipewriter.cpp +++ b/src/corelib/io/qwindowspipewriter.cpp @@ -39,6 +39,7 @@ #include "qwindowspipewriter_p.h" #include "qiodevice_p.h" +#include <qscopedvaluerollback.h> QT_BEGIN_NAMESPACE @@ -111,9 +112,8 @@ void QWindowsPipeWriter::emitPendingBytesWrittenValue() emit canWrite(); if (!inBytesWritten) { - inBytesWritten = true; + QScopedValueRollback<bool> guard(inBytesWritten, true); emit bytesWritten(bytes); - inBytesWritten = false; } } } |