summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPovilas Kanapickas <povilas@radix.lt>2021-07-30 22:58:47 +0300
committerPovilas Kanapickas <povilas@radix.lt>2021-07-30 22:58:47 +0300
commit3c76c0579ffa521af41f78ee937b1337581da985 (patch)
treeed6eee237e7f664d8d7c79082f93bacfeaff776e
parentbdc3f21a5205293852bbaa173f43389cbf66f52b (diff)
downloadxcb-libxcb-3c76c0579ffa521af41f78ee937b1337581da985.tar.gz
c_client.py: Implement handling of <length> element
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
-rw-r--r--src/c_client.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/c_client.py b/src/c_client.py
index 6b7e32c..dfb5864 100644
--- a/src/c_client.py
+++ b/src/c_client.py
@@ -1417,6 +1417,16 @@ def _c_serialize(context, self):
elif 'sizeof' == context:
param_names = [p[2] for p in params]
+ if self.length_expr is not None:
+ _c(' const %s *_aux = (%s *)_buffer;', self.c_type, self.c_type)
+ prefix = [('_aux', '->', self)]
+
+ field_mapping = _c_get_field_mapping_for_expr(self, self.length_expr, prefix)
+
+ _c(' return %s;', _c_accessor_get_expr(self.length_expr, field_mapping))
+ _c('}')
+ _c_pre.redirect_end()
+ return
if self.is_switch:
# switch: call _unpack()
_c(' %s _aux;', self.c_type)