direct-io.hg

changeset 14318:6ff2a1286484

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.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
author Ewan Mellor <ewan@xensource.com>
date Fri Mar 09 16:04:19 2007 +0000 (2007-03-09)
parents 87cb4916dd75
children 1a01d8d9dbec
files tools/libxen/src/xen_common.c
line diff
     1.1 --- a/tools/libxen/src/xen_common.c	Fri Mar 09 12:28:37 2007 +0000
     1.2 +++ b/tools/libxen/src/xen_common.c	Fri Mar 09 16:04:19 2007 +0000
     1.3 @@ -890,6 +890,9 @@ static size_t size_of_member(const abstr
     1.4      case REF:
     1.5          return sizeof(arbitrary_record_opt *);
     1.6  
     1.7 +    case STRUCT:
     1.8 +        return type->struct_size;
     1.9 +
    1.10      default:
    1.11          assert(false);
    1.12      }
    1.13 @@ -1215,7 +1218,8 @@ add_struct_value(const struct abstract_t
    1.14  
    1.15              for (size_t i = 0; i < set_val->size; i++)
    1.16              {
    1.17 -                void *member_value = set_val->contents + (i * member_size);
    1.18 +                void *member_value = (char *)set_val->contents +
    1.19 +                                     (i * member_size);
    1.20                  add_struct_value(member_type, member_value,
    1.21                                   add_unnamed_value, NULL, data_node);
    1.22              }