diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-10-14 16:57:24 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-10-16 14:19:22 +0000 |
commit | 08abfef116d893d6a062d432ff89e7af8b7b679d (patch) | |
tree | dc6f12f1669b40651a42b7a0556e264bc607a42b /desktop/source | |
parent | 1f9b6013e507ee4acb9374cee909f59139d52978 (diff) |
clang-cl loplugin: desktop
Change-Id: If2f5bfa6c05098c5362cd6c7b546520dc01ee821
Reviewed-on: https://gerrit.libreoffice.org/29871
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'desktop/source')
-rw-r--r-- | desktop/source/app/app.cxx | 4 | ||||
-rw-r--r-- | desktop/source/app/cmdlinehelp.cxx | 40 | ||||
-rw-r--r-- | desktop/source/app/cmdlinehelp.hxx | 5 | ||||
-rw-r--r-- | desktop/source/app/officeipcthread.cxx | 2 | ||||
-rw-r--r-- | desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx | 2 | ||||
-rw-r--r-- | desktop/source/deployment/misc/dp_misc.cxx | 4 | ||||
-rw-r--r-- | desktop/source/deployment/misc/lockfile.cxx | 4 |
7 files changed, 40 insertions, 21 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 6be6d6139bfa..6396a239f3cb 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -2070,7 +2070,7 @@ void Desktop::OpenClients() #if defined UNX aHelpURLBuffer.append("&System=UNX"); #elif defined WNT - aHelpURLBuffer.appendAscii("&System=WIN"); + aHelpURLBuffer.append("&System=WIN"); #endif Application::GetHelp()->Start( aHelpURLBuffer.makeStringAndClear(), nullptr); @@ -2664,7 +2664,7 @@ void Desktop::CheckFirstRun( ) HKEY hKey; if ( ERROR_SUCCESS == RegOpenKey( HKEY_LOCAL_MACHINE, "Software\\LibreOffice", &hKey ) ) { - if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("RunQuickstartAtFirstStart"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) + if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("RunQuickstartAtFirstStart"), nullptr, nullptr, reinterpret_cast<LPBYTE>(szValue), &nValueSize ) ) { css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); css::office::Quickstart::createAutoStart(xContext, true/*Quickstart*/, true/*bAutostart*/); diff --git a/desktop/source/app/cmdlinehelp.cxx b/desktop/source/app/cmdlinehelp.cxx index a674b5e156d1..c8226c6d3bbc 100644 --- a/desktop/source/app/cmdlinehelp.cxx +++ b/desktop/source/app/cmdlinehelp.cxx @@ -173,12 +173,12 @@ namespace desktop RTL_TEXTENCODING_ASCII_US).getStr()); #else // rest gets a dialog box - CmdlineHelpDialog aDlg; - aDlg.m_pftHead->SetText(aHelpMessage_version + aHelpMessage_head); - aDlg.m_pftLeft->SetText(aHelpMessage_left); - aDlg.m_pftRight->SetText(aHelpMessage_right); - aDlg.m_pftBottom->SetText(aHelpMessage_bottom); - aDlg.Execute(); + ScopedVclPtrInstance<CmdlineHelpDialog> aDlg; + aDlg->m_pftHead->SetText(aHelpMessage_version + aHelpMessage_head); + aDlg->m_pftLeft->SetText(aHelpMessage_left); + aDlg->m_pftRight->SetText(aHelpMessage_right); + aDlg->m_pftBottom->SetText(aHelpMessage_bottom); + aDlg->Execute(); #endif } @@ -190,24 +190,38 @@ namespace desktop fprintf(stdout, "%s", OUStringToOString(aVersionMsg, RTL_TEXTENCODING_ASCII_US).getStr()); #else // Just re-use the help dialog for now. - CmdlineHelpDialog aDlg; - aDlg.m_pftHead->SetText(aVersionMsg); - aDlg.m_pftLeft->SetText(""); - aDlg.m_pftRight->SetText(""); - aDlg.m_pftBottom->SetText(""); - aDlg.Execute(); + ScopedVclPtrInstance<CmdlineHelpDialog> aDlg; + aDlg->m_pftHead->SetText(aVersionMsg); + aDlg->m_pftLeft->SetText(""); + aDlg->m_pftRight->SetText(""); + aDlg->m_pftBottom->SetText(""); + aDlg->Execute(); #endif } #ifndef UNX CmdlineHelpDialog::CmdlineHelpDialog() - : ModalDialog( NULL, "CmdLineHelp", "desktop/ui/cmdlinehelp.ui" ) + : ModalDialog( nullptr, "CmdLineHelp", "desktop/ui/cmdlinehelp.ui" ) { get(m_pftHead, "header"); get(m_pftLeft, "left"); get(m_pftRight, "right"); get(m_pftBottom, "bottom"); } + + CmdlineHelpDialog::~CmdlineHelpDialog() + { + disposeOnce(); + } + + void CmdlineHelpDialog::dispose() + { + m_pftHead.disposeAndClear(); + m_pftLeft.disposeAndClear(); + m_pftRight.disposeAndClear(); + m_pftBottom.disposeAndClear(); + ModalDialog::dispose(); + } #endif } diff --git a/desktop/source/app/cmdlinehelp.hxx b/desktop/source/app/cmdlinehelp.hxx index d7b7233ab3ac..cbf1da41c35a 100644 --- a/desktop/source/app/cmdlinehelp.hxx +++ b/desktop/source/app/cmdlinehelp.hxx @@ -34,10 +34,15 @@ namespace desktop public: CmdlineHelpDialog(); + ~CmdlineHelpDialog() override; + VclPtr<FixedText> m_pftHead; VclPtr<FixedText> m_pftLeft; VclPtr<FixedText> m_pftRight; VclPtr<FixedText> m_pftBottom; + + private: + void dispose() override; }; #endif } diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx index a5be36c03789..7a2fd4624a58 100644 --- a/desktop/source/app/officeipcthread.cxx +++ b/desktop/source/app/officeipcthread.cxx @@ -1136,7 +1136,7 @@ bool IpcThread::process(OString const & arguments, bool * waitProcessed) { #if defined UNX aHelpURLBuffer.append("&System=UNX"); #elif defined WNT - aHelpURLBuffer.appendAscii("&System=WIN"); + aHelpURLBuffer.append("&System=WIN"); #endif ApplicationEvent* pAppEvent = new ApplicationEvent( ApplicationEvent::Type::OpenHelpUrl, diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx index 7105f899f384..8409ca9bcf1c 100644 --- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx +++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx @@ -682,7 +682,7 @@ void ExtensionCmdQueue::Thread::execute() //Needed for use of the service "com.sun.star.system.SystemShellExecute" in //DialogHelper::openWebBrowser CoUninitialize(); - (void) CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); + (void) CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); #endif for (;;) { diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx index 3bb4ec041a40..01f1ab95dca1 100644 --- a/desktop/source/deployment/misc/dp_misc.cxx +++ b/desktop/source/deployment/misc/dp_misc.cxx @@ -471,7 +471,7 @@ void writeConsoleWithStream(OUString const & sText, HANDLE stream) { DWORD nWrittenChars = 0; WriteFile(stream, sText.getStr(), - sText.getLength() * 2, &nWrittenChars, NULL); + sText.getLength() * 2, &nWrittenChars, nullptr); } #else void writeConsoleWithStream(OUString const & sText, FILE * stream) @@ -506,7 +506,7 @@ OUString readConsole() sal_Unicode aBuffer[1024]; DWORD dwRead = 0; //unopkg.com feeds unopkg.exe with wchar_t|s - if (ReadFile( GetStdHandle(STD_INPUT_HANDLE), &aBuffer, sizeof(aBuffer), &dwRead, NULL ) ) + if (ReadFile( GetStdHandle(STD_INPUT_HANDLE), &aBuffer, sizeof(aBuffer), &dwRead, nullptr ) ) { OSL_ASSERT((dwRead % 2) == 0); OUString value( aBuffer, dwRead / 2); diff --git a/desktop/source/deployment/misc/lockfile.cxx b/desktop/source/deployment/misc/lockfile.cxx index f33cd703fa5d..fa30bf256fee 100644 --- a/desktop/source/deployment/misc/lockfile.cxx +++ b/desktop/source/deployment/misc/lockfile.cxx @@ -46,9 +46,9 @@ static OString impl_getHostname() prevent windows from connecting to the net to get its own hostname by using the netbios name */ - sal_Int32 sz = MAX_COMPUTERNAME_LENGTH + 1; + DWORD sz = MAX_COMPUTERNAME_LENGTH + 1; char* szHost = new char[sz]; - if (GetComputerName(szHost, (LPDWORD)&sz)) + if (GetComputerName(szHost, &sz)) aHost = OString(szHost); else aHost = OString("UNKNOWN"); |