summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qfreelist_p.h4
-rw-r--r--src/corelib/tools/qlocale.cpp1
-rw-r--r--src/corelib/tools/qrect.cpp6
-rw-r--r--src/corelib/tools/qtimezone.cpp14
-rw-r--r--src/corelib/tools/qvarlengtharray.h20
5 files changed, 27 insertions, 18 deletions
diff --git a/src/corelib/tools/qfreelist_p.h b/src/corelib/tools/qfreelist_p.h
index c3efc41d62..a8d1132d06 100644
--- a/src/corelib/tools/qfreelist_p.h
+++ b/src/corelib/tools/qfreelist_p.h
@@ -237,7 +237,7 @@ inline int QFreeList<T, ConstantsType>::next()
int id, newid, at;
ElementType *v;
do {
- id = _next.load();
+ id = _next.loadAcquire();
at = id & ConstantsType::IndexMask;
const int block = blockfor(at);
@@ -254,7 +254,7 @@ inline int QFreeList<T, ConstantsType>::next()
}
newid = v[at].next.load() | (id & ~ConstantsType::IndexMask);
- } while (!_next.testAndSetRelaxed(id, newid));
+ } while (!_next.testAndSetRelease(id, newid));
// qDebug("QFreeList::next(): returning %d (_next now %d, serial %d)",
// id & ConstantsType::IndexMask,
// newid & ConstantsType::IndexMask,
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index cdda5292e7..ae4befcb9c 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -594,7 +594,6 @@ static QLocalePrivate *c_private()
*/
QSystemLocale::QSystemLocale()
{
- delete _systemLocale;
_systemLocale = this;
if (system_data)
diff --git a/src/corelib/tools/qrect.cpp b/src/corelib/tools/qrect.cpp
index 4b6183646b..895b6b9701 100644
--- a/src/corelib/tools/qrect.cpp
+++ b/src/corelib/tools/qrect.cpp
@@ -1323,8 +1323,8 @@ QDebug operator<<(QDebug dbg, const QRect &r)
rendering.
A QRectF can be constructed with a set of left, top, width and
- height integers, or from a QPoint and a QSize. The following code
- creates two identical rectangles.
+ height coordinates, or from a QPointF and a QSizeF. The following
+ code creates two identical rectangles.
\snippet code/src_corelib_tools_qrect.cpp 1
@@ -1344,7 +1344,7 @@ QDebug operator<<(QDebug dbg, const QRect &r)
translated copy of this rectangle.
The size() function returns the rectange's dimensions as a
- QSize. The dimensions can also be retrieved separately using the
+ QSizeF. The dimensions can also be retrieved separately using the
width() and height() functions. To manipulate the dimensions use
the setSize(), setWidth() or setHeight() functions. Alternatively,
the size can be changed by applying either of the functions
diff --git a/src/corelib/tools/qtimezone.cpp b/src/corelib/tools/qtimezone.cpp
index 359c2d0bdb..ec2f7c4af6 100644
--- a/src/corelib/tools/qtimezone.cpp
+++ b/src/corelib/tools/qtimezone.cpp
@@ -674,9 +674,9 @@ bool QTimeZone::isDaylightTime(const QDateTime &atDateTime) const
QTimeZone::OffsetData QTimeZone::offsetData(const QDateTime &forDateTime) const
{
if (hasTransitions())
- return d->toOffsetData(d->data(forDateTime.toMSecsSinceEpoch()));
+ return QTimeZonePrivate::toOffsetData(d->data(forDateTime.toMSecsSinceEpoch()));
else
- return d->invalidOffsetData();
+ return QTimeZonePrivate::invalidOffsetData();
}
/*!
@@ -712,9 +712,9 @@ bool QTimeZone::hasTransitions() const
QTimeZone::OffsetData QTimeZone::nextTransition(const QDateTime &afterDateTime) const
{
if (hasTransitions())
- return d->toOffsetData(d->nextTransition(afterDateTime.toMSecsSinceEpoch()));
+ return QTimeZonePrivate::toOffsetData(d->nextTransition(afterDateTime.toMSecsSinceEpoch()));
else
- return d->invalidOffsetData();
+ return QTimeZonePrivate::invalidOffsetData();
}
/*!
@@ -733,9 +733,9 @@ QTimeZone::OffsetData QTimeZone::nextTransition(const QDateTime &afterDateTime)
QTimeZone::OffsetData QTimeZone::previousTransition(const QDateTime &beforeDateTime) const
{
if (hasTransitions())
- return d->toOffsetData(d->previousTransition(beforeDateTime.toMSecsSinceEpoch()));
+ return QTimeZonePrivate::toOffsetData(d->previousTransition(beforeDateTime.toMSecsSinceEpoch()));
else
- return d->invalidOffsetData();
+ return QTimeZonePrivate::invalidOffsetData();
}
/*!
@@ -755,7 +755,7 @@ QTimeZone::OffsetDataList QTimeZone::transitions(const QDateTime &fromDateTime,
toDateTime.toMSecsSinceEpoch());
list.reserve(plist.count());
for (const QTimeZonePrivate::Data &pdata : plist)
- list.append(d->toOffsetData(pdata));
+ list.append(QTimeZonePrivate::toOffsetData(pdata));
}
return list;
}
diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h
index 25f5176c22..ae2c75e7df 100644
--- a/src/corelib/tools/qvarlengtharray.h
+++ b/src/corelib/tools/qvarlengtharray.h
@@ -146,15 +146,25 @@ public:
T value(int i, const T &defaultValue) const;
inline void append(const T &t) {
- if (s == a) // i.e. s != 0
+ if (s == a) { // i.e. s != 0
+ T copy(t);
realloc(s, s<<1);
- const int idx = s++;
- if (QTypeInfo<T>::isComplex) {
- new (ptr + idx) T(t);
+ const int idx = s++;
+ if (QTypeInfo<T>::isComplex) {
+ new (ptr + idx) T(std::move(copy));
+ } else {
+ ptr[idx] = std::move(copy);
+ }
} else {
- ptr[idx] = t;
+ const int idx = s++;
+ if (QTypeInfo<T>::isComplex) {
+ new (ptr + idx) T(t);
+ } else {
+ ptr[idx] = t;
+ }
}
}
+
void append(const T *buf, int size);
inline QVarLengthArray<T, Prealloc> &operator<<(const T &t)
{ append(t); return *this; }