diff options
author | Rosen Penev <rosenp@gmail.com> | 2020-10-05 02:32:41 -0700 |
---|---|---|
committer | Frediano Ziglio <freddy77@gmail.com> | 2021-04-09 08:20:06 +0100 |
commit | f64e61e44df8ed03f44c1f7ca55ce9fc1460911a (patch) | |
tree | 9da48943116324dc8f4abeb7a4733c396b2ac377 | |
parent | 20fa56d75d96fe87cf82bbe9e6e3027be188ed56 (diff) |
clang-tidy: use override and remove virtual
Found with modernize-use-override
This can be useful as compilers can generate a compile time error when:
The base class implementation function signature changes.
The user has not created the override with the correct
signature.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
-rw-r--r-- | server/cursor-channel.cpp | 2 | ||||
-rw-r--r-- | server/reds.cpp | 14 | ||||
-rw-r--r-- | server/sound.cpp | 24 | ||||
-rw-r--r-- | server/spicevmc.cpp | 26 | ||||
-rw-r--r-- | server/stream-channel.cpp | 10 | ||||
-rw-r--r-- | server/tests/test-channel.cpp | 4 |
6 files changed, 40 insertions, 40 deletions
diff --git a/server/cursor-channel.cpp b/server/cursor-channel.cpp index 691c304d..cd498485 100644 --- a/server/cursor-channel.cpp +++ b/server/cursor-channel.cpp @@ -27,7 +27,7 @@ struct RedCursorPipeItem: public RedPipeItemNum<RED_PIPE_ITEM_TYPE_CURSOR> { explicit RedCursorPipeItem(RedCursorCmd *cmd); - ~RedCursorPipeItem(); + ~RedCursorPipeItem() override; RedCursorCmd *red_cursor; }; diff --git a/server/reds.cpp b/server/reds.cpp index 3ae0216a..319fd32c 100644 --- a/server/reds.cpp +++ b/server/reds.cpp @@ -155,7 +155,7 @@ struct ChannelSecurityOptions { }; struct RedVDIReadBuf final: public RedAgentDataPipeItem { - ~RedVDIReadBuf(); + ~RedVDIReadBuf() override; RedCharDeviceVDIPort *dev; }; @@ -209,13 +209,13 @@ struct RedCharDeviceVDIPort: public RedCharDevice { explicit RedCharDeviceVDIPort(RedsState *reds); RedCharDeviceVDIPort(); - ~RedCharDeviceVDIPort(); + ~RedCharDeviceVDIPort() override; - virtual RedPipeItemPtr read_one_msg_from_device() override; - virtual void send_msg_to_client(RedPipeItem *msg, RedCharDeviceClientOpaque *opaque) override; - virtual void send_tokens_to_client(RedCharDeviceClientOpaque *opaque, uint32_t tokens) override; - virtual void remove_client(RedCharDeviceClientOpaque *opaque) override; - virtual void on_free_self_token() override; + RedPipeItemPtr read_one_msg_from_device() override; + void send_msg_to_client(RedPipeItem *msg, RedCharDeviceClientOpaque *opaque) override; + void send_tokens_to_client(RedCharDeviceClientOpaque *opaque, uint32_t tokens) override; + void remove_client(RedCharDeviceClientOpaque *opaque) override; + void on_free_self_token() override; RedCharDeviceVDIPortPrivate priv[1]; }; diff --git a/server/sound.cpp b/server/sound.cpp index 322171a2..4c636872 100644 --- a/server/sound.cpp +++ b/server/sound.cpp @@ -106,10 +106,10 @@ public: inline SndChannel* get_channel(); - virtual bool config_socket() override; - virtual uint8_t *alloc_recv_buf(uint16_t type, uint32_t size) override; - virtual void release_recv_buf(uint16_t type, uint32_t size, uint8_t *msg) override; - virtual void migrate() override; + bool config_socket() override; + uint8_t *alloc_recv_buf(uint16_t type, uint32_t size) override; + void release_recv_buf(uint16_t type, uint32_t size, uint8_t *msg) override; + void migrate() override; private: /* we don't expect very big messages so don't allocate too much @@ -139,13 +139,13 @@ struct AudioFrameContainer class PlaybackChannelClient final: public SndChannelClient { protected: - ~PlaybackChannelClient(); + ~PlaybackChannelClient() override; public: PlaybackChannelClient(PlaybackChannel *channel, RedClient *client, RedStream *stream, RedChannelCapabilities *caps); - virtual bool init() override; + bool init() override; AudioFrameContainer *frames = nullptr; AudioFrame *free_frames = nullptr; @@ -158,7 +158,7 @@ public: static void on_message_marshalled(uint8_t *data, void *opaque); protected: - virtual void send_item(RedPipeItem *item) override; + void send_item(RedPipeItem *item) override; }; struct SpiceVolumeState { @@ -171,7 +171,7 @@ struct SpiceVolumeState { struct SndChannel: public RedChannel { using RedChannel::RedChannel; - ~SndChannel(); + ~SndChannel() override; void set_peer_common(); bool active; SpiceVolumeState volume; @@ -202,10 +202,10 @@ struct RecordChannel final: public SndChannel class RecordChannelClient final: public SndChannelClient { protected: - ~RecordChannelClient(); + ~RecordChannelClient() override; public: using SndChannelClient::SndChannelClient; - virtual bool init() override; + bool init() override; uint32_t samples[RECORD_SAMPLES_SIZE]; uint32_t write_pos = 0; @@ -216,8 +216,8 @@ public: SndCodec codec = nullptr; uint8_t decode_buf[SND_CODEC_MAX_FRAME_BYTES]; protected: - virtual bool handle_message(uint16_t type, uint32_t size, void *message) override; - virtual void send_item(RedPipeItem *item) override; + bool handle_message(uint16_t type, uint32_t size, void *message) override; + void send_item(RedPipeItem *item) override; }; diff --git a/server/spicevmc.cpp b/server/spicevmc.cpp index 43604f08..2e83d788 100644 --- a/server/spicevmc.cpp +++ b/server/spicevmc.cpp @@ -63,12 +63,12 @@ struct RedVmcPipeItem: public RedPipeItemNum<RED_PIPE_ITEM_TYPE_SPICEVMC_DATA> { struct RedCharDeviceSpiceVmc: public RedCharDevice { RedCharDeviceSpiceVmc(SpiceCharDeviceInstance *sin, RedsState *reds, RedVmcChannel *channel); - ~RedCharDeviceSpiceVmc(); + ~RedCharDeviceSpiceVmc() override; - virtual RedPipeItemPtr read_one_msg_from_device() override; - virtual void remove_client(RedCharDeviceClientOpaque *opaque) override; - virtual void on_free_self_token() override; - virtual void port_event(uint8_t event) override; + RedPipeItemPtr read_one_msg_from_device() override; + void remove_client(RedCharDeviceClientOpaque *opaque) override; + void on_free_self_token() override; + void port_event(uint8_t event) override; red::shared_ptr<RedVmcChannel> channel; }; @@ -78,7 +78,7 @@ static void spicevmc_red_channel_queue_data(RedVmcChannel *channel, red::shared_ struct RedVmcChannel: public RedChannel { RedVmcChannel(RedsState *reds, uint32_t type, uint32_t id); - ~RedVmcChannel(); + ~RedVmcChannel() override; void on_connect(RedClient *client, RedStream *stream, int migration, RedChannelCapabilities *caps) override; @@ -108,13 +108,13 @@ public: return static_cast<RedVmcChannel*>(RedChannelClient::get_channel()); } protected: - virtual uint8_t *alloc_recv_buf(uint16_t type, uint32_t size) override; - virtual void release_recv_buf(uint16_t type, uint32_t size, uint8_t *msg) override; - virtual void on_disconnect() override; - virtual bool handle_message(uint16_t type, uint32_t size, void *msg) override; - virtual void send_item(RedPipeItem *item) override; - virtual bool handle_migrate_data(uint32_t size, void *message) override; - virtual void handle_migrate_flush_mark() override; + uint8_t *alloc_recv_buf(uint16_t type, uint32_t size) override; + void release_recv_buf(uint16_t type, uint32_t size, uint8_t *msg) override; + void on_disconnect() override; + bool handle_message(uint16_t type, uint32_t size, void *msg) override; + void send_item(RedPipeItem *item) override; + bool handle_migrate_data(uint32_t size, void *message) override; + void handle_migrate_flush_mark() override; }; static VmcChannelClient * diff --git a/server/stream-channel.cpp b/server/stream-channel.cpp index 08285bf6..9b04eddb 100644 --- a/server/stream-channel.cpp +++ b/server/stream-channel.cpp @@ -33,7 +33,7 @@ class StreamChannelClient final: public CommonGraphicsChannelClient { protected: - ~StreamChannelClient(); + ~StreamChannelClient() override; public: using CommonGraphicsChannelClient::CommonGraphicsChannelClient; @@ -51,9 +51,9 @@ private: bool handle_preferred_video_codec_type(SpiceMsgcDisplayPreferredVideoCodecType *msg); void marshall_monitors_config(StreamChannel *channel, SpiceMarshaller *m); void fill_base(SpiceMarshaller *m, const StreamChannel *channel); - virtual void on_disconnect() override; - virtual bool handle_message(uint16_t type, uint32_t size, void *msg) override; - virtual void send_item(RedPipeItem *pipe_item) override; + void on_disconnect() override; + bool handle_message(uint16_t type, uint32_t size, void *msg) override; + void send_item(RedPipeItem *pipe_item) override; }; enum { @@ -72,7 +72,7 @@ struct StreamCreateItem: public RedPipeItemNum<RED_PIPE_ITEM_TYPE_STREAM_CREATE> }; struct StreamDataItem: public RedPipeItemNum<RED_PIPE_ITEM_TYPE_STREAM_DATA> { - ~StreamDataItem(); + ~StreamDataItem() override; StreamChannel *channel; // NOTE: this must be the last field in the structure diff --git a/server/tests/test-channel.cpp b/server/tests/test-channel.cpp index e9163cd1..037677e3 100644 --- a/server/tests/test-channel.cpp +++ b/server/tests/test-channel.cpp @@ -44,8 +44,8 @@ struct RedTestChannel final: public RedChannel class RedTestChannelClient final: public RedChannelClient { using RedChannelClient::RedChannelClient; - virtual uint8_t * alloc_recv_buf(uint16_t type, uint32_t size) override; - virtual void release_recv_buf(uint16_t type, uint32_t size, uint8_t *msg) override; + uint8_t * alloc_recv_buf(uint16_t type, uint32_t size) override; + void release_recv_buf(uint16_t type, uint32_t size, uint8_t *msg) override; }; void |