fix: marshall boolean correctly (#23)

This commit is contained in:
J. Nick Koston 2022-09-19 19:11:29 -05:00 committed by GitHub
parent c3b2fa7822
commit ca2a3c1aa8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -20,8 +20,9 @@ class Marshaller:
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()

View File

@ -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"
}
]