Skip to content

ctypes.c_ulong size on arm #16

@toshem

Description

@toshem

The size of c_long on arm differs from x86_64.

ctypes.sizeof(ctypes.c_long)  # returns 4 on arm
ctypes.sizeof(ctypes.c_long)  # returns 8 on x86_64
ctypes.sizeof(ctypes.c_longlong)  # returns 8 on arm and x86_64

Using c_long results with wrong primitive type conversion for DBus 'X' and 'T'.
It would be safe to use c_longlong (c_ulonglong) instead as they are 8 bytes on both architectures.

--- a/dbussy.py 2019-03-13 13:32:14.099119209 +0100
+++ b/dbussy.py 2019-03-13 13:27:13.787765219 +0100
@@ -76,8 +76,8 @@
             TYPE_UINT16 : ct.c_ushort,
             TYPE_INT32 : ct.c_int,
             TYPE_UINT32 : ct.c_uint,
-            TYPE_INT64 : ct.c_long,
-            TYPE_UINT64 : ct.c_ulong,
+            TYPE_INT64 : ct.c_longlong,
+            TYPE_UINT64 : ct.c_ulonglong,
             TYPE_DOUBLE : ct.c_double,
             TYPE_STRING : ct.c_char_p,
             TYPE_OBJECT_PATH : ct.c_char_p,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions