From 52e8a035f8151483654e531584a5a58c966540b2 Mon Sep 17 00:00:00 2001 From: Christian Linhart Date: Thu, 21 Aug 2014 22:35:54 +0200 Subject: [PATCH] generator: support fixed size lists in var-sized structs Message-ID: <1408653356-21191-1-git-send-email-chris@demorecorder.com> Patch-Thread-Subject: [Xcb] xinput:QueryDeviceState: full-support: generator and xml-changes Patch-Set: QueryDeviceState Patch-Number: libxcb 1/3 Patch-Version: V1 Signed-off-by: Christian Linhart Reviewed-By: Ran Benita --- src/c_client.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/c_client.py b/src/c_client.py index 87f268b..fa59fff 100644 --- a/src/c_client.py +++ b/src/c_client.py @@ -870,8 +870,12 @@ def _c_serialize_helper_fields_fixed_size(context, self, field, length += " * %d" % field.type.nmemb if field.type.is_list: - # no such case in the protocol, cannot be tested and therefore ignored for now - raise Exception('list with fixed number of elemens unhandled in _unserialize()') + #list with fixed number of elements + #length of array = sizeof( arrayElementType ) * nmemb + length += " * %d" % field.type.nmemb + #use memcpy because C cannot assign whole arrays with operator= + value = ' memcpy( %s, xcb_tmp, %s );' % ( abs_field_name, length ) + elif 'serialize' == context: value = ' xcb_parts[xcb_parts_idx].iov_base = (char *) ' -- 2.34.1