summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2016-11-05 01:52:00 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2016-11-05 01:53:17 +0100
commite79ceb97340699ed806aa021e1bda4b63fa6f3fe (patch)
tree7e9ff3f64e026562eb76b523aa6be615d466598b /src/corelib
parent825bb10d9bf40587828e4e589b199a9ffec255ce (diff)
parenta21ffd44b3a13a9ef64a56e67f6e267292f0a8e2 (diff)
Merge remote-tracking branch 'gerrit/5.8' into dev
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/codecs/QBIG5CODEC_LICENSE.txt25
-rw-r--r--src/corelib/global/qcompilerdetection.h7
-rw-r--r--src/corelib/tools/qstring.cpp35
3 files changed, 46 insertions, 21 deletions
diff --git a/src/corelib/codecs/QBIG5CODEC_LICENSE.txt b/src/corelib/codecs/QBIG5CODEC_LICENSE.txt
new file mode 100644
index 0000000000..e9206a0031
--- /dev/null
+++ b/src/corelib/codecs/QBIG5CODEC_LICENSE.txt
@@ -0,0 +1,25 @@
+Copyright (C) 2000 Ming-Che Chuang
+Copyright (C) 2001, 2002 James Su, Turbolinux Inc.
+Copyright (C) 2002 WU Yi, HancomLinux Inc.
+Copyright (C) 2001, 2002 Anthony Fok, ThizLinux Laboratory Ltd.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index dcdddeb04d..0b2345f8d4 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -1060,13 +1060,6 @@
# undef Q_COMPILER_VARIADIC_TEMPLATES
# endif
# endif
-# if defined(_LIBCPP_VERSION)
-// libc++ uses __has_feature(cxx_atomic), so disable the feature if the compiler
-// doesn't support it. That's required for the Intel compiler 14.x or earlier on OS X, for example.
-# if !__has_feature(cxx_atomic)
-# undef Q_COMPILER_ATOMICS
-# endif
-# endif
# if defined(Q_COMPILER_THREADSAFE_STATICS) && defined(Q_OS_MAC)
// Apple's low-level implementation of the C++ support library
// (libc++abi.dylib, shared between libstdc++ and libc++) has deadlocks. The
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 3161c41063..987e5379a8 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -2625,21 +2625,28 @@ QString& QString::replace(QChar ch, const QString &after, Qt::CaseSensitivity cs
*/
QString& QString::replace(QChar before, QChar after, Qt::CaseSensitivity cs)
{
- ushort a = after.unicode();
- ushort b = before.unicode();
if (d->size) {
- detach();
- ushort *i = d->data();
- const ushort *e = i + d->size;
- if (cs == Qt::CaseSensitive) {
- for (; i != e; ++i)
- if (*i == b)
- *i = a;
- } else {
- b = foldCase(b);
- for (; i != e; ++i)
- if (foldCase(*i) == b)
- *i = a;
+ const int idx = indexOf(before, 0, cs);
+ if (idx != -1) {
+ detach();
+ const ushort a = after.unicode();
+ ushort *i = d->data();
+ const ushort *e = i + d->size;
+ i += idx;
+ *i = a;
+ if (cs == Qt::CaseSensitive) {
+ const ushort b = before.unicode();
+ while (++i != e) {
+ if (*i == b)
+ *i = a;
+ }
+ } else {
+ const ushort b = foldCase(before.unicode());
+ while (++i != e) {
+ if (foldCase(*i) == b)
+ *i = a;
+ }
+ }
}
}
return *this;