[Spice-devel] [PATCH spice-common v2 1/4] codegen: Remove bytes_count attribute

Frediano Ziglio fziglio at redhat.com
Fri Oct 12 11:48:04 UTC 2018


This attribute was used only in SPICE version 1.
Its usage was confusing, and was replaced by the simple usage of
array size.
Generated code does not change.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 docs/spice_protocol.txt     | 5 -----
 python_modules/demarshal.py | 5 +----
 python_modules/marshal.py   | 4 ----
 python_modules/ptypes.py    | 4 ----
 4 files changed, 1 insertion(+), 17 deletions(-)

diff --git a/docs/spice_protocol.txt b/docs/spice_protocol.txt
index 53700db..18b636f 100644
--- a/docs/spice_protocol.txt
+++ b/docs/spice_protocol.txt
@@ -450,11 +450,6 @@ minor
 
 TODO
 
-bytes_count
-~~~~~~~~~~~
-
-TODO
-
 virtual
 ~~~~~~~
 
diff --git a/python_modules/demarshal.py b/python_modules/demarshal.py
index 5a237a6..541137e 100644
--- a/python_modules/demarshal.py
+++ b/python_modules/demarshal.py
@@ -940,10 +940,7 @@ def write_member_parser(writer, container, member, dest, scope):
             writer.statement("*(%s *)end = consume_%s(&in)" % (t.c_type(), t.primitive_type()))
             writer.increment("end", t.sizeof())
         else:
-            if member.has_attr("bytes_count"):
-                dest_var = dest.get_ref(member.attributes["bytes_count"][0])
-            else:
-                dest_var = dest.get_ref(member.name)
+            dest_var = dest.get_ref(member.name)
             writer.assign(dest_var, "consume_%s(&in)" % (t.primitive_type()))
         #TODO validate e.g. flags and enums
     elif t.is_array():
diff --git a/python_modules/marshal.py b/python_modules/marshal.py
index 94ff055..940c925 100644
--- a/python_modules/marshal.py
+++ b/python_modules/marshal.py
@@ -321,10 +321,6 @@ def write_member_marshaller(writer, container, member, src, scope):
     elif t.is_primitive():
         if member.has_attr("zero"):
             writer.statement("spice_marshaller_add_%s(m, 0)" % (t.primitive_type()))
-        elif member.has_attr("bytes_count"):
-            var = "%s__ref" % member.name
-            scope.variable_def("void *", var)
-            writer.statement("%s = spice_marshaller_add_%s(m, %s)" % (var, t.primitive_type(), 0))
 
         else:
             writer.statement("spice_marshaller_add_%s(m, %s)" % (t.primitive_type(), src.get_ref(member.name)))
diff --git a/python_modules/ptypes.py b/python_modules/ptypes.py
index 91c185d..4b74225 100644
--- a/python_modules/ptypes.py
+++ b/python_modules/ptypes.py
@@ -109,9 +109,6 @@ valid_attributes=set([
     'zero',
     # specify minor version required for these members
     'minor',
-    # this member contains the byte count for an array.
-    # the argument is the member name for item count (not bytes)
-    'bytes_count',
     # this attribute does not exist on the network, fill just structure with the value
     'virtual',
     # for a switch this indicates that on network
@@ -126,7 +123,6 @@ attributes_with_arguments=set([
     'outvar',
     'ifdef',
     'minor',
-    'bytes_count',
     'virtual',
 ])
 
-- 
2.17.1



More information about the Spice-devel mailing list