From 3d64f898d10bb407868d4eb1bb7dd4bfb9c63c7b Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 1 Feb 2016 19:17:34 +0100 Subject: Correct usage of Apple-related #if-ery. As requested by sanity-bot. Change-Id: I8f6793a26f5cf600d4e6225ca219496cfbb25799 Reviewed-by: Thiago Macieira Reviewed-by: Oswald Buddenhagen --- src/corelib/global/qlibraryinfo.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index b0c7c65c1b..61e7ed64a5 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -47,7 +47,7 @@ QT_END_NAMESPACE # include "qcoreapplication.h" #endif -#ifdef Q_OS_MAC +#ifdef Q_OS_DARWIN # include "private/qcore_mac_p.h" #endif @@ -165,7 +165,7 @@ QSettings *QLibraryInfoPrivate::findConfiguration() if (QFile::exists(qtconfig)) return new QSettings(qtconfig, QSettings::IniFormat); #else -#ifdef Q_OS_MAC +#ifdef Q_OS_DARWIN CFBundleRef bundleRef = CFBundleGetMainBundle(); if (bundleRef) { QCFType urlRef = CFBundleCopyResourceURL(bundleRef, @@ -546,13 +546,13 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group) #else if (loc == PrefixPath) { if (QCoreApplication::instance()) { -#ifdef Q_OS_MAC +#ifdef Q_OS_DARWIN CFBundleRef bundleRef = CFBundleGetMainBundle(); if (bundleRef) { QCFType urlRef = CFBundleCopyBundleURL(bundleRef); if (urlRef) { QCFString path = CFURLCopyFileSystemPath(urlRef, kCFURLPOSIXPathStyle); -#ifdef Q_OS_MACX +#ifdef Q_OS_OSX QString bundleContentsDir = QString(path) + QLatin1String("/Contents/"); if (QDir(bundleContentsDir).exists()) return QDir::cleanPath(bundleContentsDir + ret); -- cgit v1.2.3 From 2564de7b1e71b4a5d0a9d918d4647e17df00392e Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Fri, 29 Jan 2016 16:57:31 +0100 Subject: Deconfuse some heavy use of the preprocessor. One #if...#endif started in one function's body and ended in another's, which is worth remarking on in comments at both ends. A later #if...#else... opened blocks in both halves, that were closed just after their #endif, leading to simplistic brace-matching failure; so move that closing brace to inside both halves, so each half is brace-balanced and the function, as a whole, brace-balances simply. Commented on each #endif that was distant from its #if. Change-Id: I74d97b6dc4b291ec05053d299077a61cecf41ca1 Reviewed-by: Oswald Buddenhagen --- src/corelib/global/qlibraryinfo.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 61e7ed64a5..8bcacca13f 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -403,12 +403,11 @@ static const struct { /*! Returns the location specified by \a loc. - */ QString QLibraryInfo::location(LibraryLocation loc) { -#ifdef QT_BUILD_QMAKE +#ifdef QT_BUILD_QMAKE // ends inside rawLocation ! QString ret = rawLocation(loc, FinalPaths); // Automatically prepend the sysroot to target paths @@ -427,7 +426,7 @@ QLibraryInfo::location(LibraryLocation loc) QString QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group) { -#endif +#endif // QT_BUILD_QMAKE, started inside location ! QString ret; #ifdef QT_BUILD_QMAKE // Logic for choosing the right data source: if EffectivePaths are requested @@ -543,6 +542,7 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group) } else { // we make any other path absolute to the prefix directory baseDir = rawLocation(PrefixPath, group); + } #else if (loc == PrefixPath) { if (QCoreApplication::instance()) { @@ -558,10 +558,10 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group) return QDir::cleanPath(bundleContentsDir + ret); #else return QDir::cleanPath(QString(path) + QLatin1Char('/') + ret); // iOS -#endif +#endif // Q_OS_OSX } } -#endif +#endif // Q_OS_DARWIN // We make the prefix path absolute to the executable's directory. baseDir = QCoreApplication::applicationDirPath(); } else { @@ -570,8 +570,8 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group) } else { // we make any other path absolute to the prefix directory baseDir = location(PrefixPath); -#endif } +#endif // QT_BUILD_QMAKE ret = QDir::cleanPath(baseDir + QLatin1Char('/') + ret); } return ret; -- cgit v1.2.3 From a965d505a0149007cae2cbfe5d5c530b3986e826 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 20 Jan 2016 14:29:52 +0100 Subject: Make interleaving of QDateTimeParser::Section values evident. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The actual section members grew up to the internal value, leading to interleaving of subsequently-added values. Change existing enum values to make this go away (class is private, so no BC constraint forbids this). Change-Id: If266b557817eae19d375519bf38268f0f2a0d372 Reviewed-by: Jędrzej Nowacki --- src/corelib/tools/qdatetimeparser_p.h | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qdatetimeparser_p.h b/src/corelib/tools/qdatetimeparser_p.h index c96def6046..dbfc7be64c 100644 --- a/src/corelib/tools/qdatetimeparser_p.h +++ b/src/corelib/tools/qdatetimeparser_p.h @@ -107,25 +107,26 @@ public: }; enum Section { - NoSection = 0x00000, - AmPmSection = 0x00001, - MSecSection = 0x00002, + NoSection = 0x00000, + AmPmSection = 0x00001, + MSecSection = 0x00002, SecondSection = 0x00004, MinuteSection = 0x00008, Hour12Section = 0x00010, Hour24Section = 0x00020, TimeSectionMask = (AmPmSection|MSecSection|SecondSection|MinuteSection|Hour12Section|Hour24Section), - Internal = 0x10000, - DaySection = 0x00100, - MonthSection = 0x00200, - YearSection = 0x00400, + DaySection = 0x00100, + MonthSection = 0x00200, + YearSection = 0x00400, YearSection2Digits = 0x00800, DayOfWeekSectionShort = 0x01000, - DayOfWeekSectionLong = 0x20000, + DayOfWeekSectionLong = 0x02000, DateSectionMask = (DaySection|MonthSection|YearSection|YearSection2Digits|DayOfWeekSectionShort|DayOfWeekSectionLong), - FirstSection = 0x02000|Internal, - LastSection = 0x04000|Internal, - CalendarPopupSection = 0x08000|Internal, + + Internal = 0x10000, + FirstSection = 0x20000 | Internal, + LastSection = 0x40000 | Internal, + CalendarPopupSection = 0x80000 | Internal, NoSectionIndex = -1, FirstSectionIndex = -2, -- cgit v1.2.3 From 72b57a5dfa49b4d4dd3b88cca8cc97e7283dcdf0 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 18 Jan 2016 18:19:21 +0100 Subject: Disintermediate QDateTimeParser::SectionNode operations. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The name, format and maxChange of a Section depend only on the section, not on the details of the currently parsed text it matches; so we don't need the parser object's list of all sections to work them out. Move these methods to the SectionNode and act directly on that instead of going via the section list. Make the name take a Section enum instead of an int. Likewise, make stateName take a State enum instead of an int. Change-Id: Ie340d042ab95aec517013c4dcc30901d40305c78 Reviewed-by: Simon Hausmann Reviewed-by: Jędrzej Nowacki --- src/corelib/tools/qdatetimeparser.cpp | 87 +++++++++++++++-------------------- src/corelib/tools/qdatetimeparser_p.h | 13 +++--- 2 files changed, 43 insertions(+), 57 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qdatetimeparser.cpp b/src/corelib/tools/qdatetimeparser.cpp index cf4fcd4929..26449750d0 100644 --- a/src/corelib/tools/qdatetimeparser.cpp +++ b/src/corelib/tools/qdatetimeparser.cpp @@ -155,7 +155,7 @@ bool QDateTimeParser::setDigit(QDateTime &v, int index, int newVal) const case AmPmSection: hour = (newVal == 0 ? hour % 12 : (hour % 12) + 12); break; default: qWarning("QDateTimeParser::setDigit() Internal error (%s)", - qPrintable(sectionName(node.type))); + qPrintable(node.name())); break; } @@ -206,7 +206,7 @@ int QDateTimeParser::absoluteMax(int s, const QDateTime &cur) const default: break; } qWarning("QDateTimeParser::absoluteMax() Internal error (%s)", - qPrintable(sectionName(sn.type))); + qPrintable(sn.name())); return -1; } @@ -235,7 +235,7 @@ int QDateTimeParser::absoluteMin(int s) const default: break; } qWarning("QDateTimeParser::absoluteMin() Internal error (%s, %0x)", - qPrintable(sectionName(sn.type)), sn.type); + qPrintable(sn.name()), sn.type); return -1; } @@ -290,7 +290,7 @@ int QDateTimeParser::sectionPos(const SectionNode &sn) const default: break; } if (sn.pos == -1) { - qWarning("QDateTimeParser::sectionPos Internal error (%s)", qPrintable(sectionName(sn.type))); + qWarning("QDateTimeParser::sectionPos Internal error (%s)", qPrintable(sn.name())); return -1; } return sn.pos; @@ -514,7 +514,7 @@ bool QDateTimeParser::parseFormat(const QString &newFormat) last.pos = -1; // for (int i=0; i maxChange) { QDTPDEBUG << "invalid because toMin > maxChange" << toMin << maxChange << t << newCurrentValue << minimum; @@ -1176,7 +1177,7 @@ end: const int min = getDigit(minimum, i); if (min == -1) { qWarning("QDateTimeParser::parse Internal error 4 (%s)", - qPrintable(sectionName(sn.type))); + qPrintable(sn.name())); state = Invalid; done = true; break; @@ -1188,7 +1189,7 @@ end: pos = -1; if (!potentialValue(t.simplified(), min, max, i, newCurrentValue, pos)) { QDTPDEBUG << "invalid because potentialValue(" << t.simplified() << min << max - << sectionName(sn.type) << "returned" << toMax << toMin << pos; + << sn.name() << "returned" << toMax << toMin << pos; state = Invalid; done = true; break; @@ -1446,10 +1447,9 @@ int QDateTimeParser::findAmPm(QString &str, int sectionIndex, int *used) const Max number of units that can be changed by this section. */ -int QDateTimeParser::maxChange(int index) const +int QDateTimeParser::SectionNode::maxChange() const { - const SectionNode &sn = sectionNode(index); - switch (sn.type) { + switch (type) { // Time. unit is msec case MSecSection: return 999; case SecondSection: return 59 * 1000; @@ -1465,7 +1465,7 @@ int QDateTimeParser::maxChange(int index) const case YearSection2Digits: return 100 * 365; default: qWarning("QDateTimeParser::maxChange() Internal error (%s)", - qPrintable(sectionName(sectionType(index)))); + qPrintable(name())); } return -1; @@ -1475,8 +1475,7 @@ QDateTimeParser::FieldInfo QDateTimeParser::fieldInfo(int index) const { FieldInfo ret = 0; const SectionNode &sn = sectionNode(index); - const Section s = sn.type; - switch (s) { + switch (sn.type) { case MSecSection: ret |= Fraction; // fallthrough @@ -1487,7 +1486,7 @@ QDateTimeParser::FieldInfo QDateTimeParser::fieldInfo(int index) const case YearSection: case YearSection2Digits: ret |= Numeric; - if (s != YearSection) { + if (sn.type != YearSection) { ret |= AllowPartial; } if (sn.count != 1) { @@ -1515,30 +1514,16 @@ QDateTimeParser::FieldInfo QDateTimeParser::fieldInfo(int index) const break; default: qWarning("QDateTimeParser::fieldInfo Internal error 2 (%d %s %d)", - index, qPrintable(sectionName(sn.type)), sn.count); + index, qPrintable(sn.name()), sn.count); break; } return ret; } -/*! - \internal - - Get a number that str can become which is between min - and max or -1 if this is not possible. -*/ - - -QString QDateTimeParser::sectionFormat(int index) const -{ - const SectionNode &sn = sectionNode(index); - return sectionFormat(sn.type, sn.count); -} - -QString QDateTimeParser::sectionFormat(Section s, int count) const +QString QDateTimeParser::SectionNode::format() const { QChar fillChar; - switch (s) { + switch (type) { case AmPmSection: return count == 1 ? QLatin1String("AP") : QLatin1String("ap"); case MSecSection: fillChar = QLatin1Char('z'); break; case SecondSection: fillChar = QLatin1Char('s'); break; @@ -1553,7 +1538,7 @@ QString QDateTimeParser::sectionFormat(Section s, int count) const case YearSection: fillChar = QLatin1Char('y'); break; default: qWarning("QDateTimeParser::sectionFormat Internal error (%s)", - qPrintable(sectionName(s))); + qPrintable(name(type))); return QString(); } if (fillChar.isNull()) { @@ -1651,7 +1636,7 @@ bool QDateTimeParser::skipToNextSection(int index, const QDateTime ¤t, con For debugging. Returns the name of the section \a s. */ -QString QDateTimeParser::sectionName(int s) const +QString QDateTimeParser::SectionNode::name(QDateTimeParser::Section s) { switch (s) { case QDateTimeParser::AmPmSection: return QLatin1String("AmPmSection"); @@ -1669,7 +1654,7 @@ QString QDateTimeParser::sectionName(int s) const case QDateTimeParser::NoSection: return QLatin1String("NoSection"); case QDateTimeParser::FirstSection: return QLatin1String("FirstSection"); case QDateTimeParser::LastSection: return QLatin1String("LastSection"); - default: return QLatin1String("Unknown section ") + QString::number(s); + default: return QLatin1String("Unknown section ") + QString::number(int(s)); } } @@ -1678,7 +1663,7 @@ QString QDateTimeParser::sectionName(int s) const For debugging. Returns the name of the state \a s. */ -QString QDateTimeParser::stateName(int s) const +QString QDateTimeParser::stateName(State s) const { switch (s) { case Invalid: return QLatin1String("Invalid"); diff --git a/src/corelib/tools/qdatetimeparser_p.h b/src/corelib/tools/qdatetimeparser_p.h index dbfc7be64c..fe6bfa9c3c 100644 --- a/src/corelib/tools/qdatetimeparser_p.h +++ b/src/corelib/tools/qdatetimeparser_p.h @@ -135,11 +135,16 @@ public: }; // duplicated from qdatetimeedit.h Q_DECLARE_FLAGS(Sections, Section) - struct SectionNode { + struct Q_CORE_EXPORT SectionNode { Section type; mutable int pos; int count; int zeroesAdded; + + static QString name(Section s); + QString name() const { return name(type); } + QString format() const; + int maxChange() const; }; enum State { // duplicated from QValidator @@ -197,15 +202,11 @@ public: QString *dayName = 0, int *used = 0) const; #endif int findAmPm(QString &str1, int index, int *used = 0) const; - int maxChange(int s) const; bool potentialValue(const QString &str, int min, int max, int index, const QDateTime ¤tValue, int insert) const; bool skipToNextSection(int section, const QDateTime ¤t, const QString §ionText) const; - QString sectionName(int s) const; - QString stateName(int s) const; - QString sectionFormat(int index) const; - QString sectionFormat(Section s, int count) const; + QString stateName(State s) const; enum FieldInfoFlag { Numeric = 0x01, -- cgit v1.2.3 From a054349be3ea8e68279ee3f478cc98e1ac522fe4 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Thu, 4 Feb 2016 09:44:12 +0100 Subject: Removed redundant and distracting test from conditional. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If argumentTypes is NULL then it is indeed not equal to the address of a local static variable, so there is no need to follow the NULL-check with a check that it's not equal to that non-NULL address. Change-Id: I62362db747c0620b2195f7997368f026f535d57c Reviewed-by: Olivier Goffart (Woboq GmbH) Reviewed-by: Jędrzej Nowacki --- src/corelib/kernel/qobject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index c316ebc69f..5afdd6a4e5 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -3536,7 +3536,7 @@ static void queued_activate(QObject *sender, int signal, QObjectPrivate::Connect QMutexLocker &locker) { const int *argumentTypes = c->argumentTypes.load(); - if (!argumentTypes && argumentTypes != &DIRECT_CONNECTION_ONLY) { + if (!argumentTypes) { QMetaMethod m = QMetaObjectPrivate::signal(sender->metaObject(), signal); argumentTypes = queuedConnectionTypes(m.parameterTypes()); if (!argumentTypes) // cannot queue arguments -- cgit v1.2.3 From f432d6401938aa3a326b4ea205f310d2559f9961 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 18 Jan 2016 18:26:17 +0100 Subject: Make findAmPm actually return the relevant enum, instead of int. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The enum needed a name to make that possible, of course. The one overt int return -1 needed to be made explicitly Neither, too. Change-Id: I3930bf03a7ee5e1619a1c74f9ca54faf6a6c5b2f Reviewed-by: Jędrzej Nowacki --- src/corelib/tools/qdatetimeparser.cpp | 20 +++++++++----------- src/corelib/tools/qdatetimeparser_p.h | 4 ++-- 2 files changed, 11 insertions(+), 13 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qdatetimeparser.cpp b/src/corelib/tools/qdatetimeparser.cpp index 26449750d0..d4004098c5 100644 --- a/src/corelib/tools/qdatetimeparser.cpp +++ b/src/corelib/tools/qdatetimeparser.cpp @@ -1355,22 +1355,20 @@ int QDateTimeParser::findDay(const QString &str1, int startDay, int sectionIndex /*! \internal - returns - 0 if str == tr("AM") - 1 if str == tr("PM") - 2 if str can become tr("AM") - 3 if str can become tr("PM") - 4 if str can become tr("PM") and can become tr("AM") - -1 can't become anything sensible - + Returns + AM if str == tr("AM") + PM if str == tr("PM") + PossibleAM if str can become tr("AM") + PossiblePM if str can become tr("PM") + PossibleBoth if str can become tr("PM") and can become tr("AM") + Neither if str can't become anything sensible */ - -int QDateTimeParser::findAmPm(QString &str, int sectionIndex, int *used) const +QDateTimeParser::AmPmFinder QDateTimeParser::findAmPm(QString &str, int sectionIndex, int *used) const { const SectionNode &s = sectionNode(sectionIndex); if (s.type != AmPmSection) { qWarning("QDateTimeParser::findAmPm Internal error"); - return -1; + return Neither; } if (used) *used = str.size(); diff --git a/src/corelib/tools/qdatetimeparser_p.h b/src/corelib/tools/qdatetimeparser_p.h index fe6bfa9c3c..257cb6e2cc 100644 --- a/src/corelib/tools/qdatetimeparser_p.h +++ b/src/corelib/tools/qdatetimeparser_p.h @@ -97,7 +97,7 @@ public: none.zeroesAdded = 0; } virtual ~QDateTimeParser() {} - enum { + enum AmPmFinder { Neither = -1, AM = 0, PM = 1, @@ -201,7 +201,7 @@ public: int findDay(const QString &str1, int intDaystart, int sectionIndex, QString *dayName = 0, int *used = 0) const; #endif - int findAmPm(QString &str1, int index, int *used = 0) const; + AmPmFinder findAmPm(QString &str, int index, int *used = 0) const; bool potentialValue(const QString &str, int min, int max, int index, const QDateTime ¤tValue, int insert) const; bool skipToNextSection(int section, const QDateTime ¤t, const QString §ionText) const; -- cgit v1.2.3 From 918b8d4e9e051e9b5882b7a7ada9ec3b390fc5a9 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Wed, 3 Feb 2016 14:57:29 +0100 Subject: Doc: corrected minor link issues Task-number: QTBUG-43810 Change-Id: I98eafe0c7ed55f309640e8495c83ffcef355aa08 Reviewed-by: Martin Smith --- src/corelib/tools/qhash.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index b334a697a9..775e1364a1 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -308,7 +308,7 @@ int qGlobalQHashSeed() /*! \relates QHash \since 5.6 - Sets the global QHash seed. + Sets the global QHash seed to \a newSeed. Manually setting the global QHash seed value should be done only for testing and debugging purposes, when deterministic and reproducible behavior on a QHash -- cgit v1.2.3 From ce29de5c33f9addd22ffa44d575b4b044598b18b Mon Sep 17 00:00:00 2001 From: Gabriel Pannwitz Date: Fri, 5 Feb 2016 13:14:59 +0100 Subject: Doc: correct minor typo Change-Id: If19900309bbef8b65d3dbda4f7795113bfe0678f Reviewed-by: Leena Miettinen --- src/corelib/tools/qsharedpointer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp index 86f4c6a268..851c1b3a1c 100644 --- a/src/corelib/tools/qsharedpointer.cpp +++ b/src/corelib/tools/qsharedpointer.cpp @@ -126,7 +126,7 @@ object being tracked is the same. \omit - \secton1 QSharedPointer internals + \section1 QSharedPointer internals QSharedPointer has two "private" members: the pointer itself being tracked and a d-pointer. Those members are private to the class, but QSharedPointer @@ -338,7 +338,7 @@ creating a QSharedPointer using toStrongRef() is too high. \omit - \secton1 QWeakPointer internals + \section1 QWeakPointer internals QWeakPointer shares most of its internal functionality with \l{QSharedPointer#qsharedpointer-internals}{QSharedPointer}, so see that -- cgit v1.2.3 From f669ea0d54302de31456d57286aa0e4ca1443e98 Mon Sep 17 00:00:00 2001 From: Lada Trimasova Date: Wed, 3 Feb 2016 22:33:02 +0300 Subject: Link with -ldl option only when it is supported -ldl option was used unconditionally while libdl is not supported when libc is static. Add build test to configure which checks if libdl is supported. QMAKE_LIBS_DYNLOAD in "src/corelib/plugin/plugin.pri" is now used only if libdl is available. qt_linux_find_symbol_sys from qlibrary_unix is now used only if QT_NO_DYNAMIC_LIBRARY is not defined. Initially reported by Buildroot autobuilder here: http://autobuild.buildroot.net/results/a85/a85a1839a45fb6102e53131ecc8f6dadf92bcdc2 Change-Id: I0397472456efdc4f3ab5f24d01253bee8048a9d1 Reviewed-by: Oswald Buddenhagen --- src/corelib/plugin/plugin.pri | 2 +- src/corelib/plugin/qlibrary_unix.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/plugin/plugin.pri b/src/corelib/plugin/plugin.pri index 8b64f93467..473480eb55 100644 --- a/src/corelib/plugin/plugin.pri +++ b/src/corelib/plugin/plugin.pri @@ -35,4 +35,4 @@ integrity { SOURCES += plugin/qlibrary_unix.cpp } -LIBS_PRIVATE += $$QMAKE_LIBS_DYNLOAD +!no-libdl: LIBS_PRIVATE += $$QMAKE_LIBS_DYNLOAD diff --git a/src/corelib/plugin/qlibrary_unix.cpp b/src/corelib/plugin/qlibrary_unix.cpp index cd158a9e49..13bc129605 100644 --- a/src/corelib/plugin/qlibrary_unix.cpp +++ b/src/corelib/plugin/qlibrary_unix.cpp @@ -286,7 +286,7 @@ bool QLibraryPrivate::unload_sys() return true; } -#ifdef Q_OS_LINUX +#if defined(Q_OS_LINUX) && !defined(QT_NO_DYNAMIC_LIBRARY) Q_CORE_EXPORT QFunctionPointer qt_linux_find_symbol_sys(const char *symbol) { return QFunctionPointer(dlsym(RTLD_DEFAULT, symbol)); -- cgit v1.2.3 From 01859cc12126b7205f5b54d383a9aa88db756f21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Sat, 16 Jan 2016 00:24:54 +0000 Subject: Reduce allocations by using reserve() Change-Id: If34fa53402985f6b3c5e7217bce4a1177af835b6 Reviewed-by: Marc Mutz --- src/corelib/codecs/qicucodec.cpp | 1 + src/corelib/itemmodels/qstringlistmodel.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/codecs/qicucodec.cpp b/src/corelib/codecs/qicucodec.cpp index b375999aeb..4a4cfd45aa 100644 --- a/src/corelib/codecs/qicucodec.cpp +++ b/src/corelib/codecs/qicucodec.cpp @@ -417,6 +417,7 @@ QList QIcuCodec::availableCodecs() QList QIcuCodec::availableMibs() { QList mibs; + mibs.reserve(mibToNameSize + 1); for (int i = 0; i < mibToNameSize; ++i) mibs += mibToName[i].mib; diff --git a/src/corelib/itemmodels/qstringlistmodel.cpp b/src/corelib/itemmodels/qstringlistmodel.cpp index dad736b445..b0919c5d78 100644 --- a/src/corelib/itemmodels/qstringlistmodel.cpp +++ b/src/corelib/itemmodels/qstringlistmodel.cpp @@ -276,7 +276,9 @@ void QStringListModel::sort(int, Qt::SortOrder order) QModelIndexList oldList = persistentIndexList(); QModelIndexList newList; - for (int i = 0; i < oldList.count(); ++i) + const int numOldIndexes = oldList.count(); + newList.reserve(numOldIndexes); + for (int i = 0; i < numOldIndexes; ++i) newList.append(index(forwarding.at(oldList.at(i).row()), 0)); changePersistentIndexList(oldList, newList); -- cgit v1.2.3 From 22c262d2d7a7c262c7cecf68c2f6bef5ec29e6b5 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Thu, 4 Feb 2016 09:41:22 +0100 Subject: Readability fix for MS isRelative, isAbsolute. The layout and phrasing of these two QFileSystemEntry methods was such as to obscure what they actually test. (Overlong lines, extraneous parentheses, spurious conditions and poor line-breaking.) Rewrote to make both clearer; and, in particular, to make it obvious that they are *not* mutually complementary. Behavior is not changed. Change-Id: If748e48d41fe3a76bab3a1f840c7b7ca62442f8f Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qfilesystementry.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/io/qfilesystementry.cpp b/src/corelib/io/qfilesystementry.cpp index c590d81f7a..9bd31932b3 100644 --- a/src/corelib/io/qfilesystementry.cpp +++ b/src/corelib/io/qfilesystementry.cpp @@ -260,17 +260,21 @@ QString QFileSystemEntry::completeSuffix() const bool QFileSystemEntry::isRelative() const { resolveFilePath(); - return (m_filePath.isEmpty() || (!m_filePath.isEmpty() && (m_filePath.at(0).unicode() != '/') - && (!(m_filePath.length() >= 2 && m_filePath.at(1).unicode() == ':')))); + return (m_filePath.isEmpty() + || (m_filePath.at(0).unicode() != '/' + && !(m_filePath.length() >= 2 && m_filePath.at(1).unicode() == ':'))); } bool QFileSystemEntry::isAbsolute() const { resolveFilePath(); - return (!m_filePath.isEmpty() && ((m_filePath.length() >= 3 - && (m_filePath.at(0).isLetter() && m_filePath.at(1).unicode() == ':' && m_filePath.at(2).unicode() == '/')) - || (m_filePath.length() >= 2 && (m_filePath.at(0) == QLatin1Char('/') && m_filePath.at(1) == QLatin1Char('/'))) - )); + return ((m_filePath.length() >= 3 + && m_filePath.at(0).isLetter() + && m_filePath.at(1).unicode() == ':' + && m_filePath.at(2).unicode() == '/') + || (m_filePath.length() >= 2 + && m_filePath.at(0) == QLatin1Char('/') + && m_filePath.at(1) == QLatin1Char('/'))); } #else bool QFileSystemEntry::isRelative() const -- cgit v1.2.3 From 2c9f6b1a1806e1ff512c85fb2aaffb16c0f51a82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Sun, 10 Jan 2016 23:44:20 +0000 Subject: Fix usage of QMutexLocker, destroy it only at end of scope Change-Id: I87f2c433c987b5f7b4680639cae51cdf6ce9ddc6 Reviewed-by: Marc Mutz Reviewed-by: Friedemann Kleint --- src/corelib/io/qfilesystemwatcher_win.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/io/qfilesystemwatcher_win.cpp b/src/corelib/io/qfilesystemwatcher_win.cpp index 410753868e..582aa3bbe9 100644 --- a/src/corelib/io/qfilesystemwatcher_win.cpp +++ b/src/corelib/io/qfilesystemwatcher_win.cpp @@ -165,7 +165,7 @@ QStringList QWindowsFileSystemWatcherEngine::addPaths(const QStringList &paths, // now look for a thread to insert bool found = false; foreach(QWindowsFileSystemWatcherEngineThread *thread, threads) { - QMutexLocker(&(thread->mutex)); + QMutexLocker locker(&(thread->mutex)); if (thread->handles.count() < MAXIMUM_WAIT_OBJECTS) { DEBUG() << "Added handle" << handle.handle << "for" << absolutePath << "to watch" << fileInfo.absoluteFilePath() << "to existing thread " << thread; -- cgit v1.2.3 From 4fc070a4192d5b914b6f814a8dcab3f552d9abac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Wed, 20 Jan 2016 22:27:50 +0000 Subject: QLocale: Use QVariant::toStringList() instead of template instantiation Avoids (binary) code duplication. Change-Id: I57a23e2f6e151963163d8073b309b3562f8e8684 Reviewed-by: Marc Mutz Reviewed-by: Thiago Macieira --- src/corelib/tools/qlocale_unix.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qlocale_unix.cpp b/src/corelib/tools/qlocale_unix.cpp index a333be62fa..732c4445df 100644 --- a/src/corelib/tools/qlocale_unix.cpp +++ b/src/corelib/tools/qlocale_unix.cpp @@ -247,7 +247,7 @@ QVariant QSystemLocale::query(QueryType type, QVariant in) const case StringToAlternateQuotation: return lc_messages.quoteString(in.value(), QLocale::AlternateQuotation); case ListToSeparatedString: - return lc_messages.createSeparatedList(in.value()); + return lc_messages.createSeparatedList(in.toStringList()); case LocaleChanged: Q_ASSERT(false); default: -- cgit v1.2.3