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

Various clang-cl/loplugin warnings

Change-Id: Ib18e04e5024d15f8bbbf4921932b07465fb1f32f
üst b30173fd
......@@ -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: */
......@@ -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: */
......@@ -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"
......
......@@ -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: */
......@@ -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: */
......@@ -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.
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -25,8 +25,6 @@ ClassFactory::~ClassFactory()
// IUnknown methods
const wchar_t* GUID2Str(REFGUID rGUID);
STDMETHODIMP ClassFactory::QueryInterface(
REFIID riid,
void **ppvObject)
......
......@@ -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);
......
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