[Spice-devel] [spice-common PATCH] test-marshallers.proto: ArrayMessage: make space for name

Uri Lublin uril at redhat.com
Tue Aug 13 16:45:12 UTC 2019


Do it by adding @end tag.
Without it the allocated memory has no space for 'name'.

Also fix SpiceMsgMainArrayMessage tests/test-marshallers.h,
replacing int8_t* name with int8_t name[].
This makes name an "in-structure" array with no pre-defined size
instead of a pointer.
The size is defined by the message size.

Signed-off-by: Uri Lublin <uril at redhat.com>
---

Since v1:
   - fix 'name' in tests/test-marshallers.h too
   - more information in the commit log

---
 tests/test-marshallers.h     | 2 +-
 tests/test-marshallers.proto | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/test-marshallers.h b/tests/test-marshallers.h
index 7686067..8ca736e 100644
--- a/tests/test-marshallers.h
+++ b/tests/test-marshallers.h
@@ -10,7 +10,7 @@ typedef struct {
 } SpiceMsgMainShortDataSubMarshall;
 
 typedef struct {
-    int8_t *name;
+    int8_t name[0];
 } SpiceMsgMainArrayMessage;
 
 typedef struct {
diff --git a/tests/test-marshallers.proto b/tests/test-marshallers.proto
index 34cc892..eabd487 100644
--- a/tests/test-marshallers.proto
+++ b/tests/test-marshallers.proto
@@ -6,7 +6,7 @@ channel TestChannel {
    } ShortDataSubMarshall;
 
    message {
-      int8 name[];
+      int8 name[] @end;
    } ArrayMessage;
 
     message {
-- 
2.21.0



More information about the Spice-devel mailing list