generate-wire: handle variable-size arrays of unknown types.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2017-02-21 14:59:14 +10:30
parent c15511cf39
commit fd09345628

View File

@ -241,8 +241,12 @@ class Message(object):
print('\t/*{} */'.format(c))
if f.is_unknown:
print('\t*{} = fromwire_{}(ctx, &cursor, plen);'
.format(f.name, basetype))
if f.is_variable_size():
print('\t*{} = fromwire_{}_array(ctx, &cursor, plen, {});'
.format(f.name, basetype, f.lenvar))
else:
print('\t*{} = fromwire_{}(ctx, &cursor, plen);'
.format(f.name, basetype))
elif f.is_padding():
print('\tfromwire_pad(&cursor, plen, {});'
.format(f.num_elems))