Skip to contentSkip to conversation

Two fixes for sending and receiving of (arrays of) structures.

PATCH Applied Stefan Berger 2 participants 2 messages Mar 9, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Two fixes for sending and receiving of (arrays of) structures.

This patch fixes two problems with sending and receiving of (arrays of) structures.

The first one allows to determine the size of a member when parsing a 'set'.
The cast in the second part fixes the address calculation when serializing an array.

xen-unstable.hg/tools/libxen/src/xen_common.c +5 -1
Index: root/xen-unstable.hg/tools/libxen/src/xen_common.c
===================================================================
@@ -890,6 +890,9 @@ static size_t size_of_member(const abstr
     case REF:
         return sizeof(arbitrary_record_opt *);
 
+    case STRUCT:
+        return type->struct_size;
+
     default:
         assert(false);
     }
@@ -1215,7 +1218,8 @@ add_struct_value(const struct abstract_t
 
             for (size_t i = 0; i < set_val->size; i++)
             {
-                void *member_value = set_val->contents + (i * member_size);
+                void *member_value = (char *)set_val->contents +
+                                     (i * member_size);
                 add_struct_value(member_type, member_value,
                                  add_unnamed_value, NULL, data_node);
             }

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Applied
#1 lore raw
Quoted 10 lines · Stefan Berger

This patch fixes two problems with sending and receiving of (arrays of) structures.

The first one allows to determine the size of a member when parsing a 'set'.
The cast in the second part fixes the address calculation when serializing an array.

Applied, thanks Stefan.

Ewan.