diff options
author | Francois Gouget <fgouget@codeweavers.com> | 2015-11-13 16:20:21 +0100 |
---|---|---|
committer | Victor Toso <victortoso@redhat.com> | 2015-11-13 17:57:07 +0100 |
commit | 02370e444514a15c58f166d86f91b4eeddb3cb11 (patch) | |
tree | 65c6513c02ccb70a73d05f2a892f56d48a8e5670 | |
parent | 0159111b22b449cf6a0225723c25f3a0938bce3f (diff) |
vdagent: VDP_LAST_PORT is redundant with VDP_END_PORT. Remove it
VDP_LAST_PORT is equal to VDP_SERVER_PORT while VDP_END_PORT (defined
in spice-protocol) is VDP_SERVER_PORT + 1 so the code needs to be
adjusted to account for this difference.
Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
-rw-r--r-- | src/vdagent-virtio-port.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/vdagent-virtio-port.c b/src/vdagent-virtio-port.c index b04d55b..722f3ba 100644 --- a/src/vdagent-virtio-port.c +++ b/src/vdagent-virtio-port.c @@ -31,7 +31,6 @@ #include "vdagent-virtio-port.h" -#define VDP_LAST_PORT VDP_SERVER_PORT struct vdagent_virtio_port_buf { uint8_t *buf; @@ -63,7 +62,7 @@ struct vdagent_virtio_port { uint8_t chunk_data[VD_AGENT_MAX_DATA_SIZE]; /* Per chunk port data */ - struct vdagent_virtio_port_chunk_port_data port_data[VDP_LAST_PORT + 1]; + struct vdagent_virtio_port_chunk_port_data port_data[VDP_END_PORT]; /* Writes are stored in a linked list of buffers, with both the header + data for a single message in 1 buffer. */ @@ -142,7 +141,7 @@ void vdagent_virtio_port_destroy(struct vdagent_virtio_port **vportp) wbuf = next_wbuf; } - for (i = 0; i <= VDP_LAST_PORT; i++) { + for (i = 0; i < VDP_END_PORT; i++) { free(vport->port_data[i].message_data); } @@ -287,7 +286,7 @@ void vdagent_virtio_port_flush(struct vdagent_virtio_port **vportp) void vdagent_virtio_port_reset(struct vdagent_virtio_port *vport, int port) { - if (port > VDP_LAST_PORT) { + if (port >= VDP_END_PORT) { syslog(LOG_ERR, "vdagent_virtio_port_reset port out of range"); return; } @@ -427,7 +426,7 @@ static void vdagent_virtio_port_do_read(struct vdagent_virtio_port **vportp) vdagent_virtio_port_destroy(vportp); return; } - if (vport->chunk_header.port > VDP_LAST_PORT) { + if (vport->chunk_header.port >= VDP_END_PORT) { syslog(LOG_ERR, "chunk port %u out of range", vport->chunk_header.port); vdagent_virtio_port_destroy(vportp); |