From 7ec49393131461e07554f37042db16b5462a5565 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 5 Jun 2014 16:42:58 +0200 Subject: Fix documentation about QStringLiteral The fallback for QStringLiteral in case C++11 features are not enabled is QString::fromUtf8(), not QLatin1String(). Also, the result of a QStringLiteral expression _is_ a QString. Change-Id: Ib9c2f4c13fff237de3acb2e0f64027bacea6271c Reviewed-by: Giuseppe D'Angelo Reviewed-by: Olivier Goffart Reviewed-by: Thiago Macieira --- src/corelib/tools/qstring.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index aac9c493c3..a018b81c38 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -9872,9 +9872,7 @@ QString QString::toHtmlEscaped() const the read-only segment of the compiled object file. For compilers not supporting the creation of compile time strings, QStringLiteral will fall back to - QLatin1String. - - The result of the QStringLiteral expression can be cast into a QString. + QString::fromUtf8(). If you have code looking like: \code -- cgit v1.2.3 From 81ba16cad933981f55218964a89ed1446022efba Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 24 Mar 2014 16:12:20 +0100 Subject: Fix case insensitive comparisons using QCollator In ICU the strength parameter decides whether a comparison is case sensitive or not. Fix mac comparison code. It can't have worked before. Added some basic automated testing for QCollator. Change-Id: I2646c464fd22ccd3a93c461fa3dba4bd1d4c7b4b Reviewed-by: Konstantin Ritt --- src/corelib/tools/qcollator_icu.cpp | 11 +++++++++-- src/corelib/tools/qcollator_macx.cpp | 9 ++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qcollator_icu.cpp b/src/corelib/tools/qcollator_icu.cpp index 407a493d25..23e88b5015 100644 --- a/src/corelib/tools/qcollator_icu.cpp +++ b/src/corelib/tools/qcollator_icu.cpp @@ -75,10 +75,17 @@ void QCollator::setCaseSensitivity(Qt::CaseSensitivity cs) { detach(); - UColAttributeValue val = (cs == Qt::CaseSensitive) ? UCOL_UPPER_FIRST : UCOL_OFF; + // The strength attribute in ICU is rather badly documented. Basically UCOL_PRIMARY + // ignores differences between base characters and accented characters as well as case. + // So A and A-umlaut would compare equal. + // UCOL_SECONDARY ignores case differences. UCOL_TERTIARY is the default in most languages + // and does case sensitive comparison. + // UCOL_QUATERNARY is used as default in a few languages such as Japanese to take care of some + // additional differences in those languages. + UColAttributeValue val = (cs == Qt::CaseSensitive) ? UCOL_DEFAULT_STRENGTH : UCOL_SECONDARY; UErrorCode status = U_ZERO_ERROR; - ucol_setAttribute(d->collator, UCOL_CASE_FIRST, val, &status); + ucol_setAttribute(d->collator, UCOL_STRENGTH, val, &status); if (U_FAILURE(status)) qWarning("ucol_setAttribute: Case First failed: %d", status); } diff --git a/src/corelib/tools/qcollator_macx.cpp b/src/corelib/tools/qcollator_macx.cpp index 8985cd4eba..877510489a 100644 --- a/src/corelib/tools/qcollator_macx.cpp +++ b/src/corelib/tools/qcollator_macx.cpp @@ -128,12 +128,15 @@ bool QCollator::ignorePunctuation() const int QCollator::compare(const QChar *s1, int len1, const QChar *s2, int len2) const { SInt32 result; - return UCCompareText(d->collator.collator, + Boolean equivalent; + UCCompareText(d->collator.collator, reinterpret_cast(s1), len1, reinterpret_cast(s2), len2, - NULL, + &equivalent, &result); - return result; + if (equivalent) + return 0; + return result < 0 ? -1 : 1; } int QCollator::compare(const QString &str1, const QString &str2) const { -- cgit v1.2.3 From 2de8ef2e49d1a14b5d4acf7bfd9539dadbcbc54f Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 18 Jun 2014 15:38:35 -0700 Subject: Fix compilation with the Intel compiler on certain systems We require the intrinsics from immintrin.h, so include it unconditioanlly with that compiler. Change-Id: I4a17676631f9d89e2d22e486f40c9b177ca06c1e Reviewed-by: Olivier Goffart --- src/corelib/tools/qsimd_p.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index f4ca971567..e1c22bac71 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -139,8 +139,10 @@ || (defined(Q_CC_CLANG) && (__clang_major__ * 100 + __clang_minor__ >= 208)) \ || defined(Q_CC_INTEL)) # define QT_COMPILER_SUPPORTS_X86INTRIN -# ifndef Q_CC_INTEL +# ifdef Q_CC_INTEL // The Intel compiler has no -- all intrinsics are in ; +# include +# else // GCC 4.4 and Clang 2.8 added a few more intrinsics there # include # endif -- cgit v1.2.3 From 7cc893b2169555a8c4d8242f69e7ef12ebc36185 Mon Sep 17 00:00:00 2001 From: Alex Trotsenko Date: Tue, 24 Jun 2014 08:41:11 +0300 Subject: Fix QRingBuffer::readPointerAtPosition() Fix condition to allow return a valid pointer when head != 0. Change-Id: I5215f7dfc44924016c2d9b67ab2d9935b5164d7a Reviewed-by: Oswald Buddenhagen --- src/corelib/tools/qringbuffer_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qringbuffer_p.h b/src/corelib/tools/qringbuffer_p.h index b17c6d2f40..5d25b0add1 100644 --- a/src/corelib/tools/qringbuffer_p.h +++ b/src/corelib/tools/qringbuffer_p.h @@ -90,7 +90,7 @@ public: // special case: it is in the first buffer int nextDataBlockSizeValue = nextDataBlockSize(); - if (pos - head < nextDataBlockSizeValue) { + if (pos < nextDataBlockSizeValue) { length = nextDataBlockSizeValue - pos; return buffers.at(0).constData() + head + pos; } -- cgit v1.2.3 From 32514298131f7e8009a7641e20ff37be91cf4582 Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Mon, 30 Jun 2014 13:52:25 +0200 Subject: Doc: Fix typo in QScopedValueRollback Change-Id: I9835b284d6bba5f7632cae6b179c6c1b08265e5c Reviewed-by: Friedemann Kleint --- src/corelib/tools/qscopedvaluerollback.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qscopedvaluerollback.cpp b/src/corelib/tools/qscopedvaluerollback.cpp index 3201a3c87a..2d61d2114e 100644 --- a/src/corelib/tools/qscopedvaluerollback.cpp +++ b/src/corelib/tools/qscopedvaluerollback.cpp @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE \since 4.8 \ingroup misc - The QScopedAssignment class can be used to revert state when an + The QScopedValueRollback class can be used to revert state when an exception is thrown without needing to write try-catch blocks. It can also be used to manage variables that are temporarily set, -- cgit v1.2.3