summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qstringalgorithms_p.h
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2015-03-16 10:31:07 +0100
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2015-03-16 10:31:07 +0100
commit198606f6dbca95ba3a170fff387327d8271018cd (patch)
tree79e8c632f5277fc7f0ae30ae7fb1e1c41745c815 /src/corelib/tools/qstringalgorithms_p.h
parent77c0c1ca6505eb66bd75b3766f9a498574822bd1 (diff)
parent0d5ffd67a4748bcbf19dc3a4b9a36ae6314e58a6 (diff)
Merge remote-tracking branch 'origin/5.5' into dev
Conflicts: src/plugins/platforms/xcb/qxcbnativeinterface.cpp src/plugins/platforms/xcb/qxcbnativeinterface.h Change-Id: I31b38ba439b9341d51a01c0fd54bea33f7410076
Diffstat (limited to 'src/corelib/tools/qstringalgorithms_p.h')
-rw-r--r--src/corelib/tools/qstringalgorithms_p.h10
1 files changed, 6 insertions, 4 deletions
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 <typename StringType> struct QStringAlgorithms
Char *dst = const_cast<Char *>(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;
}