Skip to content

Commit

Permalink
fix: marshall boolean correctly (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco authored Sep 20, 2022
1 parent c3b2fa7 commit ca2a3c1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/dbus_fast/_private/marshaller.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ def align(self, n) -> int:
return offset

def write_boolean(self, boolean: bool, _=None) -> int:
written = self.align(4)
self.buffer.extend(PACK_UINT32(int(boolean)))
return self.align(4) + 4
return written + 4

def write_signature(self, signature: str, _=None) -> int:
signature = signature.encode()
Expand Down
12 changes: 12 additions & 0 deletions tests/data/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -230,5 +230,17 @@
]
},
"data": "6c01000120000000010000007900000001016f00150000002f6f72672f667265656465736b746f702f4442757300000002017300140000006f72672e667265656465736b746f702e4442757300000000030173000500000048656c6c6f00000006017300140000006f72672e667265656465736b746f702e444275730000000008016700037661730000000000000000017600017300000005000000776f726c64000000080000000300000062617200"
},
{
"message": {
"destination": "org.freedesktop.DBus",
"path": "/org/freedesktop/DBus",
"interface": "org.freedesktop.DBus",
"member": "Hello",
"serial": 1,
"signature": "asbbasbb",
"body": [["hello", "worl"], true, false, ["hello", "worl"], true, false]
},
"data": "6c01000148000000010000007e00000001016f00150000002f6f72672f667265656465736b746f702f4442757300000002017300140000006f72672e667265656465736b746f702e4442757300000000030173000500000048656c6c6f00000006017300140000006f72672e667265656465736b746f702e444275730000000008016700086173626261736262000000150000000500000068656c6c6f00000004000000776f726c000000000100000000000000150000000500000068656c6c6f00000004000000776f726c000000000100000000000000"
}
]

0 comments on commit ca2a3c1

Please sign in to comment.