[Xcb] [PUSHED] [PATCH libxcb] make lists after align-pads work

Christian Linhart chris at DemoRecorder.com
Thu Aug 13 09:15:29 PDT 2015


I have pushed this patch now.

It got more than enough time for review and nobody complained, so it's probably ok.

It's needed for properly reflect padding between lists in the end-iterator functions
 ( this applies to both explicit and implicit padding)

I need that fix as a prerequisite for another bugfix which I'll post (hopefully this weekend, but can take longer...).

Chris

On 09/19/14 13:44, Christian Linhart wrote:
> Handle align-pads when generating an end-function
> in the same way as handling them when generating
> an accessor or iterator function.
>
> This patch can be applied to branch master
> or to the result of my pending patchsets.
> ---
>  src/c_client.py | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/src/c_client.py b/src/c_client.py
> index 33c86b3..b5a1e0c 100644
> --- a/src/c_client.py
> +++ b/src/c_client.py
> @@ -1976,18 +1976,24 @@ def _c_accessors_list(self, field):
>          if switch_obj is not None:
>              _c('    i.data = %s + %s;', fields[field.c_field_name][0],
>                 _c_accessor_get_expr(field.type.expr, fields))
>          elif field.prev_varsized_field == None:
>              _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)
>          _c('    return i;')
>          _c('}')
>  
>      else:



More information about the Xcb mailing list