summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-03-14 14:46:49 +0100
committerStephan Bergmann <sbergman@redhat.com>2017-03-14 14:46:49 +0100
commit34604446fc81be99ccee28f1977bf85e6abfab45 (patch)
tree27584dc099d25354d107ad394e4fce80474bbba7 /shell
parentb30173fd76f322aa3ca1845e5208d6f580b2ab15 (diff)
Various clang-cl/loplugin warnings
Change-Id: Ib18e04e5024d15f8bbbf4921932b07465fb1f32f
Diffstat (limited to 'shell')
-rw-r--r--shell/inc/spsupp/COMOpenDocuments.hpp15
-rw-r--r--shell/inc/spsupp/COMRefCounted.hpp6
-rw-r--r--shell/inc/spsupp/registrar.hpp4
-rw-r--r--shell/inc/spsupp/spsuppClassFactory.hpp8
-rw-r--r--shell/inc/spsupp/spsuppServ.hpp6
-rw-r--r--shell/source/win32/ooofilereader/contentreader.cxx6
-rw-r--r--shell/source/win32/ooofilereader/metainforeader.cxx8
-rw-r--r--shell/source/win32/simplemail/smplmailsuppl.cxx2
-rw-r--r--shell/source/win32/spsupp/COMOpenDocuments.cxx20
-rw-r--r--shell/source/win32/spsupp/spsuppClassFactory.cxx2
-rw-r--r--shell/source/win32/spsupp/spsuppServ.cxx18
11 files changed, 59 insertions, 36 deletions
diff --git a/shell/inc/spsupp/COMOpenDocuments.hpp b/shell/inc/spsupp/COMOpenDocuments.hpp
index 1b2a52999ead..a0f733e16f6d 100644
--- a/shell/inc/spsupp/COMOpenDocuments.hpp
+++ b/shell/inc/spsupp/COMOpenDocuments.hpp
@@ -7,10 +7,17 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef _COMOPENDOCUMENTS_HPP_
-#define _COMOPENDOCUMENTS_HPP_
+#ifndef INCLUDED_SHELL_INC_SPSUPP_COMOPENDOCUMENTS_HPP
+#define INCLUDED_SHELL_INC_SPSUPP_COMOPENDOCUMENTS_HPP
+#if defined __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnon-virtual-dtor"
+#endif
#include "spsupp_h.h"
+#if defined __clang__
+#pragma clang diagnostic pop
+#endif
#include "COMRefCounted.hpp"
#include "Objsafe.h"
#include "assert.h"
@@ -28,7 +35,7 @@ public:
};
COMOpenDocuments();
- virtual ~COMOpenDocuments();
+ virtual ~COMOpenDocuments() override;
// IUnknown methods
@@ -210,6 +217,6 @@ private:
COMObjectSafety m_aObjectSafety;
};
-#endif // _COMOPENDOCUMENTS_HPP_
+#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/shell/inc/spsupp/COMRefCounted.hpp b/shell/inc/spsupp/COMRefCounted.hpp
index 075923d84266..230f6c8da517 100644
--- a/shell/inc/spsupp/COMRefCounted.hpp
+++ b/shell/inc/spsupp/COMRefCounted.hpp
@@ -7,8 +7,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef _COMREFCOUNTED_HPP_
-#define _COMREFCOUNTED_HPP_
+#ifndef INCLUDED_SHELL_INC_SPSUPP_COMREFCOUNTED_HPP
+#define INCLUDED_SHELL_INC_SPSUPP_COMREFCOUNTED_HPP
#include "objbase.h"
@@ -37,6 +37,6 @@ private:
long m_nRef = 1; // Created referenced
};
-#endif // _COMREFCOUNTED_HPP_
+#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/shell/inc/spsupp/registrar.hpp b/shell/inc/spsupp/registrar.hpp
index 00b230e5c624..ed41c4d04003 100644
--- a/shell/inc/spsupp/registrar.hpp
+++ b/shell/inc/spsupp/registrar.hpp
@@ -7,8 +7,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef _REGISTRAR_H
-#define _REGISTRAR_H
+#ifndef INCLUDED_SHELL_INC_SPSUPP_REGISTRAR_H
+#define INCLUDED_SHELL_INC_SPSUPP_REGISTRAR_H
#include "windows.h"
diff --git a/shell/inc/spsupp/spsuppClassFactory.hpp b/shell/inc/spsupp/spsuppClassFactory.hpp
index 9d9379154222..9deccbd97edc 100644
--- a/shell/inc/spsupp/spsuppClassFactory.hpp
+++ b/shell/inc/spsupp/spsuppClassFactory.hpp
@@ -7,8 +7,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef _SPSUPPCLASSFACTORY_H_
-#define _SPSUPPCLASSFACTORY_H_
+#ifndef INCLUDED_SHELL_INC_SPSUPP_SPSUPPCLASSFACTORY_HPP
+#define INCLUDED_SHELL_INC_SPSUPP_SPSUPPCLASSFACTORY_HPP
#include "COMRefCounted.hpp"
@@ -16,7 +16,7 @@ class ClassFactory : public COMRefCounted<IClassFactory>
{
public:
ClassFactory();
- virtual ~ClassFactory();
+ virtual ~ClassFactory() override;
// IUnknown methods
@@ -44,6 +44,6 @@ private:
static long m_nLockCount;
};
-#endif // _SPSUPPCLASSFACTORY_H_
+#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/shell/inc/spsupp/spsuppServ.hpp b/shell/inc/spsupp/spsuppServ.hpp
index 971e6bcda9b8..e3c78dc3fa6b 100644
--- a/shell/inc/spsupp/spsuppServ.hpp
+++ b/shell/inc/spsupp/spsuppServ.hpp
@@ -7,14 +7,14 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef _SPSUPPSERV_HPP_
-#define _SPSUPPSERV_HPP_
+#ifndef INCLUDED_SHELL_INC_SPSUPP_SPSUPPSERV_HPP
+#define INCLUDED_SHELL_INC_SPSUPP_SPSUPPSERV_HPP
#include <objbase.h>
ITypeLib* GetTypeLib();
const wchar_t* GetLOPath();
-#endif // _SPSUPPSERV_HPP_
+#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/shell/source/win32/ooofilereader/contentreader.cxx b/shell/source/win32/ooofilereader/contentreader.cxx
index 7a2cce5c25cf..1ecaf60a9c18 100644
--- a/shell/source/win32/ooofilereader/contentreader.cxx
+++ b/shell/source/win32/ooofilereader/contentreader.cxx
@@ -88,7 +88,7 @@ ITag* CContentReader::chooseTagReader( const std::wstring& tag_name, const XmlTa
if ( XmlAttributes.find(CONTENT_STYLE_STYLE_NAME) != XmlAttributes.end())
return new CAutoStyleTag(XmlAttributes);
else
- return new CDummyTag();
+ return new CDummyTag;
}
else if ( ( tag_name == CONTENT_STYLE_PROPERTIES ) || ( tag_name == CONTENT_TEXT_STYLE_PROPERTIES ) )
{
@@ -98,10 +98,10 @@ ITag* CContentReader::chooseTagReader( const std::wstring& tag_name, const XmlTa
ITag* pTagBuilder = m_TagBuilderStack.top();
pTagBuilder->addAttributes( XmlAttributes );
- return new CDummyTag();
+ return new CDummyTag;
}
else
- return new CDummyTag();
+ return new CDummyTag;
}
/** get style of the current content.
diff --git a/shell/source/win32/ooofilereader/metainforeader.cxx b/shell/source/win32/ooofilereader/metainforeader.cxx
index 908291b9c289..2b523d6e9aaf 100644
--- a/shell/source/win32/ooofilereader/metainforeader.cxx
+++ b/shell/source/win32/ooofilereader/metainforeader.cxx
@@ -31,9 +31,9 @@ CBaseReader( DocumentName )
{
try
{
- m_pKeywords_Builder = new CKeywordsTag( );
+ m_pKeywords_Builder = new CKeywordsTag;
m_pSimple_Builder = new CSimpleTag( );
- m_pDummy_Builder = new CDummyTag( );
+ m_pDummy_Builder = new CDummyTag;
//retrieve all information that is useful
m_AllMetaInfo[META_INFO_AUTHOR] = EMPTY_XML_TAG;
@@ -68,9 +68,9 @@ CBaseReader( stream )
{
try
{
- m_pKeywords_Builder = new CKeywordsTag( );
+ m_pKeywords_Builder = new CKeywordsTag;
m_pSimple_Builder = new CSimpleTag( );
- m_pDummy_Builder = new CDummyTag( );
+ m_pDummy_Builder = new CDummyTag;
//retrieve all information that is useful
m_AllMetaInfo[META_INFO_AUTHOR] = EMPTY_XML_TAG;
diff --git a/shell/source/win32/simplemail/smplmailsuppl.cxx b/shell/source/win32/simplemail/smplmailsuppl.cxx
index e86544647ed6..e6599fd17f5e 100644
--- a/shell/source/win32/simplemail/smplmailsuppl.cxx
+++ b/shell/source/win32/simplemail/smplmailsuppl.cxx
@@ -61,7 +61,7 @@ Reference<XSimpleMailClient> SAL_CALL CSmplMailSuppl::querySimpleMailClient()
if ((handle != INVALID_HANDLE_VALUE) && (handle != nullptr))
{
FreeLibrary(handle);
- xSmplMailClient.set(new CSmplMailClient());
+ xSmplMailClient.set(new CSmplMailClient);
}
return xSmplMailClient;
}
diff --git a/shell/source/win32/spsupp/COMOpenDocuments.cxx b/shell/source/win32/spsupp/COMOpenDocuments.cxx
index 088e6d5717cd..f9e5a4bd0340 100644
--- a/shell/source/win32/spsupp/COMOpenDocuments.cxx
+++ b/shell/source/win32/spsupp/COMOpenDocuments.cxx
@@ -7,6 +7,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#include <sal/config.h>
+
+#include <cstring>
+
#include "COMOpenDocuments.hpp"
#include "spsuppServ.hpp"
#include "stdio.h"
@@ -27,7 +31,9 @@ bool SecurityWarning(const wchar_t* sProgram, const wchar_t* sDocument)
// Returns S_OK if successful
HRESULT LOStart(wchar_t* sCommandLine)
{
- STARTUPINFOW si = { sizeof(si) };
+ STARTUPINFOW si;
+ std::memset(&si, 0, sizeof si);
+ si.cb = sizeof si;
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_SHOW;
PROCESS_INFORMATION pi = {};
@@ -42,7 +48,7 @@ HRESULT LOStart(wchar_t* sCommandLine)
nullptr,
dwError,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPWSTR)&sMsgBuf,
+ reinterpret_cast<LPWSTR>(&sMsgBuf),
0, nullptr);
size_t nBufSize = wcslen(sMsgBuf) + 100;
@@ -97,7 +103,7 @@ HRESULT STDMETHODCALLTYPE COMOpenDocuments::COMObjectSafety::GetInterfaceSafetyO
}
// We know about it; release reference and return required information
- reinterpret_cast<IUnknown*>(ppvo)->Release();
+ static_cast<IUnknown*>(ppvo)->Release();
*pdwSupportedOptions = iSupportedOptionsMask;
*pdwEnabledOptions = m_iEnabledOptions;
return S_OK;
@@ -173,7 +179,7 @@ STDMETHODIMP COMOpenDocuments::QueryInterface(REFIID riid, void **ppvObject)
return E_NOINTERFACE;
}
- reinterpret_cast<IUnknown*>(*ppvObject)->AddRef();
+ static_cast<IUnknown*>(*ppvObject)->AddRef();
return S_OK;
}
@@ -306,7 +312,7 @@ STDMETHODIMP COMOpenDocuments::CreateNewDocument2(
wchar_t sCommandLine[32768];
swprintf(sCommandLine, sizeof(sCommandLine) / sizeof(*sCommandLine), L"\"%s\" -n \"%s\"", sProgram, bstrTemplateLocation);
HRESULT hr = LOStart(sCommandLine);
- *pbResult = SUCCEEDED(hr);
+ *pbResult = VARIANT_BOOL(SUCCEEDED(hr));
return hr;
}
@@ -356,7 +362,7 @@ STDMETHODIMP COMOpenDocuments::ViewDocument3(
wchar_t sCommandLine[32768];
swprintf(sCommandLine, sizeof(sCommandLine) / sizeof(*sCommandLine), L"\"%s\" --view \"%s\"", sProgram, bstrDocumentLocation);
HRESULT hr = LOStart(sCommandLine);
- *pbResult = SUCCEEDED(hr);
+ *pbResult = VARIANT_BOOL(SUCCEEDED(hr));
return hr;
}
@@ -430,7 +436,7 @@ STDMETHODIMP COMOpenDocuments::EditDocument3(
wchar_t sCommandLine[32768];
swprintf(sCommandLine, sizeof(sCommandLine) / sizeof(*sCommandLine), L"\"%s\" -o \"%s\"", sProgram, bstrDocumentLocation);
HRESULT hr = LOStart(sCommandLine);
- *pbResult = SUCCEEDED(hr);
+ *pbResult = VARIANT_BOOL(SUCCEEDED(hr));
return hr;
}
diff --git a/shell/source/win32/spsupp/spsuppClassFactory.cxx b/shell/source/win32/spsupp/spsuppClassFactory.cxx
index a86b8a16beaa..c6c2d48603a6 100644
--- a/shell/source/win32/spsupp/spsuppClassFactory.cxx
+++ b/shell/source/win32/spsupp/spsuppClassFactory.cxx
@@ -25,8 +25,6 @@ ClassFactory::~ClassFactory()
// IUnknown methods
-const wchar_t* GUID2Str(REFGUID rGUID);
-
STDMETHODIMP ClassFactory::QueryInterface(
REFIID riid,
void **ppvObject)
diff --git a/shell/source/win32/spsupp/spsuppServ.cxx b/shell/source/win32/spsupp/spsuppServ.cxx
index c71ba10b9d78..e5d1f432b2eb 100644
--- a/shell/source/win32/spsupp/spsuppServ.cxx
+++ b/shell/source/win32/spsupp/spsuppServ.cxx
@@ -8,7 +8,15 @@
*/
// Include MIDL-generated file
+#if defined __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wextra-tokens"
+ // "#endif !_MIDL_USE_GUIDDEF_" in midl-generated code
+#endif
#include "spsupp_i.c"
+#if defined __clang__
+#pragma clang diagnostic pop
+#endif
#include <memory>
#include "olectl.h"
@@ -17,8 +25,12 @@
#include "COMOpenDocuments.hpp"
#include "registrar.hpp"
+namespace {
+
HANDLE g_hModule;
+}
+
ITypeLib* GetTypeLib()
{
typedef std::unique_ptr<ITypeLib, void(*)(IUnknown* p)> ITypeLibGuard;
@@ -26,7 +38,7 @@ ITypeLib* GetTypeLib()
if (!aITypeLibGuard.get())
{
wchar_t szFile[MAX_PATH];
- if (GetModuleFileNameW((HMODULE)g_hModule, szFile, MAX_PATH) == 0)
+ if (GetModuleFileNameW(static_cast<HMODULE>(g_hModule), szFile, MAX_PATH) == 0)
return nullptr;
ITypeLib* pTypeLib;
HRESULT hr = LoadTypeLib(szFile, &pTypeLib);
@@ -43,7 +55,7 @@ const wchar_t* GetLOPath()
if (*sPath == 0)
{
// Initialization
- if (GetModuleFileNameW((HMODULE)g_hModule, sPath, MAX_PATH) == 0)
+ if (GetModuleFileNameW(static_cast<HMODULE>(g_hModule), sPath, MAX_PATH) == 0)
return nullptr;
wchar_t* pSlashPos = wcsrchr(sPath, L'\\');
if (pSlashPos == nullptr)
@@ -107,7 +119,7 @@ STDAPI DllRegisterServer(void)
return ResultFromScode(SELFREG_E_TYPELIB);
wchar_t szFile[MAX_PATH];
- if (GetModuleFileNameW((HMODULE)g_hModule, szFile, MAX_PATH) == 0)
+ if (GetModuleFileNameW(static_cast<HMODULE>(g_hModule), szFile, MAX_PATH) == 0)
return HRESULT_FROM_WIN32(GetLastError());
HRESULT hr = RegisterTypeLib(pTypeLib, szFile, nullptr);