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>
This commit is contained in:
parent
b0e6c2de09
commit
d74d066949
|
@ -869,9 +869,13 @@ def _c_serialize_helper_fields_fixed_size(context, self, field,
|
||||||
# total padding = sizeof(pad0) * nmemb
|
# total padding = sizeof(pad0) * nmemb
|
||||||
length += " * %d" % field.type.nmemb
|
length += " * %d" % field.type.nmemb
|
||||||
|
|
||||||
if field.type.is_list:
|
elif field.type.is_list:
|
||||||
# no such case in the protocol, cannot be tested and therefore ignored for now
|
# list with fixed number of elements
|
||||||
raise Exception('list with fixed number of elemens unhandled in _unserialize()')
|
# 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:
|
elif 'serialize' == context:
|
||||||
value = ' xcb_parts[xcb_parts_idx].iov_base = (char *) '
|
value = ' xcb_parts[xcb_parts_idx].iov_base = (char *) '
|
||||||
|
|
Loading…
Reference in New Issue