Skip to content

Commit

Permalink
Revert "dbus: Add method serial() and replySerial() to class DBusMess…
Browse files Browse the repository at this point in the history
…age."

This reverts commit 618e2cc. The
original commit has a section of code that I failed to review properly
and is of questionable functionality.

Change-Id: I61c53d7b8b2aa7c3312292b017a18aba7da11bc5
Reviewed-by: Thiago Macieira <[email protected]>
  • Loading branch information
thiagomacieira committed Jan 11, 2016
1 parent 1bbf7fb commit 71c0bb3
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 54 deletions.
2 changes: 0 additions & 2 deletions src/dbus/qdbus_symbols_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,6 @@ DEFINEFUNC(const char* , dbus_message_get_sender, (DBusMessage *message),
(message), return)
DEFINEFUNC(dbus_uint32_t , dbus_message_get_serial, (DBusMessage *message),
(message), return)
DEFINEFUNC(dbus_uint32_t , dbus_message_get_reply_serial, (DBusMessage *message),
(message), return)
DEFINEFUNC(const char* , dbus_message_get_signature, (DBusMessage *message),
(message), return)
DEFINEFUNC(int , dbus_message_get_type, (DBusMessage *message),
Expand Down
41 changes: 0 additions & 41 deletions src/dbus/qdbusmessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,7 @@ DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message, QDB

// check if everything is ok
if (marshaller.ok)
{
QDBusMessage *m = (QDBusMessage*)&message;
q_dbus_message_ref(msg);
m->d_ptr->msg = msg;
return msg;
}

// not ok;
q_dbus_message_unref(msg);
Expand Down Expand Up @@ -322,16 +317,6 @@ QDBusMessage QDBusMessagePrivate::makeLocalReply(const QDBusConnectionPrivate &c
return QDBusMessage(); // failed
}

uint QDBusMessagePrivate::serial()
{
return msg ? q_dbus_message_get_serial(msg) : reply ? q_dbus_message_get_serial(reply) : 0;
}

uint QDBusMessagePrivate::replySerial()
{
return msg ? q_dbus_message_get_reply_serial(msg) : reply ? q_dbus_message_get_reply_serial(reply) : 0;
}

/*!
\class QDBusMessage
\inmodule QtDBus
Expand Down Expand Up @@ -647,32 +632,6 @@ QString QDBusMessage::signature() const
return d_ptr->signature;
}

/*!
Returns the serial of the message or 0 if undefined.
The serial number is a unique identifier of a message coming from a
given connection.
The serial is set to a non zero value after the message has been sent
over a D-Bus connection.
*/
uint QDBusMessage::serial() const
{
return d_ptr->serial();
}

/*!
Returns the serial of the message this is a reply to or 0 if undefined.
The serial number is a unique identifier of a message coming from a
given connection and D-Bus messages of 'method return' or 'error' type
use them to match the reply to the method call message.
*/
uint QDBusMessage::replySerial() const
{
return d_ptr->replySerial();
}

/*!
Returns the flag that indicates if this message should see a reply
or not. This is only meaningful for \l {MethodCallMessage}{method
Expand Down
2 changes: 0 additions & 2 deletions src/dbus/qdbusmessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@ class Q_DBUS_EXPORT QDBusMessage
QString errorMessage() const;
MessageType type() const;
QString signature() const;
uint serial() const;
uint replySerial() const;

bool isReplyRequired() const;

Expand Down
2 changes: 0 additions & 2 deletions src/dbus/qdbusmessage_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ class QDBusMessagePrivate
const QDBusMessage &asSent);
static QDBusMessage makeLocalReply(const QDBusConnectionPrivate &conn,
const QDBusMessage &asSent);
uint serial();
uint replySerial();
};

QT_END_NAMESPACE
Expand Down
7 changes: 0 additions & 7 deletions tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ void tst_QDBusConnection::noConnection()
QVERIFY(con.callWithCallback(msg, &spy, SLOT(asyncReply)) == 0);

QDBusMessage reply = con.call(msg);
QCOMPARE(msg.serial(), reply.replySerial());
QVERIFY(reply.type() == QDBusMessage::ErrorMessage);

QDBusReply<void> voidreply(reply);
Expand Down Expand Up @@ -153,7 +152,6 @@ void tst_QDBusConnection::send()

QDBusMessage reply = con.call(msg);

QCOMPARE(msg.serial(), reply.replySerial());
QCOMPARE(reply.arguments().count(), 1);
QCOMPARE(reply.arguments().at(0).typeName(), "QStringList");
QVERIFY(reply.arguments().at(0).toStringList().contains(con.baseService()));
Expand All @@ -173,7 +171,6 @@ void tst_QDBusConnection::sendWithGui()

QDBusMessage reply = con.call(msg, QDBus::BlockWithGui);

QCOMPARE(msg.serial(), reply.replySerial());
QCOMPARE(reply.arguments().count(), 1);
QCOMPARE(reply.arguments().at(0).typeName(), "QStringList");
QVERIFY(reply.arguments().at(0).toStringList().contains(con.baseService()));
Expand Down Expand Up @@ -843,7 +840,6 @@ void tst_QDBusConnection::callSelf()
QString(), "test3");
msg << 44;
reply = connection.call(msg);
QCOMPARE(msg.serial(), reply.replySerial());
QCOMPARE(reply.arguments().value(0).toInt(), 45);
}

Expand Down Expand Up @@ -911,7 +907,6 @@ void tst_QDBusConnection::callSelfByAnotherName()
QString(), "test0");
QDBusMessage reply = con.call(msg, QDBus::Block, 1000);

QCOMPARE(msg.serial(), reply.replySerial());
QVERIFY(reply.type() == QDBusMessage::ReplyMessage);
}

Expand All @@ -927,7 +922,6 @@ void tst_QDBusConnection::multipleInterfacesInQObject()
QDBusMessage msg = QDBusMessage::createMethodCall(con.baseService(), "/p1",
"local.BaseObject", "anotherMethod");
QDBusMessage reply = con.call(msg, QDBus::Block);
QCOMPARE(msg.serial(), reply.replySerial());
QCOMPARE(reply.type(), QDBusMessage::ReplyMessage);
QVERIFY(reply.arguments().count() == 0);
}
Expand Down Expand Up @@ -1208,7 +1202,6 @@ void tst_QDBusConnection::callVirtualObjectLocal()

QDBusMessage message = QDBusMessage::createMethodCall(con.baseService(), path, QString(), "hello");
QDBusMessage reply = con.call(message, QDBus::Block, 5000);
QCOMPARE(message.serial(), reply.replySerial());
QCOMPARE(obj.callCount, 1);
QCOMPARE(obj.lastMessage.service(), con.baseService());
QCOMPARE(obj.lastMessage.interface(), QString());
Expand Down

0 comments on commit 71c0bb3

Please sign in to comment.