From 76f4dc436a67c6c3bd52f33c780472ef92e55917 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Mon, 5 Oct 2020 14:33:29 -0700 Subject: [PATCH] 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 --- server/cursor-channel.cpp | 2 +- server/dispatcher.cpp | 2 +- server/inputs-channel.cpp | 4 ++-- server/reds.cpp | 2 +- server/sound.cpp | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) 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 { - 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 { - RedKeyModifiersPipeItem(uint8_t modifiers); + explicit RedKeyModifiersPipeItem(uint8_t modifiers); uint8_t modifiers; }; struct RedInputsInitPipeItem: public RedPipeItemNum { - 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; };