From 88851fb3b0439e3eac197538bf76f4050a7ac018 Mon Sep 17 00:00:00 2001 From: David Faure Date: Sun, 22 Feb 2015 20:02:29 +0100 Subject: QLockFile: use QCoreApplication::applicationName. Unlike qAppName, it doesn't require a QCoreApplication instance, making QLockFile usable in destructors of global statics. This also uses the value passed to setApplicationName if called rather than always argv[0]. Change-Id: I40446aba410db42d7cfe6b4408878faf435246f7 Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira --- src/corelib/io/qlockfile_unix.cpp | 2 +- src/corelib/io/qlockfile_win.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/io/qlockfile_unix.cpp b/src/corelib/io/qlockfile_unix.cpp index 1c8da607a7..c663681aaa 100644 --- a/src/corelib/io/qlockfile_unix.cpp +++ b/src/corelib/io/qlockfile_unix.cpp @@ -137,7 +137,7 @@ QLockFile::LockError QLockFilePrivate::tryLock_sys() // (otherwise we'd have to check every write call) // Use operator% from the fast builder to avoid multiple memory allocations. QByteArray fileData = QByteArray::number(QCoreApplication::applicationPid()) % '\n' - % qAppName().toUtf8() % '\n' + % QCoreApplication::applicationName().toUtf8() % '\n' % localHostName() % '\n'; const QByteArray lockFileName = QFile::encodeName(fileName); diff --git a/src/corelib/io/qlockfile_win.cpp b/src/corelib/io/qlockfile_win.cpp index 95d952c918..a36e6e93b8 100644 --- a/src/corelib/io/qlockfile_win.cpp +++ b/src/corelib/io/qlockfile_win.cpp @@ -94,7 +94,7 @@ QLockFile::LockError QLockFilePrivate::tryLock_sys() QByteArray fileData; fileData += QByteArray::number(QCoreApplication::applicationPid()); fileData += '\n'; - fileData += qAppName().toUtf8(); + fileData += QCoreApplication::applicationName().toUtf8(); fileData += '\n'; fileData += localHostName(); fileData += '\n'; -- cgit v1.2.3 From bb5d287cc3eb68e1e46e5c3eb0a2c3991900354d Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 16 Mar 2015 13:10:27 +0100 Subject: Windows: Don't cause a malloc before calling GetLastError() When creating a string it would cause a malloc which would reset GetLastError() so we need to ensure that GetLastError() is the first thing it calls if a Windows API call fails. Task-number: QTBUG-27765 Change-Id: I5cc4ce59aa1f03a0ec978fe54949a7931a225d52 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/kernel/qsharedmemory_android.cpp | 2 +- src/corelib/kernel/qsharedmemory_p.h | 2 +- src/corelib/kernel/qsharedmemory_posix.cpp | 4 ++-- src/corelib/kernel/qsharedmemory_systemv.cpp | 4 ++-- src/corelib/kernel/qsharedmemory_unix.cpp | 2 +- src/corelib/kernel/qsharedmemory_win.cpp | 8 ++++---- 6 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/kernel/qsharedmemory_android.cpp b/src/corelib/kernel/qsharedmemory_android.cpp index f7511ea8b7..cdcd5685e0 100644 --- a/src/corelib/kernel/qsharedmemory_android.cpp +++ b/src/corelib/kernel/qsharedmemory_android.cpp @@ -47,7 +47,7 @@ QSharedMemoryPrivate::QSharedMemoryPrivate() { } -void QSharedMemoryPrivate::setErrorString(const QString &function) +void QSharedMemoryPrivate::setErrorString(QLatin1String function) { Q_UNUSED(function); qWarning() << Q_FUNC_INFO << "Not yet implemented on Android"; diff --git a/src/corelib/kernel/qsharedmemory_p.h b/src/corelib/kernel/qsharedmemory_p.h index 0308dde57f..2bcc0d4f6a 100644 --- a/src/corelib/kernel/qsharedmemory_p.h +++ b/src/corelib/kernel/qsharedmemory_p.h @@ -133,7 +133,7 @@ public: bool attach(QSharedMemory::AccessMode mode); bool detach(); - void setErrorString(const QString &function); + void setErrorString(QLatin1String function); #ifndef QT_NO_SYSTEMSEMAPHORE bool tryLocker(QSharedMemoryLocker *locker, const QString &function) { diff --git a/src/corelib/kernel/qsharedmemory_posix.cpp b/src/corelib/kernel/qsharedmemory_posix.cpp index 74f98a158a..1142d3223c 100644 --- a/src/corelib/kernel/qsharedmemory_posix.cpp +++ b/src/corelib/kernel/qsharedmemory_posix.cpp @@ -94,7 +94,7 @@ bool QSharedMemoryPrivate::create(int size) #endif if (fd == -1) { const int errorNumber = errno; - const QString function = QLatin1String("QSharedMemory::create"); + const QLatin1String function("QSharedMemory::attach (shm_open)"); switch (errorNumber) { case ENAMETOOLONG: case EINVAL: @@ -138,7 +138,7 @@ bool QSharedMemoryPrivate::attach(QSharedMemory::AccessMode mode) #endif if (hand == -1) { const int errorNumber = errno; - const QString function = QLatin1String("QSharedMemory::attach (shm_open)"); + const QLatin1String function("QSharedMemory::attach (shm_open)"); switch (errorNumber) { case ENAMETOOLONG: case EINVAL: diff --git a/src/corelib/kernel/qsharedmemory_systemv.cpp b/src/corelib/kernel/qsharedmemory_systemv.cpp index 953747e41d..29fee12c0b 100644 --- a/src/corelib/kernel/qsharedmemory_systemv.cpp +++ b/src/corelib/kernel/qsharedmemory_systemv.cpp @@ -149,7 +149,7 @@ bool QSharedMemoryPrivate::create(int size) // create if (-1 == shmget(unix_key, size, 0600 | IPC_CREAT | IPC_EXCL)) { - QString function = QLatin1String("QSharedMemory::create"); + const QLatin1String function("QSharedMemory::create"); switch (errno) { case EINVAL: errorString = QSharedMemory::tr("%1: system-imposed size restrictions").arg(QLatin1String("QSharedMemory::handle")); @@ -199,7 +199,7 @@ bool QSharedMemoryPrivate::detach() { // detach from the memory segment if (-1 == shmdt(memory)) { - QString function = QLatin1String("QSharedMemory::detach"); + const QLatin1String function("QSharedMemory::detach"); switch (errno) { case EINVAL: errorString = QSharedMemory::tr("%1: not attached").arg(function); diff --git a/src/corelib/kernel/qsharedmemory_unix.cpp b/src/corelib/kernel/qsharedmemory_unix.cpp index 92184a619b..ec6223142f 100644 --- a/src/corelib/kernel/qsharedmemory_unix.cpp +++ b/src/corelib/kernel/qsharedmemory_unix.cpp @@ -71,7 +71,7 @@ QSharedMemoryPrivate::QSharedMemoryPrivate() { } -void QSharedMemoryPrivate::setErrorString(const QString &function) +void QSharedMemoryPrivate::setErrorString(QLatin1String function) { // EINVAL is handled in functions so they can give better error strings switch (errno) { diff --git a/src/corelib/kernel/qsharedmemory_win.cpp b/src/corelib/kernel/qsharedmemory_win.cpp index 8e094cb458..4d37368b2e 100644 --- a/src/corelib/kernel/qsharedmemory_win.cpp +++ b/src/corelib/kernel/qsharedmemory_win.cpp @@ -47,9 +47,9 @@ QSharedMemoryPrivate::QSharedMemoryPrivate() : QObjectPrivate(), { } -void QSharedMemoryPrivate::setErrorString(const QString &function) +void QSharedMemoryPrivate::setErrorString(QLatin1String function) { - BOOL windowsError = GetLastError(); + DWORD windowsError = GetLastError(); if (windowsError == 0) return; switch (windowsError) { @@ -91,7 +91,7 @@ void QSharedMemoryPrivate::setErrorString(const QString &function) HANDLE QSharedMemoryPrivate::handle() { if (!hand) { - QString function = QLatin1String("QSharedMemory::handle"); + const QLatin1String function("QSharedMemory::handle"); if (nativeKey.isEmpty()) { error = QSharedMemory::KeyError; errorString = QSharedMemory::tr("%1: unable to make key").arg(function); @@ -130,7 +130,7 @@ bool QSharedMemoryPrivate::cleanHandle() bool QSharedMemoryPrivate::create(int size) { - QString function = QLatin1String("QSharedMemory::create"); + const QLatin1String function("QSharedMemory::create"); if (nativeKey.isEmpty()) { error = QSharedMemory::KeyError; errorString = QSharedMemory::tr("%1: key error").arg(function); -- cgit v1.2.3 From 59c402417122e2ec2ee3c49b5768646581103d47 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Sat, 14 Mar 2015 12:41:10 +0100 Subject: QDebug operator for Q_FLAG when the QFlags itself is registered Currently, IsQEnumHelper returns true also if QFlags is registered as a Q_FLAG. But this is going to be changed in the next commit. For the QDebug operator to continue to work even when the QFlags is registered and not the T, we need to take it into account in the QEnableIf condition Change-Id: If1fcffd133aa20ba95a07e2bfaaa308896ab01b0 Reviewed-by: Friedemann Kleint Reviewed-by: Thiago Macieira --- src/corelib/io/qdebug.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h index 7f1cb82f3a..89e2bb0afd 100644 --- a/src/corelib/io/qdebug.h +++ b/src/corelib/io/qdebug.h @@ -275,7 +275,10 @@ operator<<(QDebug dbg, T value) } template -inline typename QtPrivate::QEnableIf::Value, QDebug>::Type operator<<(QDebug debug, const QFlags &flags) +inline typename QtPrivate::QEnableIf< + QtPrivate::IsQEnumHelper::Value || QtPrivate::IsQEnumHelper >::Value, + QDebug>::Type +operator<<(QDebug debug, const QFlags &flags) { const QMetaObject *obj = qt_getEnumMetaObject(T()); const char *name = qt_getEnumName(T()); @@ -283,7 +286,10 @@ inline typename QtPrivate::QEnableIf::Value, QDebug> } template -inline typename QtPrivate::QEnableIf::Value, QDebug>::Type operator<<(QDebug debug, const QFlags &flags) +inline typename QtPrivate::QEnableIf< + !QtPrivate::IsQEnumHelper::Value && !QtPrivate::IsQEnumHelper >::Value, + QDebug>::Type +operator<<(QDebug debug, const QFlags &flags) #else // !QT_NO_QOBJECT template inline QDebug operator<<(QDebug debug, const QFlags &flags) -- cgit v1.2.3 From 7c77013c7f6ec57cd1b1faf3b480c40a619067c8 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Sun, 22 Feb 2015 10:02:08 +0100 Subject: Fix source incompatibility while connecting signals with forward declared arguments QObject::connect tries to determine if the arguments are registered metatypes. This used to work even for arguments that were forward declared. But now, the metatype system tries to call QtPrivate::IsQEnumHelper::Value to know if it is registered. That fails on gcc if T is forward declared. Apparently gcc needs to know the full type of T to pass it in the ellipsis function, even within a sizeof expression. So change the ellipsis expression to a template one. Task-number: QTBUG-44496 Change-Id: I7fa07bd3cde470b134c2ec53b0d581333d16a6f1 Reviewed-by: Thiago Macieira --- src/corelib/kernel/qmetatype.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index 2c2dbeef9d..55f8fc9b2c 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -1364,15 +1364,15 @@ namespace QtPrivate enum { Value = sizeof(checkType(static_cast(0))) == sizeof(void*) }; }; - char qt_getEnumMetaObject(...); - char qt_getEnumMetaObject(); // Workaround bugs in MSVC. + template char qt_getEnumMetaObject(const T&); template struct IsQEnumHelper { static const T &declval(); - // If the type was declared with Q_ENUM, the friend qt_getEnumMetaObject(T) declared in the + // If the type was declared with Q_ENUM, the friend qt_getEnumMetaObject() declared in the // Q_ENUM macro will be chosen by ADL, and the return type will be QMetaObject*. - // Otherwise the chosen overload will be qt_getEnumMetaObject(...) which returne 'char' + // Otherwise the chosen overload will be the catch all template function + // qt_getEnumMetaObject(T) which returns 'char' enum { Value = sizeof(qt_getEnumMetaObject(declval())) == sizeof(QMetaObject*) }; }; -- cgit v1.2.3 From 75cb6f59f1f55f3494bc601bcafc93fcdce58a19 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 11 Mar 2015 14:47:48 +0100 Subject: Add QJsonValueRef::toVariant() to better mirror the API of QJsonValue Task-number: QTBUG-43686 Change-Id: I83edecf5226d44980a8a442a512a13ab9b2ac6a9 Reviewed-by: Thiago Macieira --- src/corelib/json/qjsonvalue.cpp | 5 +++++ src/corelib/json/qjsonvalue.h | 1 + 2 files changed, 6 insertions(+) (limited to 'src/corelib') diff --git a/src/corelib/json/qjsonvalue.cpp b/src/corelib/json/qjsonvalue.cpp index c8ddfbc2cc..ae6a3678bd 100644 --- a/src/corelib/json/qjsonvalue.cpp +++ b/src/corelib/json/qjsonvalue.cpp @@ -704,6 +704,11 @@ QJsonValueRef &QJsonValueRef::operator =(const QJsonValueRef &ref) return *this; } +QVariant QJsonValueRef::toVariant() const +{ + return toValue().toVariant(); +} + QJsonArray QJsonValueRef::toArray() const { return toValue().toArray(); diff --git a/src/corelib/json/qjsonvalue.h b/src/corelib/json/qjsonvalue.h index b7e77e4b19..372ae85290 100644 --- a/src/corelib/json/qjsonvalue.h +++ b/src/corelib/json/qjsonvalue.h @@ -146,6 +146,7 @@ public: QJsonValueRef &operator = (const QJsonValue &val); QJsonValueRef &operator = (const QJsonValueRef &val); + QVariant toVariant() const; inline QJsonValue::Type type() const { return toValue().type(); } inline bool isNull() const { return type() == QJsonValue::Null; } inline bool isBool() const { return type() == QJsonValue::Bool; } -- cgit v1.2.3 From ba8c34aaf3683d1502e78ad7a6af700efdeaf0f9 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 11 Mar 2015 15:37:11 +0100 Subject: Fix QCollator::compare documentation We don't guarantee -1, 0 and 1, but simply negative 0 or positive numbers. This is in line with e.g. QString::compare() Task-number: QTBUG-42860 Change-Id: I6009b2eb732ae3b4726cec06ec0eacc2c46a3c93 Reviewed-by: Thiago Macieira --- src/corelib/tools/qcollator.cpp | 13 +++++++------ src/corelib/tools/qcollator_posix.cpp | 3 +-- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qcollator.cpp b/src/corelib/tools/qcollator.cpp index f86318c9c9..9148ecf6fc 100644 --- a/src/corelib/tools/qcollator.cpp +++ b/src/corelib/tools/qcollator.cpp @@ -275,8 +275,8 @@ bool QCollator::ignorePunctuation() const /*! \fn int QCollator::compare(const QString &s1, const QString &s2) const - Compares \a s1 with \a s2. Returns -1, 0 or 1 depending on whether \a s1 is - smaller, equal or larger than \a s2. + Compares \a s1 with \a s2. Returns an integer less than, equal to, or greater than zero + depending on whether \a s1 is smaller, equal or larger than \a s2. */ /*! @@ -288,8 +288,8 @@ bool QCollator::ignorePunctuation() const \fn int QCollator::compare(const QStringRef &s1, const QStringRef &s2) const \overload - Compares \a s1 with \a s2. Returns -1, 0 or 1 depending on whether \a s1 is - smaller, equal or larger than \a s2. + Compares \a s1 with \a s2. Returns an integer less than, equal to, or greater than zero + depending on whether \a s1 is smaller, equal or larger than \a s2. */ /*! @@ -299,8 +299,9 @@ bool QCollator::ignorePunctuation() const Compares \a s1 with \a s2. \a len1 and \a len2 specify the length of the QChar arrays pointer to by \a s1 and \a s2. - Returns -1, 0 or 1 depending on whether \a s1 is smaller, equal or larger than \a s2. - */ + Returns an integer less than, equal to, or greater than zero + depending on whether \a s1 is smaller, equal or larger than \a s2. +*/ /*! \fn QCollatorSortKey QCollator::sortKey(const QString &string) const diff --git a/src/corelib/tools/qcollator_posix.cpp b/src/corelib/tools/qcollator_posix.cpp index 0b755825b7..352ab0ba31 100644 --- a/src/corelib/tools/qcollator_posix.cpp +++ b/src/corelib/tools/qcollator_posix.cpp @@ -78,8 +78,7 @@ int QCollator::compare(const QString &s1, const QString &s2) const QVarLengthArray array1, array2; stringToWCharArray(array1, s1); stringToWCharArray(array2, s2); - int result = std::wcscoll(array1.constData(), array2.constData()); - return result > 0 ? 1 : (result == 0 ? 0 : -1); + return std::wcscoll(array1.constData(), array2.constData()); } int QCollator::compare(const QStringRef &s1, const QStringRef &s2) const -- cgit v1.2.3 From 124da60c1de2cc63ad8692bd3a72e8769c6c1e5a Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 17 Mar 2015 15:16:44 +0100 Subject: Fix support for iso8859-16 when compiling with ICU ICU doesn't support iso8859-16, so we need to fall back to the Qt codec for this encoding. Task-number: QTBUG-45053 Change-Id: I9754cf098c906fe8a75363a3d090029543cd0e35 Reviewed-by: Thiago Macieira --- src/corelib/codecs/codecs.pri | 4 ++-- src/corelib/codecs/qicucodec.cpp | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/codecs/codecs.pri b/src/corelib/codecs/codecs.pri index 86b330c589..bfb677e6fb 100644 --- a/src/corelib/codecs/codecs.pri +++ b/src/corelib/codecs/codecs.pri @@ -3,6 +3,7 @@ HEADERS += \ codecs/qisciicodec_p.h \ codecs/qlatincodec_p.h \ + codecs/qsimplecodec_p.h \ codecs/qtextcodec_p.h \ codecs/qtextcodec.h \ codecs/qtsciicodec_p.h \ @@ -11,6 +12,7 @@ HEADERS += \ SOURCES += \ codecs/qisciicodec.cpp \ codecs/qlatincodec.cpp \ + codecs/qsimplecodec.cpp \ codecs/qtextcodec.cpp \ codecs/qtsciicodec.cpp \ codecs/qutfcodec.cpp @@ -22,7 +24,6 @@ contains(QT_CONFIG,icu) { codecs/qicucodec.cpp } else { HEADERS += \ - codecs/qsimplecodec_p.h \ codecs/qgb18030codec_p.h \ codecs/qeucjpcodec_p.h \ codecs/qjiscodec_p.h \ @@ -31,7 +32,6 @@ contains(QT_CONFIG,icu) { codecs/qbig5codec_p.h SOURCES += \ - codecs/qsimplecodec.cpp \ codecs/qgb18030codec.cpp \ codecs/qjpunicode.cpp \ codecs/qeucjpcodec.cpp \ diff --git a/src/corelib/codecs/qicucodec.cpp b/src/corelib/codecs/qicucodec.cpp index 96d62f7084..65cc337708 100644 --- a/src/corelib/codecs/qicucodec.cpp +++ b/src/corelib/codecs/qicucodec.cpp @@ -40,6 +40,7 @@ #include "qlatincodec_p.h" #include "qtsciicodec_p.h" #include "qisciicodec_p.h" +#include "qsimplecodec_p.h" #include "private/qcoreglobaldata_p.h" #include "qdebug.h" @@ -364,6 +365,8 @@ static QTextCodec *loadQtCodec(const char *name) return new QUtf32BECodec; if (!strcmp(name, "UTF-32LE")) return new QUtf32LECodec; + if (!strcmp(name, "ISO-8859-16") || !strcmp(name, "latin10") || !strcmp(name, "iso-ir-226")) + return new QSimpleTextCodec(13 /* == 8859-16*/); #ifndef QT_NO_CODECS if (!strcmp(name, "TSCII")) return new QTsciiCodec; -- cgit v1.2.3 From 0411240fdaada112d150f28f82973beb15478b1d Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 17 Mar 2015 16:01:05 +0100 Subject: Make sure remove() doesn't corrupt the json object When using non latin keys, remove() could cause corruption of the json object. Task-number: QTBUG-42270 Change-Id: I7305e57ebb78630a9bf68bc4f831a6d1646abb79 Reviewed-by: Thiago Macieira --- src/corelib/json/qjson_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/json/qjson_p.h b/src/corelib/json/qjson_p.h index b8430cabf5..5fc021c841 100644 --- a/src/corelib/json/qjson_p.h +++ b/src/corelib/json/qjson_p.h @@ -629,7 +629,7 @@ public: if (value.latinKey) s += sizeof(ushort) + qFromLittleEndian(*(ushort *) ((const char *)this + sizeof(Entry))); else - s += sizeof(uint) + qFromLittleEndian(*(int *) ((const char *)this + sizeof(Entry))); + s += sizeof(uint) + sizeof(ushort)*qFromLittleEndian(*(int *) ((const char *)this + sizeof(Entry))); return alignedSize(s); } -- cgit v1.2.3 From e7b257c39b3af3a54f458614e7697d71d52d3dc8 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 18 Mar 2015 10:54:22 +0100 Subject: Doc: Fix QVector constructor documentation Change-Id: Ib16df599553e482e981573afadf3c3f4e70ed5b1 Reviewed-by: Leena Miettinen --- src/corelib/tools/qvector.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qvector.cpp b/src/corelib/tools/qvector.cpp index 1bfca44155..d10f82fbb4 100644 --- a/src/corelib/tools/qvector.cpp +++ b/src/corelib/tools/qvector.cpp @@ -229,7 +229,7 @@ /*! \fn QVector::QVector(std::initializer_list args) \since 4.8 - Construct a vector from the std::initilizer_list given by \a args. + Constructs a vector from the std::initializer_list given by \a args. This constructor is only enabled if the compiler supports C++11 initializer lists. -- cgit v1.2.3 From ba287c55ef179b073482453298f513992b54c11e Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 13 Mar 2015 10:33:35 +0100 Subject: Sort the entries in QDir by using the QDateTime::msecsTo() By using the QDateTime::msecsTo to do the sorting it means that if there is support for a precise time on the file system then this ensures it sorts correctly. Change-Id: I00528596908bba7b586aeffe5b0aa81019ff5722 Reviewed-by: Thiago Macieira --- src/corelib/io/qdir.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index c9c6704423..7fa53bd850 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -235,7 +235,7 @@ bool QDirSortItemComparator::operator()(const QDirSortItem &n1, const QDirSortIt firstModified.setTimeSpec(Qt::UTC); secondModified.setTimeSpec(Qt::UTC); - r = firstModified.secsTo(secondModified); + r = firstModified.msecsTo(secondModified); break; } case QDir::Size: -- cgit v1.2.3 From 0a275328904b8b66cc80e36b627a48c35b13c205 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Fri, 20 Mar 2015 17:05:53 +0400 Subject: Introduce icu_dependency.pri Simply to hide the magic bahind the scenes. Change-Id: I69a159eb14712e68117f10e78745bdfbad46b6f2 Reviewed-by: Oswald Buddenhagen --- src/corelib/tools/tools.pri | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index c4c347d6ff..bf20154b56 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -161,23 +161,12 @@ contains(QT_CONFIG, zlib) { } contains(QT_CONFIG,icu) { + include($$PWD/../../3rdparty/icu_dependency.pri) + SOURCES += tools/qlocale_icu.cpp \ tools/qcollator_icu.cpp \ tools/qtimezoneprivate_icu.cpp DEFINES += QT_USE_ICU - win32 { - CONFIG(static, static|shared) { - CONFIG(debug, debug|release) { - LIBS_PRIVATE += -lsicuind -lsicuucd -lsicudtd - } else { - LIBS_PRIVATE += -lsicuin -lsicuuc -lsicudt - } - } else { - LIBS_PRIVATE += -licuin -licuuc -licudt - } - } else { - LIBS_PRIVATE += -licui18n -licuuc -licudata - } } else: win32 { SOURCES += tools/qcollator_win.cpp } else: macx { -- cgit v1.2.3 From b5e0e433cc1288f3176474ff49ccfd69b914c194 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Fri, 20 Mar 2015 17:02:15 +0400 Subject: Build bundled PCRE copy as qt_helper_lib We already have an infrastructure for that. Change-Id: I9110b74dcf7f93362586687da6f112e72cb663a4 Reviewed-by: Oswald Buddenhagen --- src/corelib/tools/tools.pri | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index bf20154b56..5de0c09a4d 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -176,14 +176,10 @@ contains(QT_CONFIG,icu) { } !contains(QT_DISABLED_FEATURES, regularexpression) { + include($$PWD/../../3rdparty/pcre_dependency.pri) + HEADERS += tools/qregularexpression.h SOURCES += tools/qregularexpression.cpp - - pcre { - include($$PWD/../../3rdparty/pcre.pri) - } else { - LIBS_PRIVATE += -lpcre16 - } } INCLUDEPATH += ../3rdparty/harfbuzz/src -- cgit v1.2.3 From 31cd326bec7d94ce0408fcb9e7f71d9f5e4746bc Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Mon, 23 Mar 2015 02:07:14 +0400 Subject: Report a correct Unicode version used by Qt The version bump was forgotten in edfce46a6c0406af749ca7ef659df6315e36cd5d Change-Id: I99501bb314baab68f037417db4b3b14e11f2de02 Reviewed-by: Lars Knoll --- src/corelib/tools/qunicodetables.cpp | 2 +- src/corelib/tools/qunicodetables_p.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qunicodetables.cpp b/src/corelib/tools/qunicodetables.cpp index 6a09abd80f..5f7eee947f 100644 --- a/src/corelib/tools/qunicodetables.cpp +++ b/src/corelib/tools/qunicodetables.cpp @@ -31,7 +31,7 @@ ** ****************************************************************************/ -/* This file is autogenerated from the Unicode 6.2 database. Do not edit */ +/* This file is autogenerated from the Unicode 6.3 database. Do not edit */ #include "qunicodetables_p.h" diff --git a/src/corelib/tools/qunicodetables_p.h b/src/corelib/tools/qunicodetables_p.h index 4199724993..90340bb360 100644 --- a/src/corelib/tools/qunicodetables_p.h +++ b/src/corelib/tools/qunicodetables_p.h @@ -31,7 +31,7 @@ ** ****************************************************************************/ -/* This file is autogenerated from the Unicode 6.2 database. Do not edit */ +/* This file is autogenerated from the Unicode 6.3 database. Do not edit */ // // W A R N I N G @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE -#define UNICODE_DATA_VERSION QChar::Unicode_6_2 +#define UNICODE_DATA_VERSION QChar::Unicode_6_3 namespace QUnicodeTables { -- cgit v1.2.3 From d3659bf88bac8dbfcdc6c957bdcc25e29bef0f04 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 18 Mar 2015 09:28:59 +0100 Subject: QVarLengthArray: Add initializer_list constructor Implement an initializer_list constructor, which was probably just forgotten so far. Technically this is a SC incompatible change, since QVarLengthArray array = {10}; will now create an array with one element 10, instead of an empty array with a reserved size of 10. Anyhow, keeping the inconsistency with the STL / other Qt containers here would certainly do more harm than good in the long run. Task-number: QTBUG-45047 Change-Id: I4675880f93e141181250939942fa32300916b0e3 Reviewed-by: Marc Mutz --- src/corelib/tools/qvarlengtharray.h | 11 +++++++++++ src/corelib/tools/qvarlengtharray.qdoc | 11 +++++++++++ 2 files changed, 22 insertions(+) (limited to 'src/corelib') diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h index 54d97d8762..32f621c809 100644 --- a/src/corelib/tools/qvarlengtharray.h +++ b/src/corelib/tools/qvarlengtharray.h @@ -42,6 +42,9 @@ #include #include #include +#ifdef Q_COMPILER_INITIALIZER_LISTS +#include +#endif QT_BEGIN_NAMESPACE @@ -62,6 +65,14 @@ public: append(other.constData(), other.size()); } +#ifdef Q_COMPILER_INITIALIZER_LISTS + QVarLengthArray(std::initializer_list args) + : a(Prealloc), s(0), ptr(reinterpret_cast(array)) + { + append(args.begin(), args.size()); + } +#endif + inline ~QVarLengthArray() { if (QTypeInfo::isComplex) { T *i = ptr + s; diff --git a/src/corelib/tools/qvarlengtharray.qdoc b/src/corelib/tools/qvarlengtharray.qdoc index 6cc9f62c5a..d1b87f381e 100644 --- a/src/corelib/tools/qvarlengtharray.qdoc +++ b/src/corelib/tools/qvarlengtharray.qdoc @@ -100,6 +100,17 @@ \l{default-constructed value}. */ + +/*! \fn QVarLengthArray::QVarLengthArray(std::initializer_list args) + \since 5.5 + + Constructs an array from the std::initializer_list given by \a args. + + This constructor is only enabled if the compiler supports C++11 initializer + lists. +*/ + + /*! \fn QVarLengthArray::~QVarLengthArray() Destroys the array. -- cgit v1.2.3 From be3d4ebcbfd36c15c3fe53a8377ba93cb763e30a Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 18 Mar 2015 09:27:15 +0100 Subject: QVarLengthArray: Do not require operator!= for element comparison The documentation claims that operator== is needed, not operator!=. While at it, we can also replace the loop with std::equal, which might even allow STL implementations to choose a hand-optimized version of the algorithm for C++ builtin types ... Change-Id: I988b326d6af3b767526952e303468e18ff6594f9 Reviewed-by: Marc Mutz --- src/corelib/tools/qvarlengtharray.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h index 32f621c809..95cd0447d8 100644 --- a/src/corelib/tools/qvarlengtharray.h +++ b/src/corelib/tools/qvarlengtharray.h @@ -468,11 +468,10 @@ bool operator==(const QVarLengthArray &l, const QVarLengthArray -- cgit v1.2.3