diff options
author | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2016-01-08 12:30:57 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2016-01-08 12:35:24 +0100 |
commit | ad16478a76815f8f61d454bf7760aaf9ffbb4b51 (patch) | |
tree | eefdd9219cc9d59b62e042f49fc7555b980cb7a4 /src/corelib/tools | |
parent | 80a741f3616290897ba0d9f1cbd3c9c5ee62da37 (diff) | |
parent | 09c92863001790a0304a5ef389901ee2b5b6cdc2 (diff) |
Merge remote-tracking branch 'origin/5.6' into dev
Based on merge done by Liang Qi
Change-Id: Id566e5b9f284d29bff2199f13f9417c660f5b26f
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qcommandlineparser.cpp | 10 | ||||
-rw-r--r-- | src/corelib/tools/qstring.cpp | 19 |
2 files changed, 13 insertions, 16 deletions
diff --git a/src/corelib/tools/qcommandlineparser.cpp b/src/corelib/tools/qcommandlineparser.cpp index 317ace57e4..1b260dd122 100644 --- a/src/corelib/tools/qcommandlineparser.cpp +++ b/src/corelib/tools/qcommandlineparser.cpp @@ -540,7 +540,13 @@ static inline bool displayMessageBox() static void showParserMessage(const QString &message, MessageType type) { -#if defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WINRT) + if (type == UsageMessage) + qInfo(qPrintable(message)); + else + qCritical(qPrintable(message)); + return; +#elif defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) && !defined(Q_OS_WINCE) if (displayMessageBox()) { const UINT flags = MB_OK | MB_TOPMOST | MB_SETFOREGROUND | (type == UsageMessage ? MB_ICONINFORMATION : MB_ICONERROR); @@ -553,7 +559,7 @@ static void showParserMessage(const QString &message, MessageType type) reinterpret_cast<const wchar_t *>(title.utf16()), flags); return; } -#endif // Q_OS_WIN && !QT_BOOTSTRAPPED && !Q_OS_WIN && !Q_OS_WINRT +#endif // Q_OS_WIN && !QT_BOOTSTRAPPED && !Q_OS_WINCE fputs(qPrintable(message), type == UsageMessage ? stdout : stderr); } diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index d4a589424e..55289fa0e7 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -1675,20 +1675,11 @@ void QString::resize(int size) return; } - if (size == 0 && !d->capacityReserved) { - Data *x = Data::allocate(0); - if (!d->ref.deref()) - Data::deallocate(d); - d = x; - } else { - if (d->ref.isShared() || uint(size) + 1u > d->alloc - || (!d->capacityReserved && size < d->size - && uint(size) + 1u < uint(d->alloc >> 1))) - reallocData(uint(size) + 1u, true); - if (d->alloc) { - d->size = size; - d->data()[size] = '\0'; - } + if (d->ref.isShared() || uint(size) + 1u > d->alloc) + reallocData(uint(size) + 1u, true); + if (d->alloc) { + d->size = size; + d->data()[size] = '\0'; } } |