summaryrefslogtreecommitdiffstats
path: root/src/dbus
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-12-27 12:55:33 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2009-12-27 22:30:11 (GMT)
commit33985fb2020884955ed44db825ace7cf0ec32bbc (patch)
tree5678da497b9c4577b31cb05efc08acf29c9543bb /src/dbus
parent53abbf0cedbf2e3478e63c1b007d27a943df630d (diff)
downloadQt-33985fb2020884955ed44db825ace7cf0ec32bbc.zip
Qt-33985fb2020884955ed44db825ace7cf0ec32bbc.tar.gz
Qt-33985fb2020884955ed44db825ace7cf0ec32bbc.tar.bz2
Fix D-Bus marshalling of booleans in optimised code.
C++ booleans are 1 byte in size, but D-Bus booleans (dbus_bool_t) are 4 bytes. That means a boolean with a zero in the LSB byte but non-zero garbage in the high bytes is a valid "false" in C++, but libdbus-1 will turn that to true when sending. Task-number: QTBUG-7041 Reviewed-By: Trust Me BT: yes
Diffstat (limited to 'src/dbus')
-rw-r--r--src/dbus/qdbusmarshaller.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/dbus/qdbusmarshaller.cpp b/src/dbus/qdbusmarshaller.cpp
index f381b27..76821c8 100644
--- a/src/dbus/qdbusmarshaller.cpp
+++ b/src/dbus/qdbusmarshaller.cpp
@@ -378,7 +378,6 @@ bool QDBusMarshaller::appendVariantInternal(const QVariant &arg)
switch (*signature) {
#ifdef __OPTIMIZE__
case DBUS_TYPE_BYTE:
- case DBUS_TYPE_BOOLEAN:
case DBUS_TYPE_INT16:
case DBUS_TYPE_UINT16:
case DBUS_TYPE_INT32:
@@ -388,6 +387,9 @@ bool QDBusMarshaller::appendVariantInternal(const QVariant &arg)
case DBUS_TYPE_DOUBLE:
qIterAppend(&iterator, ba, *signature, arg.constData());
return true;
+ case DBUS_TYPE_BOOLEAN:
+ append( arg.toBool() );
+ return true;
#else
case DBUS_TYPE_BYTE:
append( qvariant_cast<uchar>(arg) );