From 162c116948e8a7705979d1d0f0d5e4f6a2acb389 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Thu, 5 Mar 2015 16:05:28 +0100 Subject: Doc: corrected doc QString::operator[] Task-number: QTBUG-43337 Change-Id: I379dfe3f6909de5a63a67261834ea0edff875f9d Reviewed-by: Oswald Buddenhagen Reviewed-by: Martin Smith --- src/corelib/tools/qstring.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index beda0f4919..fb7158c5f2 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -4797,11 +4797,11 @@ QString QString::trimmed_helper(QString &str) \overload operator[]() Returns the character at the specified \a position in the string as a -modifiable reference. Equivalent to \c at(position). +modifiable reference. */ /*! \fn const QChar QString::operator[](uint position) const - + Equivalent to \c at(position). \overload operator[]() */ -- cgit v1.2.3 From 72ef272733d9b91c991233d826054cccb926db2d Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Tue, 24 Feb 2015 21:13:06 +0100 Subject: (Re)introduce loopLevel into QThread MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This function used to reside in QEventLoop in Qt 3 and was deprecated in Qt 4. However this is useful for those who want to know how many event loops are running within the thread so we just make it possible to get at the already available variable. Change-Id: Ia6a7d94ff443a1d1577633363694bc2fa8eca7e4 Reviewed-by: Thiago Macieira Reviewed-by: Jørgen Lind --- src/corelib/thread/qthread.cpp | 13 +++++++++++++ src/corelib/thread/qthread.h | 1 + 2 files changed, 14 insertions(+) (limited to 'src/corelib') diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index f119828e8e..acee337642 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -711,6 +711,19 @@ QThread::Priority QThread::priority() const \sa terminate() */ +/*! + Returns the current event loop level for the thread. + + \note This can only be called within the thread itself, i.e. when + it is the current thread. +*/ + +int QThread::loopLevel() const +{ + Q_D(const QThread); + return d->data->eventLoops.size(); +} + #else // QT_NO_THREAD QThread::QThread(QObject *parent) diff --git a/src/corelib/thread/qthread.h b/src/corelib/thread/qthread.h index 72d8f5a5f8..58755b9625 100644 --- a/src/corelib/thread/qthread.h +++ b/src/corelib/thread/qthread.h @@ -90,6 +90,7 @@ public: void setEventDispatcher(QAbstractEventDispatcher *eventDispatcher); bool event(QEvent *event) Q_DECL_OVERRIDE; + int loopLevel() const; public Q_SLOTS: void start(Priority = InheritPriority); -- cgit v1.2.3 From 35ee5349f2f549d5fe9d9bd57cef7af0047ee2d4 Mon Sep 17 00:00:00 2001 From: Alex Trotsenko Date: Sun, 1 Mar 2015 09:44:10 +0200 Subject: QIODevice: Fix some 64-bit issues Change-Id: I77354a3069b256135c5792975a1445bcbe816e20 Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qiodevice.cpp | 76 ++++++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 38 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp index ea7e7b2731..7eb917c71f 100644 --- a/src/corelib/io/qiodevice.cpp +++ b/src/corelib/io/qiodevice.cpp @@ -586,7 +586,7 @@ qint64 QIODevice::pos() const { Q_D(const QIODevice); #if defined QIODEVICE_DEBUG - printf("%p QIODevice::pos() == %d\n", this, int(d->pos)); + printf("%p QIODevice::pos() == %lld\n", this, d->pos); #endif return d->pos; } @@ -629,31 +629,30 @@ bool QIODevice::seek(qint64 pos) return false; } if (pos < 0) { - qWarning("QIODevice::seek: Invalid pos: %d", int(pos)); + qWarning("QIODevice::seek: Invalid pos: %lld", pos); return false; } #if defined QIODEVICE_DEBUG - printf("%p QIODevice::seek(%d), before: d->pos = %d, d->buffer.size() = %d\n", - this, int(pos), int(d->pos), d->buffer.size()); + printf("%p QIODevice::seek(%lld), before: d->pos = %lld, d->buffer.size() = %lld\n", + this, pos, d->pos, d->buffer.size()); #endif qint64 offset = pos - d->pos; d->pos = pos; d->devicePos = pos; - if (offset < 0 - || offset >= qint64(d->buffer.size())) + if (offset < 0 || offset >= d->buffer.size()) // When seeking backwards, an operation that is only allowed for // random-access devices, the buffer is cleared. The next read // operation will then refill the buffer. We can optimize this, if we // find that seeking backwards becomes a significant performance hit. d->buffer.clear(); else if (!d->buffer.isEmpty()) - d->buffer.skip(int(offset)); + d->buffer.skip(offset); #if defined QIODEVICE_DEBUG - printf("%p \tafter: d->pos == %d, d->buffer.size() == %d\n", this, int(d->pos), + printf("%p \tafter: d->pos == %lld, d->buffer.size() == %lld\n", this, d->pos, d->buffer.size()); #endif return true; @@ -675,8 +674,9 @@ bool QIODevice::atEnd() const { Q_D(const QIODevice); #if defined QIODEVICE_DEBUG - printf("%p QIODevice::atEnd() returns %s, d->openMode == %d, d->pos == %d\n", this, (d->openMode == NotOpen || d->pos == size()) ? "true" : "false", - int(d->openMode), int(d->pos)); + printf("%p QIODevice::atEnd() returns %s, d->openMode == %d, d->pos == %lld\n", this, + (d->openMode == NotOpen || d->pos == size()) ? "true" : "false", int(d->openMode), + d->pos); #endif return d->openMode == NotOpen || (d->buffer.isEmpty() && bytesAvailable() == 0); } @@ -749,8 +749,8 @@ qint64 QIODevice::read(char *data, qint64 maxSize) Q_D(QIODevice); #if defined QIODEVICE_DEBUG - printf("%p QIODevice::read(%p, %d), d->pos = %d, d->buffer.size() = %d\n", - this, data, int(maxSize), int(d->pos), int(d->buffer.size())); + printf("%p QIODevice::read(%p, %lld), d->pos = %lld, d->buffer.size() = %lld\n", + this, data, maxSize, d->pos, d->buffer.size()); #endif const bool sequential = d->isSequential(); @@ -791,8 +791,8 @@ qint64 QIODevice::read(char *data, qint64 maxSize) data += bufferReadChunkSize; maxSize -= bufferReadChunkSize; #if defined QIODEVICE_DEBUG - printf("%p \treading %d bytes from buffer into position %d\n", this, - bufferReadChunkSize, int(readSoFar) - bufferReadChunkSize); + printf("%p \treading %lld bytes from buffer into position %lld\n", this, + bufferReadChunkSize, readSoFar - bufferReadChunkSize); #endif } else { if (d->firstRead) { @@ -813,8 +813,8 @@ qint64 QIODevice::read(char *data, qint64 maxSize) readFromDevice = readData(data, maxSize); deviceAtEof = (readFromDevice != maxSize); #if defined QIODEVICE_DEBUG - printf("%p \treading %d bytes from device (total %d)\n", this, - int(readFromDevice), int(readSoFar)); + printf("%p \treading %lld bytes from device (total %lld)\n", this, + readFromDevice, readSoFar); #endif if (readFromDevice > 0) { readSoFar += readFromDevice; @@ -826,17 +826,17 @@ qint64 QIODevice::read(char *data, qint64 maxSize) } } } else { - const int bytesToBuffer = QIODEVICE_BUFFERSIZE; + const qint64 bytesToBuffer = QIODEVICE_BUFFERSIZE; // Try to fill QIODevice buffer by single read readFromDevice = readData(d->buffer.reserve(bytesToBuffer), bytesToBuffer); deviceAtEof = (readFromDevice != bytesToBuffer); - d->buffer.chop(bytesToBuffer - qMax(0, int(readFromDevice))); + d->buffer.chop(bytesToBuffer - qMax(Q_INT64_C(0), readFromDevice)); if (readFromDevice > 0) { if (!sequential) d->devicePos += readFromDevice; #if defined QIODEVICE_DEBUG - printf("%p \treading %d from device into buffer\n", this, - int(readFromDevice)); + printf("%p \treading %lld from device into buffer\n", this, + readFromDevice); #endif continue; } @@ -884,8 +884,8 @@ qint64 QIODevice::read(char *data, qint64 maxSize) } #if defined QIODEVICE_DEBUG - printf("%p \treturning %d, d->pos == %d, d->buffer.size() == %d\n", this, - int(readSoFar), int(d->pos), d->buffer.size()); + printf("%p \treturning %lld, d->pos == %lld, d->buffer.size() == %lld\n", this, + readSoFar, d->pos, d->buffer.size()); debugBinaryString(data - readSoFar, readSoFar); #endif @@ -916,8 +916,8 @@ QByteArray QIODevice::read(qint64 maxSize) CHECK_MAXLEN(read, result); #if defined QIODEVICE_DEBUG - printf("%p QIODevice::read(%d), d->pos = %d, d->buffer.size() = %d\n", - this, int(maxSize), int(d->pos), int(d->buffer.size())); + printf("%p QIODevice::read(%lld), d->pos = %lld, d->buffer.size() = %lld\n", + this, maxSize, d->pos, d->buffer.size()); #else Q_UNUSED(d); #endif @@ -966,8 +966,8 @@ QByteArray QIODevice::readAll() { Q_D(QIODevice); #if defined QIODEVICE_DEBUG - printf("%p QIODevice::readAll(), d->pos = %d, d->buffer.size() = %d\n", - this, int(d->pos), int(d->buffer.size())); + printf("%p QIODevice::readAll(), d->pos = %lld, d->buffer.size() = %lld\n", + this, d->pos, d->buffer.size()); #endif QByteArray result; @@ -1054,8 +1054,8 @@ qint64 QIODevice::readLine(char *data, qint64 maxSize) } #if defined QIODEVICE_DEBUG - printf("%p QIODevice::readLine(%p, %d), d->pos = %d, d->buffer.size() = %d\n", - this, data, int(maxSize), int(d->pos), int(d->buffer.size())); + printf("%p QIODevice::readLine(%p, %lld), d->pos = %lld, d->buffer.size() = %lld\n", + this, data, maxSize, d->pos, d->buffer.size()); #endif // Leave room for a '\0' @@ -1071,8 +1071,8 @@ qint64 QIODevice::readLine(char *data, qint64 maxSize) if (!sequential) d->pos += readSoFar; #if defined QIODEVICE_DEBUG - printf("%p \tread from buffer: %d bytes, last character read: %hhx\n", this, - int(readSoFar), data[int(readSoFar) - 1]); + printf("%p \tread from buffer: %lld bytes, last character read: %hhx\n", this, + readSoFar, data[readSoFar - 1]); if (readSoFar) debugBinaryString(data, int(readSoFar)); #endif @@ -1094,8 +1094,8 @@ qint64 QIODevice::readLine(char *data, qint64 maxSize) d->baseReadLineDataCalled = false; qint64 readBytes = readLineData(data + readSoFar, maxSize - readSoFar); #if defined QIODEVICE_DEBUG - printf("%p \tread from readLineData: %d bytes, readSoFar = %d bytes\n", this, - int(readBytes), int(readSoFar)); + printf("%p \tread from readLineData: %lld bytes, readSoFar = %lld bytes\n", this, + readBytes, readSoFar); if (readBytes > 0) { debugBinaryString(data, int(readSoFar + readBytes)); } @@ -1122,8 +1122,8 @@ qint64 QIODevice::readLine(char *data, qint64 maxSize) } #if defined QIODEVICE_DEBUG - printf("%p \treturning %d, d->pos = %d, d->buffer.size() = %d, size() = %d\n", - this, int(readSoFar), int(d->pos), d->buffer.size(), int(size())); + printf("%p \treturning %lld, d->pos = %lld, d->buffer.size() = %lld, size() = %lld\n", + this, readSoFar, d->pos, d->buffer.size(), size()); debugBinaryString(data, int(readSoFar)); #endif return readSoFar; @@ -1147,8 +1147,8 @@ QByteArray QIODevice::readLine(qint64 maxSize) CHECK_MAXLEN(readLine, result); #if defined QIODEVICE_DEBUG - printf("%p QIODevice::readLine(%d), d->pos = %d, d->buffer.size() = %d\n", - this, int(maxSize), int(d->pos), int(d->buffer.size())); + printf("%p QIODevice::readLine(%lld), d->pos = %lld, d->buffer.size() = %lld\n", + this, maxSize, d->pos, d->buffer.size()); #else Q_UNUSED(d); #endif @@ -1220,8 +1220,8 @@ qint64 QIODevice::readLineData(char *data, qint64 maxSize) } #if defined QIODEVICE_DEBUG - printf("%p QIODevice::readLineData(%p, %d), d->pos = %d, d->buffer.size() = %d, returns %d\n", - this, data, int(maxSize), int(d->pos), int(d->buffer.size()), int(readSoFar)); + printf("%p QIODevice::readLineData(%p, %lld), d->pos = %lld, d->buffer.size() = %lld, " + "returns %lld\n", this, data, maxSize, d->pos, d->buffer.size(), readSoFar); #endif if (lastReadReturn != 1 && readSoFar == 0) return isSequential() ? lastReadReturn : -1; -- cgit v1.2.3 From d96c29a5d14d142e81e5a2fd1b838a85a0fca187 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Mon, 9 Mar 2015 14:06:51 +0100 Subject: Reload QLibraryInfo's settings when QCoreApplication becomes available Some of the paths may only be resolvable if the application path is known. On some platforms we can only figure out the application path if argv[0] is known. Thus, if the paths have been queried before the QCoreApplication is created, the cached settings may be wrong. We have to reload them after creating the QCoreApplication. Task-number: QTBUG-38598 Change-Id: Idf5822be87aa0872b099480040acd7b49939a22c Reviewed-by: Oswald Buddenhagen --- src/corelib/global/qlibraryinfo.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 322fc2f651..24afe719c1 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -63,12 +63,16 @@ extern void qDumpCPUFeatures(); // in qsimd.cpp struct QLibrarySettings { QLibrarySettings(); + void load(); + QScopedPointer settings; #ifdef QT_BUILD_QMAKE bool haveDevicePaths; bool haveEffectiveSourcePaths; bool haveEffectivePaths; bool havePaths; +#else + bool reloadOnQAppAvailable; #endif }; Q_GLOBAL_STATIC(QLibrarySettings, qt_library_settings) @@ -93,16 +97,31 @@ public: static QSettings *configuration() { QLibrarySettings *ls = qt_library_settings(); - return ls ? ls->settings.data() : 0; + if (ls) { +#ifndef QT_BUILD_QMAKE + if (ls->reloadOnQAppAvailable && QCoreApplication::instance() != 0) + ls->load(); +#endif + return ls->settings.data(); + } else { + return 0; + } } }; static const char platformsSection[] = "Platforms"; QLibrarySettings::QLibrarySettings() - : settings(QLibraryInfoPrivate::findConfiguration()) { + load(); +} + +void QLibrarySettings::load() +{ + // If we get any settings here, those won't change when the application shows up. + settings.reset(QLibraryInfoPrivate::findConfiguration()); #ifndef QT_BUILD_QMAKE + reloadOnQAppAvailable = (settings.data() == 0 && QCoreApplication::instance() == 0); bool haveDevicePaths; bool haveEffectivePaths; bool havePaths; -- cgit v1.2.3 From 1fc6056ff5526e61419262931de79137bf7c1b4d Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Mon, 9 Mar 2015 17:42:19 +0100 Subject: Detect qt.conf in bundle on OSX without QCoreApplication On OSX we don't need the applicationDirPath to find a qt.conf located in the application bundle. Let's take advantage of this and allow findConfiguration to use it. Task-number: QTBUG-24541 Change-Id: I38c349a3bcd140fcf91352c88c24ca662e6e6f2e Reviewed-by: Oswald Buddenhagen --- src/corelib/global/qlibraryinfo.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 24afe719c1..484c7869a6 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -162,7 +162,7 @@ QSettings *QLibraryInfoPrivate::findConfiguration() if(!QFile::exists(qtconfig)) qtconfig = qmake_libraryInfoFile(); #else - if (!QFile::exists(qtconfig) && QCoreApplication::instance()) { + if (!QFile::exists(qtconfig)) { #ifdef Q_OS_MAC CFBundleRef bundleRef = CFBundleGetMainBundle(); if (bundleRef) { @@ -177,10 +177,12 @@ QSettings *QLibraryInfoPrivate::findConfiguration() } if (qtconfig.isEmpty()) #endif - { + { + if (QCoreApplication::instance()) { QDir pwd(QCoreApplication::applicationDirPath()); qtconfig = pwd.filePath(QLatin1String("qt.conf")); } + } } #endif if (QFile::exists(qtconfig)) -- cgit v1.2.3 From a29b7635bd1d58b29fca96bd3e7831d0ee1f6666 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 27 Feb 2015 13:17:16 +0100 Subject: Simplify calculation of week number This also removes a dependency to 3rd party licensed code. Change-Id: Ia4818a5cf306501bdb7192265edc4bcba8e597d8 Reviewed-by: Simon Hausmann --- src/corelib/tools/qdatetime.cpp | 67 +++++++++++------------------------------ 1 file changed, 17 insertions(+), 50 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index e5fbf5af5e..3c8233ade7 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -560,22 +560,6 @@ int QDate::daysInYear() const January 2000 has week number 52 in the year 1999, and 31 December 2002 has week number 1 in the year 2003. - \legalese - Copyright (c) 1989 The Regents of the University of California. - All rights reserved. - - Redistribution and use in source and binary forms are permitted - provided that the above copyright notice and this paragraph are - duplicated in all such forms and that any documentation, - advertising materials, and other materials related to such - distribution and use acknowledge that the software was developed - by the University of California, Berkeley. The name of the - University may not be used to endorse or promote products derived - from this software without specific prior written permission. - THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - \sa isValid() */ @@ -585,46 +569,29 @@ int QDate::weekNumber(int *yearNumber) const return 0; int year = QDate::year(); - int yday = dayOfYear() - 1; + int yday = dayOfYear(); int wday = dayOfWeek(); - if (wday == 7) - wday = 0; - int w; - - for (;;) { - int len; - int bot; - int top; - - len = isLeapYear(year) ? 366 : 365; - /* - ** What yday (-3 ... 3) does - ** the ISO year begin on? - */ - bot = ((yday + 11 - wday) % 7) - 3; - /* - ** What yday does the NEXT - ** ISO year begin on? - */ - top = bot - (len % 7); - if (top < -3) - top += 7; - top += len; - if (yday >= top) { + + int week = (yday - wday + 10) / 7; + + if (week == 0) { + // last week of previous year + --year; + week = (yday + 365 + (QDate::isLeapYear(year) ? 1 : 0) - wday + 10) / 7; + Q_ASSERT(week == 52 || week == 53); + } else if (week == 53) { + // maybe first week of next year + int w = (yday - 365 - (QDate::isLeapYear(year + 1) ? 1 : 0) - wday + 10) / 7; + if (w > 0) { ++year; - w = 1; - break; + week = w; } - if (yday >= bot) { - w = 1 + ((yday - bot) / 7); - break; - } - --year; - yday += isLeapYear(year) ? 366 : 365; + Q_ASSERT(week == 53 || week == 1); } + if (yearNumber != 0) *yearNumber = year; - return w; + return week; } #ifndef QT_NO_TEXTDATE -- cgit v1.2.3 From 3dbb5263290b06b74bb5c0a4e15e86b398a759c2 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Tue, 10 Mar 2015 13:32:05 +0100 Subject: Fix regression in time zone handling In QtScript we use the msecs since epoch conversion (JS date is based on the concept). After a8c74ddcf78604c9038ba2a2bea81e445e4b3c58 the date conversion test in qtscript started to fail. Instead of relying on the code working by chance, simply update the date when setting it with setMSecsSinceEpoch. Task-number: QTBUG-44885 Change-Id: I9f95c9cdccea52e7d1f808f3cb9e18570ef0df13 Reviewed-by: Thiago Macieira --- src/corelib/tools/qdatetime.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/corelib') diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 3c8233ade7..48cad022a1 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -3436,6 +3436,7 @@ void QDateTime::setMSecsSinceEpoch(qint64 msecs) epochMSecsToLocalTime(msecs, &dt, &tm, &status); d->setDateTime(dt, tm); d->setDaylightStatus(status); + d->refreshDateTime(); break; } } -- cgit v1.2.3 From 3b36a550b04fbdfca835002c9c090be8099afa7f Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 11 Mar 2015 03:17:25 +0100 Subject: QDateTime: ensure we always use the daylight status if known Refactor the code so that the localMSecsToEpochMSecs function always gets the daylight status as input. The calculation can be very wrong if we forget to set it. Change-Id: I39e2a3fa6dc7c4a417f23288f10b303e450b8b98 Reviewed-by: Frederik Gladhorn --- src/corelib/tools/qdatetime.cpp | 47 ++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 19 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 48cad022a1..505a6f863b 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -2440,11 +2440,12 @@ static bool epochMSecsToLocalTime(qint64 msecs, QDate *localDate, QTime *localTi } } -// Convert a LocalTime expressed in local msecs encoding into a UTC epoch msecs -// Optionally populate the returned values from mktime for the adjusted local -// date and time and daylight status. Uses daylightStatus in calculation if populated. -static qint64 localMSecsToEpochMSecs(qint64 localMsecs, QDate *localDate = 0, QTime *localTime = 0, - QDateTimePrivate::DaylightStatus *daylightStatus = 0, +// Convert a LocalTime expressed in local msecs encoding and the corresponding +// daylight status into a UTC epoch msecs. Optionally populate the returned +// values from mktime for the adjusted local date and time. +static qint64 localMSecsToEpochMSecs(qint64 localMsecs, + QDateTimePrivate::DaylightStatus *daylightStatus, + QDate *localDate = 0, QTime *localTime = 0, QString *abbreviation = 0, bool *ok = 0) { QDate dt; @@ -2680,9 +2681,11 @@ qint64 QDateTimePrivate::toMSecsSinceEpoch() const case Qt::UTC: return (m_msecs - (m_offsetFromUtc * 1000)); - case Qt::LocalTime: + case Qt::LocalTime: { // recalculate the local timezone - return localMSecsToEpochMSecs(m_msecs); + DaylightStatus status = daylightStatus(); + return localMSecsToEpochMSecs(m_msecs, &status); + } case Qt::TimeZone: #ifndef QT_BOOTSTRAPPED @@ -2752,7 +2755,7 @@ void QDateTimePrivate::refreshDateTime() qint64 epochMSecs = 0; if (m_spec == Qt::LocalTime) { DaylightStatus status = daylightStatus(); - epochMSecs = localMSecsToEpochMSecs(m_msecs, &testDate, &testTime, &status); + epochMSecs = localMSecsToEpochMSecs(m_msecs, &status, &testDate, &testTime); #ifndef QT_BOOTSTRAPPED } else { epochMSecs = zoneMSecsToEpochMSecs(m_msecs, m_timeZone, &testDate, &testTime); @@ -3190,7 +3193,7 @@ QString QDateTime::timeZoneAbbreviation() const case Qt::LocalTime: { QString abbrev; QDateTimePrivate::DaylightStatus status = d->daylightStatus(); - localMSecsToEpochMSecs(d->m_msecs, 0, 0, &status, &abbrev); + localMSecsToEpochMSecs(d->m_msecs, &status, 0, 0, &abbrev); return abbrev; } } @@ -3221,7 +3224,7 @@ bool QDateTime::isDaylightTime() const case Qt::LocalTime: { QDateTimePrivate::DaylightStatus status = d->daylightStatus(); if (status == QDateTimePrivate::UnknownDaylightTime) - localMSecsToEpochMSecs(d->m_msecs, 0, 0, &status, 0); + localMSecsToEpochMSecs(d->m_msecs, &status); return (status == QDateTimePrivate::DaylightTime); } } @@ -3676,12 +3679,14 @@ QDateTime QDateTime::addDays(qint64 ndays) const date = date.addDays(ndays); // Result might fall into "missing" DaylightTime transition hour, // so call conversion and use the adjusted returned time - if (d->m_spec == Qt::LocalTime) - localMSecsToEpochMSecs(timeToMSecs(date, time), &date, &time); + if (d->m_spec == Qt::LocalTime) { + QDateTimePrivate::DaylightStatus status = d->daylightStatus(); + localMSecsToEpochMSecs(timeToMSecs(date, time), &status, &date, &time); #ifndef QT_BOOTSTRAPPED - else if (d->m_spec == Qt::TimeZone) + } else if (d->m_spec == Qt::TimeZone) { QDateTimePrivate::zoneMSecsToEpochMSecs(timeToMSecs(date, time), d->m_timeZone, &date, &time); #endif // QT_BOOTSTRAPPED + } dt.d->setDateTime(date, time); return dt; } @@ -3710,12 +3715,14 @@ QDateTime QDateTime::addMonths(int nmonths) const date = date.addMonths(nmonths); // Result might fall into "missing" DaylightTime transition hour, // so call conversion and use the adjusted returned time - if (d->m_spec == Qt::LocalTime) - localMSecsToEpochMSecs(timeToMSecs(date, time), &date, &time); + if (d->m_spec == Qt::LocalTime) { + QDateTimePrivate::DaylightStatus status = d->daylightStatus(); + localMSecsToEpochMSecs(timeToMSecs(date, time), &status, &date, &time); #ifndef QT_BOOTSTRAPPED - else if (d->m_spec == Qt::TimeZone) + } else if (d->m_spec == Qt::TimeZone) { QDateTimePrivate::zoneMSecsToEpochMSecs(timeToMSecs(date, time), d->m_timeZone, &date, &time); #endif // QT_BOOTSTRAPPED + } dt.d->setDateTime(date, time); return dt; } @@ -3744,12 +3751,14 @@ QDateTime QDateTime::addYears(int nyears) const date = date.addYears(nyears); // Result might fall into "missing" DaylightTime transition hour, // so call conversion and use the adjusted returned time - if (d->m_spec == Qt::LocalTime) - localMSecsToEpochMSecs(timeToMSecs(date, time), &date, &time); + if (d->m_spec == Qt::LocalTime) { + QDateTimePrivate::DaylightStatus status = d->daylightStatus(); + localMSecsToEpochMSecs(timeToMSecs(date, time), &status, &date, &time); #ifndef QT_BOOTSTRAPPED - else if (d->m_spec == Qt::TimeZone) + } else if (d->m_spec == Qt::TimeZone) { QDateTimePrivate::zoneMSecsToEpochMSecs(timeToMSecs(date, time), d->m_timeZone, &date, &time); #endif // QT_BOOTSTRAPPED + } dt.d->setDateTime(date, time); return dt; } -- cgit v1.2.3 From cacae82a7000041b5347e4cfa3a7b46e064260b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Klitzing?= Date: Tue, 10 Mar 2015 18:18:23 +0100 Subject: CMake: Fix regression with quoted OPTIONS parameter If a parameter contains quotes the check for "-binary" fails. Change-Id: I27148b590d85291a93f1992dfd277fb857bec6e2 Reviewed-by: Stephen Kelly --- src/corelib/Qt5CoreMacros.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/Qt5CoreMacros.cmake b/src/corelib/Qt5CoreMacros.cmake index 95102be108..a94caf0d25 100644 --- a/src/corelib/Qt5CoreMacros.cmake +++ b/src/corelib/Qt5CoreMacros.cmake @@ -269,7 +269,7 @@ function(QT5_ADD_RESOURCES outfiles ) set(rcc_files ${_RCC_UNPARSED_ARGUMENTS}) set(rcc_options ${_RCC_OPTIONS}) - if(${rcc_options} MATCHES "-binary") + if("${rcc_options}" MATCHES "-binary") message(WARNING "Use qt5_add_binary_resources for binary option") endif() -- cgit v1.2.3 From 3128df99d606eae3f461e96cde75e4c75683e290 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Mon, 2 Mar 2015 15:38:57 +0100 Subject: Doc: QDataStream Serializing doc error Task-number: QTBUG-44707 Change-Id: I0ccfb47fe0b2464c5b7331040ea658ace3442366 Reviewed-by: Martin Smith --- src/corelib/doc/src/datastreamformat.qdoc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/doc/src/datastreamformat.qdoc b/src/corelib/doc/src/datastreamformat.qdoc index c76cc1a95e..8ebc64ca85 100644 --- a/src/corelib/doc/src/datastreamformat.qdoc +++ b/src/corelib/doc/src/datastreamformat.qdoc @@ -129,7 +129,9 @@ \li \list \li Date (QDate) \li Time (QTime) - \li The \l{Qt::TimeSpec}{time spec} (quint8) + \li The \l{Qt::TimeSpec}{time spec} + offsetFromUtc (qint32) if Qt::TimeSpec is offsetFromUtc + TimeZone(QTimeZone) if Qt::TimeSpec is TimeZone \endlist \row \li QEasingCurve \li \list @@ -145,11 +147,19 @@ \row \li QFont \li \list \li The family (QString) - \li The point size (qint16) + \li The style name (QString) + \li The point size (double) + \li The pixel size (qint32) \li The style hint (quint8) + \li The style strategy (quint16) \li The char set (quint8) \li The weight (quint8) \li The font bits (quint8) + \li The font stretch (quint16) + \li The extended font bits (quint8) + \li The letter spacing (double) + \li The word spacing (double) + \li The hinting preference (quint8) \endlist \row \li QHash \li \list -- cgit v1.2.3 From 8eaddf8343242caa9e9dde562107ece8d0785680 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Wed, 4 Mar 2015 15:12:04 +0100 Subject: Doc: corrected snippet issue in Defining Plugins doc Task-number: QTBUG-44629 Change-Id: I70e20209b6b33f7adcbcafc6b7d959660cdc2e87 Reviewed-by: Martin Smith --- src/corelib/doc/qtcore.qdocconf | 3 ++- src/corelib/plugin/qplugin.qdoc | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/doc/qtcore.qdocconf b/src/corelib/doc/qtcore.qdocconf index f3aff83a8b..df1ee4afea 100644 --- a/src/corelib/doc/qtcore.qdocconf +++ b/src/corelib/doc/qtcore.qdocconf @@ -36,7 +36,8 @@ exampledirs += \ ../ \ snippets \ ../../../examples/corelib \ - ../../../examples/network/dnslookup + ../../../examples/network/dnslookup \ + ../../../examples/widgets/tools imagedirs += images diff --git a/src/corelib/plugin/qplugin.qdoc b/src/corelib/plugin/qplugin.qdoc index 81be1df518..94f5bc8a30 100644 --- a/src/corelib/plugin/qplugin.qdoc +++ b/src/corelib/plugin/qplugin.qdoc @@ -44,7 +44,7 @@ to the interface class called \a ClassName. The \a Identifier must be unique. For example: - \snippet code/doc_src_qplugin.cpp 0 + \snippet plugandpaint/interfaces.h 3 This macro is normally used right after the class definition for \a ClassName, in a header file. See the -- cgit v1.2.3 From aad3c089023652844a3898fa0b7cbf1db966ef3c Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 10 Mar 2015 13:31:57 +0100 Subject: Clean up QLibraryInfoPrivate::findConfiguration() The QFile::exists() check in the end was redundant if one of the !QFile::exists() had returned false before. By always doing the positive check we can get rid of it and also avoid excessive nesting. Also, on OSX the isEmpty() clause probably never evaluated to true, with the effect that qt.conf in an applicationDirPath was never found. Change-Id: I750735741b707d3e98c4bf6c6b9558618e1fcc59 Reviewed-by: Oswald Buddenhagen --- src/corelib/global/qlibraryinfo.cpp | 44 ++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 484c7869a6..5db2e94602 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -158,35 +158,35 @@ void QLibrarySettings::load() QSettings *QLibraryInfoPrivate::findConfiguration() { QString qtconfig = QStringLiteral(":/qt/etc/qt.conf"); + if (QFile::exists(qtconfig)) + return new QSettings(qtconfig, QSettings::IniFormat); #ifdef QT_BUILD_QMAKE - if(!QFile::exists(qtconfig)) - qtconfig = qmake_libraryInfoFile(); + qtconfig = qmake_libraryInfoFile(); + if (QFile::exists(qtconfig)) + return new QSettings(qtconfig, QSettings::IniFormat); #else - if (!QFile::exists(qtconfig)) { #ifdef Q_OS_MAC - CFBundleRef bundleRef = CFBundleGetMainBundle(); - if (bundleRef) { - QCFType urlRef = CFBundleCopyResourceURL(bundleRef, - QCFString(QLatin1String("qt.conf")), - 0, - 0); - if (urlRef) { - QCFString path = CFURLCopyFileSystemPath(urlRef, kCFURLPOSIXPathStyle); - qtconfig = QDir::cleanPath(path); - } + CFBundleRef bundleRef = CFBundleGetMainBundle(); + if (bundleRef) { + QCFType urlRef = CFBundleCopyResourceURL(bundleRef, + QCFString(QLatin1String("qt.conf")), + 0, + 0); + if (urlRef) { + QCFString path = CFURLCopyFileSystemPath(urlRef, kCFURLPOSIXPathStyle); + qtconfig = QDir::cleanPath(path); + if (QFile::exists(qtconfig)) + return new QSettings(qtconfig, QSettings::IniFormat); } - if (qtconfig.isEmpty()) + } #endif - { - if (QCoreApplication::instance()) { - QDir pwd(QCoreApplication::applicationDirPath()); - qtconfig = pwd.filePath(QLatin1String("qt.conf")); - } - } + if (QCoreApplication::instance()) { + QDir pwd(QCoreApplication::applicationDirPath()); + qtconfig = pwd.filePath(QLatin1String("qt.conf")); + if (QFile::exists(qtconfig)) + return new QSettings(qtconfig, QSettings::IniFormat); } #endif - if (QFile::exists(qtconfig)) - return new QSettings(qtconfig, QSettings::IniFormat); return 0; //no luck } -- cgit v1.2.3 From a3aaabc6467ee7e7d993bf09d15f3462e7bd9208 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Mon, 9 Mar 2015 17:25:28 +0100 Subject: Clarify limitations of QCoreApplication::libraryPaths() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If you call libraryPaths() before constructing a QCoreApplication, intersting things may happen. Task-number: QTBUG-38598 Change-Id: I2861746277e391ede9e921e4a8ad825007e25fa0 Reviewed-by: Topi Reiniö --- src/corelib/kernel/qcoreapplication.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 0bde57c8b3..dbffa83cee 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -2420,16 +2420,27 @@ Q_GLOBAL_STATIC_WITH_ARGS(QMutex, libraryPathMutex, (QMutex::Recursive)) Returns a list of paths that the application will search when dynamically loading libraries. + The return value of this function may change when a QCoreApplication + is created. It is not recommended to call it before creating a + QCoreApplication. The directory of the application executable (\b not + the working directory) is part of the list if it is known. In order + to make it known a QCoreApplication has to be constructed as it will + use \c {argv[0]} to find it. + Qt provides default library paths, but they can also be set using a \l{Using qt.conf}{qt.conf} file. Paths specified in this file - will override default values. + will override default values. Note that if the qt.conf file is in + the directory of the application executable, it may not be found + until a QCoreApplication is created. If it is not found when calling + this function, the default library paths will be used. - This list will include the installation directory for plugins if + The list will include the installation directory for plugins if it exists (the default installation directory for plugins is \c INSTALL/plugins, where \c INSTALL is the directory where Qt was - installed). The directory of the application executable (NOT the - working directory) is always added, as well as the colon separated - entries of the \c QT_PLUGIN_PATH environment variable. + installed). The colon separated entries of the \c QT_PLUGIN_PATH + environment variable are always added. The plugin installation + directory (and its existence) may change when the directory of + the application executable becomes known. If you want to iterate over the list, you can use the \l foreach pseudo-keyword: -- cgit v1.2.3 From 6ef8387e42790d29ea8218f6c43514b2372e9ec6 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Wed, 11 Mar 2015 12:15:13 +0100 Subject: Doc: Json classes added to list of implic.shared classes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-44053 Change-Id: I52a1b6c413aaa594bfee9bf7484c3d0ce7e9c9fa Reviewed-by: Topi Reiniö --- src/corelib/json/qjsonarray.cpp | 1 + src/corelib/json/qjsondocument.cpp | 1 + src/corelib/json/qjsonobject.cpp | 1 + src/corelib/json/qjsonparser.cpp | 1 + src/corelib/json/qjsonvalue.cpp | 1 + 5 files changed, 5 insertions(+) (limited to 'src/corelib') diff --git a/src/corelib/json/qjsonarray.cpp b/src/corelib/json/qjsonarray.cpp index a993fd6ea4..77a3d0a2b8 100644 --- a/src/corelib/json/qjsonarray.cpp +++ b/src/corelib/json/qjsonarray.cpp @@ -47,6 +47,7 @@ QT_BEGIN_NAMESPACE \class QJsonArray \inmodule QtCore \ingroup json + \ingroup shared \reentrant \since 5.0 diff --git a/src/corelib/json/qjsondocument.cpp b/src/corelib/json/qjsondocument.cpp index 7014c146d5..f5bad32233 100644 --- a/src/corelib/json/qjsondocument.cpp +++ b/src/corelib/json/qjsondocument.cpp @@ -47,6 +47,7 @@ QT_BEGIN_NAMESPACE /*! \class QJsonDocument \inmodule QtCore \ingroup json + \ingroup shared \reentrant \since 5.0 diff --git a/src/corelib/json/qjsonobject.cpp b/src/corelib/json/qjsonobject.cpp index 22bad6f8a2..ae44cd9ff9 100644 --- a/src/corelib/json/qjsonobject.cpp +++ b/src/corelib/json/qjsonobject.cpp @@ -46,6 +46,7 @@ QT_BEGIN_NAMESPACE \class QJsonObject \inmodule QtCore \ingroup json + \ingroup shared \reentrant \since 5.0 diff --git a/src/corelib/json/qjsonparser.cpp b/src/corelib/json/qjsonparser.cpp index 371a191d3f..0d62687388 100644 --- a/src/corelib/json/qjsonparser.cpp +++ b/src/corelib/json/qjsonparser.cpp @@ -77,6 +77,7 @@ QT_BEGIN_NAMESPACE \class QJsonParseError \inmodule QtCore \ingroup json + \ingroup shared \reentrant \since 5.0 diff --git a/src/corelib/json/qjsonvalue.cpp b/src/corelib/json/qjsonvalue.cpp index 4845d8c876..c8ddfbc2cc 100644 --- a/src/corelib/json/qjsonvalue.cpp +++ b/src/corelib/json/qjsonvalue.cpp @@ -46,6 +46,7 @@ QT_BEGIN_NAMESPACE \class QJsonValue \inmodule QtCore \ingroup json + \ingroup shared \reentrant \since 5.0 -- cgit v1.2.3 From 6025c36d014d77091d09271d68154261d1977761 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 9 Mar 2015 20:48:05 -0700 Subject: Make Q_ASSERT_X also check its argument for validity Commit ebef2ad1360c80ad62de5f4a1c4e7e4051725c1c did it for Q_ASSERT, but I somehow forgot to do it for Q_ASSERT_X. Do it now. This includes the fix from 9a3d7adaad367417aaa2e1ee1f996185a881a4b5 to silence a Clang warning. Change-Id: Iee8cbc07c4434ce9b560ffff13ca066a5b5ab5d4 Reviewed-by: Oswald Buddenhagen Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/global/qcompilerdetection.h | 1 - src/corelib/global/qglobal.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 0ca67df1e2..1774378c06 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -1164,7 +1164,6 @@ const bool valueOfExpression = Expr;\ Q_ASSERT_X(valueOfExpression, "Q_ASSUME()", "Assumption in Q_ASSUME(\"" #Expr "\") was not correct");\ Q_ASSUME_IMPL(valueOfExpression);\ - Q_UNUSED(valueOfExpression); /* the value may not be used if Q_ASSERT_X and Q_ASSUME_IMPL are noop */\ } while (0) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index ddba460b06..27a3bf7c3d 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -681,7 +681,7 @@ Q_CORE_EXPORT void qt_assert_x(const char *where, const char *what, const char * #if !defined(Q_ASSERT_X) # if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) -# define Q_ASSERT_X(cond, where, what) qt_noop() +# define Q_ASSERT_X(cond, where, what) do { } while ((false) && (cond)) # else # define Q_ASSERT_X(cond, where, what) ((!(cond)) ? qt_assert_x(where, what,__FILE__,__LINE__) : qt_noop()) # endif -- cgit v1.2.3 From 5930a2d314d158f67bf3bf2bd940d7b67731ebde Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 5 Mar 2015 09:11:11 +0100 Subject: Track modifications of white space in QString::simplified(). The existing check fails to detect the case where white space characters other than the space character are replaced by space characters without the length actually changing and returns the original string. Task-number: QTBUG-44936 Change-Id: Ice6faa975f8b41f185c76f6d0d4ff81603e25eb3 Reviewed-by: Thiago Macieira --- src/corelib/tools/qstringalgorithms_p.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qstringalgorithms_p.h b/src/corelib/tools/qstringalgorithms_p.h index b4be5c7ec7..65901b0286 100644 --- a/src/corelib/tools/qstringalgorithms_p.h +++ b/src/corelib/tools/qstringalgorithms_p.h @@ -120,21 +120,23 @@ template struct QStringAlgorithms Char *dst = const_cast(result.cbegin()); Char *ptr = dst; + bool unmodified = true; forever { while (src != end && isSpace(*src)) ++src; while (src != end && !isSpace(*src)) *ptr++ = *src++; - if (src != end) - *ptr++ = QChar::Space; - else + if (src == end) break; + if (*src != QChar::Space) + unmodified = false; + *ptr++ = QChar::Space; } if (ptr != dst && ptr[-1] == QChar::Space) --ptr; int newlen = ptr - dst; - if (isConst && newlen == str.size()) { + if (isConst && newlen == str.size() && unmodified) { // nothing happened, return the original return str; } -- cgit v1.2.3 From 5f324097f2901ab7a7450856f7391f636cf044ad Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 12 Mar 2015 07:47:21 +0100 Subject: Add missing \since tag for the documentation for loopLevel() Change-Id: Ib5e23c40d9258db7986ddb892def207808ac89c7 Reviewed-by: Konstantin Ritt --- src/corelib/thread/qthread.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/corelib') diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index acee337642..dc231a00f8 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -712,6 +712,7 @@ QThread::Priority QThread::priority() const */ /*! + \since 5.5 Returns the current event loop level for the thread. \note This can only be called within the thread itself, i.e. when -- cgit v1.2.3 From 58b4cf8722e80248885e38996d4688f471b73e4f Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 11 Mar 2015 13:27:01 +0100 Subject: Fix quadratic behavior when parsing very large objects QVarlengthArray is not a good data structure when you need to dynamically append to it without knowing its size in advance, as it reallocates on every append. Use a QVector instead. Task-number: QTBUG-44737 Change-Id: I68eab11eacd8368e94943511874aead823a149ab Reviewed-by: Thiago Macieira --- src/corelib/json/qjsonparser_p.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/json/qjsonparser_p.h b/src/corelib/json/qjsonparser_p.h index 98b23dc9c5..a395c0c92e 100644 --- a/src/corelib/json/qjsonparser_p.h +++ b/src/corelib/json/qjsonparser_p.h @@ -62,12 +62,14 @@ public: class ParsedObject { public: - ParsedObject(Parser *p, int pos) : parser(p), objectPosition(pos) {} + ParsedObject(Parser *p, int pos) : parser(p), objectPosition(pos) { + offsets.reserve(64); + } void insert(uint offset); Parser *parser; int objectPosition; - QVarLengthArray offsets; + QVector offsets; inline QJsonPrivate::Entry *entryAt(int i) const { return reinterpret_cast(parser->data + objectPosition + offsets[i]); -- cgit v1.2.3 From dde8c6f77e052e7f05176c38b7559cc67ab42336 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Thu, 12 Mar 2015 20:19:50 +0100 Subject: QVariant: Fix wrong return type in toPersistentModelIndex() Change-Id: I53afa712d38ec6a41fce77474acccf9c587ea6a8 Reviewed-by: Olivier Goffart (Woboq GmbH) Reviewed-by: J-P Nurmi --- src/corelib/kernel/qvariant.cpp | 2 +- src/corelib/kernel/qvariant.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 9ae6c779c0..f7a4abbf68 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -2536,7 +2536,7 @@ QModelIndex QVariant::toModelIndex() const \sa canConvert(), convert(), toModelIndex() */ -QModelIndex QVariant::toPersistentModelIndex() const +QPersistentModelIndex QVariant::toPersistentModelIndex() const { return qVariantToHelper(d, handlerManager); } diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h index d9eca94391..58dfc3aab0 100644 --- a/src/corelib/kernel/qvariant.h +++ b/src/corelib/kernel/qvariant.h @@ -320,7 +320,7 @@ class Q_CORE_EXPORT QVariant QEasingCurve toEasingCurve() const; QUuid toUuid() const; QModelIndex toModelIndex() const; - QModelIndex toPersistentModelIndex() const; + QPersistentModelIndex toPersistentModelIndex() const; QJsonValue toJsonValue() const; QJsonObject toJsonObject() const; QJsonArray toJsonArray() const; -- cgit v1.2.3 From 614f37c8b559a722538c58dd1f65229cfca7d35b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 12 Mar 2015 22:58:56 -0700 Subject: forkfd: make only one of forkfd or spawnfd be compiled We only ever use one, never both. Change-Id: Iee8cbc07c4434ce9b560ffff13caf94c05dba338 Reviewed-by: Oswald Buddenhagen --- src/corelib/io/forkfd_qt.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/corelib') diff --git a/src/corelib/io/forkfd_qt.cpp b/src/corelib/io/forkfd_qt.cpp index 56a39f8df0..dadc42151c 100644 --- a/src/corelib/io/forkfd_qt.cpp +++ b/src/corelib/io/forkfd_qt.cpp @@ -40,6 +40,13 @@ #endif #include +#include "qprocess_p.h" + +#ifdef QPROCESS_USE_SPAWN +# define FORKFD_NO_FORKFD +#else +# define FORKFD_NO_SPAWNFD +#endif #if defined(QT_NO_DEBUG) && !defined(NDEBUG) # define NDEBUG -- cgit v1.2.3 From cd1e045b3bbf4b3e73baf1cbd60d5131d8691fd5 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 19 Feb 2015 22:35:25 -0800 Subject: QString: Don't force unrolling of the tail loop if optimizing for size This is quite good if space isn't a constraint: the unrolling ensures faster execution and limits the number of iterations. But it's long. Both Clang and GCC set the predefined macro __OPTIMIZE_SIZE__ if -Os is in effect. ICC does not; MSVC is untested but there are no macros for this effect listed in its documentation. Change-Id: I1a800c709d3543699131ffff13c48919a9a79ec3 Reviewed-by: Oswald Buddenhagen Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/tools/qstring.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index fb7158c5f2..e74a8eebee 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. -** Copyright (C) 2013 Intel Corporation +** Copyright (C) 2015 Intel Corporation ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -158,7 +158,7 @@ static inline bool qt_ends_with(const QChar *haystack, int haystackLen, static inline bool qt_ends_with(const QChar *haystack, int haystackLen, QLatin1String needle, Qt::CaseSensitivity cs); -#ifdef Q_COMPILER_LAMBDA +#if defined(Q_COMPILER_LAMBDA) && !defined(__OPTIMIZE_SIZE__) namespace { template struct UnrollTailLoop { @@ -239,7 +239,7 @@ void qt_from_latin1(ushort *dst, const char *str, size_t size) size = size % 16; dst += offset; str += offset; -# ifdef Q_COMPILER_LAMBDA +# if defined(Q_COMPILER_LAMBDA) && !defined(__OPTIMIZE_SIZE__) return UnrollTailLoop<15>::exec(int(size), [=](int i) { dst[i] = (uchar)str[i]; }); # endif #endif @@ -332,7 +332,7 @@ static void qt_to_latin1(uchar *dst, const ushort *src, int length) dst += offset; src += offset; -# ifdef Q_COMPILER_LAMBDA +# if defined(Q_COMPILER_LAMBDA) && !defined(__OPTIMIZE_SIZE__) return UnrollTailLoop<15>::exec(length, [=](int i) { dst[i] = (src[i]>0xff) ? '?' : (uchar) src[i]; }); # endif #elif defined(__ARM_NEON__) @@ -470,7 +470,7 @@ static int ucstrncmp(const QChar *a, const QChar *b, int l) - reinterpret_cast(ptr + distance + idx)->unicode(); } } -# ifdef Q_COMPILER_LAMBDA +# if defined(Q_COMPILER_LAMBDA) && !defined(__OPTIMIZE_SIZE__) const auto &lambda = [=](int i) -> int { return reinterpret_cast(ptr)[i].unicode() - reinterpret_cast(ptr + distance)[i].unicode(); @@ -602,7 +602,7 @@ static int ucstrncmp(const QChar *a, const uchar *c, int l) uc += offset; c += offset; -# ifdef Q_COMPILER_LAMBDA +# if defined(Q_COMPILER_LAMBDA) && !defined(__OPTIMIZE_SIZE__) const auto &lambda = [=](int i) { return uc[i] - ushort(c[i]); }; return UnrollTailLoop::exec(e - uc, 0, lambda, lambda); # endif @@ -684,7 +684,7 @@ static int findChar(const QChar *str, int len, QChar ch, int from, } } -# ifdef Q_COMPILER_LAMBDA +# if defined(Q_COMPILER_LAMBDA) && !defined(__OPTIMIZE_SIZE__) return UnrollTailLoop<7>::exec(e - n, -1, [=](int i) { return n[i] == c; }, [=](int i) { return n - s + i; }); -- cgit v1.2.3 From eea7791fd481403ee7ed5897da95860909cac1d6 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Sun, 15 Mar 2015 21:50:37 +0000 Subject: Fix build of forkfd_qt.cpp on FreeBSD It no longer compiled after 614f37c8b559a722538c58dd1f65229cfca7d35b due to the following: - forkfd_qt.cpp set _XOPEN_SOURCE to 500 - It then includes qatomic.h which include sys/cdefs.h (the FreeBSD header that parses and sets _POSIX_C_SOURCE, _XOPEN_SOURCE and other macros) - sys/cdefs.h redefines _POSIX_C_SOURCE to 199506 due to _XOPEN_SOURCE's value - Several libc symbols expected to exist by libc++ are hidden due to _POSIX_C_SOURCE's value and the build fails Setting _XOPEN_SOURCE to 700 ensures that _POSIX_C_SOURCE is set to 200809 which is required for libc++ to work correctly Task-number: QTBUG-45006 Change-Id: Iac93220d19ca5ab9ba8ac61a79748252283c3c47 Reviewed-by: Thiago Macieira --- src/corelib/io/forkfd_qt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/io/forkfd_qt.cpp b/src/corelib/io/forkfd_qt.cpp index dadc42151c..6704ec6f2a 100644 --- a/src/corelib/io/forkfd_qt.cpp +++ b/src/corelib/io/forkfd_qt.cpp @@ -36,7 +36,7 @@ # define _POSIX_C_SOURCE 200809L #endif #if !defined(_XOPEN_SOURCE) && !defined(__QNXNTO__) && !defined(ANDROID) -# define _XOPEN_SOURCE 500 +# define _XOPEN_SOURCE 700 #endif #include -- cgit v1.2.3