From fd09345628231970b46bd5d6d0522f068cfe5f3c Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 21 Feb 2017 14:59:14 +1030 Subject: [PATCH] generate-wire: handle variable-size arrays of unknown types. Signed-off-by: Rusty Russell --- tools/generate-wire.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/generate-wire.py b/tools/generate-wire.py index b91517854..60fd67070 100755 --- a/tools/generate-wire.py +++ b/tools/generate-wire.py @@ -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))