From 691198eaf2a96481bb92ff0ca34d38e10da7798a Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 20 Feb 2015 14:58:55 +0100 Subject: Fix various qdoc-warnings. qtbase/src/corelib/doc/src/containers.qdoc:28: warning: Can't link to 'QList:end()' qtbase/src/corelib/kernel/qmetaobject.cpp:2680: warning: Cannot find 'fromType(...)' in '\fn' QMetaEnum QMetaEnum::fromType() const qtbase/src/corelib/kernel/qmetatype.cpp:1117: warning: Cannot find 'qMetaTypeTypeImpl(...)' in '\fn' int qMetaTypeTypeImpl(const char *typeName) qtbase/src/corelib/plugin/qplugin.qdoc:48: warning: Cannot find file to quote from: 'plugins/interfaces.h' Change-Id: Ie613253211e16ec616ccb70c24c625a9d5352d1b Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/doc/src/containers.qdoc | 2 +- src/corelib/kernel/qmetaobject.cpp | 2 +- src/corelib/kernel/qmetatype.cpp | 2 +- src/corelib/plugin/qplugin.qdoc | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/doc/src/containers.qdoc b/src/corelib/doc/src/containers.qdoc index 58c7569964..1979c45e17 100644 --- a/src/corelib/doc/src/containers.qdoc +++ b/src/corelib/doc/src/containers.qdoc @@ -465,7 +465,7 @@ imaginary item one position past the last item in the container. \l {QList::end()}{end()} marks an invalid position; it must never be dereferenced. It is typically used in a loop's break condition. If the list is - empty, \l{QList::begin}{begin()} equals \l{QList:end()}{end()}, so we never execute the loop. + empty, \l{QList::begin}{begin()} equals \l{QList::end()}{end()}, so we never execute the loop. The diagram below shows the valid iterator positions as red arrows for a vector containing four items: diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index 4baf09167b..e7be2339da 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -2678,7 +2678,7 @@ QByteArray QMetaEnum::valueToKeys(int value) const } /*! - \fn QMetaEnum QMetaEnum::fromType() const + \fn QMetaEnum QMetaEnum::fromType() \since 5.5 Returns the QMetaEnum corresponding to the type in the template parameter. diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 8adb4a4903..305e998818 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -1117,7 +1117,7 @@ bool QMetaType::isRegistered(int type) } /*! - \fn int qMetaTypeTypeImpl(const char *typeName) + \fn int qMetaTypeTypeImpl(const char *typeName, int length) \internal Implementation of QMetaType::type(). diff --git a/src/corelib/plugin/qplugin.qdoc b/src/corelib/plugin/qplugin.qdoc index 35dd52218a..81be1df518 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 plugins/interfaces.h 3 + \snippet code/doc_src_qplugin.cpp 0 This macro is normally used right after the class definition for \a ClassName, in a header file. See the -- cgit v1.2.3 From 059a570b8a97b0e38af8c78656e638aa657310e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pasi=20Pet=C3=A4j=C3=A4j=C3=A4rvi?= Date: Fri, 20 Feb 2015 16:36:26 +0200 Subject: Fix QT_POSIX_IPC support On platforms which does not have at all sysv support, all posix ipc tests and compilation failed because sysv specific header files were included unconditionally. Change-Id: I5713ace6daeb6e79f8794ce42b2b3dfa1b95ab2d Reviewed-by: Konstantin Ritt --- src/corelib/kernel/qsharedmemory_posix.cpp | 1 - src/corelib/kernel/qsharedmemory_unix.cpp | 2 +- src/corelib/kernel/qsystemsemaphore_posix.cpp | 2 -- src/corelib/kernel/qsystemsemaphore_unix.cpp | 2 +- 4 files changed, 2 insertions(+), 5 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/kernel/qsharedmemory_posix.cpp b/src/corelib/kernel/qsharedmemory_posix.cpp index 4f9b3b1429..74f98a158a 100644 --- a/src/corelib/kernel/qsharedmemory_posix.cpp +++ b/src/corelib/kernel/qsharedmemory_posix.cpp @@ -46,7 +46,6 @@ #ifndef QT_NO_SHAREDMEMORY #include -#include #include #include #include diff --git a/src/corelib/kernel/qsharedmemory_unix.cpp b/src/corelib/kernel/qsharedmemory_unix.cpp index 4f55e523e3..92184a619b 100644 --- a/src/corelib/kernel/qsharedmemory_unix.cpp +++ b/src/corelib/kernel/qsharedmemory_unix.cpp @@ -42,8 +42,8 @@ #ifndef QT_NO_SHAREDMEMORY #include -#include #ifndef QT_POSIX_IPC +#include #include #else #include diff --git a/src/corelib/kernel/qsystemsemaphore_posix.cpp b/src/corelib/kernel/qsystemsemaphore_posix.cpp index abe3cc7e8c..5a8e5941b7 100644 --- a/src/corelib/kernel/qsystemsemaphore_posix.cpp +++ b/src/corelib/kernel/qsystemsemaphore_posix.cpp @@ -45,8 +45,6 @@ #ifndef QT_NO_SYSTEMSEMAPHORE #include -#include -#include #include #include diff --git a/src/corelib/kernel/qsystemsemaphore_unix.cpp b/src/corelib/kernel/qsystemsemaphore_unix.cpp index cb34b8aeff..d1ec39ea40 100644 --- a/src/corelib/kernel/qsystemsemaphore_unix.cpp +++ b/src/corelib/kernel/qsystemsemaphore_unix.cpp @@ -40,8 +40,8 @@ #ifndef QT_NO_SYSTEMSEMAPHORE #include -#include #ifndef QT_POSIX_IPC +#include #include #endif #include -- cgit v1.2.3 From 18ab75be815ab97ab1f70be04297634b6225ab0a Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Wed, 18 Feb 2015 18:34:21 +0100 Subject: Doc: Fix typos Change-Id: Id7ecc747545f9675b84c3a8c284a52e72a584135 Reviewed-by: Sune Vuorela Reviewed-by: Oswald Buddenhagen Reviewed-by: Mitch Curtis --- src/corelib/global/qlibraryinfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 9211ce17e8..d9cda29e66 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -230,7 +230,7 @@ QLibraryInfo::licensedProducts() /*! \since 4.6 \deprecated - This function used to return the the installation date for this build of Qt, but now returns an a constant date. + This function used to return the installation date for this build of Qt, but now returns a constant date. */ #ifndef QT_NO_DATESTRING #if QT_DEPRECATED_SINCE(5, 5) -- cgit v1.2.3 From be4f5d55fcb7715460ab08b4e50b0468555cd065 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 18 Feb 2015 11:41:50 +0100 Subject: QVariant: fix converting enum to string Use QMetaEnum::valueToKey instead of valueToKeys. Change-Id: I270f0820a03aaebde94c37c011c5e9b81421b50f Reviewed-by: Friedemann Kleint --- src/corelib/kernel/qvariant.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 3dc0805dd1..b14c9ed167 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -460,7 +460,7 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) { QMetaEnum en = metaEnumFromType(d->type); if (en.isValid()) { - *str = QString::fromUtf8(en.valueToKeys(qConvertToNumber(d, ok))); + *str = QString::fromUtf8(en.valueToKey(qConvertToNumber(d, ok))); return *ok; } } @@ -637,7 +637,7 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) { QMetaEnum en = metaEnumFromType(d->type); if (en.isValid()) { - *ba = en.valueToKeys(qConvertToNumber(d, ok)); + *ba = en.valueToKey(qConvertToNumber(d, ok)); return *ok; } } -- cgit v1.2.3 From 28fedba03b135a187e9eb0985b972fb034a92e85 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 25 Feb 2015 16:07:49 +0100 Subject: Fix various qdoc-warnings. qtbase/src/corelib/itemmodels/qitemselectionmodel.cpp:1199: warning: Undocumented parameter 'model' in QItemSelectionModel::modelChanged() qtbase/src/corelib/plugin/qpluginloader.cpp:420: warning: Can't link to 'staticPlugin()' qtbase/src/gui/text/qtextdocument.cpp:1452: warning: No such parameter 'from' in QTextDocument::find() qtbase/src/testlib/qtestcase.cpp:2770: warning: No documentation for 'QTest::qExtractTestData()' Change-Id: I76758dbdf3ad7b0ae1f14de0407a6fde523827d0 Reviewed-by: Konstantin Ritt --- src/corelib/itemmodels/qitemselectionmodel.cpp | 2 +- src/corelib/plugin/qpluginloader.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/itemmodels/qitemselectionmodel.cpp b/src/corelib/itemmodels/qitemselectionmodel.cpp index 7e23709f1b..3882da30a7 100644 --- a/src/corelib/itemmodels/qitemselectionmodel.cpp +++ b/src/corelib/itemmodels/qitemselectionmodel.cpp @@ -1200,7 +1200,7 @@ void QItemSelectionModel::select(const QModelIndex &index, QItemSelectionModel:: \fn void QItemSelectionModel::modelChanged(QAbstractItemModel *model) \since 5.5 - This signal is emitted when the model is successfully set with setModel(). + This signal is emitted when the \a model is successfully set with setModel(). \sa model(), setModel() */ diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp index 0bdf9034ee..8ed9199c60 100644 --- a/src/corelib/plugin/qpluginloader.cpp +++ b/src/corelib/plugin/qpluginloader.cpp @@ -420,7 +420,7 @@ void Q_CORE_EXPORT qRegisterStaticPluginFunction(QStaticPlugin plugin) /*! Returns a list of static plugin instances (root components) held by the plugin loader. - \sa staticPlugin() + \sa staticPlugins() */ QObjectList QPluginLoader::staticInstances() { -- cgit v1.2.3 From 41ef1965c5c0450230fbc0e35b817654d1713e25 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 19 Feb 2015 21:23:55 -0800 Subject: QSysInfo: expand Linux distribution detection to /etc/lsb-release Some older (or weird) Linux distributions don't have /etc/os-release, so let's try to read /etc/lsb-release instead. If we find a file called /etc/-release and it's bigger than the pretty name we read from /etc/lsb-release, use that. Because the order of the keys changes between the two *-release files, we can't do a sorted search anymore. Change-Id: I1a800c709d3543699131ffff13c48532d5074f3c Reviewed-by: Friedemann Kleint Reviewed-by: Dirk Hohndel Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira --- src/corelib/global/qglobal.cpp | 89 +++++++++++++++++++++++++++--------------- 1 file changed, 58 insertions(+), 31 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 712e84185c..7913af3103 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. -** Copyright (C) 2014 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. @@ -2120,10 +2120,10 @@ const QSysInfo::WinVersion QSysInfo::WindowsVersion = QSysInfo::windowsVersion() # define USE_ETC_OS_RELEASE struct QUnixOSVersion { - // from /etc/os-release - QString productType; // $ID - QString productVersion; // $VERSION_ID - QString prettyName; // $PRETTY_NAME + // from /etc/os-release older /etc/lsb-release + QString productType; // $ID $DISTRIB_ID + QString productVersion; // $VERSION_ID $DISTRIB_RELEASE + QString prettyName; // $PRETTY_NAME $DISTRIB_DESCRIPTION }; static QString unquote(const char *begin, const char *end) @@ -2135,10 +2135,11 @@ static QString unquote(const char *begin, const char *end) return QString::fromLatin1(begin, end - begin); } -static bool readEtcOsRelease(QUnixOSVersion &v) +static bool readEtcFile(QUnixOSVersion &v, const char *filename, + const QByteArray &idKey, const QByteArray &versionKey, const QByteArray &prettyNameKey) { // we're avoiding QFile here - int fd = qt_safe_open("/etc/os-release", O_RDONLY); + int fd = qt_safe_open(filename, O_RDONLY); if (fd == -1) return false; @@ -2155,41 +2156,28 @@ static bool readEtcOsRelease(QUnixOSVersion &v) const char *ptr = buffer.constData(); const char *end = buffer.constEnd(); const char *eol; + QByteArray line; for ( ; ptr != end; ptr = eol + 1) { - static const char idString[] = "ID="; - static const char prettyNameString[] = "PRETTY_NAME="; - static const char versionIdString[] = "VERSION_ID="; - // find the end of the line after ptr eol = static_cast(memchr(ptr, '\n', end - ptr)); if (!eol) eol = end - 1; + line.setRawData(ptr, eol - ptr); - // note: we're doing a binary search here, so comparison - // must always be sorted - int cmp = strncmp(ptr, idString, strlen(idString)); - if (cmp < 0) - continue; - if (cmp == 0) { - ptr += strlen(idString); + if (line.startsWith(idKey)) { + ptr += idKey.length(); v.productType = unquote(ptr, eol); continue; } - cmp = strncmp(ptr, prettyNameString, strlen(prettyNameString)); - if (cmp < 0) - continue; - if (cmp == 0) { - ptr += strlen(prettyNameString); + if (line.startsWith(prettyNameKey)) { + ptr += prettyNameKey.length(); v.prettyName = unquote(ptr, eol); continue; } - cmp = strncmp(ptr, versionIdString, strlen(versionIdString)); - if (cmp < 0) - continue; - if (cmp == 0) { - ptr += strlen(versionIdString); + if (line.startsWith(versionKey)) { + ptr += versionKey.length(); v.productVersion = unquote(ptr, eol); continue; } @@ -2197,6 +2185,45 @@ static bool readEtcOsRelease(QUnixOSVersion &v) return true; } + +static bool readEtcOsRelease(QUnixOSVersion &v) +{ + return readEtcFile(v, "/etc/os-release", QByteArrayLiteral("ID="), + QByteArrayLiteral("VERSION_ID="), QByteArrayLiteral("PRETTY_NAME=")); +} + +static bool readEtcLsbRelease(QUnixOSVersion &v) +{ + bool ok = readEtcFile(v, "/etc/lsb-release", QByteArrayLiteral("DISTRIB_ID="), + QByteArrayLiteral("DISTRIB_RELEASE="), QByteArrayLiteral("DISTRIB_DESCRIPTION=")); + if (ok && (v.prettyName.isEmpty() || v.prettyName == v.productType)) { + // some distributions have redundant information for the pretty name, + // so try /etc/-release + + // we're still avoiding QFile here + QByteArray distrorelease = "/etc/" + v.productType.toLatin1().toLower() + "-release"; + int fd = qt_safe_open(distrorelease, O_RDONLY); + if (fd != -1) { + QT_STATBUF sbuf; + if (QT_FSTAT(fd, &sbuf) != -1 && sbuf.st_size > v.prettyName.length()) { + // file apparently contains interesting information + QByteArray buffer(sbuf.st_size, Qt::Uninitialized); + buffer.resize(qt_safe_read(fd, buffer.data(), sbuf.st_size)); + v.prettyName = QString::fromLatin1(buffer.trimmed()); + } + qt_safe_close(fd); + } + } + + return ok; +} + +static bool findUnixOsVersion(QUnixOSVersion &v) +{ + if (readEtcOsRelease(v)) + return true; + return readEtcLsbRelease(v); +} # endif // USE_ETC_OS_RELEASE #endif // Q_OS_UNIX @@ -2531,7 +2558,7 @@ QString QSysInfo::productType() #elif defined(USE_ETC_OS_RELEASE) // Q_OS_UNIX QUnixOSVersion unixOsVersion; - readEtcOsRelease(unixOsVersion); + findUnixOsVersion(unixOsVersion); if (!unixOsVersion.productType.isEmpty()) return unixOsVersion.productType; #endif @@ -2587,7 +2614,7 @@ QString QSysInfo::productVersion() } #elif defined(USE_ETC_OS_RELEASE) // Q_OS_UNIX QUnixOSVersion unixOsVersion; - readEtcOsRelease(unixOsVersion); + findUnixOsVersion(unixOsVersion); if (!unixOsVersion.productVersion.isEmpty()) return unixOsVersion.productVersion; #endif @@ -2664,7 +2691,7 @@ QString QSysInfo::prettyProductName() #elif defined(Q_OS_UNIX) # ifdef USE_ETC_OS_RELEASE QUnixOSVersion unixOsVersion; - readEtcOsRelease(unixOsVersion); + findUnixOsVersion(unixOsVersion); if (!unixOsVersion.prettyName.isEmpty()) return unixOsVersion.prettyName; # endif -- cgit v1.2.3 From a659b4e56be9721389d28e212b4f4bcd393e6410 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 25 Feb 2015 12:14:52 +0100 Subject: fix default of SettingsPath when qt.conf is present it's documented to fall back to Prefix if qt.conf is present but Settings is not specified. Task-number: QTBUG-44644 Change-Id: I8ef6659cbdad51b2fb3c1075ea6f0af4997117ed Reviewed-by: Thiago Macieira --- src/corelib/global/qlibraryinfo.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index d592032c1f..d66007b2b6 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -441,8 +441,10 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group) defaultValue = QLatin1String(qtConfEntries[loc].value); } #ifndef Q_OS_WIN // On Windows we use the registry - else if (loc == SettingsPath) + else if (loc == SettingsPath) { key = QLatin1String("Settings"); + defaultValue = QLatin1String("."); + } #endif if(!key.isNull()) { -- cgit v1.2.3 From 05e0dfa0060aab80afc696161226b2ab0cddfbf9 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 17 Feb 2015 09:23:29 +0100 Subject: Reverse iteration in QMetaEnum::valueToKeys(). Otherwise, values that are composed of others are not handled correctly. For example, Qt::Dialog|Qt::FramelessWindowHint (Qt::Dialog=0x2|Qt::Window) is currently output as "Window|FramelessWindowHint" since Qt::Window matches first and its bits are removed from the flag value so that Qt::Dialog in the next iteration no longer matches. Change-Id: I67db5c977c75f887392aa8f345c5e6e9d82c5c26 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/kernel/qmetaobject.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index e7be2339da..e89b914227 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -2665,13 +2665,14 @@ QByteArray QMetaEnum::valueToKeys(int value) const int count = mobj->d.data[handle + 2]; int data = mobj->d.data[handle + 3]; int v = value; - for(int i = 0; i < count; i++) { + // reverse iterate to ensure values like Qt::Dialog=0x2|Qt::Window are processed first. + for (int i = count - 1; i >= 0; --i) { int k = mobj->d.data[data + 2*i + 1]; if ((k != 0 && (v & k) == k ) || (k == value)) { v = v & ~k; if (!keys.isEmpty()) - keys += '|'; - keys += stringData(mobj, mobj->d.data[data + 2*i]); + keys.prepend('|'); + keys.prepend(stringData(mobj, mobj->d.data[data + 2*i])); } } return keys; -- cgit v1.2.3 From 9608629d7ee42dd65437d2e7fad5c91438d7de4b Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Thu, 26 Feb 2015 13:00:39 +0100 Subject: OSX: fix leaks due to missing NSAutoreleasePool MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit env OBJC_DEBUG_MISSING_POOLS=YES qtcreator Change-Id: Ibbe5f42af5b94a439be3f0dd0f2b6e34bb1afd3f Reviewed-by: Morten Johan Sørvig --- src/corelib/tools/qlocale_mac.mm | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/corelib') diff --git a/src/corelib/tools/qlocale_mac.mm b/src/corelib/tools/qlocale_mac.mm index b581e33aef..37a63a2ca4 100644 --- a/src/corelib/tools/qlocale_mac.mm +++ b/src/corelib/tools/qlocale_mac.mm @@ -44,6 +44,18 @@ QT_BEGIN_NAMESPACE +namespace { +class AutoReleasePool +{ +public: + AutoReleasePool(): pool([[NSAutoreleasePool alloc] init]) {} + ~AutoReleasePool() { [pool release]; } + +private: + NSAutoreleasePool *pool; +}; +} + /****************************************************************************** ** Wrappers for Mac locale system functions */ @@ -414,6 +426,7 @@ QLocale QSystemLocale::fallbackUiLocale() const QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const { + AutoReleasePool pool; switch(type) { // case Name: // return getMacLocaleName(); -- cgit v1.2.3 From cd46d94906ec0d10acd0fcb086d9177a1b282691 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 17 Feb 2015 11:25:36 +0100 Subject: Output registered enums in qDebug operator for QFlags. Change-Id: Ia424df234fbd333782c10f0a4422875bb1bfc1f5 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/io/qdebug.cpp | 16 +++++++++++++++- src/corelib/io/qdebug.h | 14 +++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/io/qdebug.cpp b/src/corelib/io/qdebug.cpp index f55f68f9b3..357d63137c 100644 --- a/src/corelib/io/qdebug.cpp +++ b/src/corelib/io/qdebug.cpp @@ -661,6 +661,20 @@ QDebug qt_QMetaEnum_debugOperator(QDebug &dbg, int value, const QMetaObject *met dbg << ')'; return dbg; } -#endif + +QDebug qt_QMetaEnum_flagDebugOperator(QDebug &debug, quint64 value, const QMetaObject *meta, const char *name) +{ + QDebugStateSaver saver(debug); + debug.resetFormat(); + debug.noquote(); + debug.nospace(); + debug << "QFlags<"; + const QMetaEnum me = meta->enumerator(meta->indexOfEnumerator(name)); + if (const char *scope = me.scope()) + debug << scope << "::"; + debug << me.name() << ">(" << me.valueToKeys(value) << ')'; + return debug; +} +#endif // !QT_NO_QOBJECT QT_END_NAMESPACE diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h index 435e7450c7..7f1cb82f3a 100644 --- a/src/corelib/io/qdebug.h +++ b/src/corelib/io/qdebug.h @@ -263,6 +263,7 @@ inline QDebug operator<<(QDebug debug, const QContiguousCache &cache) #ifndef QT_NO_QOBJECT Q_CORE_EXPORT QDebug qt_QMetaEnum_debugOperator(QDebug&, int value, const QMetaObject *meta, const char *name); +Q_CORE_EXPORT QDebug qt_QMetaEnum_flagDebugOperator(QDebug &dbg, quint64 value, const QMetaObject *meta, const char *name); template typename QtPrivate::QEnableIf::Value, QDebug>::Type @@ -272,10 +273,21 @@ operator<<(QDebug dbg, T value) const char *name = qt_getEnumName(value); return qt_QMetaEnum_debugOperator(dbg, typename QFlags::Int(value), obj, name); } -#endif +template +inline typename QtPrivate::QEnableIf::Value, QDebug>::Type operator<<(QDebug debug, const QFlags &flags) +{ + const QMetaObject *obj = qt_getEnumMetaObject(T()); + const char *name = qt_getEnumName(T()); + return qt_QMetaEnum_flagDebugOperator(debug, quint64(flags), obj, name); +} + +template +inline typename QtPrivate::QEnableIf::Value, QDebug>::Type operator<<(QDebug debug, const QFlags &flags) +#else // !QT_NO_QOBJECT template inline QDebug operator<<(QDebug debug, const QFlags &flags) +#endif { QDebugStateSaver saver(debug); debug.resetFormat(); -- cgit v1.2.3 From 4054f8a5ad9388143041fe8c43ee7abaaf7b78fa Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 25 Feb 2015 22:06:07 +0100 Subject: Specific the correct mibEnum value for the 'macintosh' codec Change-Id: Ib57dd3c98a2ae3994898d7ea40baa0fed482c99a Reviewed-by: Lars Knoll --- src/corelib/codecs/qsimplecodec.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/codecs/qsimplecodec.cpp b/src/corelib/codecs/qsimplecodec.cpp index aa8ba2802a..8a4ff66731 100644 --- a/src/corelib/codecs/qsimplecodec.cpp +++ b/src/corelib/codecs/qsimplecodec.cpp @@ -507,7 +507,7 @@ static const struct { 0x0111, 0x00F1, 0x0323, 0x00F3, 0x00F4, 0x01A1, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x01B0, 0x20AB, 0x00FF} }, - { "macintosh", { "Apple Roman", "MacRoman", 0 }, -168, + { "macintosh", { "Apple Roman", "MacRoman", 0 }, 2027, { 0x00C4, 0x00C5, 0x00C7, 0x00C9, 0x00D1, 0x00D6, 0x00DC, 0x00E1, 0x00E0, 0x00E2, 0x00E4, 0x00E3, 0x00E5, 0x00E7, 0x00E9, 0x00E8, 0x00EA, 0x00EB, 0x00ED, 0x00EC, 0x00EE, 0x00EF, 0x00F1, 0x00F3, -- cgit v1.2.3 From a782369071db1d89448c0b94248d31fa877bcf8c Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 25 Feb 2015 20:43:12 +0100 Subject: Delete the file that we will move to not the new file before moving In the case of Windows Embedded Compact we need to delete the destination file before doing the move if DeleteAndRenameFile has failed since MoveFile will fail if the destination file exists. Change-Id: I29d04c147bf8b6b5de850fd7da7bb3dc6a827f1d Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qfsfileengine_win.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index a1ab8fc0f8..ea2b1bbc63 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -544,7 +544,7 @@ bool QFSFileEngine::renameOverwrite(const QString &newName) bool ret = ::DeleteAndRenameFile((wchar_t*)QFileSystemEntry(newName).nativeFilePath().utf16(), (wchar_t*)d->fileEntry.nativeFilePath().utf16()) != 0; if (!ret) { - ret = ::DeleteFile((wchar_t*)d->fileEntry.nativeFilePath().utf16()) != 0; + ret = ::DeleteFile((wchar_t*)QFileSystemEntry(newName).nativeFilePath().utf16()) != 0; if (ret) ret = ::MoveFile((wchar_t*)d->fileEntry.nativeFilePath().utf16(), (wchar_t*)QFileSystemEntry(newName).nativeFilePath().utf16()) != 0; -- cgit v1.2.3 From 4e966497ce3674286f38faab68679201ec6ca22e Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 26 Feb 2015 14:45:13 +0100 Subject: Android: Fix compilation for x86 Bionic on x86 does not have an implementation of ffs(), for some reason. The declaration is available in strings.h, but causes a linker error. The toolchain has a builtin version though, which can be used instead. Change-Id: Iaf4c27542c1aabe88713842303251db44ae6ba86 Reviewed-by: Jani Heikkinen Reviewed-by: Christian Stromme Reviewed-by: Thiago Macieira --- src/corelib/tools/qsimd.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp index a031080fdb..52ffc161bf 100644 --- a/src/corelib/tools/qsimd.cpp +++ b/src/corelib/tools/qsimd.cpp @@ -512,7 +512,9 @@ int ffs(int i) #endif } #endif -#endif // Q_OS_WIN +#elif defined(Q_OS_ANDROID) +# define ffs __builtin_ffs +#endif QBasicAtomicInt qt_cpu_features = Q_BASIC_ATOMIC_INITIALIZER(0); -- cgit v1.2.3