[Spice-commits] 4 commits - server/char-device.cpp server/cursor-channel.cpp server/dcc-send.cpp server/dispatcher.cpp server/image-encoders.cpp server/inputs-channel.cpp server/main-channel-client.cpp server/main-dispatcher.cpp server/red-channel-client.cpp server/red-channel.cpp server/red-parse-qxl.cpp server/red-replay-qxl.cpp server/reds.cpp server/red-stream.cpp server/red-stream-device.cpp server/red-worker.cpp server/sound.cpp server/tests server/tree.cpp

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 8 15:27:49 UTC 2021


 server/char-device.cpp              |    6 +++---
 server/cursor-channel.cpp           |    2 +-
 server/dcc-send.cpp                 |   12 ++++++------
 server/dispatcher.cpp               |    2 +-
 server/image-encoders.cpp           |    4 ++--
 server/inputs-channel.cpp           |    6 +++---
 server/main-channel-client.cpp      |    4 ++--
 server/main-dispatcher.cpp          |   16 ++++++++--------
 server/red-channel-client.cpp       |   26 +++++++++++++-------------
 server/red-channel.cpp              |   12 ++++++------
 server/red-parse-qxl.cpp            |    7 +------
 server/red-replay-qxl.cpp           |    4 ++--
 server/red-stream-device.cpp        |   16 ++++++----------
 server/red-stream.cpp               |    9 ++++-----
 server/red-worker.cpp               |    4 ++--
 server/reds.cpp                     |   20 ++++++++++----------
 server/sound.cpp                    |    8 ++++----
 server/tests/test-channel.cpp       |    2 +-
 server/tests/test-dispatcher.cpp    |    2 +-
 server/tests/test-display-base.cpp  |   22 +++++++++++-----------
 server/tests/test-stream-device.cpp |    8 ++++----
 server/tree.cpp                     |    4 ++--
 22 files changed, 93 insertions(+), 103 deletions(-)

New commits:
commit 20fa56d75d96fe87cf82bbe9e6e3027be188ed56
Author: Rosen Penev <rosenp at gmail.com>
Date:   Mon Oct 5 03:19:13 2020 -0700

    clang-tidy: simplify boolean expression
    
    Found with readability-simplify-boolean-expr
    
    Signed-off-by: Rosen Penev <rosenp at gmail.com>

diff --git a/server/red-parse-qxl.cpp b/server/red-parse-qxl.cpp
index 486f5f78..4c4cf672 100644
--- a/server/red-parse-qxl.cpp
+++ b/server/red-parse-qxl.cpp
@@ -1440,11 +1440,7 @@ bool red_validate_surface(uint32_t width, uint32_t height,
 
     /* the multiplication can overflow, also abs(-2^31) may return a negative value */
     size = (uint64_t) height * abs(stride);
-    if (size > MAX_DATA_CHUNK) {
-        return false;
-    }
-
-    return true;
+    return size <= MAX_DATA_CHUNK;
 }
 
 static bool red_get_surface_cmd(QXLInstance *qxl_instance, RedMemSlotInfo *slots, int group_id,
diff --git a/server/red-stream-device.cpp b/server/red-stream-device.cpp
index 983e2b94..8f7868bc 100644
--- a/server/red-stream-device.cpp
+++ b/server/red-stream-device.cpp
@@ -146,16 +146,12 @@ StreamDevice::partial_read()
         }
     }
 
-    if (handled || has_error) {
-        // Qemu put the device on blocking state if we don't read all data
-        // so schedule another read.
-        // We arrive here if we processed that entire message or we
-        // got an error, try to read another message or discard the
-        // wrong data
-        return true;
-    }
-
-    return false;
+    // Qemu put the device on blocking state if we don't read all data
+    // so schedule another read.
+    // We arrive here if we processed that entire message or we
+    // got an error, try to read another message or discard the
+    // wrong data
+    return handled || has_error;
 }
 
 RedPipeItemPtr StreamDevice::read_one_msg_from_device()
commit 76f4dc436a67c6c3bd52f33c780472ef92e55917
Author: Rosen Penev <rosenp at gmail.com>
Date:   Mon Oct 5 14:33:29 2020 -0700

    clang-tidy: add explicit to single argument constructors
    
    Found with google-explicit-constructor
    
    Explicit prevents type conversions for safety reasons.
    
    Signed-off-by: Rosen Penev <rosenp at gmail.com>

diff --git a/server/cursor-channel.cpp b/server/cursor-channel.cpp
index f78dbba2..691c304d 100644
--- a/server/cursor-channel.cpp
+++ b/server/cursor-channel.cpp
@@ -26,7 +26,7 @@
 #include "reds.h"
 
 struct RedCursorPipeItem: public RedPipeItemNum<RED_PIPE_ITEM_TYPE_CURSOR> {
-    RedCursorPipeItem(RedCursorCmd *cmd);
+    explicit RedCursorPipeItem(RedCursorCmd *cmd);
     ~RedCursorPipeItem();
     RedCursorCmd *red_cursor;
 };
diff --git a/server/dispatcher.cpp b/server/dispatcher.cpp
index 0ddb63ae..1163681c 100644
--- a/server/dispatcher.cpp
+++ b/server/dispatcher.cpp
@@ -45,7 +45,7 @@ struct DispatcherMessage {
 
 struct DispatcherPrivate {
     SPICE_CXX_GLIB_ALLOCATOR
-    DispatcherPrivate(uint32_t init_max_message_type):
+    explicit DispatcherPrivate(uint32_t init_max_message_type):
         max_message_type(init_max_message_type)
     {
     }
diff --git a/server/inputs-channel.cpp b/server/inputs-channel.cpp
index 939d652c..9a1880cb 100644
--- a/server/inputs-channel.cpp
+++ b/server/inputs-channel.cpp
@@ -87,12 +87,12 @@ RedsState* spice_tablet_state_get_server(SpiceTabletState *st)
 }
 
 struct RedKeyModifiersPipeItem: public RedPipeItemNum<RED_PIPE_ITEM_KEY_MODIFIERS> {
-    RedKeyModifiersPipeItem(uint8_t modifiers);
+    explicit RedKeyModifiersPipeItem(uint8_t modifiers);
     uint8_t modifiers;
 };
 
 struct RedInputsInitPipeItem: public RedPipeItemNum<RED_PIPE_ITEM_INPUTS_INIT> {
-    RedInputsInitPipeItem(uint8_t modifiers);
+    explicit RedInputsInitPipeItem(uint8_t modifiers);
     uint8_t modifiers;
 };
 
diff --git a/server/reds.cpp b/server/reds.cpp
index 052bd6aa..3ae0216a 100644
--- a/server/reds.cpp
+++ b/server/reds.cpp
@@ -207,7 +207,7 @@ struct SPICE_ATTR_PACKED VDInternalBuf {
 
 struct RedCharDeviceVDIPort: public RedCharDevice
 {
-    RedCharDeviceVDIPort(RedsState *reds);
+    explicit RedCharDeviceVDIPort(RedsState *reds);
     RedCharDeviceVDIPort();
     ~RedCharDeviceVDIPort();
 
diff --git a/server/sound.cpp b/server/sound.cpp
index e5c8d3e8..322171a2 100644
--- a/server/sound.cpp
+++ b/server/sound.cpp
@@ -185,7 +185,7 @@ inline SndChannel* SndChannelClient::get_channel()
 
 struct PlaybackChannel final: public SndChannel
 {
-    PlaybackChannel(RedsState *reds);
+    explicit PlaybackChannel(RedsState *reds);
     void on_connect(RedClient *client, RedStream *stream,
                     int migration, RedChannelCapabilities *caps) override;
 };
@@ -193,7 +193,7 @@ struct PlaybackChannel final: public SndChannel
 
 struct RecordChannel final: public SndChannel
 {
-    RecordChannel(RedsState *reds);
+    explicit RecordChannel(RedsState *reds);
     void on_connect(RedClient *client, RedStream *stream,
                     int migration, RedChannelCapabilities *caps) override;
 };
commit 11374b28b494a31499fd8269c801b6857ebe6aec
Author: Rosen Penev <rosenp at gmail.com>
Date:   Mon Oct 5 02:48:10 2020 -0700

    clang-tidy: remove pointless void
    
    Found with modernize-redundant-void-arg
    
    Signed-off-by: Rosen Penev <rosenp at gmail.com>

diff --git a/server/inputs-channel.cpp b/server/inputs-channel.cpp
index 80ea8a89..939d652c 100644
--- a/server/inputs-channel.cpp
+++ b/server/inputs-channel.cpp
@@ -60,7 +60,7 @@ struct SpiceMouseState {
     int dummy;
 };
 
-static SpiceMouseState* spice_mouse_state_new(void)
+static SpiceMouseState* spice_mouse_state_new()
 {
     return g_new0(SpiceMouseState, 1);
 }
diff --git a/server/reds.cpp b/server/reds.cpp
index a777ac1a..052bd6aa 100644
--- a/server/reds.cpp
+++ b/server/reds.cpp
@@ -2740,7 +2740,7 @@ static inline void openssl_global_init(void)
 }
 
 #else
-static inline void openssl_global_init(void)
+static inline void openssl_global_init()
 {
 }
 #endif
diff --git a/server/tests/test-channel.cpp b/server/tests/test-channel.cpp
index b1f2be83..e9163cd1 100644
--- a/server/tests/test-channel.cpp
+++ b/server/tests/test-channel.cpp
@@ -196,7 +196,7 @@ static RedStream *create_dummy_stream(SpiceServer *server, int *p_socket)
     return stream;
 }
 
-static void channel_loop(void)
+static void channel_loop()
 {
     SpiceCoreInterface *core;
     SpiceServer *server = spice_server_new();
diff --git a/server/tests/test-display-base.cpp b/server/tests/test-display-base.cpp
index 89634903..dea49b07 100644
--- a/server/tests/test-display-base.cpp
+++ b/server/tests/test-display-base.cpp
@@ -97,7 +97,7 @@ static void child_exited(GPid pid, gint status, gpointer user_data)
     exit(0);
 }
 
-static void regression_test(void)
+static void regression_test()
 {
     GPid pid;
     GError *error = NULL;
@@ -476,12 +476,12 @@ static void push_command(QXLCommandExt *ext)
     pthread_mutex_unlock(&command_mutex);
 }
 
-static int get_num_commands(void)
+static int get_num_commands()
 {
     return commands_end - commands_start;
 }
 
-static struct QXLCommandExt *get_simple_command(void)
+static struct QXLCommandExt *get_simple_command()
 {
     pthread_mutex_lock(&command_mutex);
     struct QXLCommandExt *ret = NULL;
@@ -685,7 +685,7 @@ static struct {
     uint8_t data[CURSOR_WIDTH * CURSOR_HEIGHT * 4 + 128]; // 32bit per pixel
 } cursor;
 
-static void cursor_init(void)
+static void cursor_init()
 {
     cursor.cursor.header.unique = 0;
     cursor.cursor.header.type = SPICE_CURSOR_TYPE_COLOR32;
@@ -960,7 +960,7 @@ void test_destroy(Test *test)
     g_free(test);
 }
 
-static void init_automated(void)
+static void init_automated()
 {
 }
 
diff --git a/server/tests/test-stream-device.cpp b/server/tests/test-stream-device.cpp
index c7db9343..bb9852ae 100644
--- a/server/tests/test-stream-device.cpp
+++ b/server/tests/test-stream-device.cpp
@@ -67,7 +67,7 @@ static uint8_t *add_format(uint8_t *p, uint32_t w, uint32_t h, SpiceVideoCodecTy
 /* currently we don't care about possible capabilities sent so discard them
  * from server reply */
 static void
-discard_server_capabilities(void)
+discard_server_capabilities()
 {
     StreamDevHeader hdr;
 
@@ -88,7 +88,7 @@ discard_server_capabilities(void)
 
 // check we have an error message on the write buffer
 static void
-check_vmc_error_message(void)
+check_vmc_error_message()
 {
     StreamDevHeader hdr;
 
@@ -181,7 +181,7 @@ static void test_stream_device_teardown(TestFixture *fixture, gconstpointer user
     core = NULL;
 }
 
-static void test_kick(void)
+static void test_kick()
 {
     spice_server_add_interface(test->server, &vmc->instance.base);
 
commit 9f1514b8040cf8dd74bd85097855f8da4fa143d0
Author: Rosen Penev <rosenp at gmail.com>
Date:   Mon Oct 5 02:40:16 2020 -0700

    clang-tidy: use using
    
    Found with modernize-use-using
    
    Also manually removed a bunch of typedefs as they are no longer useful
    in C++.
    
    https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Rt-using
    
    Signed-off-by: Rosen Penev <rosenp at gmail.com>

diff --git a/server/char-device.cpp b/server/char-device.cpp
index fff650a4..bf3fafcf 100644
--- a/server/char-device.cpp
+++ b/server/char-device.cpp
@@ -31,12 +31,12 @@
 #define CHAR_DEVICE_WRITE_TO_TIMEOUT 100
 #define RED_CHAR_DEVICE_WAIT_TOKENS_TIMEOUT 30000
 
-typedef enum {
+enum WriteBufferOrigin {
     WRITE_BUFFER_ORIGIN_NONE,
     WRITE_BUFFER_ORIGIN_CLIENT,
     WRITE_BUFFER_ORIGIN_SERVER,
     WRITE_BUFFER_ORIGIN_SERVER_NO_TOKEN,
-} WriteBufferOrigin;
+};
 
 struct RedCharDeviceWriteBufferPrivate {
     RedCharDeviceClientOpaque *client; /* The client that sent the message to the device.
@@ -48,7 +48,7 @@ struct RedCharDeviceWriteBufferPrivate {
 
 struct RedCharDeviceClient {
     SPICE_CXX_GLIB_ALLOCATOR
-    typedef std::list<RedPipeItemPtr, red::Mallocator<RedPipeItemPtr>> Queue;
+    using Queue = std::list<RedPipeItemPtr, red::Mallocator<RedPipeItemPtr> >;
 
     RedCharDeviceClient(RedCharDevice *dev,
                         RedsState *reds,
diff --git a/server/dcc-send.cpp b/server/dcc-send.cpp
index a498c27c..d42a64e4 100644
--- a/server/dcc-send.cpp
+++ b/server/dcc-send.cpp
@@ -24,28 +24,28 @@
 #include "display-channel-private.h"
 #include "red-qxl.h"
 
-typedef enum {
+enum FillBitsType {
     FILL_BITS_TYPE_INVALID,
     FILL_BITS_TYPE_CACHE,
     FILL_BITS_TYPE_SURFACE,
     FILL_BITS_TYPE_COMPRESS_LOSSLESS,
     FILL_BITS_TYPE_COMPRESS_LOSSY,
     FILL_BITS_TYPE_BITMAP,
-} FillBitsType;
+};
 
-typedef enum {
+enum BitmapDataType {
     BITMAP_DATA_TYPE_INVALID,
     BITMAP_DATA_TYPE_CACHE,
     BITMAP_DATA_TYPE_SURFACE,
     BITMAP_DATA_TYPE_BITMAP,
     BITMAP_DATA_TYPE_BITMAP_TO_CACHE,
-} BitmapDataType;
+};
 
-typedef struct BitmapData {
+struct BitmapData {
     BitmapDataType type;
     uint64_t id; // surface id or cache item id
     SpiceRect lossy_rect;
-} BitmapData;
+};
 
 static int dcc_pixmap_cache_unlocked_hit(DisplayChannelClient *dcc, uint64_t id, int *lossy)
 {
diff --git a/server/image-encoders.cpp b/server/image-encoders.cpp
index 801e3e8d..caafdc4c 100644
--- a/server/image-encoders.cpp
+++ b/server/image-encoders.cpp
@@ -38,8 +38,8 @@
     } G_STMT_END
 #endif
 
-typedef struct RedGlzDrawable RedGlzDrawable;
-typedef struct GlzDrawableInstanceItem GlzDrawableInstanceItem;
+struct RedGlzDrawable;
+struct GlzDrawableInstanceItem;
 
 struct GlzSharedDictionary {
     GlzEncDictContext *dict;
diff --git a/server/main-channel-client.cpp b/server/main-channel-client.cpp
index 32730b4c..6d6cc18e 100644
--- a/server/main-channel-client.cpp
+++ b/server/main-channel-client.cpp
@@ -28,13 +28,13 @@
 #define NET_TEST_WARMUP_BYTES 0
 #define NET_TEST_BYTES (1024 * 250)
 
-typedef enum {
+enum NetTestStage {
     NET_TEST_STAGE_INVALID,
     NET_TEST_STAGE_WARMUP,
     NET_TEST_STAGE_LATENCY,
     NET_TEST_STAGE_RATE,
     NET_TEST_STAGE_COMPLETE,
-} NetTestStage;
+};
 
 #define CLIENT_CONNECTIVITY_TIMEOUT (MSEC_PER_SEC * 30)
 
diff --git a/server/main-dispatcher.cpp b/server/main-dispatcher.cpp
index 533f679c..94dbb4c1 100644
--- a/server/main-dispatcher.cpp
+++ b/server/main-dispatcher.cpp
@@ -56,23 +56,23 @@ enum {
     MAIN_DISPATCHER_NUM_MESSAGES
 };
 
-typedef struct MainDispatcherChannelEventMessage {
+struct MainDispatcherChannelEventMessage {
     int event;
     SpiceChannelEventInfo *info;
-} MainDispatcherChannelEventMessage;
+};
 
-typedef struct MainDispatcherMigrateSeamlessDstCompleteMessage {
+struct MainDispatcherMigrateSeamlessDstCompleteMessage {
     RedClient *client;
-} MainDispatcherMigrateSeamlessDstCompleteMessage;
+};
 
-typedef struct MainDispatcherMmTimeLatencyMessage {
+struct MainDispatcherMmTimeLatencyMessage {
     RedClient *client;
     uint32_t latency;
-} MainDispatcherMmTimeLatencyMessage;
+};
 
-typedef struct MainDispatcherClientDisconnectMessage {
+struct MainDispatcherClientDisconnectMessage {
     RedClient *client;
-} MainDispatcherClientDisconnectMessage;
+};
 
 /* channel_event - calls core->channel_event, must be done in main thread */
 static void main_dispatcher_handle_channel_event(void *opaque,
diff --git a/server/red-channel-client.cpp b/server/red-channel-client.cpp
index 2d6a780c..48271a9d 100644
--- a/server/red-channel-client.cpp
+++ b/server/red-channel-client.cpp
@@ -44,7 +44,7 @@
 #define IOV_MAX 1024
 #endif
 
-typedef struct SpiceDataHeaderOpaque SpiceDataHeaderOpaque;
+struct SpiceDataHeaderOpaque;
 
 typedef uint16_t (*get_msg_type_proc)(SpiceDataHeaderOpaque *header);
 typedef uint32_t (*get_msg_size_proc)(SpiceDataHeaderOpaque *header);
@@ -66,14 +66,14 @@ struct SpiceDataHeaderOpaque {
     get_msg_size_proc get_msg_size;
 };
 
-typedef enum {
+enum QosPingState {
     PING_STATE_NONE,
     PING_STATE_TIMER,
     PING_STATE_WARMUP,
     PING_STATE_LATENCY,
-} QosPingState;
+};
 
-typedef struct RedChannelClientLatencyMonitor {
+struct RedChannelClientLatencyMonitor {
     QosPingState state;
     uint64_t last_pong_time;
     SpiceTimer *timer;
@@ -83,35 +83,35 @@ typedef struct RedChannelClientLatencyMonitor {
     bool warmup_was_sent;
 
     int64_t roundtrip;
-} RedChannelClientLatencyMonitor;
+};
 
-typedef enum {
+enum ConnectivityState {
     CONNECTIVITY_STATE_CONNECTED,
     CONNECTIVITY_STATE_BLOCKED,
     CONNECTIVITY_STATE_WAIT_PONG,
     CONNECTIVITY_STATE_DISCONNECTED,
-} ConnectivityState;
+};
 
-typedef struct RedChannelClientConnectivityMonitor {
+struct RedChannelClientConnectivityMonitor {
     ConnectivityState state;
     bool sent_bytes;
     bool received_bytes;
     uint32_t timeout;
     SpiceTimer *timer;
-} RedChannelClientConnectivityMonitor;
+};
 
-typedef struct OutgoingMessageBuffer {
+struct OutgoingMessageBuffer {
     int pos;
     int size;
-} OutgoingMessageBuffer;
+};
 
-typedef struct IncomingMessageBuffer {
+struct IncomingMessageBuffer {
     uint8_t header_buf[MAX_HEADER_SIZE];
     SpiceDataHeaderOpaque header;
     uint32_t header_pos;
     uint8_t *msg; // data of the msg following the header. allocated by alloc_msg_buf.
     uint32_t msg_pos;
-} IncomingMessageBuffer;
+};
 
 struct RedChannelClientPrivate
 {
diff --git a/server/red-channel.cpp b/server/red-channel.cpp
index dc577695..c06f29e5 100644
--- a/server/red-channel.cpp
+++ b/server/red-channel.cpp
@@ -322,13 +322,13 @@ void RedChannel::disconnect()
     red_channel_foreach_client(this, &RedChannelClient::disconnect);
 }
 
-typedef struct RedMessageConnect {
+struct RedMessageConnect {
     RedChannel *channel;
     RedClient *client;
     RedStream *stream;
     int migration;
     RedChannelCapabilities caps;
-} RedMessageConnect;
+};
 
 static void handle_dispatcher_connect(void *opaque, RedMessageConnect *msg)
 {
@@ -538,9 +538,9 @@ const RedChannelCapabilities* RedChannel::get_local_capabilities()
     return &priv->local_caps;
 }
 
-typedef struct RedMessageMigrate {
+struct RedMessageMigrate {
     RedChannelClient *rcc;
-} RedMessageMigrate;
+};
 
 static void handle_dispatcher_migrate(void *opaque, RedMessageMigrate *msg)
 {
@@ -562,9 +562,9 @@ void RedChannel::migrate_client(RedChannelClient *rcc)
                                           &payload, false);
 }
 
-typedef struct RedMessageDisconnect {
+struct RedMessageDisconnect {
     RedChannelClient *rcc;
-} RedMessageDisconnect;
+};
 
 static void handle_dispatcher_disconnect(void *opaque, RedMessageDisconnect *msg)
 {
diff --git a/server/red-parse-qxl.cpp b/server/red-parse-qxl.cpp
index ac0d85bd..486f5f78 100644
--- a/server/red-parse-qxl.cpp
+++ b/server/red-parse-qxl.cpp
@@ -45,7 +45,6 @@ verify(MAX_DATA_CHUNK <= G_MAXINT32);
 
 #define INVALID_SIZE ((size_t) -1)
 
-typedef struct RedDataChunk RedDataChunk;
 struct RedDataChunk {
     uint32_t data_size;
     RedDataChunk *prev_chunk;
diff --git a/server/red-replay-qxl.cpp b/server/red-replay-qxl.cpp
index 13431094..c87a79c8 100644
--- a/server/red-replay-qxl.cpp
+++ b/server/red-replay-qxl.cpp
@@ -32,10 +32,10 @@
 #define QXLPHYSICAL_FROM_PTR(ptr) ((QXLPHYSICAL)(uintptr_t)(ptr))
 #define QXLPHYSICAL_TO_PTR(phy) ((void*)(uintptr_t)(phy))
 
-typedef enum {
+enum replay_t {
     REPLAY_OK = 0,
     REPLAY_ERROR,
-} replay_t;
+};
 
 struct SpiceReplay {
     FILE *fd;
diff --git a/server/red-stream.cpp b/server/red-stream.cpp
index c1f0f00c..8a01857d 100644
--- a/server/red-stream.cpp
+++ b/server/red-stream.cpp
@@ -53,12 +53,11 @@ struct AsyncRead {
     AsyncReadDone done;
     AsyncReadError error;
 };
-typedef struct AsyncRead AsyncRead;
 
 #if HAVE_SASL
 #include <sasl/sasl.h>
 
-typedef struct RedSASL {
+struct RedSASL {
     sasl_conn_t *conn;
 
     /* If we want to negotiate an SSF layer with client */
@@ -75,7 +74,7 @@ typedef struct RedSASL {
     unsigned int encodedOffset;
 
     SpiceBuffer inbuffer;
-} RedSASL;
+};
 #endif
 
 struct RedStreamPrivate {
@@ -807,7 +806,7 @@ static int auth_sasl_check_ssf(RedSASL *sasl, int *runSSF)
     return 1;
 }
 
-typedef struct RedSASLAuth {
+struct RedSASLAuth {
     RedStream *stream;
     // list of mechanisms allowed, allocated and freed by SASL
     char *mechlist;
@@ -821,7 +820,7 @@ typedef struct RedSASLAuth {
     // saved Async callback, we need to call if failed as
     // we need to chain it in order to use a different opaque data
     AsyncReadError saved_error_cb;
-} RedSASLAuth;
+};
 
 static void red_sasl_auth_free(RedSASLAuth *auth)
 {
diff --git a/server/red-worker.cpp b/server/red-worker.cpp
index 205cc28f..98ce13a9 100644
--- a/server/red-worker.cpp
+++ b/server/red-worker.cpp
@@ -949,10 +949,10 @@ static void register_callbacks(Dispatcher *dispatcher)
 
 
 
-typedef struct RedWorkerSource {
+struct RedWorkerSource {
     GSource source;
     RedWorker *worker;
-} RedWorkerSource;
+};
 
 static gboolean worker_source_prepare(GSource *source, gint *p_timeout)
 {
diff --git a/server/reds.cpp b/server/reds.cpp
index 31a02ce2..a777ac1a 100644
--- a/server/reds.cpp
+++ b/server/reds.cpp
@@ -138,7 +138,7 @@ struct RedServerConfig {
 };
 
 
-typedef struct RedLinkInfo {
+struct RedLinkInfo {
     RedsState *reds;
     RedStream *stream;
     SpiceLinkHeader link_header;
@@ -146,7 +146,7 @@ typedef struct RedLinkInfo {
     TicketInfo tiTicketing;
     SpiceLinkAuthMechanism auth_mechanism;
     int skip_auth;
-} RedLinkInfo;
+};
 
 struct ChannelSecurityOptions {
     uint32_t channel_id;
@@ -160,11 +160,11 @@ struct RedVDIReadBuf final: public RedAgentDataPipeItem {
     RedCharDeviceVDIPort *dev;
 };
 
-typedef enum {
+enum VDIPortReadStates {
     VDI_PORT_READ_STATE_READ_HEADER,
     VDI_PORT_READ_STATE_GET_BUFF,
     VDI_PORT_READ_STATE_READ_DATA,
-} VDIPortReadStates;
+};
 
 struct RedCharDeviceVDIPortPrivate {
     bool agent_attached;
@@ -194,7 +194,7 @@ struct RedCharDeviceVDIPortPrivate {
 
 /* messages that are addressed to the agent and are created in the server */
 #include <spice/start-packed.h>
-typedef struct SPICE_ATTR_PACKED VDInternalBuf {
+struct SPICE_ATTR_PACKED VDInternalBuf {
     VDIChunkHeader chunk_header;
     VDAgentMessage header;
     union {
@@ -202,7 +202,7 @@ typedef struct SPICE_ATTR_PACKED VDInternalBuf {
         VDAgentGraphicsDeviceInfo graphics_device_info;
     }
     u;
-} VDInternalBuf;
+};
 #include <spice/end-packed.h>
 
 struct RedCharDeviceVDIPort: public RedCharDevice
@@ -3484,10 +3484,10 @@ SPICE_GNUC_VISIBLE SpiceServer *spice_server_new(void)
     return reds;
 }
 
-typedef struct {
+struct EnumNames {
     uint32_t id;
     const char *name;
-} EnumNames;
+};
 
 static gboolean get_name_index(const EnumNames names[], const char *name, uint32_t *index)
 {
diff --git a/server/sound.cpp b/server/sound.cpp
index 7c20e1da..e5c8d3e8 100644
--- a/server/sound.cpp
+++ b/server/sound.cpp
@@ -161,11 +161,11 @@ protected:
     virtual void send_item(RedPipeItem *item) override;
 };
 
-typedef struct SpiceVolumeState {
+struct SpiceVolumeState {
     uint16_t *volume;
     uint8_t volume_nchannels;
     int mute;
-} SpiceVolumeState;
+};
 
 /* Base class for PlaybackChannel and RecordChannel */
 struct SndChannel: public RedChannel
diff --git a/server/tests/test-dispatcher.cpp b/server/tests/test-dispatcher.cpp
index 0ec88f1f..65e3f215 100644
--- a/server/tests/test-dispatcher.cpp
+++ b/server/tests/test-dispatcher.cpp
@@ -38,7 +38,7 @@ static red::shared_ptr<Dispatcher> dispatcher;
 static SpiceWatch *watch;
 // incremental number we use during the test, each message sent is incremented
 static unsigned num;
-typedef int TestFixture;
+using TestFixture = int;
 
 static void test_dispatcher_setup(TestFixture *fixture, gconstpointer user_data)
 {
diff --git a/server/tests/test-display-base.cpp b/server/tests/test-display-base.cpp
index ae6ea1ac..89634903 100644
--- a/server/tests/test-display-base.cpp
+++ b/server/tests/test-display-base.cpp
@@ -47,17 +47,17 @@
 
 /* Parts cribbed from spice-display.h/.c/qxl.c */
 
-typedef struct SimpleSpiceUpdate {
+struct SimpleSpiceUpdate {
     QXLCommandExt ext; // first
     QXLDrawable drawable;
     QXLImage image;
     uint8_t *bitmap;
-} SimpleSpiceUpdate;
+};
 
-typedef struct SimpleSurfaceCmd {
+struct SimpleSurfaceCmd {
     QXLCommandExt ext; // first
     QXLSurfaceCmd surface_cmd;
-} SimpleSurfaceCmd;
+};
 
 static void test_spice_destroy_update(SimpleSpiceUpdate *update)
 {
@@ -142,11 +142,11 @@ static void simple_set_release_info(QXLReleaseInfo *info, intptr_t ptr)
     //info->group_id = MEM_SLOT_GROUP_ID;
 }
 
-typedef struct Path {
+struct Path {
     int t;
     int min_t;
     int max_t;
-} Path;
+};
 
 static void path_init(Path *path, int min, int max)
 {
diff --git a/server/tests/test-stream-device.cpp b/server/tests/test-stream-device.cpp
index 7e490b0a..c7db9343 100644
--- a/server/tests/test-stream-device.cpp
+++ b/server/tests/test-stream-device.cpp
@@ -150,7 +150,7 @@ void StreamChannel::on_connect(RedClient *red_client, RedStream *stream,
 
 static SpiceCoreInterface *core;
 static Test *test;
-typedef int TestFixture;
+using TestFixture = int;
 
 static void test_stream_device_setup(TestFixture *fixture, gconstpointer user_data)
 {
diff --git a/server/tree.cpp b/server/tree.cpp
index c1d862d3..5feadf26 100644
--- a/server/tree.cpp
+++ b/server/tree.cpp
@@ -107,10 +107,10 @@ static void show_draw_item(DrawItem *draw_item, const char *prefix)
            draw_item->base.rgn.extents.y2);
 }
 
-typedef struct DumpItem {
+struct DumpItem {
     int level;
     Container *container;
-} DumpItem;
+};
 
 static void dump_item(TreeItem *item, void *data)
 {


More information about the Spice-commits mailing list