From 0121d355c4ccceb477c5a3ed83658c6c220212ee Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Tue, 13 Aug 2019 14:39:45 -0700 Subject: [PATCH 1/2] Fix missed override declarations --- lib/audiodev/PulseAudio.cpp | 2 +- lib/x11/WindowXlib.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/audiodev/PulseAudio.cpp b/lib/audiodev/PulseAudio.cpp index c79c5fe..c80d9ee 100644 --- a/lib/audiodev/PulseAudio.cpp +++ b/lib/audiodev/PulseAudio.cpp @@ -270,7 +270,7 @@ struct PulseAudioVoiceEngine : LinuxMidi { if (i) userdata->m_sinks.push_back(std::make_pair(i->name, i->description)); } - std::vector> enumerateAudioOutputs() const { + std::vector> enumerateAudioOutputs() const override { pa_operation* op = pa_context_get_sink_info_list(m_ctx, pa_sink_info_cb_t(_getSinkInfoListReply), (void*)this); _paIterate(op); pa_operation_unref(op); diff --git a/lib/x11/WindowXlib.cpp b/lib/x11/WindowXlib.cpp index 30b6c1f..48bf2a7 100644 --- a/lib/x11/WindowXlib.cpp +++ b/lib/x11/WindowXlib.cpp @@ -510,7 +510,7 @@ public: visualIdOut = screen->root_visual->visualid; } - void destroy() { + void destroy() override { VulkanContext::Window& m_windowCtx = *m_ctx->m_windows[m_parentWindow]; m_windowCtx.m_swapChains[0].destroy(m_ctx->m_dev); m_windowCtx.m_swapChains[1].destroy(m_ctx->m_dev); From 3c9866d6973dc9d67ab25abc85b88db3058a8f49 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 16 Aug 2019 04:42:57 -0400 Subject: [PATCH 2/2] DeviceToken: Amend move constructor The default move constructor isn't const qualified. The copy assignment operator wasn't deleted either which is somewhat dangerous. We can also opt for simply defaulting the move constructor and assignment operators instead of defining the move constructor like a copy constructor. --- include/boo/inputdev/DeviceToken.hpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/include/boo/inputdev/DeviceToken.hpp b/include/boo/inputdev/DeviceToken.hpp index eb98c66..b70a749 100644 --- a/include/boo/inputdev/DeviceToken.hpp +++ b/include/boo/inputdev/DeviceToken.hpp @@ -28,14 +28,7 @@ class DeviceToken { public: DeviceToken(const DeviceToken&) = delete; - DeviceToken(const DeviceToken&& other) - : m_devType(other.m_devType) - , m_vendorId(other.m_vendorId) - , m_productId(other.m_productId) - , m_vendorName(other.m_vendorName) - , m_productName(other.m_productName) - , m_devPath(other.m_devPath) - , m_connectedDev(other.m_connectedDev) {} + DeviceToken(DeviceToken&& other) noexcept = default; DeviceToken(DeviceType devType, unsigned vid, unsigned pid, const char* vname, const char* pname, const char* path) : m_devType(devType), m_vendorId(vid), m_productId(pid), m_devPath(path), m_connectedDev(NULL) { if (vname) @@ -44,6 +37,12 @@ public: m_productName = pname; } + DeviceToken& operator=(const DeviceToken&) = delete; + DeviceToken& operator=(DeviceToken&&) noexcept = default; + + bool operator==(const DeviceToken& rhs) const { return m_devPath == rhs.m_devPath; } + bool operator<(const DeviceToken& rhs) const { return m_devPath < rhs.m_devPath; } + DeviceType getDeviceType() const { return m_devType; } unsigned getVendorId() const { return m_vendorId; } unsigned getProductId() const { return m_productId; } @@ -56,9 +55,6 @@ public: m_connectedDev = DeviceSignature::DeviceNew(*this); return m_connectedDev; } - - bool operator==(const DeviceToken& rhs) const { return m_devPath == rhs.m_devPath; } - bool operator<(const DeviceToken& rhs) const { return m_devPath < rhs.m_devPath; } }; } // namespace boo