summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Linhart <chris@DemoRecorder.com>2014-09-06 20:06:15 +0200
committerChristian Linhart <chris@demorecorder.com>2014-09-09 23:54:41 +0200
commitd74d066949dbbbbbcb03bf7764e63f4347f99974 (patch)
tree7a7386e07ad9e11b4c88d64adea40552d4b621f5 /src
parentb0e6c2de09c7474868dd7185674fa113a5c2e0aa (diff)
generator: support fixed size lists in var-sized structs
V2: patch revised according to suggestions from Ran Benita: * removed blanks before an after parentheses of function-calls or tuples * replaced if by elif in "if field.type.is_list". ( this fixes old code ) Message-ID: <540B4D17.1080908@DemoRecorder.com> Patch-Thread-Subject: [Xcb] xinput:QueryDeviceState: full-support: generator and xml-changes Patch-Set: QueryDeviceState Patch-Number: libxcb 1/3 Patch-Version: V2 Signed-off-by: Christian Linhart <chris@DemoRecorder.com> Reviewed-By: Ran Benita <ran234@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/c_client.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/c_client.py b/src/c_client.py
index 87f268b..6f8f8f2 100644
--- a/src/c_client.py
+++ b/src/c_client.py
@@ -869,9 +869,13 @@ def _c_serialize_helper_fields_fixed_size(context, self, field,
# total padding = sizeof(pad0) * nmemb
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()')
+ elif field.type.is_list:
+ # 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 *) '