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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]