mirror of
https://gitlab.freedesktop.org/xorg/lib/libxcb.git
synced 2025-12-20 03:20:09 +01:00
c_client.py: fix getter because &array does not decay to base pointer
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libxcb/-/merge_requests/77>
This commit is contained in:
parent
a0d4be4593
commit
93ee2ac73c
1 changed files with 4 additions and 3 deletions
|
|
@ -1926,10 +1926,11 @@ def _c_accessors_list(self, field):
|
||||||
if f == field:
|
if f == field:
|
||||||
break
|
break
|
||||||
prev_field = f
|
prev_field = f
|
||||||
# utilize the previous field and its number of elements to index past the end of the reply
|
# utilize the previous field to index past the end of the reply
|
||||||
# e.g. if the final field is uint8_t pad[2], generate &R->pad + 2
|
# e.g. if the final field is uint8_t pad[2], generate &R->pad + 1
|
||||||
# e.g. if the final field is uint16_t len, generate &R->len + 1
|
# e.g. if the final field is uint16_t len, generate &R->len + 1
|
||||||
_c(' return (%s *) (&R->%s + %d);', field.c_field_type, prev_field.c_field_name, prev_field.type.nmemb)
|
# the type of &R->pad is uint8_t (*)[2], so + 1 will walk 2 uint8_ts.
|
||||||
|
_c(' return (%s *) (&R->%s + 1);', field.c_field_type, prev_field.c_field_name)
|
||||||
else:
|
else:
|
||||||
_c(' return (%s *) (R + 1);', field.c_field_type)
|
_c(' return (%s *) (R + 1);', field.c_field_type)
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue