diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-12-24 00:56:59 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-12-24 00:56:59 +0100 |
commit | f0fbff4c905fd3e21d7aefedd45d98cc9dd54018 (patch) | |
tree | c61f47f858a9ac6183676bd7aee378a6a2b84a19 /src/corelib | |
parent | d776937df91e46536f404c6868d64016b6038d7b (diff) | |
parent | 0e1ce36ae67de940b2d499ec7f23e520dce0f112 (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Change-Id: I2defae1904154283446b069d151c3ef57302ec7b
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/Qt5CoreMacros.cmake | 1 | ||||
-rw-r--r-- | src/corelib/doc/src/containers.qdoc | 8 | ||||
-rw-r--r-- | src/corelib/global/qglobal.h | 13 | ||||
-rw-r--r-- | src/corelib/global/qlogging.h | 49 | ||||
-rw-r--r-- | src/corelib/kernel/qcorecmdlineargs_p.h | 4 | ||||
-rw-r--r-- | src/corelib/kernel/qobject.cpp | 11 | ||||
-rw-r--r-- | src/corelib/kernel/qobject_p.h | 8 | ||||
-rw-r--r-- | src/corelib/plugin/qplugin.qdoc | 1 | ||||
-rw-r--r-- | src/corelib/thread/qthread_win.cpp | 6 | ||||
-rw-r--r-- | src/corelib/tools/qlocale_blackberry.cpp | 8 | ||||
-rw-r--r-- | src/corelib/tools/qlocale_win.cpp | 12 | ||||
-rw-r--r-- | src/corelib/tools/qstring.h | 20 |
12 files changed, 63 insertions, 78 deletions
diff --git a/src/corelib/Qt5CoreMacros.cmake b/src/corelib/Qt5CoreMacros.cmake index dca257f080..88710bc55e 100644 --- a/src/corelib/Qt5CoreMacros.cmake +++ b/src/corelib/Qt5CoreMacros.cmake @@ -110,6 +110,7 @@ macro(QT5_CREATE_MOC_COMMAND infile outfile moc_flags moc_options moc_target) string (REPLACE ";" "\n" _moc_parameters "${_moc_parameters}") if(moc_target) + set(_moc_parameters_file ${_moc_parameters_file}$<$<BOOL:$<CONFIGURATION>>:_$<CONFIGURATION>>) set(targetincludes "$<TARGET_PROPERTY:${moc_target},INCLUDE_DIRECTORIES>") set(targetdefines "$<TARGET_PROPERTY:${moc_target},COMPILE_DEFINITIONS>") diff --git a/src/corelib/doc/src/containers.qdoc b/src/corelib/doc/src/containers.qdoc index fa26409d83..6017269272 100644 --- a/src/corelib/doc/src/containers.qdoc +++ b/src/corelib/doc/src/containers.qdoc @@ -578,9 +578,11 @@ \snippet code/doc_src_containers.cpp 18 With QMap and QHash, \c foreach accesses the value component of - the (key, value) pairs. If you want to iterate over both the keys - and the values, you can use iterators (which are fastest), or you - can write code like this: + the (key, value) pairs automatically, so you should not call + values() on the container (it would generate an unnecessary copy, + see below). If you want to iterate over both the keys and the + values, you can use iterators (which are faster), or you can + obtain the keys, and use them to get the values too: \snippet code/doc_src_containers.cpp 19 diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 18e9ecae85..f5f144fe6b 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -467,6 +467,19 @@ typedef qptrdiff qintptr; # define QT_FASTCALL #endif +// enable gcc warnings for printf-style functions +#if defined(Q_CC_GNU) && !defined(__INSURE__) +# if defined(Q_CC_MINGW) && !defined(Q_CC_CLANG) +# define Q_ATTRIBUTE_FORMAT_PRINTF(A, B) \ + __attribute__((format(gnu_printf, (A), (B)))) +# else +# define Q_ATTRIBUTE_FORMAT_PRINTF(A, B) \ + __attribute__((format(printf, (A), (B)))) +# endif +#else +# define Q_ATTRIBUTE_FORMAT_PRINTF(A, B) +#endif + //defines the type for the WNDPROC on windows //the alignment needs to be forced for sse2 to not crash with mingw #if defined(Q_OS_WIN) diff --git a/src/corelib/global/qlogging.h b/src/corelib/global/qlogging.h index 2b798f9ea0..5ae1fb3205 100644 --- a/src/corelib/global/qlogging.h +++ b/src/corelib/global/qlogging.h @@ -92,55 +92,16 @@ public: Q_DECL_CONSTEXPR QMessageLogger(const char *file, int line, const char *function, const char *category) : context(file, line, function, category) {} - void debug(const char *msg, ...) const -#if defined(Q_CC_GNU) && !defined(__INSURE__) -# if defined(Q_CC_MINGW) && !defined(Q_CC_CLANG) - __attribute__ ((format (gnu_printf, 2, 3))) -# else - __attribute__ ((format (printf, 2, 3))) -# endif -#endif - ; - void noDebug(const char *, ...) const -#if defined(Q_CC_GNU) && !defined(__INSURE__) -# if defined(Q_CC_MINGW) && !defined(Q_CC_CLANG) - __attribute__ ((format (gnu_printf, 2, 3))) -# else - __attribute__ ((format (printf, 2, 3))) -# endif -#endif + void debug(const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(2, 3); + void noDebug(const char *, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(2, 3) {} - void warning(const char *msg, ...) const -#if defined(Q_CC_GNU) && !defined(__INSURE__) -# if defined(Q_CC_MINGW) && !defined(Q_CC_CLANG) - __attribute__ ((format (gnu_printf, 2, 3))) -# else - __attribute__ ((format (printf, 2, 3))) -# endif -#endif - ; - void critical(const char *msg, ...) const -#if defined(Q_CC_GNU) && !defined(__INSURE__) -# if defined(Q_CC_MINGW) && !defined(Q_CC_CLANG) - __attribute__ ((format (gnu_printf, 2, 3))) -# else - __attribute__ ((format (printf, 2, 3))) -# endif -#endif - ; + void warning(const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(2, 3); + void critical(const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(2, 3); #ifndef Q_CC_MSVC Q_NORETURN #endif - void fatal(const char *msg, ...) const Q_DECL_NOTHROW -#if defined(Q_CC_GNU) && !defined(__INSURE__) -# if defined(Q_CC_MINGW) && !defined(Q_CC_CLANG) - __attribute__ ((format (gnu_printf, 2, 3))) -# else - __attribute__ ((format (printf, 2, 3))) -# endif -#endif - ; + void fatal(const char *msg, ...) const Q_DECL_NOTHROW Q_ATTRIBUTE_FORMAT_PRINTF(2, 3); #ifndef QT_NO_DEBUG_STREAM QDebug debug() const; diff --git a/src/corelib/kernel/qcorecmdlineargs_p.h b/src/corelib/kernel/qcorecmdlineargs_p.h index d1cfa2dfa9..bbbee7df25 100644 --- a/src/corelib/kernel/qcorecmdlineargs_p.h +++ b/src/corelib/kernel/qcorecmdlineargs_p.h @@ -101,8 +101,8 @@ static QVector<Char*> qWinCmdLine(Char *cmdParam, int length, int &argc) } } if (*p == '\\') { // escape char? - // testing by looking at argc, argv shows that it only escapes quotes and backslashes - if (p < p_end && (*(p+1) == Char('\"') || *(p+1) == Char('\\'))) + // testing by looking at argc, argv shows that it only escapes quotes + if (p < p_end && (*(p+1) == Char('\"'))) p++; } else { if (!quote && (*p == Char('\"'))) { diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 8e0dc4dede..a027f82f82 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -908,10 +908,13 @@ QObject::~QObject() } if (d->declarativeData) { - if (QAbstractDeclarativeData::destroyed) - QAbstractDeclarativeData::destroyed(d->declarativeData, this); - if (QAbstractDeclarativeData::destroyed_qml1) - QAbstractDeclarativeData::destroyed_qml1(d->declarativeData, this); + if (static_cast<QAbstractDeclarativeDataImpl*>(d->declarativeData)->ownedByQml1) { + if (QAbstractDeclarativeData::destroyed_qml1) + QAbstractDeclarativeData::destroyed_qml1(d->declarativeData, this); + } else { + if (QAbstractDeclarativeData::destroyed) + QAbstractDeclarativeData::destroyed(d->declarativeData, this); + } } // set ref to zero to indicate that this object has been deleted diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h index cd2d592cec..011e140e3b 100644 --- a/src/corelib/kernel/qobject_p.h +++ b/src/corelib/kernel/qobject_p.h @@ -97,6 +97,14 @@ public: static bool (*isSignalConnected)(QAbstractDeclarativeData *, const QObject *, int); }; +// This is an implementation of QAbstractDeclarativeData that is identical with +// the implementation in QtDeclarative and QtQml for the first bit +struct QAbstractDeclarativeDataImpl : public QAbstractDeclarativeData +{ + quint32 ownedByQml1:1; + quint32 unused: 31; +}; + class Q_CORE_EXPORT QObjectPrivate : public QObjectData { Q_DECLARE_PUBLIC(QObject) diff --git a/src/corelib/plugin/qplugin.qdoc b/src/corelib/plugin/qplugin.qdoc index 0a94077d95..b72516eae5 100644 --- a/src/corelib/plugin/qplugin.qdoc +++ b/src/corelib/plugin/qplugin.qdoc @@ -28,6 +28,7 @@ /*! \headerfile <QtPlugin> \title Defining Plugins + \target qtplugin-defining-plugins \ingroup plugins \brief The <QtPlugin> header file defines macros for defining plugins. diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp index 903e72c151..28e13910d9 100644 --- a/src/corelib/thread/qthread_win.cpp +++ b/src/corelib/thread/qthread_win.cpp @@ -258,7 +258,11 @@ DWORD WINAPI qt_adopted_thread_watcher_function(LPVOID) qt_adopted_thread_watcher_mutex.unlock(); DWORD ret = WAIT_TIMEOUT; - int loops = (handlesCopy.count() / MAXIMUM_WAIT_OBJECTS) + 1, offset, count; + int count; + int offset; + int loops = handlesCopy.size() / MAXIMUM_WAIT_OBJECTS; + if (handlesCopy.size() % MAXIMUM_WAIT_OBJECTS) + ++loops; if (loops == 1) { // no need to loop, no timeout offset = 0; diff --git a/src/corelib/tools/qlocale_blackberry.cpp b/src/corelib/tools/qlocale_blackberry.cpp index c2c3476b0a..0165780634 100644 --- a/src/corelib/tools/qlocale_blackberry.cpp +++ b/src/corelib/tools/qlocale_blackberry.cpp @@ -193,15 +193,15 @@ QByteArray QBBSystemLocaleData::readPpsValue(const char *ppsObject, int ppsFd) // Using QVarLengthArray means the first try (of size == 512) uses a buffer on the stack - no allocation necessary. // Hopefully that covers most use cases. int bytes; - QVarLengthArray<char, 512> buffer; + QVarLengthArray<char, 512> buffer(512); for (;;) { errno = 0; - bytes = qt_safe_read(ppsFd, buffer.data(), buffer.capacity() - 1); - const bool bufferIsTooSmall = (bytes == -1 && errno == EMSGSIZE && buffer.capacity() < MAX_PPS_SIZE); + bytes = qt_safe_read(ppsFd, buffer.data(), buffer.size() - 1); + const bool bufferIsTooSmall = (bytes == -1 && errno == EMSGSIZE && buffer.size() < MAX_PPS_SIZE); if (!bufferIsTooSmall) break; - buffer.resize(qMin(buffer.capacity()*2, MAX_PPS_SIZE)); + buffer.resize(qMin(buffer.size()*2, MAX_PPS_SIZE)); } // This method is called in the ctor(), so do not use qWarning to log warnings diff --git a/src/corelib/tools/qlocale_win.cpp b/src/corelib/tools/qlocale_win.cpp index bbc208e673..885c77c46d 100644 --- a/src/corelib/tools/qlocale_win.cpp +++ b/src/corelib/tools/qlocale_win.cpp @@ -102,6 +102,9 @@ static QString winIso3116CtryName(LPWSTR id = LOCALE_NAME_USER_DEFAULT); #ifndef LOCALE_SNATIVECOUNTRYNAME # define LOCALE_SNATIVECOUNTRYNAME 0x00000008 #endif +#ifndef LOCALE_SSHORTTIME +# define LOCALE_SSHORTTIME 0x00000079 +#endif struct QSystemLocalePrivate { @@ -327,7 +330,9 @@ QVariant QSystemLocalePrivate::timeFormat(QLocale::FormatType type) { switch (type) { case QLocale::ShortFormat: - return winToQtFormat(getLocaleInfo(LOCALE_STIMEFORMAT)); //### + if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7) + return winToQtFormat(getLocaleInfo(LOCALE_SSHORTTIME)); + // fall through case QLocale::LongFormat: return winToQtFormat(getLocaleInfo(LOCALE_STIMEFORMAT)); case QLocale::NarrowFormat: @@ -410,7 +415,7 @@ QVariant QSystemLocalePrivate::toString(const QDate &date, QLocale::FormatType t return QString(); } -QVariant QSystemLocalePrivate::toString(const QTime &time, QLocale::FormatType) +QVariant QSystemLocalePrivate::toString(const QTime &time, QLocale::FormatType type) { SYSTEMTIME st; memset(&st, 0, sizeof(SYSTEMTIME)); @@ -420,6 +425,9 @@ QVariant QSystemLocalePrivate::toString(const QTime &time, QLocale::FormatType) st.wMilliseconds = 0; DWORD flags = 0; + // keep the same conditional as timeFormat() above + if (type == QLocale::ShortFormat && QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7) + flags = TIME_NOSECONDS; wchar_t buf[255]; if (getTimeFormat(flags, &st, NULL, buf, 255)) { diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index 460afb00f4..01ddf669f5 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -302,24 +302,8 @@ public: const QString &a4, const QString &a5, const QString &a6, const QString &a7, const QString &a8, const QString &a9) const Q_REQUIRED_RESULT; - QString &vsprintf(const char *format, va_list ap) -#if defined(Q_CC_GNU) && !defined(__INSURE__) -# if defined(Q_CC_MINGW) && !defined(Q_CC_CLANG) - __attribute__ ((format (gnu_printf, 2, 0))) -# else - __attribute__ ((format (printf, 2, 0))) -# endif -#endif - ; - QString &sprintf(const char *format, ...) -#if defined(Q_CC_GNU) && !defined(__INSURE__) -# if defined(Q_CC_MINGW) && !defined(Q_CC_CLANG) - __attribute__ ((format (gnu_printf, 2, 3))) -# else - __attribute__ ((format (printf, 2, 3))) -# endif -#endif - ; + QString &vsprintf(const char *format, va_list ap) Q_ATTRIBUTE_FORMAT_PRINTF(2, 0); + QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3); int indexOf(QChar c, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; int indexOf(const QString &s, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; |