[Spice-devel] [PATCH spice-common 1/2] Fix demarshaller code generator

Frediano Ziglio fziglio at redhat.com
Thu May 17 17:08:50 UTC 2018


> 
> Even though commit df4ec5c3186e796624e4bbf2dc4a269faf2823f6 commented
> out most of smartcard code which triggered this error, it still might
> happen if a new message is added with an array member.
> 
> The reason is a missing declaration of mem_size, which is fixed simply
> by checking if the attribute 'nocopy' is present.
> 
> The error log follows:
> 
> generated_server_demarshallers.c: In function
> ‘parse_msgc_smartcard_reader_add’:
> generated_server_demarshallers.c:1985:30: error: ‘mem_size’ undeclared (first
> use in this function); did you mean ‘nw_size’?
>      data = (uint8_t *)malloc(mem_size);
>                               ^~~~~~~~
>                               nw_size
> 
> Signed-off-by: Eduardo Lima (Etrunko) <etrunko at redhat.com>

Acked-by: Frediano Ziglio <fziglio at redhat.com>

Would be great to have a test for this.
Maybe extending test-marshaller ?

> ---
>  python_modules/demarshal.py | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/python_modules/demarshal.py b/python_modules/demarshal.py
> index 8d3f5cb..7b53361 100644
> --- a/python_modules/demarshal.py
> +++ b/python_modules/demarshal.py
> @@ -1039,8 +1039,7 @@ def write_msg_parser(writer, message):
>      msg_type = message.c_type()
>      msg_sizeof = message.sizeof()
>  
> -    want_mem_size = (len(message.members) != 1 or
> message.members[0].is_fixed_nw_size()
> -                         or not message.members[0].is_array())
> +    want_mem_size = not message.has_attr("nocopy")
>  
>      writer.newline()
>      if message.has_attr("ifdef"):


More information about the Spice-devel mailing list