diff --git a/common/draw.h b/common/draw.h index 95f07b8..deed468 100644 --- a/common/draw.h +++ b/common/draw.h @@ -80,7 +80,7 @@ typedef struct SpiceClipRects { } SpiceClipRects; typedef struct SpiceClip { - uint32_t type; + enum SpiceClipType type; SpiceClipRects *rects; } SpiceClip; @@ -94,14 +94,14 @@ typedef struct SpicePalette { typedef struct SpiceImageDescriptor { uint64_t id; - uint8_t type; + enum SpiceImageType type; uint8_t flags; uint32_t width; uint32_t height; } SpiceImageDescriptor; typedef struct SpiceBitmap { - uint8_t format; + enum SpiceBitmapFmt format; uint8_t flags; uint32_t x; uint32_t y; @@ -162,7 +162,7 @@ typedef struct SpicePattern { } SpicePattern; typedef struct SpiceBrush { - uint32_t type; + enum SpiceBrushType type; union { uint32_t color; SpicePattern pattern; @@ -186,7 +186,7 @@ typedef struct SpiceOpaque { SpiceRect src_area; SpiceBrush brush; uint16_t rop_descriptor; - uint8_t scale_mode; + enum SpiceImageScaleMode scale_mode; SpiceQMask mask; } SpiceOpaque; @@ -194,7 +194,7 @@ typedef struct SpiceCopy { SpiceImage *src_bitmap; SpiceRect src_area; uint16_t rop_descriptor; - uint8_t scale_mode; + enum SpiceImageScaleMode scale_mode; SpiceQMask mask; } SpiceCopy, SpiceBlend; @@ -217,7 +217,7 @@ typedef struct SpiceRop3 { SpiceRect src_area; SpiceBrush brush; uint8_t rop3; - uint8_t scale_mode; + enum SpiceImageScaleMode scale_mode; SpiceQMask mask; } SpiceRop3; @@ -264,7 +264,7 @@ typedef struct SpiceText { typedef struct SpiceCursorHeader { uint64_t unique; - uint16_t type; + enum SpiceCursorType type; uint16_t width; uint16_t height; uint16_t hot_spot_x; diff --git a/common/messages.h b/common/messages.h index 65541c5..ce05394 100644 --- a/common/messages.h +++ b/common/messages.h @@ -59,7 +59,7 @@ typedef struct SpiceMsgMainMigrationBegin { uint16_t sport; uint32_t host_offset; uint32_t host_size; - uint16_t pub_key_type; + enum SpicePubkeyType pub_key_type; uint32_t pub_key_offset; uint32_t pub_key_size; } SpiceMsgMainMigrationBegin; @@ -126,13 +126,13 @@ typedef struct SpiceMsgMainInit { typedef struct SpiceMsgDisconnect { uint64_t time_stamp; - uint32_t reason; // SPICE_ERR_? + enum SpiceLinkErr reason; } SpiceMsgDisconnect; typedef struct SpiceMsgNotify { uint64_t time_stamp; - uint32_t severity; - uint32_t visibilty; + enum SpiceNotifySeverity severity; + enum SpiceNotifyVisibility visibilty; uint32_t what; uint32_t message_len; uint8_t message[0]; @@ -156,7 +156,7 @@ typedef struct SpiceMsgPing { } SpiceMsgPing; typedef struct SpiceMsgMainAgentDisconnect { - uint32_t error_code; // SPICE_ERR_? + enum SpiceLinkErr error_code; // SPICE_ERR_? } SpiceMsgMainAgentDisconnect; #define SPICE_AGENT_MAX_DATA_SIZE 2048 @@ -190,7 +190,7 @@ typedef struct SpiceMsgSurfaceCreate { uint32_t surface_id; uint32_t width; uint32_t height; - uint32_t format; + enum SpiceSurfaceFmt format; uint32_t flags; } SpiceMsgSurfaceCreate; @@ -368,14 +368,14 @@ typedef struct SpiceMsgcMouseRelease { typedef struct SpiceMsgPlaybackMode { uint32_t time; - uint32_t mode; //SPICE_AUDIO_DATA_MODE_? + enum SpiceAudioDataMode mode; uint8_t *data; uint32_t data_size; } SpiceMsgPlaybackMode, SpiceMsgcRecordMode; typedef struct SpiceMsgPlaybackStart { uint32_t channels; - uint32_t format; //SPICE_AUDIO_FMT_? + enum SpiceAudioFmt format; uint32_t frequency; uint32_t time; } SpiceMsgPlaybackStart; @@ -388,7 +388,7 @@ typedef struct SpiceMsgPlaybackPacket { typedef struct SpiceMsgRecordStart { uint32_t channels; - uint32_t format; //SPICE_AUDIO_FMT_? + enum SpiceAudioFmt format; uint32_t frequency; } SpiceMsgRecordStart; @@ -402,7 +402,7 @@ typedef struct SpiceMsgTunnelInit { } SpiceMsgTunnelInit; typedef struct SpiceMsgTunnelIpInfo { - uint16_t type; + enum SpiceTunnelIpType type; uint8_t data[0]; } SpiceMsgTunnelIpInfo; @@ -444,7 +444,7 @@ typedef struct SpiceMsgTunnelSocketClosedAck { } SpiceMsgTunnelSocketClosedAck; typedef struct SpiceMsgcTunnelAddGenericService { - uint32_t type; + enum SpiceTunnelServiceType type; uint32_t id; uint32_t group; uint32_t port; diff --git a/server/red_parse_qxl.c b/server/red_parse_qxl.c index 127141c..f74a399 100644 --- a/server/red_parse_qxl.c +++ b/server/red_parse_qxl.c @@ -395,6 +395,8 @@ void red_put_image(SpiceImage *red) } spice_chunks_destroy(red->u.bitmap.data); break; + default: + break; } free(red); } @@ -411,6 +413,8 @@ static void red_get_brush_ptr(RedMemSlotInfo *slots, int group_id, red->u.pattern.pat = red_get_image(slots, group_id, qxl->u.pattern.pat); red_get_point_ptr(&red->u.pattern.pos, &qxl->u.pattern.pos); break; + default: + break; } } @@ -420,6 +424,8 @@ static void red_put_brush(SpiceBrush *red) case SPICE_BRUSH_TYPE_PATTERN: red_put_image(red->u.pattern.pat); break; + default: + break; } } @@ -722,6 +728,8 @@ static void red_get_clip_ptr(RedMemSlotInfo *slots, int group_id, case SPICE_CLIP_TYPE_RECTS: red->rects = red_get_clip_rects(slots, group_id, qxl->data); break; + default: + break; } } @@ -731,6 +739,8 @@ static void red_put_clip(SpiceClip *red) case SPICE_CLIP_TYPE_RECTS: free(red->rects); break; + default: + break; } }