2005-11-27 Robert McQueen <robot101@debian.org>
authorRobert McQueen <robot101@debian.org>
Sun, 27 Nov 2005 17:44:19 +0000 (17:44 +0000)
committerRobert McQueen <robot101@debian.org>
Sun, 27 Nov 2005 17:44:19 +0000 (17:44 +0000)
* python/dbus_bindings.pyx: Repair my previous commit which reverted
part of the preceding one. Oops. Merge patch by Johan Hedberg
<johan.hedberg@nokia.com> 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
python/dbus_bindings.pyx
test/python/test-client.py

index d8da60c..7e2bd0c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2005-11-27  Robert McQueen  <robot101@debian.org>
+
+       * python/dbus_bindings.pyx: Repair my previous commit which reverted
+       part of the preceding one. Oops. Merge patch by Johan Hedberg
+       <johan.hedberg@nokia.com> 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  <carlosgc@gnome.org>
 
        * glib/dbus-gobject.c: Append a GValue instead of a basic type in
index 8b1b221..3bde96a 100644 (file)
@@ -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, <char *>&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, <dbus_int32_t *>&c_value)
+        return dbus_message_iter_append_basic(self.iter, TYPE_INT16, <dbus_int16_t *>&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, <dbus_uint32_t *>&c_value)
+        return dbus_message_iter_append_basic(self.iter, TYPE_UINT16, <dbus_uint16_t *>&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
index 2300040..f6ef12b 100755 (executable)
@@ -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")})
                  ]