From e3ee065312e295300fb25457e18344225eeffbd4 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 23 Jan 2018 15:06:52 +0100 Subject: Various loplugin in --enable-gtk3-kde5 code Change-Id: Ic12464f01950a5037bb6819a2722aba5a7e3e2e6 --- vcl/unx/gtk3_kde5/filepicker_ipc_commands.hxx | 13 ++----------- vcl/unx/gtk3_kde5/gtk3_kde5_filepicker.cxx | 27 +++++++++++++------------- vcl/unx/gtk3_kde5/gtk3_kde5_filepicker.hxx | 4 ++-- vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.cxx | 14 ++++++------- vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.hxx | 12 +++--------- vcl/unx/gtk3_kde5/gtk3_kde5_folderpicker.hxx | 2 +- 6 files changed, 28 insertions(+), 44 deletions(-) (limited to 'vcl') 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(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(value) << ' '; } -inline void sendIpcArg(std::ostream& stream, sal_Bool value) -{ - stream << static_cast(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 -#include "strings.hrc" +#include #include @@ -64,7 +64,7 @@ namespace bf = boost::filesystem; namespace { -uno::Sequence SAL_CALL FilePicker_getSupportedServiceNames() +uno::Sequence FilePicker_getSupportedServiceNames() { uno::Sequence 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()) + if (value.has()) { - m_ipc.sendCommand(Commands::SetValue, controlId, nControlAction, value.get()); + m_ipc.sendCommand(Commands::SetValue, controlId, nControlAction, value.get()); } 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& args uno::Any arg; if (args.getLength() == 0) { - throw lang::IllegalArgumentException(OUString("no arguments"), - static_cast(this), 1); + throw lang::IllegalArgumentException("no arguments", static_cast(this), 1); } arg = args[0]; @@ -317,14 +316,14 @@ void SAL_CALL Gtk3KDE5FilePicker::initialize(const uno::Sequence& args if ((arg.getValueType() != cppu::UnoType::get()) && (arg.getValueType() != cppu::UnoType::get())) { - throw lang::IllegalArgumentException(OUString("invalid argument type"), + throw lang::IllegalArgumentException("invalid argument type", static_cast(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(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&); - 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 -#include "strings.hrc" +#include #include @@ -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 SAL_CALL Gtk3KDE5FilePickerIpc::blockMainWindow() +std::function Gtk3KDE5FilePickerIpc::blockMainWindow() { vcl::Window* pParentWin = Application::GetDefDialogParent(); if (!pParentWin) @@ -157,7 +157,7 @@ std::function SAL_CALL Gtk3KDE5FilePickerIpc::blockMainWindow() sendCommand(Commands::SetWinId, pSysData->aWindow); - auto* pMainWindow = reinterpret_cast(pSysData->pWidget); + auto* pMainWindow = static_cast(pSysData->pWidget); if (!pMainWindow) return {}; @@ -190,7 +190,7 @@ std::function SAL_CALL Gtk3KDE5FilePickerIpc::blockMainWindow() }; } -void SAL_CALL Gtk3KDE5FilePickerIpc::await(const std::future& future) +void Gtk3KDE5FilePickerIpc::await(const std::future& 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 #include -void readIpcArg(std::istream& stream, OUString& str); - -void readIpcArg(std::istream& stream, css::uno::Sequence& 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 uint64_t sendCommand(Commands command, const Args&... args) { @@ -101,9 +95,9 @@ public: } private: - std::function SAL_CALL blockMainWindow(); + std::function blockMainWindow(); - static void SAL_CALL await(const std::future& future); + static void await(const std::future& 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& xServiceMgr); - virtual ~Gtk3KDE5FolderPicker(); + virtual ~Gtk3KDE5FolderPicker() override; // XExecutableDialog functions virtual void SAL_CALL setTitle(const OUString& aTitle) override; -- cgit