Kaydet (Commit) e3ee0653 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Various loplugin in --enable-gtk3-kde5 code

Change-Id: Ic12464f01950a5037bb6819a2722aba5a7e3e2e6
üst 862d2fc5
......@@ -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 << ' '; }
......
......@@ -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);
......
......@@ -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
......
......@@ -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)
{
......
......@@ -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: */
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment