diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-01-23 15:06:52 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-01-23 15:06:52 +0100 |
commit | e3ee065312e295300fb25457e18344225eeffbd4 (patch) | |
tree | 90ea35f9920b880b82f195b5621252b0f894886c | |
parent | 862d2fc5c3736c6bb0c1ee54bd195c502fe17d28 (diff) |
Various loplugin in --enable-gtk3-kde5 code
Change-Id: Ic12464f01950a5037bb6819a2722aba5a7e3e2e6
-rw-r--r-- | vcl/unx/gtk3_kde5/filepicker_ipc_commands.hxx | 13 | ||||
-rw-r--r-- | vcl/unx/gtk3_kde5/gtk3_kde5_filepicker.cxx | 27 | ||||
-rw-r--r-- | vcl/unx/gtk3_kde5/gtk3_kde5_filepicker.hxx | 4 | ||||
-rw-r--r-- | vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.cxx | 14 | ||||
-rw-r--r-- | vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.hxx | 12 | ||||
-rw-r--r-- | vcl/unx/gtk3_kde5/gtk3_kde5_folderpicker.hxx | 2 |
6 files changed, 28 insertions, 44 deletions
diff --git a/vcl/unx/gtk3_kde5/filepicker_ipc_commands.hxx b/vcl/unx/gtk3_kde5/filepicker_ipc_commands.hxx index 3aef6da858b1..8ce8cfa9e78d 100644 --- a/vcl/unx/gtk3_kde5/filepicker_ipc_commands.hxx +++ b/vcl/unx/gtk3_kde5/filepicker_ipc_commands.hxx @@ -80,13 +80,7 @@ inline void readIpcArg(std::istream& stream, Commands& value) value = static_cast<Commands>(v); } -inline void readIpcArg(std::istream& stream, sal_Bool& value) -{ - bool v = false; - stream >> v; - value = v; - stream.ignore(); // skip space -} +void readIpcArg(std::istream&, sal_Bool) = delete; inline void readIpcArg(std::istream& stream, bool& value) { @@ -133,10 +127,7 @@ inline void sendIpcArg(std::ostream& stream, Commands value) stream << static_cast<uint16_t>(value) << ' '; } -inline void sendIpcArg(std::ostream& stream, sal_Bool value) -{ - stream << static_cast<bool>(value) << ' '; -} +void sendIpcArg(std::ostream&, sal_Bool) = delete; inline void sendIpcArg(std::ostream& stream, bool value) { stream << value << ' '; } diff --git a/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker.cxx b/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker.cxx index 28c0af2047aa..7372d476f55e 100644 --- a/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker.cxx +++ b/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker.cxx @@ -38,9 +38,9 @@ #undef Region -#include "unx/geninst.h" +#include <unx/geninst.h> -#include "strings.hrc" +#include <strings.hrc> #include <future> @@ -64,7 +64,7 @@ namespace bf = boost::filesystem; namespace { -uno::Sequence<OUString> SAL_CALL FilePicker_getSupportedServiceNames() +uno::Sequence<OUString> FilePicker_getSupportedServiceNames() { uno::Sequence<OUString> aRet(3); aRet[0] = "com.sun.star.ui.dialogs.FilePicker"; @@ -107,7 +107,7 @@ sal_Int16 SAL_CALL Gtk3KDE5FilePicker::execute() { return m_ipc.execute(); } void SAL_CALL Gtk3KDE5FilePicker::setMultiSelectionMode(sal_Bool multiSelect) { - m_ipc.sendCommand(Commands::SetMultiSelectionMode, multiSelect); + m_ipc.sendCommand(Commands::SetMultiSelectionMode, bool(multiSelect)); } void SAL_CALL Gtk3KDE5FilePicker::setDefaultName(const OUString& name) @@ -176,9 +176,9 @@ void SAL_CALL Gtk3KDE5FilePicker::appendFilterGroup(const OUString& /*rGroupTitl void SAL_CALL Gtk3KDE5FilePicker::setValue(sal_Int16 controlId, sal_Int16 nControlAction, const uno::Any& value) { - if (value.has<sal_Bool>()) + if (value.has<bool>()) { - m_ipc.sendCommand(Commands::SetValue, controlId, nControlAction, value.get<sal_Bool>()); + m_ipc.sendCommand(Commands::SetValue, controlId, nControlAction, value.get<bool>()); } else { @@ -198,7 +198,7 @@ uno::Any SAL_CALL Gtk3KDE5FilePicker::getValue(sal_Int16 controlId, sal_Int16 nC auto id = m_ipc.sendCommand(Commands::GetValue, controlId, nControlAction); - sal_Bool value = false; + bool value = false; m_ipc.readResponse(id, value); return uno::Any(value); @@ -206,7 +206,7 @@ uno::Any SAL_CALL Gtk3KDE5FilePicker::getValue(sal_Int16 controlId, sal_Int16 nC void SAL_CALL Gtk3KDE5FilePicker::enableControl(sal_Int16 controlId, sal_Bool enable) { - m_ipc.sendCommand(Commands::EnableControl, controlId, enable); + m_ipc.sendCommand(Commands::EnableControl, controlId, bool(enable)); } void SAL_CALL Gtk3KDE5FilePicker::setLabel(sal_Int16 controlId, const OUString& label) @@ -284,7 +284,7 @@ void Gtk3KDE5FilePicker::addCustomControl(sal_Int16 controlId) { // the checkbox is created even for CHECKBOX_AUTOEXTENSION to simplify // code, but the checkbox is hidden and ignored - sal_Bool hidden = controlId == CHECKBOX_AUTOEXTENSION; + bool hidden = controlId == CHECKBOX_AUTOEXTENSION; m_ipc.sendCommand(Commands::AddCheckBox, controlId, hidden, getResString(resId)); @@ -308,8 +308,7 @@ void SAL_CALL Gtk3KDE5FilePicker::initialize(const uno::Sequence<uno::Any>& args uno::Any arg; if (args.getLength() == 0) { - throw lang::IllegalArgumentException(OUString("no arguments"), - static_cast<XFilePicker2*>(this), 1); + throw lang::IllegalArgumentException("no arguments", static_cast<XFilePicker2*>(this), 1); } arg = args[0]; @@ -317,14 +316,14 @@ void SAL_CALL Gtk3KDE5FilePicker::initialize(const uno::Sequence<uno::Any>& args if ((arg.getValueType() != cppu::UnoType<sal_Int16>::get()) && (arg.getValueType() != cppu::UnoType<sal_Int8>::get())) { - throw lang::IllegalArgumentException(OUString("invalid argument type"), + throw lang::IllegalArgumentException("invalid argument type", static_cast<XFilePicker2*>(this), 1); } sal_Int16 templateId = -1; arg >>= templateId; - sal_Bool saveDialog = false; + bool saveDialog = false; switch (templateId) { case FILEOPEN_SIMPLE: @@ -411,7 +410,7 @@ void SAL_CALL Gtk3KDE5FilePicker::cancel() // TODO } -void SAL_CALL Gtk3KDE5FilePicker::disposing(const lang::EventObject& rEvent) +void Gtk3KDE5FilePicker::disposing(const lang::EventObject& rEvent) { uno::Reference<XFilePickerListener> xFilePickerListener(rEvent.Source, uno::UNO_QUERY); diff --git a/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker.hxx b/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker.hxx index 506bc3bb5afc..80261ded9f9b 100644 --- a/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker.hxx +++ b/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker.hxx @@ -56,7 +56,7 @@ protected: public: explicit Gtk3KDE5FilePicker(const css::uno::Reference<css::uno::XComponentContext>&); - virtual ~Gtk3KDE5FilePicker(); + virtual ~Gtk3KDE5FilePicker() override; // XFilePickerNotifier virtual void SAL_CALL addFilePickerListener( @@ -115,7 +115,7 @@ public: virtual void SAL_CALL cancel() override; // XEventListener - virtual void SAL_CALL disposing(const css::lang::EventObject& rEvent); + virtual void disposing(const css::lang::EventObject& rEvent); using cppu::WeakComponentImplHelperBase::disposing; // XServiceInfo diff --git a/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.cxx b/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.cxx index 983617cbf58e..fd9c1c7b64e1 100644 --- a/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.cxx +++ b/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.cxx @@ -21,9 +21,9 @@ #undef Region -#include "unx/geninst.h" +#include <unx/geninst.h> -#include "strings.hrc" +#include <strings.hrc> #include <future> @@ -125,12 +125,12 @@ Gtk3KDE5FilePickerIpc::~Gtk3KDE5FilePickerIpc() m_process.wait_for(std::chrono::milliseconds(100)); } -sal_Int16 SAL_CALL Gtk3KDE5FilePickerIpc::execute() +sal_Int16 Gtk3KDE5FilePickerIpc::execute() { auto restoreMainWindow = blockMainWindow(); auto id = sendCommand(Commands::Execute); - sal_Bool accepted = false; + bool accepted = false; readResponse(id, accepted); if (restoreMainWindow) @@ -145,7 +145,7 @@ static gboolean ignoreDeleteEvent(GtkWidget* /*widget*/, GdkEvent* /*event*/, return true; } -std::function<void()> SAL_CALL Gtk3KDE5FilePickerIpc::blockMainWindow() +std::function<void()> Gtk3KDE5FilePickerIpc::blockMainWindow() { vcl::Window* pParentWin = Application::GetDefDialogParent(); if (!pParentWin) @@ -157,7 +157,7 @@ std::function<void()> SAL_CALL Gtk3KDE5FilePickerIpc::blockMainWindow() sendCommand(Commands::SetWinId, pSysData->aWindow); - auto* pMainWindow = reinterpret_cast<GtkWidget*>(pSysData->pWidget); + auto* pMainWindow = static_cast<GtkWidget*>(pSysData->pWidget); if (!pMainWindow) return {}; @@ -190,7 +190,7 @@ std::function<void()> SAL_CALL Gtk3KDE5FilePickerIpc::blockMainWindow() }; } -void SAL_CALL Gtk3KDE5FilePickerIpc::await(const std::future<void>& future) +void Gtk3KDE5FilePickerIpc::await(const std::future<void>& future) { while (future.wait_for(std::chrono::milliseconds(1)) != std::future_status::ready) { diff --git a/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.hxx b/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.hxx index c7b13cd4573f..8b8bfbc7a726 100644 --- a/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.hxx +++ b/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.hxx @@ -36,12 +36,6 @@ #include <mutex> #include <thread> -void readIpcArg(std::istream& stream, OUString& str); - -void readIpcArg(std::istream& stream, css::uno::Sequence<OUString>& seq); - -void sendIpcArg(std::ostream& stream, const OUString& string); - OUString getResString(const char* pResId); class Gtk3KDE5FilePickerIpc @@ -60,7 +54,7 @@ public: explicit Gtk3KDE5FilePickerIpc(); ~Gtk3KDE5FilePickerIpc(); - sal_Int16 SAL_CALL execute(); + sal_Int16 execute(); template <typename... Args> uint64_t sendCommand(Commands command, const Args&... args) { @@ -101,9 +95,9 @@ public: } private: - std::function<void()> SAL_CALL blockMainWindow(); + std::function<void()> blockMainWindow(); - static void SAL_CALL await(const std::future<void>& future); + static void await(const std::future<void>& future); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk3_kde5/gtk3_kde5_folderpicker.hxx b/vcl/unx/gtk3_kde5/gtk3_kde5_folderpicker.hxx index c6a6c4edfb73..fed9f0bc5a12 100644 --- a/vcl/unx/gtk3_kde5/gtk3_kde5_folderpicker.hxx +++ b/vcl/unx/gtk3_kde5/gtk3_kde5_folderpicker.hxx @@ -38,7 +38,7 @@ public: // constructor explicit Gtk3KDE5FolderPicker( const css::uno::Reference<css::uno::XComponentContext>& xServiceMgr); - virtual ~Gtk3KDE5FolderPicker(); + virtual ~Gtk3KDE5FolderPicker() override; // XExecutableDialog functions virtual void SAL_CALL setTitle(const OUString& aTitle) override; |