summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Linhart <chris@demorecorder.com>2014-09-19 13:44:38 +0200
committerChristian Linhart <chris@demorecorder.com>2015-08-13 18:06:43 +0200
commit4033d39d4da21842bb1396a419dfc299591c3b1f (patch)
treea7c574f87cd896bacaa42c97a72b504cc32a80f1
parentb15c96f9507119e5d38a61d92b4dbcd479ea2099 (diff)
make lists after align-pads work
Handle align-pads when generating an end-function in the same way as handling them when generating an accessor or iterator function. Signed-off-by: Christian Linhart <chris@demorecorder.com>
-rw-r--r--src/c_client.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/c_client.py b/src/c_client.py
index 5fff350..c38b434 100644
--- a/src/c_client.py
+++ b/src/c_client.py
@@ -1938,10 +1938,16 @@ def _c_accessors_list(self, field):
_c(' i.data = ((%s *) (R + 1)) + (%s);', field.type.c_wiretype,
_c_accessor_get_expr(field.type.expr, fields))
else:
- _c(' xcb_generic_iterator_t child = %s;',
- _c_iterator_get_end(field.prev_varsized_field, 'R'))
- _c(' i.data = ((%s *) child.data) + (%s);', field.type.c_wiretype,
- _c_accessor_get_expr(field.type.expr, fields))
+ (prev_varsized_field, align_pad) = get_align_pad(field)
+
+ if align_pad is None:
+ align_pad = ('XCB_TYPE_PAD(%s, prev.index)' %
+ type_pad_type(field.first_field_after_varsized.type.c_type))
+
+ _c(' xcb_generic_iterator_t prev = %s;',
+ _c_iterator_get_end(prev_varsized_field, 'R'))
+ _c(' i.data = ((%s *) prev.data) + %s + (%s);', field.type.c_wiretype,
+ align_pad, _c_accessor_get_expr(field.type.expr, fields))
_c(' i.rem = 0;')
_c(' i.index = (char *) i.data - (char *) %s;', param)