summaryrefslogtreecommitdiff
path: root/src/c_client.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/c_client.py')
-rw-r--r--src/c_client.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/c_client.py b/src/c_client.py
index 91719b7..a10b3f1 100644
--- a/src/c_client.py
+++ b/src/c_client.py
@@ -1423,6 +1423,11 @@ def _c_accessor_get_expr(expr, field_mapping):
else:
return lenexp
+def type_pad_type(type):
+ if type == 'void':
+ return 'char'
+ return type
+
def _c_accessors_field(self, field):
'''
Declares the accessor functions for a non-list field that follows a variable-length field.
@@ -1457,7 +1462,7 @@ def _c_accessors_field(self, field):
else:
_c(' xcb_generic_iterator_t prev = %s;', _c_iterator_get_end(field.prev_varsized_field, 'R'))
_c(' return * (%s *) ((char *) prev.data + XCB_TYPE_PAD(%s, prev.index) + %d);',
- field.c_field_type, field.first_field_after_varsized.type.c_type, field.prev_varsized_offset)
+ field.c_field_type, type_pad_type(field.first_field_after_varsized.type.c_type), field.prev_varsized_offset)
_c('}')
else:
_hc('')
@@ -1488,7 +1493,7 @@ def _c_accessors_field(self, field):
else:
_c(' xcb_generic_iterator_t prev = %s;', _c_iterator_get_end(field.prev_varsized_field, 'R'))
_c(' return (%s) ((char *) prev.data + XCB_TYPE_PAD(%s, prev.index) + %d);',
- return_type, field.first_field_after_varsized.type.c_type, field.prev_varsized_offset)
+ return_type, type_pad_type(field.first_field_after_varsized.type.c_type), field.prev_varsized_offset)
_c('}')
@@ -1575,7 +1580,7 @@ def _c_accessors_list(self, field):
else:
_c(' xcb_generic_iterator_t prev = %s;', _c_iterator_get_end(field.prev_varsized_field, 'R'))
_c(' return (%s *) ((char *) prev.data + XCB_TYPE_PAD(%s, prev.index) + %d);',
- field.c_field_type, field.first_field_after_varsized.type.c_type, field.prev_varsized_offset)
+ field.c_field_type, type_pad_type(field.first_field_after_varsized.type.c_type), field.prev_varsized_offset)
_c('}')
_hc('')
@@ -1679,7 +1684,7 @@ def _c_accessors_list(self, field):
else:
_c(' xcb_generic_iterator_t prev = %s;', _c_iterator_get_end(field.prev_varsized_field, 'R'))
_c(' i.data = (%s *) ((char *) prev.data + XCB_TYPE_PAD(%s, prev.index));',
- field.c_field_type, field.c_field_type)
+ field.c_field_type, type_pad_type(field.c_field_type))
if switch_obj is None:
_c(' i.rem = %s;', _c_accessor_get_expr(field.type.expr, fields))
_c(' i.index = (char *) i.data - (char *) %s;', 'R' if switch_obj is None else 'S' )