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

2018-05-17 Thread Eduardo Lima (Etrunko)
On 17/05/18 14:08, Frediano Ziglio wrote:
>>
>> 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) 
> 
> Acked-by: Frediano Ziglio 
> 
> Would be great to have a test for this.
> Maybe extending test-marshaller ?

Sure, I will send a v2 with the changes.


-- 
Eduardo de Barros Lima (Etrunko)
Software Engineer - RedHat
etru...@redhat.com
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


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

2018-05-17 Thread Frediano Ziglio
> 
> 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) 

Acked-by: Frediano Ziglio 

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"):
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


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

2018-05-17 Thread Eduardo Lima (Etrunko)
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) 
---
 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"):
-- 
2.14.3

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel