From 9216bfbcb18c61429b6cdbe7ecf2e9e16c9cdaf7 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 3 Mar 2014 19:29:19 +0100 Subject: Doc: document QTimeZone::swap() Change-Id: I80d55df65546b671772ed93cb852e88ee040114a Reviewed-by: Sze Howe Koh Reviewed-by: Lars Knoll --- src/corelib/tools/qtimezone.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qtimezone.cpp b/src/corelib/tools/qtimezone.cpp index b30caf4289..e17ff2b249 100644 --- a/src/corelib/tools/qtimezone.cpp +++ b/src/corelib/tools/qtimezone.cpp @@ -417,6 +417,13 @@ QTimeZone::~QTimeZone() { } +/*! + \fn QTimeZone::swap(QTimeZone &other) + + Swaps this time zone instance with \a other. This function is very + fast and never fails. +*/ + /*! Assignment operator, assign \a other to this. */ -- cgit v1.2.3 From 0ec07b68ad34e135451dd5291732bf73d297ba0c Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Thu, 10 Apr 2014 13:50:53 +0300 Subject: Improve the Unicode script itemization implementation Make it closer to the Unicode specs (UAX#24): * Common now inherits the preceding character's script, if any; * In a combining character sequence, if the base character is of Common script, the entire sequence is treated like if it were of the first non-Inherited, non-Common script in the sequence. See http://www.unicode.org/reports/tr24/tr24-21.html for more details. [ChangeLog][QtGui] Fixed regression in arabic text rendering. Task-number: QTBUG-28813 Task-number: QTBUG-29930 (related) Task-number: QTBUG-35836 Change-Id: Id85761965b08ca94c674d5f3613fe58b82b2ce9c Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Ahmed Saidi --- src/corelib/tools/qunicodetools.cpp | 38 +++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qunicodetools.cpp b/src/corelib/tools/qunicodetools.cpp index fac795051a..fc36d07a4a 100644 --- a/src/corelib/tools/qunicodetools.cpp +++ b/src/corelib/tools/qunicodetools.cpp @@ -667,7 +667,7 @@ Q_CORE_EXPORT void initCharAttributes(const ushort *string, int length, // ---------------------------------------------------------------------------- // -// The Unicode script property. See http://www.unicode.org/reports/tr24/ (some very old version) +// The Unicode script property. See http://www.unicode.org/reports/tr24/tr24-21.html // // ---------------------------------------------------------------------------- @@ -689,15 +689,36 @@ Q_CORE_EXPORT void initScripts(const ushort *string, int length, uchar *scripts) const QUnicodeTables::Properties *prop = QUnicodeTables::properties(ucs4); - if (Q_LIKELY(prop->script == script || prop->script == QChar::Script_Inherited)) + if (Q_LIKELY(prop->script == script || prop->script <= QChar::Script_Inherited)) continue; // Never break between a combining mark (gc= Mc, Mn or Me) and its base character. // Thus, a combining mark — whatever its script property value is — should inherit // the script property value of its base character. static const int test = (FLAG(QChar::Mark_NonSpacing) | FLAG(QChar::Mark_SpacingCombining) | FLAG(QChar::Mark_Enclosing)); - if (Q_UNLIKELY(FLAG(prop->category) & test)) - continue; + if (Q_UNLIKELY(FLAG(prop->category) & test)) { + // In cases where the base character itself has the Common script property value, + // and it is followed by one or more combining marks with a specific script property value, + // it may be even better for processing to let the base acquire the script property value + // from the first mark. This approach can be generalized by treating all the characters + // of a combining character sequence as having the script property value + // of the first non-Inherited, non-Common character in the sequence if there is one, + // and otherwise treating all the characters as having the Common script property value. + if (Q_LIKELY(script > QChar::Script_Common || prop->script <= QChar::Script_Common)) + continue; + + script = QChar::Script(prop->script); + } + + if (Q_LIKELY(script != QChar::Script_Common)) { + // override preceding Common-s + while (sor > 0 && scripts[sor - 1] == QChar::Script_Common) + --sor; + } else { + // see if we are inheriting preceding run + if (sor > 0) + script = scripts[sor - 1]; + } while (sor < eor) scripts[sor++] = script; @@ -705,6 +726,15 @@ Q_CORE_EXPORT void initScripts(const ushort *string, int length, uchar *scripts) script = prop->script; } eor = length; + if (Q_LIKELY(script != QChar::Script_Common)) { + // override preceding Common-s + while (sor > 0 && scripts[sor - 1] == QChar::Script_Common) + --sor; + } else { + // see if we are inheriting preceding run + if (sor > 0) + script = scripts[sor - 1]; + } while (sor < eor) scripts[sor++] = script; } -- cgit v1.2.3 From 38aba919ac7eac6633dcb63ddc8f11807545ffca Mon Sep 17 00:00:00 2001 From: jkobus Date: Mon, 14 Apr 2014 13:17:12 +0200 Subject: Fix documentation of QRegExp Change-Id: I6c9083941eb791eb34ce982986e3e04ac5a765ad Reviewed-by: Leena Miettinen --- src/corelib/tools/qregexp.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qregexp.cpp b/src/corelib/tools/qregexp.cpp index cadf2da019..fbcd271f1d 100644 --- a/src/corelib/tools/qregexp.cpp +++ b/src/corelib/tools/qregexp.cpp @@ -388,7 +388,7 @@ int qFindString(const QChar *haystack, int haystackLen, int from, Note: Quantifiers are normally "greedy". They always match as much text as they can. For example, \b{0+} matches the first zero it finds and all the consecutive zeros after the first zero. Applied - to '20005', it matches'2\underline{000}5'. Quantifiers can be made + to '20005', it matches '2\underline{000}5'. Quantifiers can be made non-greedy, see setMinimal(). \target capturing parentheses @@ -678,7 +678,7 @@ int qFindString(const QChar *haystack, int haystackLen, int from, QRegExp can match case insensitively using setCaseSensitivity(), and can use non-greedy matching, see setMinimal(). By default QRegExp uses full regexps but this can be changed with - setWildcard(). Searching can be forward with indexIn() or backward + setPatternSyntax(). Searching can be done forward with indexIn() or backward with lastIndexIn(). Captured text can be accessed using capturedTexts() which returns a string list of all captured strings, or using cap() which returns the captured string for the -- cgit v1.2.3 From 3536823c7f967b164f64a6bcfa64e4c5e3b8eb01 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 14 Apr 2014 11:29:37 +0200 Subject: QCollator: Add note about ICU dependency. Task-number: QTBUG-28766 Change-Id: If661915457c4874a72e1111b85897aea596362bf Reviewed-by: Leena Miettinen Reviewed-by: Thiago Macieira --- src/corelib/tools/qcollator.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qcollator.cpp b/src/corelib/tools/qcollator.cpp index 9c97d6b158..f7dfaa7d33 100644 --- a/src/corelib/tools/qcollator.cpp +++ b/src/corelib/tools/qcollator.cpp @@ -205,6 +205,11 @@ QLocale QCollator::locale() const By default this mode is off. + \note On Windows, this functionality makes use of the \l{ICU} library. If Qt was + compiled without ICU support, it falls back to code using native Windows API, + which only works from Windows 7 onwards. On older versions of Windows, it will not work + and a warning will be emitted at runtime. + \sa numericMode() */ -- cgit v1.2.3 From aeb0d58782cb75fa70ffc1b08422a0a44129e4b6 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Fri, 18 Apr 2014 15:51:51 +0300 Subject: Fix warning with -Wswitch-enum > warning: enumeration values 'Joining_None', 'Joining_Left', and 'Joining_Transparent' > not explicitly handled in switch [-Wswitch-enum] Change-Id: I314b486462451e7d62980b6185b46cd115be1547 Reviewed-by: Lars Knoll --- src/corelib/tools/qchar.h | 3 +++ src/corelib/tools/qstring.h | 3 +++ 2 files changed, 6 insertions(+) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qchar.h b/src/corelib/tools/qchar.h index 266effb66a..1955758fca 100644 --- a/src/corelib/tools/qchar.h +++ b/src/corelib/tools/qchar.h @@ -358,6 +358,9 @@ public: case QChar::Joining_Causing: return QChar::Center; case QChar::Joining_Dual: return QChar::Dual; case QChar::Joining_Right: return QChar::Right; + case QChar::Joining_None: + case QChar::Joining_Left: + case QChar::Joining_Transparent: default: return QChar::OtherJoining; } } diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index 2d9a42957e..359d0c49e5 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -954,6 +954,9 @@ public: case QChar::Joining_Causing: return QChar::Center; case QChar::Joining_Dual: return QChar::Dual; case QChar::Joining_Right: return QChar::Right; + case QChar::Joining_None: + case QChar::Joining_Left: + case QChar::Joining_Transparent: default: return QChar::OtherJoining; } } -- cgit v1.2.3 From bbf37b61d00a6470349b728a4e6982a359e0931c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 4 Apr 2014 10:34:15 -0700 Subject: Document QString's UTF-8 conversion behaviors We haven't handled the Unicode non-characters specially since Qt 5.2 (since commit 9327bc87c3abf58bb471693b5448cd78e3db1b46), so this part of the documentation was stale. Since Qt 5.3 (since 8dd47e34b9b96ac27a99cdcf10b8aec506882fc2), QString will insert one replacement character for each byte that can't be decoded properly. [ChangeLog][Important Behavior Changes][UTF-8 decoding] The QString UTF-8 decoder changed behavior slightly: when it encounters invalid sequences, it will insert one replacement character per byte that is invalid, instead of one replacement character for the whole invalid length. Change-Id: Ia4ec78afded9445bbe937311d6be80f71bd1a55f Reviewed-by: Richard J. Moore Reviewed-by: Olivier Goffart Reviewed-by: Lars Knoll --- src/corelib/tools/qstring.cpp | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 79365b11b1..aac9c493c3 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -4331,14 +4331,6 @@ QByteArray QString::toLocal8Bit_helper(const QChar *data, int size) UTF-8 is a Unicode codec and can represent all characters in a Unicode string like QString. - However, in the Unicode range, there are certain codepoints that are not - considered characters. The Unicode standard reserves the last two - codepoints in each Unicode Plane (U+FFFE, U+FFFF, U+1FFFE, U+1FFFF, - U+2FFFE, etc.), as well as 32 codepoints in the range U+FDD0..U+FDEF, - inclusive, as non-characters. If any of those appear in the string, they - may be discarded and will not appear in the UTF-8 representation, or they - may be replaced by one or more replacement characters. - \sa fromUtf8(), toLatin1(), toLocal8Bit(), QTextCodec */ @@ -4493,10 +4485,10 @@ QString QString::fromLocal8Bit_helper(const char *str, int size) sequences, non-characters, overlong sequences or surrogate codepoints encoded into UTF-8. - Non-characters are codepoints that the Unicode standard reserves and must - not be used in text interchange. They are the last two codepoints in each - Unicode Plane (U+FFFE, U+FFFF, U+1FFFE, U+1FFFF, U+2FFFE, etc.), as well - as 32 codepoints in the range U+FDD0..U+FDEF, inclusive. + This function can be used to process incoming data incrementally as long as + all UTF-8 characters are terminated within the incoming data. Any + unterminated characters at the end of the string will be replaced or + suppressed. In order to do stateful decoding, please use \l QTextDecoder. \sa toUtf8(), fromLatin1(), fromLocal8Bit() */ @@ -9517,14 +9509,6 @@ QByteArray QStringRef::toLocal8Bit() const UTF-8 is a Unicode codec and can represent all characters in a Unicode string like QString. - However, in the Unicode range, there are certain codepoints that are not - considered characters. The Unicode standard reserves the last two - codepoints in each Unicode Plane (U+FFFE, U+FFFF, U+1FFFE, U+1FFFF, - U+2FFFE, etc.), as well as 16 codepoints in the range U+FDD0..U+FDDF, - inclusive, as non-characters. If any of those appear in the string, they - may be discarded and will not appear in the UTF-8 representation, or they - may be replaced by one or more replacement characters. - \sa toLatin1(), toLocal8Bit(), QTextCodec */ QByteArray QStringRef::toUtf8() const -- cgit v1.2.3 From e57b521d950575a96d54e6944ab153a9505e51f7 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 6 Mar 2014 13:01:20 -0800 Subject: Deprecate setSharable in Qt containers The ability to set a container to be unsharable has very little use and it costs us an extra conditional for every refcount up and possibly down. This change is a no-op for current Qt 5. It shuffles a few things around just so Qt can compile if you define QT_NO_UNSHARABLE_CONTAINERS. That is done to ease the fixing of the code in Qt 6 and to make my life easier: I'll keep that defined in my local Qt build so I can catch any misuses of this deprecated API. The newly deprecated methods are not marked QT_DEPRECATED because the bootstrapped tools wouldn't build -- they're built with QT_NO_DEPRECATED defined, which causes build errors. [ChangeLog][QtCore] The setSharable() and isSharable() functions in Qt containers has been deprecated and will be removed in Qt 6. New applications should not use this feature, while old applications that may be using this (undocumented) feature should port away from it. Discussed-on: http://lists.qt-project.org/pipermail/development/2014-February/015724.html Change-Id: I789771743dcaed6a43eccd99382f8b3ffa61e479 Reviewed-by: Oswald Buddenhagen Reviewed-by: Lars Knoll --- src/corelib/tools/qarraydata.cpp | 13 +++++++++---- src/corelib/tools/qarraydata.h | 4 ++++ src/corelib/tools/qarraydatapointer.h | 4 ++++ src/corelib/tools/qcontiguouscache.h | 2 ++ src/corelib/tools/qhash.h | 2 ++ src/corelib/tools/qlinkedlist.h | 2 ++ src/corelib/tools/qlist.h | 2 ++ src/corelib/tools/qmap.h | 2 ++ src/corelib/tools/qrefcount.h | 18 ++++++++++++------ src/corelib/tools/qset.h | 2 ++ src/corelib/tools/qvector.h | 14 +++++++++++--- 11 files changed, 52 insertions(+), 13 deletions(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qarraydata.cpp b/src/corelib/tools/qarraydata.cpp index 825b3289c7..12736d5c2e 100644 --- a/src/corelib/tools/qarraydata.cpp +++ b/src/corelib/tools/qarraydata.cpp @@ -75,10 +75,13 @@ QArrayData *QArrayData::allocate(size_t objectSize, size_t alignment, && !(alignment & (alignment - 1))); // Don't allocate empty headers - if (!(options & RawData) && !capacity) - return !(options & Unsharable) - ? const_cast(&qt_array_empty) - : const_cast(&qt_array_unsharable_empty); + if (!(options & RawData) && !capacity) { +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) + if (options & Unsharable) + return const_cast(&qt_array_unsharable_empty); +#endif + return const_cast(&qt_array_empty); + } size_t headerSize = sizeof(QArrayData); @@ -118,8 +121,10 @@ void QArrayData::deallocate(QArrayData *data, size_t objectSize, && !(alignment & (alignment - 1))); Q_UNUSED(objectSize) Q_UNUSED(alignment) +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) if (data == &qt_array_unsharable_empty) return; +#endif Q_ASSERT_X(!data->ref.isStatic(), "QArrayData::deallocate", "Static data can not be deleted"); ::free(data); diff --git a/src/corelib/tools/qarraydata.h b/src/corelib/tools/qarraydata.h index ffb2b8765e..10a9e35542 100644 --- a/src/corelib/tools/qarraydata.h +++ b/src/corelib/tools/qarraydata.h @@ -80,7 +80,9 @@ struct Q_CORE_EXPORT QArrayData enum AllocationOption { CapacityReserved = 0x1, +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) Unsharable = 0x2, +#endif RawData = 0x4, Grow = 0x8, @@ -99,8 +101,10 @@ struct Q_CORE_EXPORT QArrayData AllocationOptions detachFlags() const { AllocationOptions result; +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) if (!ref.isSharable()) result |= Unsharable; +#endif if (capacityReserved) result |= CapacityReserved; return result; diff --git a/src/corelib/tools/qarraydatapointer.h b/src/corelib/tools/qarraydatapointer.h index 533f7a306f..2245106ec0 100644 --- a/src/corelib/tools/qarraydatapointer.h +++ b/src/corelib/tools/qarraydatapointer.h @@ -134,6 +134,7 @@ public: return (!d->isMutable() || d->ref.isShared()); } +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) void setSharable(bool sharable) { if (needsDetach()) { @@ -147,6 +148,9 @@ public: } } + bool isSharable() const { return d->isSharable(); } +#endif + void swap(QArrayDataPointer &other) { qSwap(d, other.d); diff --git a/src/corelib/tools/qcontiguouscache.h b/src/corelib/tools/qcontiguouscache.h index d601ddb819..e05ef33aa2 100644 --- a/src/corelib/tools/qcontiguouscache.h +++ b/src/corelib/tools/qcontiguouscache.h @@ -104,7 +104,9 @@ public: inline void detach() { if (d->ref.load() != 1) detach_helper(); } inline bool isDetached() const { return d->ref.load() == 1; } +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) inline void setSharable(bool sharable) { if (!sharable) detach(); d->sharable = sharable; } +#endif QContiguousCache &operator=(const QContiguousCache &other); #ifdef Q_COMPILER_RVALUE_REFS diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index 40e501355c..f68b02be2c 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -330,7 +330,9 @@ public: inline void detach() { if (d->ref.isShared()) detach_helper(); } inline bool isDetached() const { return !d->ref.isShared(); } +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) inline void setSharable(bool sharable) { if (!sharable) detach(); if (d != &QHashData::shared_null) d->sharable = sharable; } +#endif inline bool isSharedWith(const QHash &other) const { return d == other.d; } void clear(); diff --git a/src/corelib/tools/qlinkedlist.h b/src/corelib/tools/qlinkedlist.h index bdacdbcd26..3377d1bbc3 100644 --- a/src/corelib/tools/qlinkedlist.h +++ b/src/corelib/tools/qlinkedlist.h @@ -106,7 +106,9 @@ public: inline void detach() { if (d->ref.isShared()) detach_helper2(this->e); } inline bool isDetached() const { return !d->ref.isShared(); } +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) inline void setSharable(bool sharable) { if (!sharable) detach(); if (d != &QLinkedListData::shared_null) d->sharable = sharable; } +#endif inline bool isSharedWith(const QLinkedList &other) const { return d == other.d; } inline bool isEmpty() const { return d->size == 0; } diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 3a0d01aa8d..9e4ba70908 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -146,6 +146,7 @@ public: } inline bool isDetached() const { return !d->ref.isShared(); } +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) inline void setSharable(bool sharable) { if (sharable == d->ref.isSharable()) @@ -155,6 +156,7 @@ public: if (d != &QListData::shared_null) d->ref.setSharable(sharable); } +#endif inline bool isSharedWith(const QList &other) const { return d == other.d; } inline bool isEmpty() const { return p.isEmpty(); } diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h index 487039ccfb..76f8bd6f17 100644 --- a/src/corelib/tools/qmap.h +++ b/src/corelib/tools/qmap.h @@ -377,6 +377,7 @@ public: inline void detach() { if (d->ref.isShared()) detach_helper(); } inline bool isDetached() const { return !d->ref.isShared(); } +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) inline void setSharable(bool sharable) { if (sharable == d->ref.isSharable()) @@ -386,6 +387,7 @@ public: // Don't call on shared_null d->ref.setSharable(sharable); } +#endif inline bool isSharedWith(const QMap &other) const { return d == other.d; } void clear(); diff --git a/src/corelib/tools/qrefcount.h b/src/corelib/tools/qrefcount.h index 84314b1fcc..3a8f0f3982 100644 --- a/src/corelib/tools/qrefcount.h +++ b/src/corelib/tools/qrefcount.h @@ -55,8 +55,10 @@ class RefCount public: inline bool ref() Q_DECL_NOTHROW { int count = atomic.load(); +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) if (count == 0) // !isSharable return false; +#endif if (count != -1) // !isStatic atomic.ref(); return true; @@ -64,13 +66,16 @@ public: inline bool deref() Q_DECL_NOTHROW { int count = atomic.load(); +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) if (count == 0) // !isSharable return false; +#endif if (count == -1) // isStatic return true; return atomic.deref(); } +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) bool setSharable(bool sharable) Q_DECL_NOTHROW { Q_ASSERT(!isShared()); @@ -80,17 +85,18 @@ public: return atomic.testAndSetRelaxed(1, 0); } - bool isStatic() const Q_DECL_NOTHROW - { - // Persistent object, never deleted - return atomic.load() == -1; - } - bool isSharable() const Q_DECL_NOTHROW { // Sharable === Shared ownership. return atomic.load() != 0; } +#endif + + bool isStatic() const Q_DECL_NOTHROW + { + // Persistent object, never deleted + return atomic.load() == -1; + } bool isShared() const Q_DECL_NOTHROW { diff --git a/src/corelib/tools/qset.h b/src/corelib/tools/qset.h index ad2f91b983..0cc704b6cf 100644 --- a/src/corelib/tools/qset.h +++ b/src/corelib/tools/qset.h @@ -91,7 +91,9 @@ public: inline void detach() { q_hash.detach(); } inline bool isDetached() const { return q_hash.isDetached(); } +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) inline void setSharable(bool sharable) { q_hash.setSharable(sharable); } +#endif inline void clear() { q_hash.clear(); } diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index b0be98c296..6f7c534085 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -107,6 +107,7 @@ public: inline void detach(); inline bool isDetached() const { return !d->ref.isShared(); } +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) inline void setSharable(bool sharable) { if (sharable == d->ref.isSharable()) @@ -122,6 +123,7 @@ public: } Q_ASSERT(d->ref.isSharable() == sharable); } +#endif inline bool isSharedWith(const QVector &other) const { return d == other.d; } @@ -329,10 +331,12 @@ template void QVector::detach() { if (!isDetached()) { - if (d->alloc) - reallocData(d->size, int(d->alloc)); - else +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) + if (!d->alloc) d = Data::unsharableEmpty(); + else +#endif + reallocData(d->size, int(d->alloc)); } Q_ASSERT(isDetached()); } @@ -484,7 +488,9 @@ void QVector::reallocData(const int asize, const int aalloc, QArrayData::Allo x = Data::allocate(aalloc, options); Q_CHECK_PTR(x); // aalloc is bigger then 0 so it is not [un]sharedEmpty +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) Q_ASSERT(x->ref.isSharable() || options.testFlag(QArrayData::Unsharable)); +#endif Q_ASSERT(!x->ref.isStatic()); x->size = asize; @@ -550,7 +556,9 @@ void QVector::reallocData(const int asize, const int aalloc, QArrayData::Allo Q_ASSERT(d->data()); Q_ASSERT(uint(d->size) <= d->alloc); +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) Q_ASSERT(d != Data::unsharableEmpty()); +#endif Q_ASSERT(aalloc ? d != Data::sharedNull() : d == Data::sharedNull()); Q_ASSERT(d->alloc >= uint(aalloc)); Q_ASSERT(d->size == asize); -- cgit v1.2.3 From 774082e2ee2b9d7f290b84c3a483cc7710bbe8d4 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 23 Apr 2014 07:36:01 -0700 Subject: Doc: QSize::isValid does >= 0 instead of > 0 comparisons The member function documentation was correct, just the class description was off. Task-number: QTBUG-38535 Change-Id: I55dded9d5ea79d93ce4984911acbeec8bbe6884a Reviewed-by: Martin Smith --- src/corelib/tools/qsize.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qsize.cpp b/src/corelib/tools/qsize.cpp index b53eced298..c9a6ffa03a 100644 --- a/src/corelib/tools/qsize.cpp +++ b/src/corelib/tools/qsize.cpp @@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE width and height can be swapped using the transpose() function. The isValid() function determines if a size is valid (a valid size - has both width and height greater than zero). The isEmpty() + has both width and height greater than or equal to zero). The isEmpty() function returns \c true if either of the width and height is less than, or equal to, zero, while the isNull() function returns \c true only if both the width and the height is zero. -- cgit v1.2.3 From 159465536f0dd1a373f0c67e5530f9af6ccec433 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 24 Apr 2014 13:49:21 +0200 Subject: Allow building against static ICU libs also on Unix For dynamic builds of ICU, libicudata is an implicit dependency. Anyhow, it doesn't harm to explicitly link against it, either. So let's do this everywhere ... Task-number: QTBUG-38445 Change-Id: I420ba096e2ce5e1b8d81814ffb4aa7b300143b01 Reviewed-by: Thiago Macieira --- src/corelib/tools/tools.pri | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index 863cf03439..57a9591060 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -163,10 +163,10 @@ contains(QT_CONFIG,icu) { LIBS_PRIVATE += -lsicuin -lsicuuc -lsicudt } } else { - LIBS_PRIVATE += -licuin -licuuc + LIBS_PRIVATE += -licuin -licuuc -licudt } } else { - LIBS_PRIVATE += -licui18n -licuuc + LIBS_PRIVATE += -licui18n -licuuc -licudata } } else: win32 { SOURCES += tools/qcollator_win.cpp -- cgit v1.2.3