From 262d2cba12e9b164f9699951b37def21e1ed1652 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Mon, 26 May 2014 09:24:18 +0200 Subject: WinRT: Fix compile warnings Change-Id: If223dd73b9558a0f5144be38f19a61316f8c807b Reviewed-by: Oliver Wolff --- src/corelib/tools/qcollator_win.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qcollator_win.cpp b/src/corelib/tools/qcollator_win.cpp index 9a672a0505..4141ba1205 100644 --- a/src/corelib/tools/qcollator_win.cpp +++ b/src/corelib/tools/qcollator_win.cpp @@ -155,6 +155,7 @@ QCollatorSortKey QCollator::sortKey(const QString &string) const #elif defined(Q_OS_WINPHONE) int size = 0; Q_UNIMPLEMENTED(); + Q_UNUSED(string) #else // Q_OS_WINPHONE int size = LCMapStringEx(LOCALE_NAME_USER_DEFAULT, LCMAP_SORTKEY | d->collator, reinterpret_cast(string.constData()), string.size(), -- cgit v1.2.3 From 50491efb0e366f2a73b950d052adb9c621ea67eb Mon Sep 17 00:00:00 2001 From: David Faure Date: Fri, 23 May 2014 20:21:31 +0200 Subject: Fix typos in comments (qfreelist and qmutex) Change-Id: I782b18b9f82a72a29371564838252e1838faf86c Reviewed-by: Olivier Goffart --- src/corelib/tools/qfreelist_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qfreelist_p.h b/src/corelib/tools/qfreelist_p.h index 5e90a03d7f..69b7fc67a0 100644 --- a/src/corelib/tools/qfreelist_p.h +++ b/src/corelib/tools/qfreelist_p.h @@ -81,7 +81,7 @@ struct QFreeListElement /*! \internal - Element in a QFreeList without a paylout. ConstReferenceType and + Element in a QFreeList without a payload. ConstReferenceType and ReferenceType are void, the t() functions return void and are empty. */ template <> -- cgit v1.2.3 From 6e32a58428fc0cf95dd3c7cae6286be5ce44a833 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 27 May 2014 11:26:38 -0700 Subject: Remove unused QMapNode{,Base}::minimumNode These functions are not used anywhere. Since the classes are not documented, we're free to remove the inline functions. The implementation of the const function in QMapNode is also bogus: it discards a const qualifier. Task-number: QTBUG-39301 Change-Id: Ib8fd10a4da4b58a62cef17017ea6127c4d964325 Reviewed-by: Lars Knoll --- src/corelib/tools/qmap.h | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h index 76f8bd6f17..d7bd9c739c 100644 --- a/src/corelib/tools/qmap.h +++ b/src/corelib/tools/qmap.h @@ -102,9 +102,6 @@ struct Q_CORE_EXPORT QMapNodeBase void setColor(Color c) { if (c == Black) p |= Black; else p &= ~Black; } QMapNodeBase *parent() const { return reinterpret_cast(p & ~Mask); } void setParent(QMapNodeBase *pp) { p = (p & Mask) | quintptr(pp); } - - QMapNodeBase *minimumNode() { QMapNodeBase *n = this; while (n->left) n = n->left; return n; } - const QMapNodeBase *minimumNode() const { const QMapNodeBase *n = this; while (n->left) n = n->left; return n; } }; template @@ -121,9 +118,6 @@ struct QMapNode : public QMapNodeBase inline QMapNode *nextNode() { return static_cast(QMapNodeBase::nextNode()); } inline QMapNode *previousNode() { return static_cast(QMapNodeBase::previousNode()); } - QMapNode *minimumNode() { return static_cast(QMapNodeBase::minimumNode()); } - const QMapNode *minimumNode() const { return static_cast(QMapNodeBase::minimumNode()); } - QMapNode *copy(QMapData *d) const; void destroySubTree(); -- cgit v1.2.3 From 6b9a9a01e289381ea915ac43595c6c5da0db73b4 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Fri, 23 May 2014 17:16:54 +0200 Subject: remove HSTRING instances HSTRING needs to be released or handles will be leaked. Instead use HString which takes care of resource management on its own. Task-Number: QTBUG-38115 Change-Id: I2c767776c1f22f45acd8dd77b693f30d63d894b9 Reviewed-by: Andrew Knight Reviewed-by: Oliver Wolff --- src/corelib/tools/qlocale_win.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qlocale_win.cpp b/src/corelib/tools/qlocale_win.cpp index 1690dd83ee..4c44016fdf 100644 --- a/src/corelib/tools/qlocale_win.cpp +++ b/src/corelib/tools/qlocale_win.cpp @@ -663,10 +663,10 @@ QVariant QSystemLocalePrivate::uiLanguages() unsigned int size; languageList->get_Size(&size); for (unsigned int i = 0; i < size; ++i) { - HSTRING language; - languageList->GetAt(i, &language); + HString language; + languageList->GetAt(i, language.GetAddressOf()); UINT32 length; - PCWSTR rawString = WindowsGetStringRawBuffer(language, &length); + PCWSTR rawString = language.GetRawBuffer(&length); result << QString::fromWCharArray(rawString, length); } #else // !Q_OS_WINPHONE -- cgit v1.2.3 From 8636bade176d692672f191bbfb8ded8bbb6aa88c Mon Sep 17 00:00:00 2001 From: David Faure Date: Fri, 23 May 2014 20:22:02 +0200 Subject: qfreelist: fix data race on v[at].next Detected by clang's -fsanitize=thread in tst_qcoreapplication. Task-number: QTBUG-39024 Change-Id: I60b7cece0384f89dc62ac5128faf39a4084e72e2 Reviewed-by: Olivier Goffart --- src/corelib/tools/qfreelist_p.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qfreelist_p.h b/src/corelib/tools/qfreelist_p.h index 69b7fc67a0..ca946cbd8a 100644 --- a/src/corelib/tools/qfreelist_p.h +++ b/src/corelib/tools/qfreelist_p.h @@ -73,7 +73,7 @@ struct QFreeListElement typedef T &ReferenceType; T _t; - int next; + QAtomicInt next; inline ConstReferenceType t() const { return _t; } inline ReferenceType t() { return _t; } @@ -90,7 +90,7 @@ struct QFreeListElement typedef void ConstReferenceType; typedef void ReferenceType; - int next; + QAtomicInt next; inline void t() const { } inline void t() { } @@ -172,7 +172,7 @@ class QFreeList // qDebug("QFreeList: allocating %d elements (%ld bytes) with offset %d", size, size * sizeof(ElementType), offset); ElementType *v = new ElementType[size]; for (int i = 0; i < size; ++i) - v[i].next = offset + i + 1; + v[i].next.store(offset + i + 1); return v; } @@ -254,7 +254,7 @@ inline int QFreeList::next() } } - newid = v[at].next | (id & ~ConstantsType::IndexMask); + newid = v[at].next.load() | (id & ~ConstantsType::IndexMask); } while (!_next.testAndSetRelaxed(id, newid)); // qDebug("QFreeList::next(): returning %d (_next now %d, serial %d)", // id & ConstantsType::IndexMask, @@ -273,7 +273,7 @@ inline void QFreeList::release(int id) int x, newid; do { x = _next.loadAcquire(); - v[at].next = x & ConstantsType::IndexMask; + v[at].next.store(x & ConstantsType::IndexMask); newid = incrementserial(x, id); } while (!_next.testAndSetRelease(x, newid)); -- cgit v1.2.3