mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-01-24 17:01:43 +00:00
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@gmail.com>
This commit is contained in:
parent
a56e65187e
commit
9f1514b804
@ -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,
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -38,8 +38,8 @@
|
||||
} G_STMT_END
|
||||
#endif
|
||||
|
||||
typedef struct RedGlzDrawable RedGlzDrawable;
|
||||
typedef struct GlzDrawableInstanceItem GlzDrawableInstanceItem;
|
||||
struct RedGlzDrawable;
|
||||
struct GlzDrawableInstanceItem;
|
||||
|
||||
struct GlzSharedDictionary {
|
||||
GlzEncDictContext *dict;
|
||||
|
||||
@ -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)
|
||||
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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
|
||||
{
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user