summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2011-10-31 10:36:57 +0100
committerQt by Nokia <qt-info@nokia.com>2011-10-31 11:29:08 +0100
commite277575987657aa07444eea9bee99769f039d3b0 (patch)
tree549c419596e340c8ad123df44fc75662ed47b2a7
parent5761d8546f3ff3802cae85ed5224c2bdd9524452 (diff)
Fix most warnings about assignments of QAtomicInt.
Change-Id: Ide409d72d2637b68ec2a85aaca4bc783a7e911e7 Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
-rw-r--r--src/corelib/concurrent/qfuturewatcher.cpp4
-rw-r--r--src/corelib/io/qurl.cpp21
-rw-r--r--src/corelib/kernel/qeventdispatcher_glib.cpp6
-rw-r--r--src/corelib/kernel/qobject.cpp2
-rw-r--r--src/dbus/qdbusargument.cpp4
-rw-r--r--src/dbus/qdbusintegrator.cpp4
-rw-r--r--src/dbus/qdbusunixfiledescriptor.cpp16
-rw-r--r--src/gui/kernel/qcursor_qpa.cpp3
-rw-r--r--src/gui/kernel/qevent_p.h2
-rw-r--r--src/gui/kernel/qkeysequence_p.h6
-rw-r--r--src/gui/painting/qpainterpath.h3
-rw-r--r--src/gui/painting/qpainterpath_p.h4
-rw-r--r--src/gui/painting/qpen.cpp2
-rw-r--r--src/gui/text/qfontengine_ft.cpp2
-rw-r--r--src/gui/text/qstatictext_p.h2
-rw-r--r--src/network/kernel/qauthenticator.cpp2
-rw-r--r--src/network/ssl/qsslsocket.cpp4
-rw-r--r--src/sql/kernel/qsqldatabase.cpp5
-rw-r--r--src/sql/kernel/qsqlrecord.cpp6
-rw-r--r--src/xml/dom/qdom.cpp20
20 files changed, 52 insertions, 66 deletions
diff --git a/src/corelib/concurrent/qfuturewatcher.cpp b/src/corelib/concurrent/qfuturewatcher.cpp
index c9a16a8bbf..e405896f0b 100644
--- a/src/corelib/concurrent/qfuturewatcher.cpp
+++ b/src/corelib/concurrent/qfuturewatcher.cpp
@@ -400,7 +400,7 @@ void QFutureWatcherBase::disconnectOutputInterface(bool pendingAssignment)
{
if (pendingAssignment) {
Q_D(QFutureWatcherBase);
- d->pendingResultsReady = 0;
+ d->pendingResultsReady.store(0);
qDeleteAll(d->pendingCallOutEvents);
d->pendingCallOutEvents.clear();
d->finished = false;
@@ -439,7 +439,7 @@ void QFutureWatcherBasePrivate::sendCallOutEvent(QFutureCallOutEvent *event)
emit q->finished();
break;
case QFutureCallOutEvent::Canceled:
- pendingResultsReady = 0;
+ pendingResultsReady.store(0);
emit q->canceled();
break;
case QFutureCallOutEvent::Paused:
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index b960528fb8..c921a89b30 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -3407,23 +3407,15 @@ static QString qt_ACE_do(const QString &domain, AceOperation op)
return result;
}
-
-QUrlPrivate::QUrlPrivate()
+QUrlPrivate::QUrlPrivate() : ref(1), port(-1), parsingMode(QUrl::TolerantMode),
+ hasQuery(false), hasFragment(false), isValid(false), isHostValid(true),
+ valueDelimiter('='), pairDelimiter('&'),
+ stateFlags(0)
{
- ref = 1;
- port = -1;
- isValid = false;
- isHostValid = true;
- parsingMode = QUrl::TolerantMode;
- valueDelimiter = '=';
- pairDelimiter = '&';
- stateFlags = 0;
- hasFragment = false;
- hasQuery = false;
}
QUrlPrivate::QUrlPrivate(const QUrlPrivate &copy)
- : scheme(copy.scheme),
+ : ref(1), scheme(copy.scheme),
userName(copy.userName),
password(copy.password),
host(copy.host),
@@ -3445,7 +3437,8 @@ QUrlPrivate::QUrlPrivate(const QUrlPrivate &copy)
pairDelimiter(copy.pairDelimiter),
stateFlags(copy.stateFlags),
encodedNormalized(copy.encodedNormalized)
-{ ref = 1; }
+{
+}
QString QUrlPrivate::canonicalHost() const
{
diff --git a/src/corelib/kernel/qeventdispatcher_glib.cpp b/src/corelib/kernel/qeventdispatcher_glib.cpp
index 176048d322..0773915391 100644
--- a/src/corelib/kernel/qeventdispatcher_glib.cpp
+++ b/src/corelib/kernel/qeventdispatcher_glib.cpp
@@ -264,7 +264,7 @@ static gboolean postEventSourcePrepare(GSource *s, gint *timeout)
GPostEventSource *source = reinterpret_cast<GPostEventSource *>(s);
return (!data->canWait
- || (source->serialNumber != source->lastSerialNumber));
+ || (source->serialNumber.load() != source->lastSerialNumber));
}
static gboolean postEventSourceCheck(GSource *source)
@@ -275,7 +275,7 @@ static gboolean postEventSourceCheck(GSource *source)
static gboolean postEventSourceDispatch(GSource *s, GSourceFunc, gpointer)
{
GPostEventSource *source = reinterpret_cast<GPostEventSource *>(s);
- source->lastSerialNumber = source->serialNumber;
+ source->lastSerialNumber = source->serialNumber.load();
QCoreApplication::sendPostedEvents();
source->d->runTimersOnceWithNormalPriority();
return true; // i dunno, george...
@@ -320,7 +320,7 @@ QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(GMainContext *context)
// setup post event source
postEventSource = reinterpret_cast<GPostEventSource *>(g_source_new(&postEventSourceFuncs,
sizeof(GPostEventSource)));
- postEventSource->serialNumber = 1;
+ postEventSource->serialNumber.store(1);
postEventSource->d = this;
g_source_set_can_recurse(&postEventSource->source, true);
g_source_attach(&postEventSource->source, mainContext);
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 555bfa674d..6bca22b6df 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -3011,7 +3011,7 @@ bool QMetaObjectPrivate::connect(const QObject *sender, int signal_index,
c->method_relative = method_index;
c->method_offset = method_offset;
c->connectionType = type;
- c->argumentTypes = types;
+ c->argumentTypes.store(types);
c->nextConnectionList = 0;
c->callFunction = callFunction;
diff --git a/src/dbus/qdbusargument.cpp b/src/dbus/qdbusargument.cpp
index 251859d9e3..af800d765d 100644
--- a/src/dbus/qdbusargument.cpp
+++ b/src/dbus/qdbusargument.cpp
@@ -113,7 +113,7 @@ bool QDBusArgumentPrivate::checkWrite(QDBusArgumentPrivate *&d)
if (!d->marshaller()->ok)
return false;
- if (d->message && d->ref != 1) {
+ if (d->message && d->ref.load() != 1) {
QDBusMarshaller *dd = new QDBusMarshaller(d->capabilities);
dd->message = q_dbus_message_copy(d->message);
q_dbus_message_iter_init_append(dd->message, &dd->iterator);
@@ -154,7 +154,7 @@ bool QDBusArgumentPrivate::checkReadAndDetach(QDBusArgumentPrivate *&d)
if (!checkRead(d))
return false; // don't bother
- if (d->ref == 1)
+ if (d->ref.load() == 1)
return true; // no need to detach
QDBusDemarshaller *dd = new QDBusDemarshaller(d->capabilities);
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
index 8bb7487c9e..f6b433e1ba 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -557,7 +557,7 @@ bool QDBusConnectionPrivate::handleMessage(const QDBusMessage &amsg)
(*(*list)[i])(amsg);
}
- if (!ref)
+ if (!ref.load())
return false;
switch (amsg.type()) {
@@ -1981,7 +1981,7 @@ QDBusPendingCallPrivate *QDBusConnectionPrivate::sendWithReplyAsync(const QDBusM
checkThread();
QDBusPendingCallPrivate *pcall = new QDBusPendingCallPrivate(message, this);
- pcall->ref = 0;
+ pcall->ref.store(0);
QDBusError error;
DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message, capabilities, &error);
diff --git a/src/dbus/qdbusunixfiledescriptor.cpp b/src/dbus/qdbusunixfiledescriptor.cpp
index 86d2b3c92e..0ee29fc20f 100644
--- a/src/dbus/qdbusunixfiledescriptor.cpp
+++ b/src/dbus/qdbusunixfiledescriptor.cpp
@@ -194,7 +194,7 @@ QDBusUnixFileDescriptor::~QDBusUnixFileDescriptor()
*/
bool QDBusUnixFileDescriptor::isValid() const
{
- return d ? d->fd != -1 : false;
+ return d ? d->fd.load() != -1 : false;
}
/*!
@@ -212,7 +212,7 @@ bool QDBusUnixFileDescriptor::isValid() const
*/
int QDBusUnixFileDescriptor::fileDescriptor() const
{
- return d ? d->fd.operator int() : -1;
+ return d ? d->fd.load() : -1;
}
// actual implementation
@@ -269,11 +269,12 @@ void QDBusUnixFileDescriptor::giveFileDescriptor(int fileDescriptor)
else
d = new QDBusUnixFileDescriptorPrivate;
- if (d->fd != -1)
- qt_safe_close(d->fd);
+ const int fdl = d->fd.load();
+ if (fdl != -1)
+ qt_safe_close(fdl);
if (fileDescriptor != -1)
- d->fd = fileDescriptor;
+ d->fd.store(fileDescriptor);
}
/*!
@@ -294,8 +295,9 @@ int QDBusUnixFileDescriptor::takeFileDescriptor()
QDBusUnixFileDescriptorPrivate::~QDBusUnixFileDescriptorPrivate()
{
- if (fd != -1)
- qt_safe_close(fd);
+ const int fdl = fd.load();
+ if (fdl != -1)
+ qt_safe_close(fdl);
}
#else
diff --git a/src/gui/kernel/qcursor_qpa.cpp b/src/gui/kernel/qcursor_qpa.cpp
index 40a15317ee..7b3059e1df 100644
--- a/src/gui/kernel/qcursor_qpa.cpp
+++ b/src/gui/kernel/qcursor_qpa.cpp
@@ -58,9 +58,8 @@ static int nextCursorId = Qt::BitmapCursor;
*****************************************************************************/
QCursorData::QCursorData(Qt::CursorShape s)
- : cshape(s), bm(0), bmm(0), hx(0), hy(0), id(s)
+ : ref(1), cshape(s), bm(0), bmm(0), hx(0), hy(0), id(s)
{
- ref = 1;
}
QCursorData::~QCursorData()
diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h
index 1d65eb63be..fa6b675c86 100644
--- a/src/gui/kernel/qevent_p.h
+++ b/src/gui/kernel/qevent_p.h
@@ -91,7 +91,7 @@ public:
inline QTouchEventTouchPointPrivate *detach()
{
QTouchEventTouchPointPrivate *d = new QTouchEventTouchPointPrivate(*this);
- d->ref = 1;
+ d->ref.store(1);
if (!this->ref.deref())
delete this;
return d;
diff --git a/src/gui/kernel/qkeysequence_p.h b/src/gui/kernel/qkeysequence_p.h
index eb8527a952..7fa98dd5eb 100644
--- a/src/gui/kernel/qkeysequence_p.h
+++ b/src/gui/kernel/qkeysequence_p.h
@@ -69,14 +69,12 @@ struct Q_AUTOTEST_EXPORT QKeyBinding
class Q_AUTOTEST_EXPORT QKeySequencePrivate
{
public:
- inline QKeySequencePrivate()
+ inline QKeySequencePrivate() : ref(1)
{
- ref = 1;
key[0] = key[1] = key[2] = key[3] = 0;
}
- inline QKeySequencePrivate(const QKeySequencePrivate &copy)
+ inline QKeySequencePrivate(const QKeySequencePrivate &copy) : ref(1)
{
- ref = 1;
key[0] = copy.key[0];
key[1] = copy.key[1];
key[2] = copy.key[2];
diff --git a/src/gui/painting/qpainterpath.h b/src/gui/painting/qpainterpath.h
index 9dc435f630..a558abca3d 100644
--- a/src/gui/painting/qpainterpath.h
+++ b/src/gui/painting/qpainterpath.h
@@ -249,6 +249,9 @@ public:
friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPainterPath &);
friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPainterPath &);
#endif
+
+ QPainterPathPrivate() : ref(1) {}
+
private:
QAtomicInt ref;
QVector<QPainterPath::Element> elements;
diff --git a/src/gui/painting/qpainterpath_p.h b/src/gui/painting/qpainterpath_p.h
index 93cc11c8ee..8d5bd7310f 100644
--- a/src/gui/painting/qpainterpath_p.h
+++ b/src/gui/painting/qpainterpath_p.h
@@ -148,13 +148,12 @@ public:
dirtyControlBounds(false),
pathConverter(0)
{
- ref = 1;
require_moveTo = false;
convex = false;
}
QPainterPathData(const QPainterPathData &other) :
- QPainterPathPrivate(), cStart(other.cStart), fillRule(other.fillRule),
+ cStart(other.cStart), fillRule(other.fillRule),
bounds(other.bounds),
controlBounds(other.controlBounds),
dirtyBounds(other.dirtyBounds),
@@ -162,7 +161,6 @@ public:
convex(other.convex),
pathConverter(0)
{
- ref = 1;
require_moveTo = false;
elements = other.elements;
}
diff --git a/src/gui/painting/qpen.cpp b/src/gui/painting/qpen.cpp
index 5a4582e31e..5358239014 100644
--- a/src/gui/painting/qpen.cpp
+++ b/src/gui/painting/qpen.cpp
@@ -358,7 +358,7 @@ void QPen::detach()
QPenData *x = new QPenData(*static_cast<QPenData *>(d));
if (!d->ref.deref())
delete d;
- x->ref = 1;
+ x->ref.store(1);
d = x;
}
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index 37bbd4ffee..7c95af31a8 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -259,7 +259,7 @@ QFreetypeFace *QFreetypeFace::getFace(const QFontEngine::FaceId &face_id,
newFreetype->hbFace = qHBNewFace(face, hb_getSFntTable);
Q_CHECK_PTR(newFreetype->hbFace);
- newFreetype->ref = 1;
+ newFreetype->ref.store(1);
newFreetype->xsize = 0;
newFreetype->ysize = 0;
newFreetype->matrix.xx = 0x10000;
diff --git a/src/gui/text/qstatictext_p.h b/src/gui/text/qstatictext_p.h
index c84e85396d..5f9410c31d 100644
--- a/src/gui/text/qstatictext_p.h
+++ b/src/gui/text/qstatictext_p.h
@@ -68,7 +68,7 @@ public:
OpenGLUserData
};
- QStaticTextUserData(Type t) : type(t) { ref = 0; }
+ QStaticTextUserData(Type t) : ref(0), type(t) {}
virtual ~QStaticTextUserData() {}
QAtomicInt ref;
diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp
index 0423e2224d..8e64968346 100644
--- a/src/network/kernel/qauthenticator.cpp
+++ b/src/network/kernel/qauthenticator.cpp
@@ -264,7 +264,7 @@ void QAuthenticator::detach()
{
if (!d) {
d = new QAuthenticatorPrivate;
- d->ref = 1;
+ d->ref.store(1);
return;
}
diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp
index 2fb04077d4..7aac889b40 100644
--- a/src/network/ssl/qsslsocket.cpp
+++ b/src/network/ssl/qsslsocket.cpp
@@ -870,7 +870,7 @@ QSslConfiguration QSslSocket::sslConfiguration() const
// create a deep copy of our configuration
QSslConfigurationPrivate *copy = new QSslConfigurationPrivate(d->configuration);
- copy->ref = 0; // the QSslConfiguration constructor refs up
+ copy->ref.store(0); // the QSslConfiguration constructor refs up
copy->sessionCipher = d->sessionCipher();
return QSslConfiguration(copy);
@@ -2039,7 +2039,7 @@ void QSslConfigurationPrivate::deepCopyDefaultConfiguration(QSslConfigurationPri
return;
}
- ptr->ref = 1;
+ ptr->ref.store(1);
ptr->peerCertificate = global->peerCertificate;
ptr->peerCertificateChain = global->peerCertificateChain;
ptr->localCertificate = global->localCertificate;
diff --git a/src/sql/kernel/qsqldatabase.cpp b/src/sql/kernel/qsqldatabase.cpp
index a53120c460..6aa45c46e1 100644
--- a/src/sql/kernel/qsqldatabase.cpp
+++ b/src/sql/kernel/qsqldatabase.cpp
@@ -133,11 +133,11 @@ class QSqlDatabasePrivate
{
public:
QSqlDatabasePrivate(QSqlDatabase *d, QSqlDriver *dr = 0):
+ ref(1),
q(d),
driver(dr),
port(-1)
{
- ref = 1;
if(driver)
precisionPolicy = driver->numericalPrecisionPolicy();
else
@@ -171,9 +171,8 @@ public:
static void cleanConnections();
};
-QSqlDatabasePrivate::QSqlDatabasePrivate(const QSqlDatabasePrivate &other)
+QSqlDatabasePrivate::QSqlDatabasePrivate(const QSqlDatabasePrivate &other) : ref(1)
{
- ref = 1;
q = other.q;
dbname = other.dbname;
uname = other.uname;
diff --git a/src/sql/kernel/qsqlrecord.cpp b/src/sql/kernel/qsqlrecord.cpp
index 944f2fc9bc..3f14cba245 100644
--- a/src/sql/kernel/qsqlrecord.cpp
+++ b/src/sql/kernel/qsqlrecord.cpp
@@ -63,14 +63,12 @@ public:
QAtomicInt ref;
};
-QSqlRecordPrivate::QSqlRecordPrivate()
+QSqlRecordPrivate::QSqlRecordPrivate() : ref(1)
{
- ref = 1;
}
-QSqlRecordPrivate::QSqlRecordPrivate(const QSqlRecordPrivate &other): fields(other.fields)
+QSqlRecordPrivate::QSqlRecordPrivate(const QSqlRecordPrivate &other): fields(other.fields), ref(1)
{
- ref = 1;
}
/*! \internal
diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp
index 29798d8a85..5aa7311e6c 100644
--- a/src/xml/dom/qdom.cpp
+++ b/src/xml/dom/qdom.cpp
@@ -1153,18 +1153,17 @@ void QDomImplementation::setInvalidDataPolicy(InvalidDataPolicy policy)
*
**************************************************************/
-QDomNodeListPrivate::QDomNodeListPrivate(QDomNodePrivate *n_impl)
+QDomNodeListPrivate::QDomNodeListPrivate(QDomNodePrivate *n_impl) : ref(1)
{
- ref = 1;
node_impl = n_impl;
if (node_impl)
node_impl->ref.ref();
timestamp = 0;
}
-QDomNodeListPrivate::QDomNodeListPrivate(QDomNodePrivate *n_impl, const QString &name)
+QDomNodeListPrivate::QDomNodeListPrivate(QDomNodePrivate *n_impl, const QString &name) :
+ ref(1)
{
- ref = 1;
node_impl = n_impl;
if (node_impl)
node_impl->ref.ref();
@@ -1172,9 +1171,9 @@ QDomNodeListPrivate::QDomNodeListPrivate(QDomNodePrivate *n_impl, const QString
timestamp = 0;
}
-QDomNodeListPrivate::QDomNodeListPrivate(QDomNodePrivate *n_impl, const QString &_nsURI, const QString &localName)
+QDomNodeListPrivate::QDomNodeListPrivate(QDomNodePrivate *n_impl, const QString &_nsURI, const QString &localName) :
+ ref(1)
{
- ref = 1;
node_impl = n_impl;
if (node_impl)
node_impl->ref.ref();
@@ -1449,9 +1448,8 @@ inline void QDomNodePrivate::setOwnerDocument(QDomDocumentPrivate *doc)
hasParent = false;
}
-QDomNodePrivate::QDomNodePrivate(QDomDocumentPrivate *doc, QDomNodePrivate *par)
+QDomNodePrivate::QDomNodePrivate(QDomDocumentPrivate *doc, QDomNodePrivate *par) : ref(1)
{
- ref = 1;
if (par)
setParent(par);
else
@@ -1465,9 +1463,8 @@ QDomNodePrivate::QDomNodePrivate(QDomDocumentPrivate *doc, QDomNodePrivate *par)
columnNumber = -1;
}
-QDomNodePrivate::QDomNodePrivate(QDomNodePrivate *n, bool deep)
+QDomNodePrivate::QDomNodePrivate(QDomNodePrivate *n, bool deep) : ref(1)
{
- ref = 1;
setOwnerDocument(n->ownerDocument());
prev = 0;
next = 0;
@@ -3052,9 +3049,8 @@ int QDomNode::columnNumber() const
*
**************************************************************/
-QDomNamedNodeMapPrivate::QDomNamedNodeMapPrivate(QDomNodePrivate* n)
+QDomNamedNodeMapPrivate::QDomNamedNodeMapPrivate(QDomNodePrivate* n) : ref(1)
{
- ref = 1;
readonly = false;
parent = n;
appendToParent = false;