From 3bcfd003b64d8eba41375f98fc1c12c6d153aa14 Mon Sep 17 00:00:00 2001 From: Robert McQueen Date: Sun, 27 Nov 2005 17:44:19 +0000 Subject: 2005-11-27 Robert McQueen * python/dbus_bindings.pyx: Repair my previous commit which reverted part of the preceding one. Oops. Merge patch by Johan Hedberg to fix marshalling of 16-bit integer values on big-endian platforms. * test/python/test-client.py: Add some 16-bit integers to the test values. --- ChangeLog | 10 ++++++++++ python/dbus_bindings.pyx | 22 ++++++++++++++++------ test/python/test-client.py | 1 + 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index d8da60ce..7e2bd0c3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2005-11-27 Robert McQueen + + * python/dbus_bindings.pyx: Repair my previous commit which reverted + part of the preceding one. Oops. Merge patch by Johan Hedberg + to fix marshalling of 16-bit integer values + on big-endian platforms. + + * test/python/test-client.py: Add some 16-bit integers to the test + values. + 2005-11-27 Carlos Garcia Campos * glib/dbus-gobject.c: Append a GValue instead of a basic type in diff --git a/python/dbus_bindings.pyx b/python/dbus_bindings.pyx index 8b1b221b..3bde96a1 100644 --- a/python/dbus_bindings.pyx +++ b/python/dbus_bindings.pyx @@ -1053,7 +1053,10 @@ cdef class MessageIter: tmp_sig = sig[1:-1] retval = self.append_struct(value, signature = tmp_sig) elif sig_type == TYPE_VARIANT: - retval = self.append_variant(Variant(value)) + if isinstance(value, Variant): + retval = self.append_variant(value) + else: + retval = self.append_variant(Variant(value)) elif sig_type == DICT_ENTRY_BEGIN: raise TypeError, "Signiture is invalid in append_strict. A dict entry must be part of an array." else: @@ -1137,14 +1140,14 @@ cdef class MessageIter: return dbus_message_iter_append_basic(self.iter, TYPE_BYTE, &b) def append_int16(self, value): - cdef dbus_int32_t c_value + cdef dbus_int16_t c_value c_value = value - return dbus_message_iter_append_basic(self.iter, TYPE_INT16, &c_value) + return dbus_message_iter_append_basic(self.iter, TYPE_INT16, &c_value) def append_uint16(self, value): - cdef dbus_uint32_t c_value + cdef dbus_uint16_t c_value c_value = value - return dbus_message_iter_append_basic(self.iter, TYPE_UINT16, &c_value) + return dbus_message_iter_append_basic(self.iter, TYPE_UINT16, &c_value) def append_int32(self, value): cdef dbus_int32_t c_value @@ -1359,6 +1362,12 @@ cdef class MessageIter: elif type == TYPE_OBJECT_PATH: path = iter.get_object_path() arg = 'object_path:%s\n' % (path) + elif type == TYPE_INT16: + num = iter.get_int16() + arg = 'int16:%d\n' % (num) + elif type == TYPE_UINT16: + num = iter.get_uint16() + arg = 'uint16:%u\n' % (num) elif type == TYPE_INT32: num = iter.get_int32() arg = 'int32:%d\n' % (num) @@ -1748,8 +1757,9 @@ def bus_register(Connection connection): return retval -NAME_FLAG_PROHIBIT_REPLACEMENT = 0x1 +NAME_FLAG_ALLOW_REPLACEMENT = 0x1 NAME_FLAG_REPLACE_EXISTING = 0x2 +NAME_FLAG_DO_NOT_QUEUE = 0x4 REQUEST_NAME_REPLY_PRIMARY_OWNER = 1 REQUEST_NAME_REPLY_IN_QUEUE = 2 diff --git a/test/python/test-client.py b/test/python/test-client.py index 23000400..f6ef12ba 100755 --- a/test/python/test-client.py +++ b/test/python/test-client.py @@ -31,6 +31,7 @@ test_types_vals = [1, 12323231, 3.14159265, 99999999.99, {1:"a", 2:"b"}, {"a":1, "b":2}, #{"a":(1,"B")}, {1:1.1, 2:2.2}, [[1,2,3],[2,3,4]], [["a","b"],["c","d"]], True, False, + dbus.Int16(-10), dbus.UInt16(10), #([1,2,3],"c", 1.2, ["a","b","c"], {"a": (1,"v"), "b": (2,"d")}) ] -- cgit