From 70e6e9fe590590f602dee230a64870365d9301aa Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 17 Sep 2019 07:35:26 -0700 Subject: Filesystem: avoid crashes on exit in case the locale codec is null On exit, QLocale::codecForLocale() can return null as the codec may have already been destroyed. In that case, pretend that Latin1 was the locale, so any file name is acceptable. This matches QString: QTextCodec *codec = QTextCodec::codecForLocale(); if (codec) return codec->toUnicode(str, size); #endif // textcodec return fromLatin1(str, size); Note that if we're wrong and the locale was *not* Latin1, files that you had a name to may not be encoded or decoded the same way. Fixes: QTBUG-78446 Change-Id: Iece6e011237e4ab284ecfffd15c54077728a17ca Reviewed-by: Edward Welbourne --- src/corelib/io/qfilesystemiterator_unix.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/io/qfilesystemiterator_unix.cpp b/src/corelib/io/qfilesystemiterator_unix.cpp index 92ebdf0341..0d178d062a 100644 --- a/src/corelib/io/qfilesystemiterator_unix.cpp +++ b/src/corelib/io/qfilesystemiterator_unix.cpp @@ -69,7 +69,9 @@ static bool checkNameDecodable(const char *d_name, qsizetype len) # ifdef QT_LOCALE_IS_UTF8 int mibEnum = 106; # else - int mibEnum = codec->mibEnum(); + int mibEnum = 4; // Latin 1 + if (codec) + mibEnum = codec->mibEnum(); # endif if (Q_LIKELY(mibEnum == 106)) // UTF-8 return QUtf8::isValidUtf8(d_name, len).isValidUtf8; -- cgit v1.2.3 From 1872d1a41de0d4994c799c8d7dd4e72aaf49c677 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 28 Jul 2019 08:05:44 -0700 Subject: Doc: Q_FLAG should be applied to the enum, not the QFlags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit moc extracts he name that is inthe Q_FLAG macro and that gets used in qDebug(). As the documentation described, qDebug would have printed: QFlags(QLibrary::ResolveAllSymbolsHint) which doesn't compile (though we could have partially specialized QFlags> to be QFlags). The semantically correct output is: QFlags(QLibrary::ResolveAllSymbolsHint) which is what this change gets. The ideal output would be: LoadHints(QLibrary::ResolveAllSymbolsHint) But that's not a doc change. Fixes: QTBUG-77216 Change-Id: I0635172f4f2a4c51a435fffd15b59a859886e90c Reviewed-by: MÃ¥rten Nordheim --- src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp b/src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp index 1e31a5292f..1966f8195a 100644 --- a/src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp @@ -416,7 +416,7 @@ public: LoadArchiveMemberHint = 0x04 }; Q_DECLARE_FLAGS(LoadHints, LoadHint) - Q_FLAG(LoadHints) + Q_FLAG(LoadHint) ... } //! [39] -- cgit v1.2.3 From abfac029ceaf6c3199694a505f312ace347b8245 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 14 Aug 2019 10:34:18 -0700 Subject: QFileInfo: clarify documentation about handling of symlink attributes On Windows, shortcut ".lnk" files are treated as symlinks, and attribute queries on a shortcut file return the results for the shortcut target. Fixes: QTBUG-77523 Change-Id: I907a43cd9a714da288a2fffd15bada7eba37d3ba Reviewed-by: Volker Hilsheimer --- src/corelib/io/qfileinfo.cpp | 86 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 75 insertions(+), 11 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp index 998382021d..82d848eba0 100644 --- a/src/corelib/io/qfileinfo.cpp +++ b/src/corelib/io/qfileinfo.cpp @@ -249,17 +249,18 @@ QDateTime &QFileInfoPrivate::getFileTime(QAbstractFileEngine::FileTime request) isSymLink(). The symLinkTarget() function provides the name of the file the symlink points to. - On Unix (including \macos and iOS), the symlink has the same size() has - the file it points to, because Unix handles symlinks - transparently; similarly, opening a symlink using QFile - effectively opens the link's target. For example: + On Unix (including \macos and iOS), the property getter functions in this + class return the properties such as times and size of the target file, not + the symlink, because Unix handles symlinks transparently. Opening a symlink + using QFile effectively opens the link's target. For example: \snippet code/src_corelib_io_qfileinfo.cpp 0 - On Windows, symlinks (shortcuts) are \c .lnk files. The reported - size() is that of the symlink (not the link's target), and - opening a symlink using QFile opens the \c .lnk file. For - example: + On Windows, symlinks (shortcuts) are \c .lnk files. Similarly to Unix + systems, the property getters return the size of the targeted file, not + the \c .lnk file itself. Please note this behavior is deprecated and will + likely be removed in a future version of Qt, after which \c .lnk files will + be treated as regular files. \snippet code/src_corelib_io_qfileinfo.cpp 1 @@ -904,6 +905,9 @@ QDir QFileInfo::absoluteDir() const /*! Returns \c true if the user can read the file; otherwise returns \c false. + If the file is a symlink, this function returns true if the target is + readable (not the symlink). + \note If the \l{NTFS permissions} check has not been enabled, the result on Windows will merely reflect whether the file exists. @@ -921,6 +925,9 @@ bool QFileInfo::isReadable() const /*! Returns \c true if the user can write to the file; otherwise returns \c false. + If the file is a symlink, this function returns true if the target is + writeable (not the symlink). + \note If the \l{NTFS permissions} check has not been enabled, the result on Windows will merely reflect whether the file is marked as Read Only. @@ -938,6 +945,9 @@ bool QFileInfo::isWritable() const /*! Returns \c true if the file is executable; otherwise returns \c false. + If the file is a symlink, this function returns true if the target is + executable (not the symlink). + \sa isReadable(), isWritable(), permission() */ bool QFileInfo::isExecutable() const @@ -952,8 +962,13 @@ bool QFileInfo::isExecutable() const /*! Returns \c true if this is a `hidden' file; otherwise returns \c false. - \b{Note:} This function returns \c true for the special entries - "." and ".." on Unix, even though QDir::entryList threats them as shown. + \b{Note:} This function returns \c true for the special entries "." and + ".." on Unix, even though QDir::entryList threats them as shown. And note + that, since this function inspects the file name, on Unix it will inspect + the name of the symlink, if this file is a symlink, not the target's name. + + On Windows, this function returns \c true if the target file is hidden (not + the symlink). */ bool QFileInfo::isHidden() const { @@ -992,6 +1007,9 @@ bool QFileInfo::isNativePath() const link to a file. Returns \c false if the object points to something which isn't a file, such as a directory. + If the file is a symlink, this function returns true if the target is a + regular file (not the symlink). + \sa isDir(), isSymLink(), isBundle() */ bool QFileInfo::isFile() const @@ -1007,6 +1025,9 @@ bool QFileInfo::isFile() const Returns \c true if this object points to a directory or to a symbolic link to a directory; otherwise returns \c false. + If the file is a symlink, this function returns true if the target is a + directory (not the symlink). + \sa isFile(), isSymLink(), isBundle() */ bool QFileInfo::isDir() const @@ -1024,6 +1045,9 @@ bool QFileInfo::isDir() const Returns \c true if this object points to a bundle or to a symbolic link to a bundle on \macos and iOS; otherwise returns \c false. + If the file is a symlink, this function returns true if the target is a + bundle (not the symlink). + \sa isDir(), isSymLink(), isFile() */ bool QFileInfo::isBundle() const @@ -1045,7 +1069,8 @@ bool QFileInfo::isBundle() const the \l{symLinkTarget()}{link's target}. In addition, true will be returned for shortcuts (\c *.lnk files) on - Windows. Opening those will open the \c .lnk file itself. + Windows. This behavior is deprecated and will likely change in a future + version of Qt. Opening those will open the \c .lnk file itself. Example: @@ -1136,6 +1161,9 @@ QString QFileInfo::symLinkTarget() const milliseconds). On Windows, it will return an empty string unless the \l{NTFS permissions} check has been enabled. + If the file is a symlink, this function returns the owner of the target + (not the symlink). + \sa ownerId(), group(), groupId() */ QString QFileInfo::owner() const @@ -1152,6 +1180,9 @@ QString QFileInfo::owner() const On Windows and on systems where files do not have owners this function returns ((uint) -2). + If the file is a symlink, this function returns the id of the owner of the target + (not the symlink). + \sa owner(), group(), groupId() */ uint QFileInfo::ownerId() const @@ -1171,6 +1202,9 @@ uint QFileInfo::ownerId() const This function can be time consuming under Unix (in the order of milliseconds). + If the file is a symlink, this function returns the owning group of the + target (not the symlink). + \sa groupId(), owner(), ownerId() */ QString QFileInfo::group() const @@ -1187,6 +1221,9 @@ QString QFileInfo::group() const On Windows and on systems where files do not have groups this function always returns (uint) -2. + If the file is a symlink, this function returns the id of the group owning the + target (not the symlink). + \sa group(), owner(), ownerId() */ uint QFileInfo::groupId() const @@ -1212,6 +1249,9 @@ uint QFileInfo::groupId() const Example: \snippet code/src_corelib_io_qfileinfo.cpp 10 + If the file is a symlink, this function checks the permissions of the + target (not the symlink). + \sa isReadable(), isWritable(), isExecutable() */ bool QFileInfo::permission(QFile::Permissions permissions) const @@ -1234,6 +1274,9 @@ bool QFileInfo::permission(QFile::Permissions permissions) const \note The result might be inaccurate on Windows if the \l{NTFS permissions} check has not been enabled. + + If the file is a symlink, this function returns the permissions of the + target (not the symlink). */ QFile::Permissions QFileInfo::permissions() const { @@ -1251,6 +1294,9 @@ QFile::Permissions QFileInfo::permissions() const Returns the file size in bytes. If the file does not exist or cannot be fetched, 0 is returned. + If the file is a symlink, the size of the target file is returned + (not the symlink). + \sa exists() */ qint64 QFileInfo::size() const @@ -1280,6 +1326,9 @@ qint64 QFileInfo::size() const the time the file was created, metadataChangeTime() to get the time its metadata was last changed, or lastModified() to get the time it was last modified. + If the file is a symlink, the time of the target file is returned + (not the symlink). + \sa birthTime(), metadataChangeTime(), lastModified(), lastRead() */ QDateTime QFileInfo::created() const @@ -1298,6 +1347,9 @@ QDateTime QFileInfo::created() const If the file birth time is not available, this function returns an invalid QDateTime. + If the file is a symlink, the time of the target file is returned + (not the symlink). + \sa lastModified(), lastRead(), metadataChangeTime() */ QDateTime QFileInfo::birthTime() const @@ -1312,6 +1364,9 @@ QDateTime QFileInfo::birthTime() const user writes or sets inode information (for example, changing the file permissions). + If the file is a symlink, the time of the target file is returned + (not the symlink). + \sa lastModified(), lastRead() */ QDateTime QFileInfo::metadataChangeTime() const @@ -1322,6 +1377,9 @@ QDateTime QFileInfo::metadataChangeTime() const /*! Returns the date and local time when the file was last modified. + If the file is a symlink, the time of the target file is returned + (not the symlink). + \sa birthTime(), lastRead(), metadataChangeTime(), fileTime() */ QDateTime QFileInfo::lastModified() const @@ -1335,6 +1393,9 @@ QDateTime QFileInfo::lastModified() const On platforms where this information is not available, returns the same as lastModified(). + If the file is a symlink, the time of the target file is returned + (not the symlink). + \sa birthTime(), lastModified(), metadataChangeTime(), fileTime() */ QDateTime QFileInfo::lastRead() const @@ -1348,6 +1409,9 @@ QDateTime QFileInfo::lastRead() const Returns the file time specified by \a time. If the time cannot be determined, an invalid date time is returned. + If the file is a symlink, the time of the target file is returned + (not the symlink). + \sa QFile::FileTime, QDateTime::isValid() */ QDateTime QFileInfo::fileTime(QFile::FileTime time) const -- cgit v1.2.3 From 5839714d986f28412c9f9ed4801d1bf9378f7b51 Mon Sep 17 00:00:00 2001 From: Dmitry Kazakov Date: Thu, 5 Sep 2019 10:23:08 +0300 Subject: Fix QRandomGenerator initialization on AMD CPUs Some AMD CPUs (e.g. AMD A4-6250J and AMD Ryzen 3000-series) have a failing random generation instruction, which always returns 0xffffffff, even when generation was "successful". This code checks if hardware random generator generates four consecutive equal numbers. If it does, then we probably have a failing one and should disable it completely. Change-Id: I38c87920ca2e8cce4143afbff5e453ce3845d11a Fixes: QTBUG-69423 Reviewed-by: Edward Welbourne --- src/corelib/global/qrandom.cpp | 45 ++-------------------------- src/corelib/global/qrandom_p.h | 8 ----- src/corelib/tools/qsimd.cpp | 68 ++++++++++++++++++++++++++++++++++++++++++ src/corelib/tools/qsimd_p.h | 18 +++++++++++ 4 files changed, 88 insertions(+), 51 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qrandom.cpp b/src/corelib/global/qrandom.cpp index fa26d54afa..b150a29b88 100644 --- a/src/corelib/global/qrandom.cpp +++ b/src/corelib/global/qrandom.cpp @@ -90,47 +90,6 @@ DECLSPEC_IMPORT BOOLEAN WINAPI SystemFunction036(PVOID RandomBuffer, ULONG Rando QT_BEGIN_NAMESPACE -#if defined(Q_PROCESSOR_X86) && QT_COMPILER_SUPPORTS_HERE(RDRND) -static qsizetype qt_random_cpu(void *buffer, qsizetype count) Q_DECL_NOTHROW; - -# ifdef Q_PROCESSOR_X86_64 -# define _rdrandXX_step _rdrand64_step -# else -# define _rdrandXX_step _rdrand32_step -# endif - -static QT_FUNCTION_TARGET(RDRND) qsizetype qt_random_cpu(void *buffer, qsizetype count) Q_DECL_NOTHROW -{ - unsigned *ptr = reinterpret_cast(buffer); - unsigned *end = ptr + count; - int retries = 10; - - while (ptr + sizeof(qregisteruint)/sizeof(*ptr) <= end) { - if (_rdrandXX_step(reinterpret_cast(ptr))) - ptr += sizeof(qregisteruint)/sizeof(*ptr); - else if (--retries == 0) - goto out; - } - - while (sizeof(*ptr) != sizeof(qregisteruint) && ptr != end) { - bool ok = _rdrand32_step(ptr); - if (!ok && --retries) - continue; - if (ok) - ++ptr; - break; - } - -out: - return ptr - reinterpret_cast(buffer); -} -#else -static qsizetype qt_random_cpu(void *, qsizetype) -{ - return 0; -} -#endif - enum { // may be "overridden" by a member enum FillBufferNoexcept = true @@ -371,8 +330,8 @@ Q_NEVER_INLINE void QRandomGenerator::SystemGenerator::generate(quint32 *begin, } qsizetype filled = 0; - if (qt_has_hwrng() && (uint(qt_randomdevice_control) & SkipHWRNG) == 0) - filled += qt_random_cpu(buffer, count); + if (qHasHwrng() && (uint(qt_randomdevice_control) & SkipHWRNG) == 0) + filled += qRandomCpu(buffer, count); if (filled != count && (uint(qt_randomdevice_control) & SkipSystemRNG) == 0) { qsizetype bytesFilled = diff --git a/src/corelib/global/qrandom_p.h b/src/corelib/global/qrandom_p.h index 917a91098e..4a0adff51c 100644 --- a/src/corelib/global/qrandom_p.h +++ b/src/corelib/global/qrandom_p.h @@ -79,14 +79,6 @@ extern Q_CORE_EXPORT QBasicAtomicInteger qt_randomdevice_control; enum { qt_randomdevice_control = 0 }; #endif -inline bool qt_has_hwrng() -{ -#if defined(Q_PROCESSOR_X86) && QT_COMPILER_SUPPORTS_HERE(RDRND) - return qCpuHasFeature(RDRND); -#else - return false; -#endif -} QT_END_NAMESPACE diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp index ddd715f745..09c276c4e0 100644 --- a/src/corelib/tools/qsimd.cpp +++ b/src/corelib/tools/qsimd.cpp @@ -376,6 +376,38 @@ static quint64 detectProcessorFeatures() features &= ~AllAVX512; } +#if defined(Q_PROCESSOR_X86) && QT_COMPILER_SUPPORTS_HERE(RDRND) + /** + * Some AMD CPUs (e.g. AMD A4-6250J and AMD Ryzen 3000-series) have a + * failing random generation instruction, which always returns + * 0xffffffff, even when generation was "successful". + * + * This code checks if hardware random generator generates four consecutive + * equal numbers. If it does, then we probably have a failing one and + * should disable it completely. + * + * https://bugreports.qt.io/browse/QTBUG-69423 + */ + if (features & CpuFeatureRDRND) { + const qsizetype testBufferSize = 4; + unsigned testBuffer[4] = {}; + + const qsizetype generated = qRandomCpu(testBuffer, testBufferSize); + + if (Q_UNLIKELY(generated == testBufferSize && + testBuffer[0] == testBuffer[1] && + testBuffer[1] == testBuffer[2] && + testBuffer[2] == testBuffer[3])) { + + fprintf(stderr, "WARNING: CPU random generator seem to be failing, disable hardware random number generation\n"); + fprintf(stderr, "WARNING: RDRND generated: 0x%x 0x%x 0x%x 0x%x\n", + testBuffer[0], testBuffer[1], testBuffer[2], testBuffer[3]); + + features &= ~CpuFeatureRDRND; + } + } +#endif + return features; } @@ -590,4 +622,40 @@ void qDumpCPUFeatures() puts(""); } +#if defined(Q_PROCESSOR_X86) && QT_COMPILER_SUPPORTS_HERE(RDRND) + +# ifdef Q_PROCESSOR_X86_64 +# define _rdrandXX_step _rdrand64_step +# else +# define _rdrandXX_step _rdrand32_step +# endif + +QT_FUNCTION_TARGET(RDRND) qsizetype qRandomCpu(void *buffer, qsizetype count) Q_DECL_NOTHROW +{ + unsigned *ptr = reinterpret_cast(buffer); + unsigned *end = ptr + count; + int retries = 10; + + while (ptr + sizeof(qregisteruint)/sizeof(*ptr) <= end) { + if (_rdrandXX_step(reinterpret_cast(ptr))) + ptr += sizeof(qregisteruint)/sizeof(*ptr); + else if (--retries == 0) + goto out; + } + + while (sizeof(*ptr) != sizeof(qregisteruint) && ptr != end) { + bool ok = _rdrand32_step(ptr); + if (!ok && --retries) + continue; + if (ok) + ++ptr; + break; + } + +out: + return ptr - reinterpret_cast(buffer); +} +#endif + + QT_END_NAMESPACE diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index c36e1e484f..d603631a24 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -346,6 +346,15 @@ extern Q_CORE_EXPORT QBasicAtomicInteger qt_cpu_features[2]; #endif Q_CORE_EXPORT quint64 qDetectCpuFeatures(); +#if defined(Q_PROCESSOR_X86) && QT_COMPILER_SUPPORTS_HERE(RDRND) +Q_CORE_EXPORT qsizetype qRandomCpu(void *, qsizetype) Q_DECL_NOTHROW; +#else +static inline qsizetype qRandomCpu(void *, qsizetype) Q_DECL_NOTHROW +{ + return 0; +} +#endif + static inline quint64 qCpuFeatures() { quint64 features = qt_cpu_features[0].load(); @@ -362,6 +371,15 @@ static inline quint64 qCpuFeatures() #define qCpuHasFeature(feature) (((qCompilerCpuFeatures & CpuFeature ## feature) == CpuFeature ## feature) \ || ((qCpuFeatures() & CpuFeature ## feature) == CpuFeature ## feature)) +inline bool qHasHwrng() +{ +#if defined(Q_PROCESSOR_X86) && QT_COMPILER_SUPPORTS_HERE(RDRND) + return qCpuHasFeature(RDRND); +#else + return false; +#endif +} + #define ALIGNMENT_PROLOGUE_16BYTES(ptr, i, length) \ for (; i < static_cast(qMin(static_cast(length), ((4 - ((reinterpret_cast(ptr) >> 2) & 0x3)) & 0x3))); ++i) -- cgit v1.2.3 From d35de9e1b250ce46739dcb6afb9ae8a0247195c7 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 19 Sep 2019 09:12:39 +0200 Subject: Windows/MinGW: Fix posted events timer not stopping Specify the type of the enum value SendPostedEventsWindowsTimerId to be UINT_PTR to work with the g++ interpretation of enumeration signedness and use the correct type for the returned timer id. Fixes: QTBUG-78491 Change-Id: I7b3f306d3f60da7a21500ece5243ac90854ccf1a Reviewed-by: Thiago Macieira --- src/corelib/kernel/qeventdispatcher_win.cpp | 7 +++++-- src/corelib/kernel/qeventdispatcher_win_p.h | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index 685d765adb..8ff7637b7e 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -83,7 +83,10 @@ enum { WM_QT_SOCKETNOTIFIER = WM_USER, WM_QT_SENDPOSTEDEVENTS = WM_USER + 1, WM_QT_ACTIVATENOTIFIERS = WM_USER + 2, - SendPostedEventsWindowsTimerId = ~1u +}; + +enum : UINT_PTR { + SendPostedEventsWindowsTimerId = ~UINT_PTR(1) }; class QEventDispatcherWin32Private; @@ -278,7 +281,7 @@ LRESULT QT_WIN_CALLBACK qt_GetMessageHook(int code, WPARAM wp, LPARAM lp) // no more input or timer events in the message queue, we can allow posted events to be sent normally now if (d->sendPostedEventsWindowsTimerId != 0) { // stop the timer to send posted events, since we now allow the WM_QT_SENDPOSTEDEVENTS message - KillTimer(d->internalHwnd, d->sendPostedEventsWindowsTimerId); + KillTimer(d->internalHwnd, SendPostedEventsWindowsTimerId); d->sendPostedEventsWindowsTimerId = 0; } (void) d->wakeUps.fetchAndStoreRelease(0); diff --git a/src/corelib/kernel/qeventdispatcher_win_p.h b/src/corelib/kernel/qeventdispatcher_win_p.h index dbad2a5450..a3a0cd1c2f 100644 --- a/src/corelib/kernel/qeventdispatcher_win_p.h +++ b/src/corelib/kernel/qeventdispatcher_win_p.h @@ -173,7 +173,8 @@ public: // for controlling when to send posted events QAtomicInt serialNumber; - int lastSerialNumber, sendPostedEventsWindowsTimerId; + int lastSerialNumber; + UINT_PTR sendPostedEventsWindowsTimerId; QAtomicInt wakeUps; // timers -- cgit v1.2.3 From 46201f0e82a7b1629adad196dfa8f7ff1cf4dffd Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Sat, 28 Sep 2019 15:52:45 +0200 Subject: QVarLengthArray: Avoid int vs. size_t warnings in operator= Change-Id: I879b62c55e4211d3e4e1a18f6699f26e3f5de1f8 Reviewed-by: Thiago Macieira --- src/corelib/tools/qvarlengtharray.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h index 597e7464cb..ef3a9884bf 100644 --- a/src/corelib/tools/qvarlengtharray.h +++ b/src/corelib/tools/qvarlengtharray.h @@ -99,7 +99,7 @@ public: #ifdef Q_COMPILER_INITIALIZER_LISTS QVarLengthArray &operator=(std::initializer_list list) { - resize(list.size()); + resize(int(list.size())); // ### q6sizetype std::copy(list.begin(), list.end(), QT_MAKE_CHECKED_ARRAY_ITERATOR(this->begin(), this->size())); return *this; -- cgit v1.2.3