summaryrefslogtreecommitdiffstats
path: root/server/red_parse_qxl.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2010-07-05 20:45:13 +0200
committerAlexander Larsson <alexl@redhat.com>2010-07-05 20:45:13 +0200
commitf39d64f40bca094396d5002dcfcd38eaa281c9af (patch)
tree5e25c5d01bf1bd390f119ec3146f4f6b56dee2b4 /server/red_parse_qxl.c
parent6dcf43912e752b8c61199017718ccfb067b45576 (diff)
downloadspice-f39d64f40bca094396d5002dcfcd38eaa281c9af.tar.gz
spice-f39d64f40bca094396d5002dcfcd38eaa281c9af.tar.xz
spice-f39d64f40bca094396d5002dcfcd38eaa281c9af.zip
Convert SpicePath.segments to a pointer array
Diffstat (limited to 'server/red_parse_qxl.c')
-rw-r--r--server/red_parse_qxl.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/server/red_parse_qxl.c b/server/red_parse_qxl.c
index d38cad7b..56f17dc8 100644
--- a/server/red_parse_qxl.c
+++ b/server/red_parse_qxl.c
@@ -153,7 +153,7 @@ static SpicePath *red_get_path(RedMemSlotInfo *slots, int group_id,
bool free_data;
QXLPath *qxl;
SpicePath *red;
- size_t size, mem_size, mem_size2, dsize;
+ size_t size, mem_size, mem_size2, dsize, segment_size;
int n_segments;
int i;
uint32_t count;
@@ -173,7 +173,8 @@ static SpicePath *red_get_path(RedMemSlotInfo *slots, int group_id,
while (start < end) {
n_segments++;
count = start->count;
- mem_size += sizeof(SpicePathSeg) + count * sizeof(SpicePointFix);
+ segment_size = sizeof(SpicePathSeg) + count * sizeof(SpicePointFix);
+ mem_size += sizeof(SpicePathSeg *) + SPICE_ALIGN(segment_size, 4);
start = (QXLPathSeg*)(&start->points[count]);
}
@@ -182,11 +183,11 @@ static SpicePath *red_get_path(RedMemSlotInfo *slots, int group_id,
start = (QXLPathSeg*)data;
end = (QXLPathSeg*)(data + size);
- seg = (SpicePathSeg*)red->segments;
+ seg = (SpicePathSeg*)&red->segments[n_segments];
n_segments = 0;
mem_size2 = sizeof(*red);
while (start < end) {
- n_segments++;
+ red->segments[n_segments++] = seg;
count = start->count;
/* Protect against overflow in size calculations before