diff options
author | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-03-18 15:23:56 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2015-03-18 22:27:24 +0000 |
commit | dcf0ececbf167502ac9943c6435bb9ddeeb29d5e (patch) | |
tree | 19416d427b84f0a90e0d3028588404a544003734 /src/corelib/tools/qstringalgorithms_p.h | |
parent | 7aad6b9fd426e05fdfb3892d60432a45e4079887 (diff) | |
parent | 198606f6dbca95ba3a170fff387327d8271018cd (diff) |
Merge "Merge remote-tracking branch 'origin/5.5' into dev" into refs/staging/dev
Diffstat (limited to 'src/corelib/tools/qstringalgorithms_p.h')
-rw-r--r-- | src/corelib/tools/qstringalgorithms_p.h | 10 |
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; } |