[Spice-devel] [PATCH spice-server 1/3] reds: Use proper enumeration for read_state field

Frediano Ziglio fziglio at redhat.com
Wed Feb 13 14:53:14 UTC 2019


Allows the compiler to catch some additional errors.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/reds.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/server/reds.c b/server/reds.c
index 306bb7c6e..f27e28b9d 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -224,11 +224,11 @@ typedef struct RedVDIReadBuf {
     uint8_t data[SPICE_AGENT_MAX_DATA_SIZE];
 } RedVDIReadBuf;
 
-enum {
+typedef enum {
     VDI_PORT_READ_STATE_READ_HEADER,
     VDI_PORT_READ_STATE_GET_BUFF,
     VDI_PORT_READ_STATE_READ_DATA,
-};
+} VDIPortReadStates;
 
 struct RedCharDeviceVDIPortPrivate {
     gboolean agent_attached;
@@ -242,7 +242,7 @@ struct RedCharDeviceVDIPortPrivate {
 
     /* read from agent */
     uint32_t num_read_buf;
-    uint32_t read_state;
+    VDIPortReadStates read_state;
     uint32_t message_receive_len;
     uint8_t *receive_pos;
     uint32_t receive_len;
-- 
2.20.1



More information about the Spice-devel mailing list