diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2009-12-27 10:55:33 -0200 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2009-12-27 23:30:11 +0100 |
commit | 33985fb2020884955ed44db825ace7cf0ec32bbc (patch) | |
tree | 5678da497b9c4577b31cb05efc08acf29c9543bb | |
parent | 53abbf0cedbf2e3478e63c1b007d27a943df630d (diff) | |
download | qt4-tools-33985fb2020884955ed44db825ace7cf0ec32bbc.tar.gz |
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
-rw-r--r-- | src/dbus/qdbusmarshaller.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/dbus/qdbusmarshaller.cpp b/src/dbus/qdbusmarshaller.cpp index f381b27a42..76821c8994 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) ); |