summaryrefslogtreecommitdiff
path: root/shell/source
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-10-14 16:52:11 +0200
committerStephan Bergmann <sbergman@redhat.com>2016-10-15 08:57:39 +0000
commit85876a11ceb9bf144ae8365ff3a9fedd8c363ef2 (patch)
tree4db05eaf14aaadc4c8bad4199dbfad3cb6106190 /shell/source
parentcb97267f5676b7790806dc15d17f2a6523232ccc (diff)
clang-cl loplugin: shell
Change-Id: I98d2e5154270b795cdd11653ecfff2abd8dda294 Reviewed-on: https://gerrit.libreoffice.org/29851 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'shell/source')
-rw-r--r--shell/source/backends/wininetbe/wininetbackend.cxx19
-rw-r--r--shell/source/backends/wininetbe/wininetbackend.hxx22
-rw-r--r--shell/source/backends/wininetbe/wininetbecdef.cxx4
-rw-r--r--shell/source/tools/regsvrex/regsvrex.cxx8
-rw-r--r--shell/source/win32/SysShExec.cxx10
-rw-r--r--shell/source/win32/SysShExec.hxx8
-rw-r--r--shell/source/win32/SysShentry.cxx2
-rw-r--r--shell/source/win32/ooofilereader/autostyletag.hxx12
-rw-r--r--shell/source/win32/ooofilereader/contentreader.cxx2
-rw-r--r--shell/source/win32/ooofilereader/dummytag.hxx12
-rw-r--r--shell/source/win32/ooofilereader/keywordstag.hxx12
-rw-r--r--shell/source/win32/ooofilereader/metainforeader.cxx2
-rw-r--r--shell/source/win32/ooofilereader/simpletag.hxx12
-rw-r--r--shell/source/win32/shlxthandler/classfactory.cxx8
-rw-r--r--shell/source/win32/shlxthandler/classfactory.hxx10
-rw-r--r--shell/source/win32/shlxthandler/columninfo/columninfo.cxx26
-rw-r--r--shell/source/win32/shlxthandler/infotips/infotips.cxx14
-rw-r--r--shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx56
-rw-r--r--shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx44
-rw-r--r--shell/source/win32/shlxthandler/ooofilt/propspec.cxx41
-rw-r--r--shell/source/win32/shlxthandler/ooofilt/propspec.hxx11
-rw-r--r--shell/source/win32/shlxthandler/ooofilt/stream_helper.cxx6
-rw-r--r--shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx69
-rw-r--r--shell/source/win32/shlxthandler/propsheets/document_statistic.hxx6
-rw-r--r--shell/source/win32/shlxthandler/propsheets/listviewbuilder.hxx6
-rw-r--r--shell/source/win32/shlxthandler/propsheets/propsheets.cxx18
-rw-r--r--shell/source/win32/shlxthandler/shlxthdl.cxx8
-rw-r--r--shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx80
-rw-r--r--shell/source/win32/shlxthandler/util/iso8601_converter.cxx16
-rw-r--r--shell/source/win32/shlxthandler/util/registry.cxx16
-rw-r--r--shell/source/win32/shlxthandler/util/utilities.cxx14
-rw-r--r--shell/source/win32/simplemail/senddoc.cxx28
-rw-r--r--shell/source/win32/simplemail/simplemapi.cxx8
-rw-r--r--shell/source/win32/simplemail/smplmailclient.cxx10
-rw-r--r--shell/source/win32/simplemail/smplmailclient.hxx4
-rw-r--r--shell/source/win32/simplemail/smplmailentry.cxx4
-rw-r--r--shell/source/win32/simplemail/smplmailmsg.hxx28
-rw-r--r--shell/source/win32/simplemail/smplmailsuppl.cxx2
-rw-r--r--shell/source/win32/simplemail/smplmailsuppl.hxx10
-rw-r--r--shell/source/win32/zipfile/zipexcptn.cxx31
-rw-r--r--shell/source/win32/zipfile/zipexcptn.hxx10
-rw-r--r--shell/source/win32/zipfile/zipfile.cxx30
42 files changed, 367 insertions, 372 deletions
diff --git a/shell/source/backends/wininetbe/wininetbackend.cxx b/shell/source/backends/wininetbe/wininetbackend.cxx
index 1a9f9989986b..42f091fe759a 100644
--- a/shell/source/backends/wininetbe/wininetbackend.cxx
+++ b/shell/source/backends/wininetbe/wininetbackend.cxx
@@ -119,9 +119,9 @@ WinInetBackend::WinInetBackend()
LPINTERNET_PROXY_INFO lpi = &pi;
DWORD dwLength = sizeof (INTERNET_PROXY_INFO);
BOOL ok = lpfnInternetQueryOption(
- NULL,
+ nullptr,
INTERNET_OPTION_PROXY,
- (LPVOID)lpi,
+ lpi,
&dwLength );
if (!ok)
{
@@ -136,12 +136,12 @@ WinInetBackend::WinInetBackend()
// alloca is nice because it is fast and we don't
// have to free the allocated memory, it will be
// automatically done
- lpi = reinterpret_cast< LPINTERNET_PROXY_INFO >(
+ lpi = static_cast< LPINTERNET_PROXY_INFO >(
alloca( dwLength ) );
ok = lpfnInternetQueryOption(
- NULL,
+ nullptr,
INTERNET_OPTION_PROXY,
- (LPVOID)lpi,
+ lpi,
&dwLength );
if (!ok)
{
@@ -218,13 +218,10 @@ WinInetBackend::WinInetBackend()
ProxyEntry aTypeIndepProxy = FindProxyEntry( aProxyList, OUString());
- ProxyEntry aHttpProxy = FindProxyEntry( aProxyList, OUString(
- "http" ) );
- ProxyEntry aHttpsProxy = FindProxyEntry( aProxyList, OUString(
- "https" ) );
+ ProxyEntry aHttpProxy = FindProxyEntry( aProxyList, "http" );
+ ProxyEntry aHttpsProxy = FindProxyEntry( aProxyList, "https" );
- ProxyEntry aFtpProxy = FindProxyEntry( aProxyList, OUString(
- "ftp" ) );
+ ProxyEntry aFtpProxy = FindProxyEntry( aProxyList, "ftp" );
if( aTypeIndepProxy.Server.getLength() )
{
diff --git a/shell/source/backends/wininetbe/wininetbackend.hxx b/shell/source/backends/wininetbe/wininetbackend.hxx
index 81098743bfe8..222ed09a1070 100644
--- a/shell/source/backends/wininetbe/wininetbackend.hxx
+++ b/shell/source/backends/wininetbe/wininetbackend.hxx
@@ -40,15 +40,15 @@ class WinInetBackend : public ::cppu::WeakImplHelper <
// XServiceInfo
virtual OUString SAL_CALL
getImplementationName( )
- throw (uno::RuntimeException) ;
+ throw (uno::RuntimeException) override;
virtual sal_Bool SAL_CALL
supportsService( const OUString& aServiceName )
- throw (uno::RuntimeException) ;
+ throw (uno::RuntimeException) override;
virtual uno::Sequence<OUString> SAL_CALL
getSupportedServiceNames( )
- throw (uno::RuntimeException) ;
+ throw (uno::RuntimeException) override;
/**
Provides the implementation name.
@@ -65,7 +65,7 @@ class WinInetBackend : public ::cppu::WeakImplHelper <
// XPropertySet
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
- getPropertySetInfo() throw (css::uno::RuntimeException)
+ getPropertySetInfo() throw (css::uno::RuntimeException) override
{ return css::uno::Reference< css::beans::XPropertySetInfo >(); }
virtual void SAL_CALL setPropertyValue(
@@ -74,20 +74,20 @@ class WinInetBackend : public ::cppu::WeakImplHelper <
css::beans::UnknownPropertyException,
css::beans::PropertyVetoException,
css::lang::IllegalArgumentException,
- css::lang::WrappedTargetException, css::uno::RuntimeException);
+ css::lang::WrappedTargetException, css::uno::RuntimeException) override;
virtual css::uno::Any SAL_CALL getPropertyValue(
OUString const & PropertyName)
throw (
css::beans::UnknownPropertyException,
- css::lang::WrappedTargetException, css::uno::RuntimeException);
+ css::lang::WrappedTargetException, css::uno::RuntimeException) override;
virtual void SAL_CALL addPropertyChangeListener(
OUString const &,
css::uno::Reference< css::beans::XPropertyChangeListener > const &)
throw (
css::beans::UnknownPropertyException,
- css::lang::WrappedTargetException, css::uno::RuntimeException)
+ css::lang::WrappedTargetException, css::uno::RuntimeException) override
{}
virtual void SAL_CALL removePropertyChangeListener(
@@ -95,7 +95,7 @@ class WinInetBackend : public ::cppu::WeakImplHelper <
css::uno::Reference< css::beans::XPropertyChangeListener > const &)
throw (
css::beans::UnknownPropertyException,
- css::lang::WrappedTargetException, css::uno::RuntimeException)
+ css::lang::WrappedTargetException, css::uno::RuntimeException) override
{}
virtual void SAL_CALL addVetoableChangeListener(
@@ -103,7 +103,7 @@ class WinInetBackend : public ::cppu::WeakImplHelper <
css::uno::Reference< css::beans::XVetoableChangeListener > const &)
throw (
css::beans::UnknownPropertyException,
- css::lang::WrappedTargetException, css::uno::RuntimeException)
+ css::lang::WrappedTargetException, css::uno::RuntimeException) override
{}
virtual void SAL_CALL removeVetoableChangeListener(
@@ -111,7 +111,7 @@ class WinInetBackend : public ::cppu::WeakImplHelper <
css::uno::Reference< css::beans::XVetoableChangeListener > const &)
throw (
css::beans::UnknownPropertyException,
- css::lang::WrappedTargetException, css::uno::RuntimeException)
+ css::lang::WrappedTargetException, css::uno::RuntimeException) override
{}
protected:
@@ -123,7 +123,7 @@ class WinInetBackend : public ::cppu::WeakImplHelper <
WinInetBackend();
/** Destructor */
- ~WinInetBackend() ;
+ ~WinInetBackend() override;
private:
css::beans::Optional< css::uno::Any >
diff --git a/shell/source/backends/wininetbe/wininetbecdef.cxx b/shell/source/backends/wininetbe/wininetbecdef.cxx
index e34ddaa31298..3f180df0ed3b 100644
--- a/shell/source/backends/wininetbe/wininetbecdef.cxx
+++ b/shell/source/backends/wininetbe/wininetbecdef.cxx
@@ -41,10 +41,10 @@ static const cppu::ImplementationEntry kImplementations_entries[] =
WinInetBackend::getBackendName,
WinInetBackend::getBackendServiceNames,
cppu::createSingleComponentFactory,
- NULL,
+ nullptr,
0
},
- { NULL, NULL, NULL, NULL, NULL, 0 }
+ { nullptr, nullptr, nullptr, nullptr, nullptr, 0 }
} ;
diff --git a/shell/source/tools/regsvrex/regsvrex.cxx b/shell/source/tools/regsvrex/regsvrex.cxx
index 34d5bcde7f6e..295db56942c1 100644
--- a/shell/source/tools/regsvrex/regsvrex.cxx
+++ b/shell/source/tools/regsvrex/regsvrex.cxx
@@ -49,8 +49,8 @@ int main(int argc, char* argv[])
if (hmod)
{
- lpfnDllRegisterServer lpfn_register = (lpfnDllRegisterServer)GetProcAddress(
- hmod, "DllRegisterServer");
+ lpfnDllRegisterServer lpfn_register = reinterpret_cast<lpfnDllRegisterServer>(GetProcAddress(
+ hmod, "DllRegisterServer"));
if (lpfn_register)
lpfn_register();
@@ -64,8 +64,8 @@ int main(int argc, char* argv[])
if (hmod)
{
- lpfnDllUnregisterServer lpfn_unregister = (lpfnDllUnregisterServer)GetProcAddress(
- hmod, "DllUnregisterServer");
+ lpfnDllUnregisterServer lpfn_unregister = reinterpret_cast<lpfnDllUnregisterServer>(GetProcAddress(
+ hmod, "DllUnregisterServer"));
if (lpfn_unregister)
lpfn_unregister();
diff --git a/shell/source/win32/SysShExec.cxx b/shell/source/win32/SysShExec.cxx
index fe6a82620369..c69d3f2a0c59 100644
--- a/shell/source/win32/SysShExec.cxx
+++ b/shell/source/win32/SysShExec.cxx
@@ -176,7 +176,7 @@ namespace
const OUString JUMP_MARK_HTML(".html#");
const sal_Unicode HASH_MARK = (sal_Unicode)'#';
- bool has_jump_mark(const OUString& system_path, sal_Int32* jmp_mark_start = NULL)
+ bool has_jump_mark(const OUString& system_path, sal_Int32* jmp_mark_start = nullptr)
{
sal_Int32 jmp_mark = std::max<int>(
system_path.lastIndexOf(JUMP_MARK_HTM),
@@ -240,7 +240,7 @@ CSysShExec::CSysShExec( const Reference< css::uno::XComponentContext >& xContext
* Once this changed, we can remove the uninitialize call.
*/
CoUninitialize();
- CoInitialize( NULL );
+ CoInitialize( nullptr );
}
void SAL_CALL CSysShExec::execute( const OUString& aCommand, const OUString& aParameter, sal_Int32 nFlags )
@@ -266,8 +266,8 @@ void SAL_CALL CSysShExec::execute( const OUString& aCommand, const OUString& aPa
if (!(uri.is() && uri->isAbsolute()))
{
throw css::lang::IllegalArgumentException(
- OUString("XSystemShellExecute.execute URIS_ONLY with"
- " non-absolute URI reference ")
+ "XSystemShellExecute.execute URIS_ONLY with"
+ " non-absolute URI reference "
+ aCommand,
static_cast< cppu::OWeakObject * >(this), 0);
}
@@ -306,7 +306,7 @@ void SAL_CALL CSysShExec::execute( const OUString& aCommand, const OUString& aPa
SetLastError( 0 );
- sal_Bool bRet = ShellExecuteExW(&sei) ? sal_True : sal_False;
+ bool bRet = ShellExecuteExW(&sei);
if (!bRet && (nFlags & NO_SYSTEM_ERROR_MESSAGE))
{
diff --git a/shell/source/win32/SysShExec.hxx b/shell/source/win32/SysShExec.hxx
index 04141391fbe4..49cc910e7ed0 100644
--- a/shell/source/win32/SysShExec.hxx
+++ b/shell/source/win32/SysShExec.hxx
@@ -53,20 +53,20 @@ public:
virtual void SAL_CALL execute( const OUString& aCommand, const OUString& aParameter, sal_Int32 nFlags )
- throw (css::lang::IllegalArgumentException, css::system::SystemShellExecuteException, css::uno::RuntimeException);
+ throw (css::lang::IllegalArgumentException, css::system::SystemShellExecuteException, css::uno::RuntimeException) override;
// XServiceInfo
virtual OUString SAL_CALL getImplementationName( )
- throw(css::uno::RuntimeException);
+ throw(css::uno::RuntimeException) override;
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
- throw(css::uno::RuntimeException);
+ throw(css::uno::RuntimeException) override;
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( )
- throw(css::uno::RuntimeException);
+ throw(css::uno::RuntimeException) override;
};
#endif
diff --git a/shell/source/win32/SysShentry.cxx b/shell/source/win32/SysShentry.cxx
index fd37cef26a16..4f208399ca5d 100644
--- a/shell/source/win32/SysShentry.cxx
+++ b/shell/source/win32/SysShentry.cxx
@@ -46,7 +46,7 @@ extern "C"
SAL_DLLPUBLIC_EXPORT void* SAL_CALL syssh_component_getFactory(
const sal_Char* pImplName, void*, void* /*pRegistryKey*/ )
{
- void* pRet = 0;
+ void* pRet = nullptr;
if ( 0 == rtl_str_compare( pImplName, SYSSHEXEC_IMPL_NAME ) )
{
diff --git a/shell/source/win32/ooofilereader/autostyletag.hxx b/shell/source/win32/ooofilereader/autostyletag.hxx
index 9a86c1943efe..b988ac3f9e0f 100644
--- a/shell/source/win32/ooofilereader/autostyletag.hxx
+++ b/shell/source/win32/ooofilereader/autostyletag.hxx
@@ -40,12 +40,12 @@ class CAutoStyleTag : public ITag
CAutoStyleTag():m_CurrentStyleLocalePair( EMPTY_STYLELOCALE_PAIR ){}
explicit CAutoStyleTag(const XmlTagAttributes_t& attributes);
- virtual void startTag();
- virtual void endTag();
- virtual void addCharacters(const std::wstring& characters);
- virtual void addAttributes(const XmlTagAttributes_t& attributes);
- virtual std::wstring getTagContent(){ return EMPTY_STRING; };
- virtual ::std::wstring const getTagAttribute( ::std::wstring const & /*attrname*/ ){ return ::std::wstring() ; }
+ virtual void startTag() override;
+ virtual void endTag() override;
+ virtual void addCharacters(const std::wstring& characters) override;
+ virtual void addAttributes(const XmlTagAttributes_t& attributes) override;
+ virtual std::wstring getTagContent() override { return EMPTY_STRING; };
+ virtual ::std::wstring const getTagAttribute( ::std::wstring const & /*attrname*/ ) override { return ::std::wstring() ; }
void setStyle( ::std::wstring const & Style );
void setLocale(const LocaleSet_t& Locale);
diff --git a/shell/source/win32/ooofilereader/contentreader.cxx b/shell/source/win32/ooofilereader/contentreader.cxx
index ef2b7748ed17..7a2cce5c25cf 100644
--- a/shell/source/win32/ooofilereader/contentreader.cxx
+++ b/shell/source/win32/ooofilereader/contentreader.cxx
@@ -165,7 +165,7 @@ void CContentReader::start_element(
{
//get appropriate Xml Tag Builder using MetaInfoBuilderFactory;
ITag* pTagBuilder = chooseTagReader( local_name,attributes );
- assert( pTagBuilder != NULL );
+ assert( pTagBuilder != nullptr );
pTagBuilder->startTag( );
m_TagBuilderStack.push( pTagBuilder );
diff --git a/shell/source/win32/ooofilereader/dummytag.hxx b/shell/source/win32/ooofilereader/dummytag.hxx
index da954c7400a4..9fdb3df1a4f8 100644
--- a/shell/source/win32/ooofilereader/dummytag.hxx
+++ b/shell/source/win32/ooofilereader/dummytag.hxx
@@ -33,20 +33,20 @@
class CDummyTag : public ITag
{
public:
- virtual void startTag(){};
+ virtual void startTag() override {};
- virtual void endTag(){};
+ virtual void endTag() override {};
- virtual void addCharacters(const std::wstring& /*characters*/){};
+ virtual void addCharacters(const std::wstring& /*characters*/) override {};
- virtual void addAttributes(const XmlTagAttributes_t& /*attributes*/){};
+ virtual void addAttributes(const XmlTagAttributes_t& /*attributes*/) override {};
- virtual std::wstring getTagContent()
+ virtual std::wstring getTagContent() override
{
return EMPTY_STRING;
};
- virtual ::std::wstring const getTagAttribute( ::std::wstring const & /*attrname*/ ){ return ::std::wstring(EMPTY_STRING); };
+ virtual ::std::wstring const getTagAttribute( ::std::wstring const & /*attrname*/ ) override { return ::std::wstring(EMPTY_STRING); };
};
diff --git a/shell/source/win32/ooofilereader/keywordstag.hxx b/shell/source/win32/ooofilereader/keywordstag.hxx
index 6660b86f79cb..d1dbe9288dfd 100644
--- a/shell/source/win32/ooofilereader/keywordstag.hxx
+++ b/shell/source/win32/ooofilereader/keywordstag.hxx
@@ -31,12 +31,12 @@
class CKeywordsTag : public ITag
{
public:
- virtual void startTag();
- virtual void endTag();
- virtual void addCharacters(const std::wstring& characters);
- virtual void addAttributes(const XmlTagAttributes_t& attributes);
- virtual std::wstring getTagContent();
- virtual ::std::wstring const getTagAttribute( ::std::wstring const & /*attrname*/ ){ return ::std::wstring(); };
+ virtual void startTag() override;
+ virtual void endTag() override;
+ virtual void addCharacters(const std::wstring& characters) override;
+ virtual void addAttributes(const XmlTagAttributes_t& attributes) override;
+ virtual std::wstring getTagContent() override;
+ virtual ::std::wstring const getTagAttribute( ::std::wstring const & /*attrname*/ ) override { return ::std::wstring(); };
private:
StringList_t m_slKeywords;
diff --git a/shell/source/win32/ooofilereader/metainforeader.cxx b/shell/source/win32/ooofilereader/metainforeader.cxx
index 0490b9505e8c..908291b9c289 100644
--- a/shell/source/win32/ooofilereader/metainforeader.cxx
+++ b/shell/source/win32/ooofilereader/metainforeader.cxx
@@ -248,7 +248,7 @@ void CMetaInfoReader::start_element(
{
//get appropriate Xml Tag Builder using MetaInfoBuilderFactory;
ITag* pTagBuilder = chooseTagReader( local_name,attributes );
- assert( pTagBuilder!= NULL );
+ assert( pTagBuilder!= nullptr );
pTagBuilder->startTag( );
m_TagBuilderStack.push( pTagBuilder );
diff --git a/shell/source/win32/ooofilereader/simpletag.hxx b/shell/source/win32/ooofilereader/simpletag.hxx
index 1310bd1045b5..5f167681ec4d 100644
--- a/shell/source/win32/ooofilereader/simpletag.hxx
+++ b/shell/source/win32/ooofilereader/simpletag.hxx
@@ -34,13 +34,13 @@ class CSimpleTag : public ITag
CSimpleTag(){};
explicit CSimpleTag( const XmlTagAttributes_t& attributes ):m_SimpleAttributes(attributes){}
- virtual void startTag();
- virtual void endTag();
- virtual void addCharacters(const std::wstring& characters);
- virtual void addAttributes(const XmlTagAttributes_t& attributes);
- virtual std::wstring getTagContent();
+ virtual void startTag() override;
+ virtual void endTag() override;
+ virtual void addCharacters(const std::wstring& characters) override;
+ virtual void addAttributes(const XmlTagAttributes_t& attributes) override;
+ virtual std::wstring getTagContent() override;
- virtual ::std::wstring const getTagAttribute( ::std::wstring const & attrname );
+ virtual ::std::wstring const getTagAttribute( ::std::wstring const & attrname ) override;
private:
std::wstring m_SimpleContent;
diff --git a/shell/source/win32/shlxthandler/classfactory.cxx b/shell/source/win32/shlxthandler/classfactory.cxx
index 36d287708db1..e64f87a87a33 100644
--- a/shell/source/win32/shlxthandler/classfactory.cxx
+++ b/shell/source/win32/shlxthandler/classfactory.cxx
@@ -51,7 +51,7 @@ CClassFactory::~CClassFactory()
HRESULT STDMETHODCALLTYPE CClassFactory::QueryInterface(REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject)
{
- *ppvObject = 0;
+ *ppvObject = nullptr;
if (IID_IUnknown == riid || IID_IClassFactory == riid)
{
@@ -90,10 +90,10 @@ HRESULT STDMETHODCALLTYPE CClassFactory::CreateInstance(
REFIID riid,
void __RPC_FAR *__RPC_FAR *ppvObject)
{
- if ((pUnkOuter != NULL))
+ if ((pUnkOuter != nullptr))
return CLASS_E_NOAGGREGATION;
- IUnknown* pUnk = 0;
+ IUnknown* pUnk = nullptr;
if (CLSID_PROPERTYSHEET_HANDLER == m_Clsid)
pUnk = static_cast<IShellExtInit*>(new CPropertySheet());
@@ -107,7 +107,7 @@ HRESULT STDMETHODCALLTYPE CClassFactory::CreateInstance(
else if (CLSID_THUMBVIEWER_HANDLER == m_Clsid)
pUnk = static_cast<IExtractImage*>(new CThumbviewer());
- if (0 == pUnk)
+ if (nullptr == pUnk)
{
return E_OUTOFMEMORY;
}
diff --git a/shell/source/win32/shlxthandler/classfactory.hxx b/shell/source/win32/shlxthandler/classfactory.hxx
index 047b661ab5e9..69a0841b62f5 100644
--- a/shell/source/win32/shlxthandler/classfactory.hxx
+++ b/shell/source/win32/shlxthandler/classfactory.hxx
@@ -40,11 +40,11 @@ public:
virtual HRESULT STDMETHODCALLTYPE QueryInterface(
REFIID riid,
- void __RPC_FAR *__RPC_FAR *ppvObject);
+ void __RPC_FAR *__RPC_FAR *ppvObject) override;
- virtual ULONG STDMETHODCALLTYPE AddRef();
+ virtual ULONG STDMETHODCALLTYPE AddRef() override;
- virtual ULONG STDMETHODCALLTYPE Release();
+ virtual ULONG STDMETHODCALLTYPE Release() override;
// IClassFactory methods
@@ -53,9 +53,9 @@ public:
virtual HRESULT STDMETHODCALLTYPE CreateInstance(
IUnknown __RPC_FAR *pUnkOuter,
REFIID riid,
- void __RPC_FAR *__RPC_FAR *ppvObject);
+ void __RPC_FAR *__RPC_FAR *ppvObject) override;
- virtual HRESULT STDMETHODCALLTYPE LockServer(BOOL fLock);
+ virtual HRESULT STDMETHODCALLTYPE LockServer(BOOL fLock) override;
static bool IsLocked();
diff --git a/shell/source/win32/shlxthandler/columninfo/columninfo.cxx b/shell/source/win32/shlxthandler/columninfo/columninfo.cxx
index 6cfbcda1a9fb..b51d00e8e8f9 100644
--- a/shell/source/win32/shlxthandler/columninfo/columninfo.cxx
+++ b/shell/source/win32/shlxthandler/columninfo/columninfo.cxx
@@ -40,6 +40,18 @@ namespace /* private */
};
size_t ColumnInfoTableSize = SAL_N_ELEMENTS(ColumnInfoTable);
+
+bool IsOOFileExtension(wchar_t* Extension)
+{
+ for (size_t i = 0; i < OOFileExtensionTableSize; i++)
+ {
+ if (0 == _wcsicmp(Extension, OOFileExtensionTable[i].ExtensionUnicode))
+ return true;
+ }
+
+ return false;
+}
+
}
@@ -61,7 +73,7 @@ CColumnInfo::~CColumnInfo()
HRESULT STDMETHODCALLTYPE CColumnInfo::QueryInterface(REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject)
{
- *ppvObject = 0;
+ *ppvObject = nullptr;
if (IID_IUnknown == riid || IID_IColumnProvider == riid)
{
@@ -183,16 +195,4 @@ HRESULT STDMETHODCALLTYPE CColumnInfo::GetItemData(LPCSHCOLUMNID pscid, LPCSHCOL
return S_FALSE;
}
-
-bool CColumnInfo::IsOOFileExtension(wchar_t* Extension) const
-{
- for (size_t i = 0; i < OOFileExtensionTableSize; i++)
- {
- if (0 == _wcsicmp(Extension, OOFileExtensionTable[i].ExtensionUnicode))
- return true;
- }
-
- return false;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/shell/source/win32/shlxthandler/infotips/infotips.cxx b/shell/source/win32/shlxthandler/infotips/infotips.cxx
index d8fc781e87e6..31f9bc56e144 100644
--- a/shell/source/win32/shlxthandler/infotips/infotips.cxx
+++ b/shell/source/win32/shlxthandler/infotips/infotips.cxx
@@ -58,9 +58,9 @@ CInfoTip::~CInfoTip()
HRESULT STDMETHODCALLTYPE CInfoTip::QueryInterface(REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject)
{
- *ppvObject = 0;
+ *ppvObject = nullptr;
- IUnknown* pUnk = 0;
+ IUnknown* pUnk = nullptr;
if (IID_IUnknown == riid || IID_IQueryInfo == riid)
{
@@ -120,14 +120,14 @@ DWORD getSizeOfFile( char* FileName )
HANDLE hFile = CreateFile(StringToWString(FileName).c_str(), // open file
GENERIC_READ, // open for reading
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, // share for all operations
- NULL, // no security
+ nullptr, // no security
OPEN_EXISTING, // existing file only
FILE_ATTRIBUTE_NORMAL, // normal file
- NULL); // no attr. template
+ nullptr); // no attr. template
if (hFile != INVALID_HANDLE_VALUE)
{
- DWORD dwSize = GetFileSize( HANDLE(hFile), NULL );
+ DWORD dwSize = GetFileSize( HANDLE(hFile), nullptr );
CloseHandle( HANDLE(hFile) );
return dwSize;
}
@@ -148,7 +148,7 @@ std::wstring formatSizeOfFile( DWORD dwSize )
return StringToWString( buffer ).append(StringToWString("B"));
}
- char *buffer=NULL;
+ char *buffer=nullptr;
int decimal, sign;
double dFileSize = (double)dwSize/(double)KB;
@@ -281,7 +281,7 @@ HRESULT STDMETHODCALLTYPE CInfoTip::GetInfoTip(DWORD /*dwFlags*/, wchar_t** ppws
if (SUCCEEDED(hr))
{
size_t len = sizeof(wchar_t) * msg.length() + sizeof(wchar_t);
- wchar_t* pMem = reinterpret_cast<wchar_t*>(lpMalloc->Alloc(len));
+ wchar_t* pMem = static_cast<wchar_t*>(lpMalloc->Alloc(len));
ZeroMemory(pMem, len);
diff --git a/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx b/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx
index bbcdebb1f7d7..f6f2516b6260 100644
--- a/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx
+++ b/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx
@@ -80,8 +80,8 @@ using ::std::min;
COooFilter::COooFilter() :
m_lRefs(1),
- m_pContentReader(NULL),
- m_pMetaInfoReader(NULL),
+ m_pContentReader(nullptr),
+ m_pMetaInfoReader(nullptr),
m_eState(FilteringContent),
m_ulUnicodeBufferLen(0),
m_ulUnicodeCharsRead(0),
@@ -92,8 +92,8 @@ COooFilter::COooFilter() :
m_fEof(FALSE),
m_ChunkPosition(0),
m_cAttributes(0),
- m_pAttributes(0),
- m_pStream(NULL)
+ m_pAttributes(nullptr),
+ m_pStream(nullptr)
{
InterlockedIncrement( &g_lInstances );
@@ -129,23 +129,23 @@ SCODE STDMETHODCALLTYPE COooFilter::QueryInterface(
REFIID riid,
void ** ppvObject)
{
- IUnknown *pUnkTemp = 0;
+ IUnknown *pUnkTemp = nullptr;
if ( IID_IFilter == riid )
- pUnkTemp = (IUnknown *)(IFilter *)this;
+ pUnkTemp = static_cast<IUnknown *>(static_cast<IFilter *>(this));
else if ( IID_IPersistFile == riid )
- pUnkTemp = (IUnknown *)(IPersistFile *)this;
+ pUnkTemp = static_cast<IUnknown *>(static_cast<IPersistFile *>(this));
else if ( IID_IPersist == riid )
- pUnkTemp = (IUnknown *)(IPersist *)(IPersistFile *)this;
+ pUnkTemp = static_cast<IUnknown *>(static_cast<IPersist *>(static_cast<IPersistFile *>(this)));
else if (IID_IPersistStream == riid)
- pUnkTemp = (IUnknown *)(IPersistStream *)this;
+ pUnkTemp = static_cast<IUnknown *>(static_cast<IPersistStream *>(this));
else if ( IID_IUnknown == riid )
- pUnkTemp = (IUnknown *)(IPersist *)(IPersistFile *)this;
+ pUnkTemp = static_cast<IUnknown *>(static_cast<IPersist *>(static_cast<IPersistFile *>(this)));
else
{
- *ppvObject = NULL;
+ *ppvObject = nullptr;
return E_NOINTERFACE;
}
- *ppvObject = (void *)pUnkTemp;
+ *ppvObject = pUnkTemp;
pUnkTemp->AddRef();
return S_OK;
}
@@ -213,18 +213,18 @@ SCODE STDMETHODCALLTYPE COooFilter::Init(
if ( m_cAttributes > 0 )
{
delete[] m_pAttributes;
- m_pAttributes = 0;
+ m_pAttributes = nullptr;
m_cAttributes = 0;
}
if( 0 < cAttributes )
{
// Filter properties specified in aAttributes
- if ( 0 == aAttributes )
+ if ( nullptr == aAttributes )
return E_INVALIDARG;
m_pAttributes = new CFullPropSpec[cAttributes];
m_cAttributes = cAttributes;
// Is caller want to filter contents?
- CFullPropSpec *pAttrib = (CFullPropSpec *) aAttributes;
+ CFullPropSpec const *pAttrib = reinterpret_cast<CFullPropSpec const *>(aAttributes);
ULONG ulNumAttr;
for ( ulNumAttr = 0 ; ulNumAttr < cAttributes; ulNumAttr++ )
{
@@ -474,8 +474,8 @@ SCODE STDMETHODCALLTYPE COooFilter::GetValue(PROPVARIANT ** ppPropValue)
{
if ( m_cAttributes == 0 || ( m_ulCurrentPropertyNum == m_ulPropertyNum ) )
return FILTER_E_NO_MORE_VALUES;
- PROPVARIANT *pPropVar = (PROPVARIANT *) CoTaskMemAlloc( sizeof (PROPVARIANT) );
- if ( pPropVar == 0 )
+ PROPVARIANT *pPropVar = static_cast<PROPVARIANT *>(CoTaskMemAlloc( sizeof (PROPVARIANT) ));
+ if ( pPropVar == nullptr )
return E_OUTOFMEMORY;
::std::wstring wsTagName= GetMetaInfoNameFromPropertyId( m_pAttributes[m_ulCurrentPropertyNum].GetPropertyPropid() );
if ( wsTagName == EMPTY_STRING )
@@ -484,7 +484,7 @@ SCODE STDMETHODCALLTYPE COooFilter::GetValue(PROPVARIANT ** ppPropValue)
pPropVar->vt = VT_LPWSTR;
size_t cw = wsTagData.length() + 1; // reserve one for the '\0'
pPropVar->pwszVal = static_cast<WCHAR*>( CoTaskMemAlloc(cw*sizeof(WCHAR)) );
- if (pPropVar->pwszVal == 0)
+ if (pPropVar->pwszVal == nullptr)
{
CoTaskMemFree(pPropVar);
return E_OUTOFMEMORY;
@@ -691,7 +691,7 @@ SCODE STDMETHODCALLTYPE COooFilter::GetCurFile(LPWSTR * ppszFileName)
if ( EMPTY_STRING == m_pwszFileName )
return E_FAIL;
else
- *ppszFileName = (LPWSTR)m_pwszFileName.c_str();
+ *ppszFileName = const_cast<LPWSTR>(m_pwszFileName.c_str());
return S_OK;
}
@@ -733,15 +733,15 @@ SCODE STDMETHODCALLTYPE COooFilterCF::QueryInterface(REFIID riid, void ** ppvOb
IUnknown *pUnkTemp;
if ( IID_IClassFactory == riid )
- pUnkTemp = (IUnknown *)(IClassFactory *)this;
+ pUnkTemp = static_cast<IUnknown *>(static_cast<IClassFactory *>(this));
else if ( IID_IUnknown == riid )
- pUnkTemp = (IUnknown *)this;
+ pUnkTemp = static_cast<IUnknown *>(this);
else
{
- *ppvObject = NULL;
+ *ppvObject = nullptr;
return E_NOINTERFACE;
}
- *ppvObject = (void *)pUnkTemp;
+ *ppvObject = pUnkTemp;
pUnkTemp->AddRef();
return S_OK;
}
@@ -795,8 +795,8 @@ SCODE STDMETHODCALLTYPE COooFilterCF::CreateInstance(
REFIID riid,
void * * ppvObject)
{
- COooFilter *pIUnk = 0;
- if ( 0 != pUnkOuter )
+ COooFilter *pIUnk = nullptr;
+ if ( nullptr != pUnkOuter )
return CLASS_E_NOAGGREGATION;
pIUnk = new COooFilter();
if ( SUCCEEDED( pIUnk->QueryInterface( riid , ppvObject ) ) )
@@ -886,13 +886,13 @@ extern "C" SCODE STDMETHODCALLTYPE DllGetClassObject(
void ** ppvObj
)
{
- COooFilterCF* pImpl = 0;
- IUnknown *pResult = 0;
+ COooFilterCF* pImpl = nullptr;
+ IUnknown *pResult = nullptr;
if ( CLSID_COooFilter == cid )
{
pImpl = new COooFilterCF;
- pResult = (IUnknown *) pImpl;
+ pResult = static_cast<IUnknown *>(pImpl);
}
else
return CLASS_E_CLASSNOTAVAILABLE;
diff --git a/shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx b/shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx
index b448951ed0d4..96ca3a3d0337 100644
--- a/shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx
+++ b/shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx
@@ -75,57 +75,57 @@ public:
// From IUnknown
virtual SCODE STDMETHODCALLTYPE QueryInterface(
REFIID riid,
- void ** ppvObject);
- virtual ULONG STDMETHODCALLTYPE AddRef();
- virtual ULONG STDMETHODCALLTYPE Release();
+ void ** ppvObject) override;
+ virtual ULONG STDMETHODCALLTYPE AddRef() override;
+ virtual ULONG STDMETHODCALLTYPE Release() override;
// From IFilter
virtual SCODE STDMETHODCALLTYPE Init(
ULONG grfFlags,
ULONG cAttributes,
FULLPROPSPEC const * aAttributes,
- ULONG * pFlags);
+ ULONG * pFlags) override;
virtual SCODE STDMETHODCALLTYPE GetChunk(
- STAT_CHUNK * pStat);
+ STAT_CHUNK * pStat) override;
virtual SCODE STDMETHODCALLTYPE GetText(
ULONG * pcwcBuffer,
- WCHAR * awcBuffer);
+ WCHAR * awcBuffer) override;
virtual SCODE STDMETHODCALLTYPE GetValue(
- PROPVARIANT ** ppPropValue);
+ PROPVARIANT ** ppPropValue) override;
virtual SCODE STDMETHODCALLTYPE BindRegion(
FILTERREGION origPos,
REFIID riid,
- void ** ppunk);
+ void ** ppunk) override;
// From IPersistFile
virtual SCODE STDMETHODCALLTYPE GetClassID(
- CLSID * pClassID);
- virtual SCODE STDMETHODCALLTYPE IsDirty();
+ CLSID * pClassID) override;
+ virtual SCODE STDMETHODCALLTYPE IsDirty() override;
virtual SCODE STDMETHODCALLTYPE Load(
LPCWSTR pszFileName,
- DWORD dwMode);
+ DWORD dwMode) override;
virtual SCODE STDMETHODCALLTYPE Save(
LPCWSTR pszFileName,
- BOOL fRemember);
+ BOOL fRemember) override;
virtual SCODE STDMETHODCALLTYPE SaveCompleted(
- LPCWSTR pszFileName);
+ LPCWSTR pszFileName) override;
virtual SCODE STDMETHODCALLTYPE GetCurFile(
- LPWSTR * ppszFileName);
+ LPWSTR * ppszFileName) override;
// From IPersistStream
virtual SCODE STDMETHODCALLTYPE Load(
- IStream *pStm);
+ IStream *pStm) override;
virtual SCODE STDMETHODCALLTYPE Save(
IStream *pStm,
- BOOL fClearDirty);
+ BOOL fClearDirty) override;
virtual SCODE STDMETHODCALLTYPE GetSizeMax(
- ULARGE_INTEGER *pcbSize);
+ ULARGE_INTEGER *pcbSize) override;
private:
@@ -165,18 +165,18 @@ public:
// From IUnknown
virtual SCODE STDMETHODCALLTYPE QueryInterface(
REFIID riid,
- void ** ppvObject);
+ void ** ppvObject) override;
- virtual ULONG STDMETHODCALLTYPE AddRef();
- virtual ULONG STDMETHODCALLTYPE Release();
+ virtual ULONG STDMETHODCALLTYPE AddRef() override;
+ virtual ULONG STDMETHODCALLTYPE Release() override;
// From IClassFactory
virtual SCODE STDMETHODCALLTYPE CreateInstance(
IUnknown * pUnkOuter,
- REFIID riid, void ** ppvObject);
+ REFIID riid, void ** ppvObject) override;
virtual SCODE STDMETHODCALLTYPE LockServer(
- BOOL fLock);
+ BOOL fLock) override;
private:
friend SCODE STDMETHODCALLTYPE DllGetClassObject(
diff --git a/shell/source/win32/shlxthandler/ooofilt/propspec.cxx b/shell/source/win32/shlxthandler/ooofilt/propspec.cxx
index 830bb4f486a0..1defe9644852 100644
--- a/shell/source/win32/shlxthandler/ooofilt/propspec.cxx
+++ b/shell/source/win32/shlxthandler/ooofilt/propspec.cxx
@@ -22,6 +22,10 @@
// File: propspec.cxx
// Contents: C++ wrappers for FULLPROPSPEC
+#include <sal/config.h>
+
+#include <new>
+
#if defined _MSC_VER
#pragma warning(push, 1)
#endif
@@ -95,17 +99,14 @@ CFullPropSpec::CFullPropSpec( CFullPropSpec const & src ) :
SetProperty( src._psProperty.lpwstr );
}
else
- _psProperty.lpwstr = 0;
+ _psProperty.lpwstr = nullptr;
}
else
{
_psProperty.propid = src._psProperty.propid;
}
}
-inline void * operator new( size_t /*size*/, void * p )
-{
- return p;
-}
+
//+-------------------------------------------------------------------------
// Member: CFullPropSpec::operator=, public
// Synopsis: Assignment operator
@@ -116,13 +117,7 @@ CFullPropSpec & CFullPropSpec::operator=( CFullPropSpec const & Property )
// Clean up.
this->CFullPropSpec::~CFullPropSpec();
-#ifdef _MSC_VER
-#pragma warning( disable : 4291 ) // unmatched operator new
-#endif
- new (this) CFullPropSpec( Property );
-#ifdef _MSC_VER
-#pragma warning( default : 4291 )
-#endif
+ ::new (this) CFullPropSpec( Property );
return *this;
}
CFullPropSpec::~CFullPropSpec()
@@ -136,7 +131,7 @@ CFullPropSpec::~CFullPropSpec()
void CFullPropSpec::SetProperty( PROPID pidProperty )
{
if ( _psProperty.ulKind == PRSPEC_LPWSTR &&
- 0 != _psProperty.lpwstr )
+ nullptr != _psProperty.lpwstr )
{
CoTaskMemFree( _psProperty.lpwstr );
}
@@ -146,14 +141,14 @@ void CFullPropSpec::SetProperty( PROPID pidProperty )
BOOL CFullPropSpec::SetProperty( WCHAR const * wcsProperty )
{
if ( _psProperty.ulKind == PRSPEC_LPWSTR &&
- 0 != _psProperty.lpwstr )
+ nullptr != _psProperty.lpwstr )
{
CoTaskMemFree( _psProperty.lpwstr );
}
_psProperty.ulKind = PRSPEC_LPWSTR;
int len = (int) ( (wcslen( wcsProperty ) + 1) * sizeof( WCHAR ) );
- _psProperty.lpwstr = (WCHAR *)CoTaskMemAlloc( len );
- if ( 0 != _psProperty.lpwstr )
+ _psProperty.lpwstr = static_cast<WCHAR *>(CoTaskMemAlloc( len ));
+ if ( nullptr != _psProperty.lpwstr )
{
memcpy( _psProperty.lpwstr,
wcsProperty,
@@ -162,18 +157,18 @@ BOOL CFullPropSpec::SetProperty( WCHAR const * wcsProperty )
}
else
{
- _psProperty.lpwstr = 0;
+ _psProperty.lpwstr = nullptr;
return FALSE;
}
}
-int CFullPropSpec::operator==( CFullPropSpec const & prop ) const
+bool CFullPropSpec::operator==( CFullPropSpec const & prop ) const
{
if ( memcmp( &prop._guidPropSet,
&_guidPropSet,
sizeof( _guidPropSet ) ) != 0 ||
prop._psProperty.ulKind != _psProperty.ulKind )
{
- return 0;
+ return false;
}
switch( _psProperty.ulKind )
{
@@ -184,16 +179,16 @@ int CFullPropSpec::operator==( CFullPropSpec const & prop ) const
return( GetPropertyPropid() == prop.GetPropertyPropid() );
break;
default:
- return 0;
+ return false;
break;
}
}
-int CFullPropSpec::operator!=( CFullPropSpec const & prop ) const
+bool CFullPropSpec::operator!=( CFullPropSpec const & prop ) const
{
if (*this == prop)
- return 0;
+ return false;
else
- return 1;
+ return true;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/shell/source/win32/shlxthandler/ooofilt/propspec.hxx b/shell/source/win32/shlxthandler/ooofilt/propspec.hxx
index 682d7df4b665..963493c0a49c 100644
--- a/shell/source/win32/shlxthandler/ooofilt/propspec.hxx
+++ b/shell/source/win32/shlxthandler/ooofilt/propspec.hxx
@@ -59,13 +59,12 @@ public:
~CFullPropSpec();
// Memory allocation
void * operator new( size_t size );
- inline void * operator new( size_t size, void * p );
void operator delete( void * p );
inline FULLPROPSPEC * CastToStruct();
inline FULLPROPSPEC const * CastToStruct() const;
// Comparators
- int operator==( CFullPropSpec const & prop ) const;
- int operator!=( CFullPropSpec const & prop ) const;
+ bool operator==( CFullPropSpec const & prop ) const;
+ bool operator!=( CFullPropSpec const & prop ) const;
// Member variable access
inline void SetPropSet( GUID const & guidPropSet );
inline GUID const & GetPropSet() const;
@@ -87,10 +86,6 @@ inline void * CFullPropSpec::operator new( size_t size )
void * p = CoTaskMemAlloc( size );
return p;
}
-inline void * CFullPropSpec::operator new( size_t /*size*/, void * p )
-{
- return p;
-}
inline void CFullPropSpec::operator delete( void * p )
{
if ( p )
@@ -99,7 +94,7 @@ inline void CFullPropSpec::operator delete( void * p )
inline BOOL CFullPropSpec::IsValid() const
{
return ( _psProperty.ulKind == PRSPEC_PROPID ||
- 0 != _psProperty.lpwstr );
+ nullptr != _psProperty.lpwstr );
}
inline void CFullPropSpec::SetPropSet( GUID const & guidPropSet )
{
diff --git a/shell/source/win32/shlxthandler/ooofilt/stream_helper.cxx b/shell/source/win32/shlxthandler/ooofilt/stream_helper.cxx
index 57cf217700d3..49adb0aa95ac 100644
--- a/shell/source/win32/shlxthandler/ooofilt/stream_helper.cxx
+++ b/shell/source/win32/shlxthandler/ooofilt/stream_helper.cxx
@@ -67,7 +67,7 @@ long BufferStream::stell ()
Move.QuadPart = 0;
NewPosition.QuadPart = 0;
- hr = ((IStream *)stream)->Seek (Move, STREAM_SEEK_CUR, &NewPosition);
+ hr = stream->Seek (Move, STREAM_SEEK_CUR, &NewPosition);
if (hr == S_OK)
return (long) NewPosition.QuadPart;
else
@@ -96,7 +96,7 @@ long BufferStream::sseek (long offset, int origin)
return -1;
}
- hr = stream->Seek (Move, dwOrigin, NULL);
+ hr = stream->Seek (Move, dwOrigin, nullptr);
if (hr == S_OK)
return 0;
else
@@ -104,7 +104,7 @@ long BufferStream::sseek (long offset, int origin)
}
FileStream::FileStream(const char *filename) :
- file(0)
+ file(nullptr)
{
// fdo#67534: avoid locking to not interfere with soffice opening the file
file = _fsopen(filename, "rb", _SH_DENYNO);
diff --git a/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx b/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx
index 5f4bda470c21..edb7ab25910c 100644
--- a/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx
+++ b/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx
@@ -37,7 +37,7 @@
// Module global
long g_DllRefCnt = 0;
-HINSTANCE g_hModule = NULL;
+HINSTANCE g_hModule = nullptr;
// Map of property keys to the locations of their value(s) in the .??? XML schema
struct PROPERTYMAP
@@ -61,7 +61,7 @@ size_t gPropertyMapTableSize = SAL_N_ELEMENTS(g_rgPROPERTYMAP);
CPropertyHdl::CPropertyHdl( long nRefCnt ) :
m_RefCnt( nRefCnt ),
- m_pCache( NULL )
+ m_pCache( nullptr )
{
OutputDebugStringFormatA( "CPropertyHdl: CTOR\n" );
InterlockedIncrement( &g_DllRefCnt );
@@ -73,7 +73,7 @@ CPropertyHdl::~CPropertyHdl()
if ( m_pCache )
{
m_pCache->Release();
- m_pCache = NULL;
+ m_pCache = nullptr;
}
InterlockedDecrement( &g_DllRefCnt );
}
@@ -83,7 +83,7 @@ CPropertyHdl::~CPropertyHdl()
HRESULT STDMETHODCALLTYPE CPropertyHdl::QueryInterface(REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject)
{
- *ppvObject = 0;
+ *ppvObject = nullptr;
if (IID_IUnknown == riid || IID_IPropertyStore == riid)
{
@@ -216,7 +216,7 @@ HRESULT STDMETHODCALLTYPE CPropertyHdl::Initialize( IStream *pStream, DWORD grfM
BufferStream tmpStream(pStream);
- CMetaInfoReader *pMetaInfoReader = NULL;
+ CMetaInfoReader *pMetaInfoReader = nullptr;
try
{
@@ -234,31 +234,9 @@ HRESULT STDMETHODCALLTYPE CPropertyHdl::Initialize( IStream *pStream, DWORD grfM
return S_OK;
}
+namespace {
-void CPropertyHdl::LoadProperties( CMetaInfoReader *pMetaInfoReader )
-{
- OutputDebugStringFormatA( "CPropertyHdl: LoadProperties\n" );
- PROPVARIANT propvarValues;
-
- for ( UINT i = 0; i < (UINT)gPropertyMapTableSize; ++i )
- {
- PropVariantClear( &propvarValues );
- HRESULT hr = GetItemData( pMetaInfoReader, i, &propvarValues);
- if (hr == S_OK)
- {
- // coerce the value(s) to the appropriate type for the property key
- hr = PSCoerceToCanonicalValue( g_rgPROPERTYMAP[i].key, &propvarValues );
- if (SUCCEEDED(hr))
- {
- // cache the value(s) loaded
- hr = m_pCache->SetValueAndState( g_rgPROPERTYMAP[i].key, &propvarValues, PSC_NORMAL );
- }
- }
- }
-}
-
-
-HRESULT CPropertyHdl::GetItemData( CMetaInfoReader *pMetaInfoReader, UINT nIndex, PROPVARIANT *pVarData )
+HRESULT GetItemData( CMetaInfoReader *pMetaInfoReader, UINT nIndex, PROPVARIANT *pVarData )
{
switch (nIndex) {
case 0: {
@@ -302,6 +280,29 @@ HRESULT CPropertyHdl::GetItemData( CMetaInfoReader *pMetaInfoReader, UINT nIndex
return S_FALSE;
}
+}
+
+void CPropertyHdl::LoadProperties( CMetaInfoReader *pMetaInfoReader )
+{
+ OutputDebugStringFormatA( "CPropertyHdl: LoadProperties\n" );
+ PROPVARIANT propvarValues;
+
+ for ( UINT i = 0; i < (UINT)gPropertyMapTableSize; ++i )
+ {
+ PropVariantClear( &propvarValues );
+ HRESULT hr = GetItemData( pMetaInfoReader, i, &propvarValues);
+ if (hr == S_OK)
+ {
+ // coerce the value(s) to the appropriate type for the property key
+ hr = PSCoerceToCanonicalValue( g_rgPROPERTYMAP[i].key, &propvarValues );
+ if (SUCCEEDED(hr))
+ {
+ // cache the value(s) loaded
+ hr = m_pCache->SetValueAndState( g_rgPROPERTYMAP[i].key, &propvarValues, PSC_NORMAL );
+ }
+ }
+ }
+}
// CClassFactory
@@ -327,7 +328,7 @@ CClassFactory::~CClassFactory()
HRESULT STDMETHODCALLTYPE CClassFactory::QueryInterface( REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject )
{
- *ppvObject = 0;
+ *ppvObject = nullptr;
if ( IID_IUnknown == riid || IID_IClassFactory == riid )
{
@@ -365,15 +366,15 @@ HRESULT STDMETHODCALLTYPE CClassFactory::CreateInstance(
REFIID riid,
void __RPC_FAR *__RPC_FAR *ppvObject)
{
- if ( pUnkOuter != NULL )
+ if ( pUnkOuter != nullptr )
return CLASS_E_NOAGGREGATION;
- IUnknown* pUnk = 0;
+ IUnknown* pUnk = nullptr;
if ( CLSID_PROPERTY_HANDLER == m_Clsid )
pUnk = static_cast<IPropertyStore*>( new CPropertyHdl() );
- if (0 == pUnk)
+ if (nullptr == pUnk)
{
return E_OUTOFMEMORY;
}
@@ -407,7 +408,7 @@ bool CClassFactory::IsLocked()
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void** ppv)
{
OutputDebugStringFormatA( "DllGetClassObject.\n" );
- *ppv = 0;
+ *ppv = nullptr;
if ( rclsid != CLSID_PROPERTY_HANDLER )
return CLASS_E_CLASSNOTAVAILABLE;
diff --git a/shell/source/win32/shlxthandler/propsheets/document_statistic.hxx b/shell/source/win32/shlxthandler/propsheets/document_statistic.hxx
index ae979a536967..876ecfe81918 100644
--- a/shell/source/win32/shlxthandler/propsheets/document_statistic.hxx
+++ b/shell/source/win32/shlxthandler/propsheets/document_statistic.hxx
@@ -86,7 +86,7 @@ class writer_document_statistic_reader : public document_statistic_reader
protected:
writer_document_statistic_reader(const std::string& document_name, CMetaInfoReader* meta_info_accessor);
- virtual void fill_description_section(CMetaInfoReader *meta_info_accessor, statistic_group_list_t* group_list);
+ virtual void fill_description_section(CMetaInfoReader *meta_info_accessor, statistic_group_list_t* group_list) override;
friend document_statistic_reader_ptr create_document_statistic_reader(
const std::string& document_name, CMetaInfoReader* meta_info_accessor);
@@ -98,7 +98,7 @@ class calc_document_statistic_reader : public document_statistic_reader
protected:
calc_document_statistic_reader(const std::string& document_name, CMetaInfoReader* meta_info_accessor);
- virtual void fill_description_section( CMetaInfoReader *meta_info_accessor,statistic_group_list_t* group_list);
+ virtual void fill_description_section( CMetaInfoReader *meta_info_accessor,statistic_group_list_t* group_list) override;
friend document_statistic_reader_ptr create_document_statistic_reader(
const std::string& document_name, CMetaInfoReader* meta_info_accessor);
@@ -110,7 +110,7 @@ class draw_impress_math_document_statistic_reader : public document_statistic_re
protected:
draw_impress_math_document_statistic_reader(const std::string& document_name, CMetaInfoReader* meta_info_accessor);
- virtual void fill_description_section(CMetaInfoReader *meta_info_accessor, statistic_group_list_t* group_list);
+ virtual void fill_description_section(CMetaInfoReader *meta_info_accessor, statistic_group_list_t* group_list) override;
friend document_statistic_reader_ptr create_document_statistic_reader(
const std::string& document_name, CMetaInfoReader* meta_info_accessor);
diff --git a/shell/source/win32/shlxthandler/propsheets/listviewbuilder.hxx b/shell/source/win32/shlxthandler/propsheets/listviewbuilder.hxx
index bb0072f49da4..300c269c7e4d 100644
--- a/shell/source/win32/shlxthandler/propsheets/listviewbuilder.hxx
+++ b/shell/source/win32/shlxthandler/propsheets/listviewbuilder.hxx
@@ -80,9 +80,9 @@ protected:
const std::wstring& column1_title,
const std::wstring& column2_title);
- virtual void setup_list_view();
- virtual void insert_group(const std::wstring& name);
- virtual void insert_item(const std::wstring& title, const std::wstring& value, bool is_editable);
+ virtual void setup_list_view() override;
+ virtual void insert_group(const std::wstring& name) override;
+ virtual void insert_item(const std::wstring& title, const std::wstring& value, bool is_editable) override;
private:
int group_count_;
diff --git a/shell/source/win32/shlxthandler/propsheets/propsheets.cxx b/shell/source/win32/shlxthandler/propsheets/propsheets.cxx
index 8b4d201dd9c9..9d524e990d00 100644
--- a/shell/source/win32/shlxthandler/propsheets/propsheets.cxx
+++ b/shell/source/win32/shlxthandler/propsheets/propsheets.cxx
@@ -74,9 +74,9 @@ CPropertySheet::~CPropertySheet()
HRESULT STDMETHODCALLTYPE CPropertySheet::QueryInterface(
REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject)
{
- *ppvObject = 0;
+ *ppvObject = nullptr;
- IUnknown* pUnk = 0;
+ IUnknown* pUnk = nullptr;
if (IID_IUnknown == riid || IID_IShellExtInit == riid)
{
pUnk = static_cast<IShellExtInit*>(this);
@@ -124,23 +124,23 @@ HRESULT STDMETHODCALLTYPE CPropertySheet::Initialize(
InitCommonControls();
STGMEDIUM medium;
- FORMATETC fe = {CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
+ FORMATETC fe = {CF_HDROP, nullptr, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
HRESULT hr = lpdobj->GetData(&fe, &medium);
// save the file name
if (SUCCEEDED(hr) &&
(1 == DragQueryFileA(
- reinterpret_cast<HDROP>(medium.hGlobal),
+ static_cast<HDROP>(medium.hGlobal),
0xFFFFFFFF,
- NULL,
+ nullptr,
0)))
{
- UINT size = DragQueryFileW( reinterpret_cast<HDROP>(medium.hGlobal), 0, 0, 0 );
+ UINT size = DragQueryFileW( static_cast<HDROP>(medium.hGlobal), 0, nullptr, 0 );
if ( size != 0 )
{
WCHAR * buffer = new WCHAR[ size + 1 ];
- UINT result_size = DragQueryFileW( reinterpret_cast<HDROP>(medium.hGlobal),
+ UINT result_size = DragQueryFileW( static_cast<HDROP>(medium.hGlobal),
0, buffer, size + 1 );
if ( result_size != 0 )
{
@@ -173,7 +173,7 @@ HRESULT STDMETHODCALLTYPE CPropertySheet::AddPages(LPFNADDPROPSHEETPAGE lpfnAddP
{
// the Win32 SDK 8.1 deprecates GetVersionEx()
#ifdef _WIN32_WINNT_WINBLUE
- bool bIsVistaOrLater = IsWindowsVistaOrGreater() ? true : false;
+ bool bIsVistaOrLater = IsWindowsVistaOrGreater();
#else
// Get OS version (we don't need the summary page on Windows Vista or later)
OSVERSIONINFO sInfoOS;
@@ -196,7 +196,7 @@ HRESULT STDMETHODCALLTYPE CPropertySheet::AddPages(LPFNADDPROPSHEETPAGE lpfnAddP
psp.lParam = reinterpret_cast<LPARAM>(this);
psp.pfnCallback = reinterpret_cast<LPFNPSPCALLBACK>(CPropertySheet::PropPageSummaryCallback);
- HPROPSHEETPAGE hPage = NULL;
+ HPROPSHEETPAGE hPage = nullptr;
if ( !bIsVistaOrLater )
{
diff --git a/shell/source/win32/shlxthandler/shlxthdl.cxx b/shell/source/win32/shlxthandler/shlxthdl.cxx
index 1463c6695ea4..cba73c410145 100644
--- a/shell/source/win32/shlxthandler/shlxthdl.cxx
+++ b/shell/source/win32/shlxthandler/shlxthdl.cxx
@@ -33,7 +33,7 @@
// Module global
long g_DllRefCnt = 0;
-HINSTANCE g_hModule = NULL;
+HINSTANCE g_hModule = nullptr;
namespace /* private */
{
@@ -331,7 +331,7 @@ STDAPI DllRegisterServer()
hr = E_FAIL;
// notify the Shell that something has changed
- SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, 0, 0);
+ SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nullptr, nullptr);
return hr;
}
@@ -361,14 +361,14 @@ STDAPI DllUnregisterServer()
UnapproveShellExtension(CLSID_THUMBVIEWER_HANDLER);
// notify the Shell that something has changed
- SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, 0, 0);
+ SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nullptr, nullptr);
return hr;
}
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void** ppv)
{
- *ppv = 0;
+ *ppv = nullptr;
if ((rclsid != CLSID_INFOTIP_HANDLER) &&
(rclsid != CLSID_COLUMN_HANDLER) &&
diff --git a/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx b/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx
index 20909bf82f66..f7ddd6103346 100644
--- a/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx
+++ b/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx
@@ -60,7 +60,7 @@ namespace internal
HRSRC hrc = FindResourceW(g_hModule, L"#2000", RT_RCDATA);
DWORD size = SizeofResource(g_hModule, hrc);
HGLOBAL hglob = LoadResource(g_hModule, hrc);
- char* data = reinterpret_cast<char*>(LockResource(hglob));
+ char* data = static_cast<char*>(LockResource(hglob));
buffer = ZipFile::ZipContentBuffer_t(data, data + size);
}
@@ -73,7 +73,7 @@ namespace internal
{
// the Win32 SDK 8.1 deprecates GetVersionEx()
#ifdef _WIN32_WINNT_WINBLUE
- return IsWindowsXPOrGreater() ? true : false;
+ return IsWindowsXPOrGreater();
#else
OSVERSIONINFO osvi;
ZeroMemory(&osvi, sizeof(osvi));
@@ -117,28 +117,43 @@ namespace internal
}
}
+namespace {
+
+Gdiplus::Rect CalcScaledAspectRatio(const Gdiplus::Rect& src, const Gdiplus::Rect& dest)
+{
+ Gdiplus::Rect result;
+ if (src.Width >= src.Height)
+ result = Gdiplus::Rect(0, 0, dest.Width, src.Height * dest.Width / src.Width);
+ else
+ result = Gdiplus::Rect(0, 0, src.Width * dest.Height / src.Height, dest.Height);
+
+ return result;
+}
+
+}
+
class StreamOnZipBuffer final : public IStream
{
public:
explicit StreamOnZipBuffer(const ZipFile::ZipContentBuffer_t& zip_buffer);
// IUnknown
- virtual ULONG STDMETHODCALLTYPE AddRef();
- virtual ULONG STDMETHODCALLTYPE Release();
- virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef() override;
+ virtual ULONG STDMETHODCALLTYPE Release() override;
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject) override;
// IStream
- virtual HRESULT STDMETHODCALLTYPE Read(void *pv, ULONG cb, ULONG *pcbRead);
- virtual HRESULT STDMETHODCALLTYPE Write(void const *pv, ULONG cb, ULONG *pcbWritten);
- virtual HRESULT STDMETHODCALLTYPE Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition);
- virtual HRESULT STDMETHODCALLTYPE SetSize(ULARGE_INTEGER libNewSize);
- virtual HRESULT STDMETHODCALLTYPE CopyTo(IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten);
- virtual HRESULT STDMETHODCALLTYPE Commit(DWORD grfCommitFlags);
- virtual HRESULT STDMETHODCALLTYPE Revert();
- virtual HRESULT STDMETHODCALLTYPE LockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType);
- virtual HRESULT STDMETHODCALLTYPE UnlockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType);
- virtual HRESULT STDMETHODCALLTYPE Stat(STATSTG *pstatstg, DWORD grfStatFlag);
- virtual HRESULT STDMETHODCALLTYPE Clone(IStream **ppstm);
+ virtual HRESULT STDMETHODCALLTYPE Read(void *pv, ULONG cb, ULONG *pcbRead) override;
+ virtual HRESULT STDMETHODCALLTYPE Write(void const *pv, ULONG cb, ULONG *pcbWritten) override;
+ virtual HRESULT STDMETHODCALLTYPE Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition) override;
+ virtual HRESULT STDMETHODCALLTYPE SetSize(ULARGE_INTEGER libNewSize) override;
+ virtual HRESULT STDMETHODCALLTYPE CopyTo(IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten) override;
+ virtual HRESULT STDMETHODCALLTYPE Commit(DWORD grfCommitFlags) override;
+ virtual HRESULT STDMETHODCALLTYPE Revert() override;
+ virtual HRESULT STDMETHODCALLTYPE LockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) override;
+ virtual HRESULT STDMETHODCALLTYPE UnlockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) override;
+ virtual HRESULT STDMETHODCALLTYPE Stat(STATSTG *pstatstg, DWORD grfStatFlag) override;
+ virtual HRESULT STDMETHODCALLTYPE Clone(IStream **ppstm) override;
private:
LONG ref_count_;
@@ -172,8 +187,8 @@ ULONG STDMETHODCALLTYPE StreamOnZipBuffer::Release()
HRESULT STDMETHODCALLTYPE StreamOnZipBuffer::QueryInterface(REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject)
{
- *ppvObject = 0;
- IUnknown* pUnk = 0;
+ *ppvObject = nullptr;
+ IUnknown* pUnk = nullptr;
if ((IID_IUnknown == riid) || (IID_IStream == riid))
{
@@ -187,7 +202,7 @@ HRESULT STDMETHODCALLTYPE StreamOnZipBuffer::QueryInterface(REFIID riid, void __
HRESULT STDMETHODCALLTYPE StreamOnZipBuffer::Read(void *pv, ULONG cb, ULONG *pcbRead)
{
- if (pv == NULL)
+ if (pv == nullptr)
return STG_E_INVALIDPOINTER;
size_t size = ref_zip_buffer_.size();
@@ -195,7 +210,7 @@ HRESULT STDMETHODCALLTYPE StreamOnZipBuffer::Read(void *pv, ULONG cb, ULONG *pcb
if (pos_ > size)
return S_FALSE;
- char* p = reinterpret_cast<char*>(pv);
+ char* p = static_cast<char*>(pv);
ULONG read = 0;
for ( ;(pos_ < size) && (cb > 0); pos_++, cb--, read++)
@@ -238,7 +253,7 @@ HRESULT STDMETHODCALLTYPE StreamOnZipBuffer::Seek(LARGE_INTEGER dlibMove, DWORD
HRESULT STDMETHODCALLTYPE StreamOnZipBuffer::Stat(STATSTG *pstatstg, DWORD grfStatFlag)
{
- if (pstatstg == NULL)
+ if (pstatstg == nullptr)
return STG_E_INVALIDPOINTER;
ZeroMemory(pstatstg, sizeof(STATSTG));
@@ -246,7 +261,7 @@ HRESULT STDMETHODCALLTYPE StreamOnZipBuffer::Stat(STATSTG *pstatstg, DWORD grfSt
if (grfStatFlag == STATFLAG_DEFAULT)
{
size_t sz = 4 * sizeof(wchar_t);
- wchar_t* name = reinterpret_cast<wchar_t*>(CoTaskMemAlloc(sz));
+ wchar_t* name = static_cast<wchar_t*>(CoTaskMemAlloc(sz));
ZeroMemory(name, sz);
memcpy(name, L"png", 3 * sizeof(wchar_t));
pstatstg->pwcsName = name;
@@ -297,7 +312,7 @@ CThumbviewer::CThumbviewer(long RefCnt) :
thumbnail_size_.cy = 0;
Gdiplus::GdiplusStartupInput gdiplusStartupInput;
- Gdiplus::GdiplusStartup(&gdiplus_token_, &gdiplusStartupInput, NULL);
+ Gdiplus::GdiplusStartup(&gdiplus_token_, &gdiplusStartupInput, nullptr);
ZipFile::ZipContentBuffer_t img_data;
internal::LoadSignetImageFromResource(img_data);
@@ -317,8 +332,8 @@ CThumbviewer::~CThumbviewer()
HRESULT STDMETHODCALLTYPE CThumbviewer::QueryInterface(REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject)
{
- *ppvObject = 0;
- IUnknown* pUnk = 0;
+ *ppvObject = nullptr;
+ IUnknown* pUnk = nullptr;
if ((IID_IUnknown == riid) || (IID_IPersistFile == riid))
{
@@ -408,7 +423,7 @@ HRESULT STDMETHODCALLTYPE CThumbviewer::Extract(HBITMAP *phBmpImage)
dib.bi.biCompression = BI_RGB;
LPVOID lpBits;
- HBITMAP hMemBmp = CreateDIBSection(memDC, (LPBITMAPINFO)&dib, DIB_RGB_COLORS, &lpBits, NULL, 0);
+ HBITMAP hMemBmp = CreateDIBSection(memDC, reinterpret_cast<LPBITMAPINFO>(&dib), DIB_RGB_COLORS, &lpBits, nullptr, 0);
HGDIOBJ hOldObj = SelectObject(memDC, hMemBmp);
Gdiplus::Graphics graphics(memDC);
@@ -473,7 +488,7 @@ HRESULT STDMETHODCALLTYPE CThumbviewer::Extract(HBITMAP *phBmpImage)
HRESULT STDMETHODCALLTYPE CThumbviewer::GetLocation(
LPWSTR pszPathBuffer, DWORD cchMax, DWORD *pdwPriority, const SIZE *prgSize, DWORD dwRecClrDepth, DWORD *pdwFlags)
{
- if ((prgSize == NULL) || (pdwFlags == NULL) || ((*pdwFlags & IEIFLAG_ASYNC) && (pdwPriority == NULL)))
+ if ((prgSize == nullptr) || (pdwFlags == nullptr) || ((*pdwFlags & IEIFLAG_ASYNC) && (pdwPriority == nullptr)))
return E_INVALIDARG;
thumbnail_size_ = *prgSize;
@@ -515,17 +530,6 @@ HRESULT STDMETHODCALLTYPE CThumbviewer::GetCurFile(LPOLESTR __RPC_FAR*)
{ return E_NOTIMPL; }
-Gdiplus::Rect CThumbviewer::CalcScaledAspectRatio(const Gdiplus::Rect& src, const Gdiplus::Rect& dest)
-{
- Gdiplus::Rect result;
- if (src.Width >= src.Height)
- result = Gdiplus::Rect(0, 0, dest.Width, src.Height * dest.Width / src.Width);
- else
- result = Gdiplus::Rect(0, 0, src.Width * dest.Height / src.Height, dest.Height);
-
- return result;
-}
-
#endif // DONT_HAVE_GDIPLUS
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/shell/source/win32/shlxthandler/util/iso8601_converter.cxx b/shell/source/win32/shlxthandler/util/iso8601_converter.cxx
index 9933a9c41805..932b44b0655a 100644
--- a/shell/source/win32/shlxthandler/util/iso8601_converter.cxx
+++ b/shell/source/win32/shlxthandler/util/iso8601_converter.cxx
@@ -49,13 +49,13 @@ std::wstring iso8601_date_to_local_date(const std::wstring& isoDate )
{
std::string asDateTime = WStringToString( ws8601DateTime );
SYSTEMTIME DateTime;
- DateTime.wYear = ( unsigned short )strtol( asDateTime.substr( 0, 4 ).c_str(), NULL, 10 );
- DateTime.wMonth = ( unsigned short )strtol( asDateTime.substr( 5, 2 ).c_str(), NULL, 10 );
+ DateTime.wYear = ( unsigned short )strtol( asDateTime.substr( 0, 4 ).c_str(), nullptr, 10 );
+ DateTime.wMonth = ( unsigned short )strtol( asDateTime.substr( 5, 2 ).c_str(), nullptr, 10 );
DateTime.wDayOfWeek = 0;
- DateTime.wDay = ( unsigned short )strtol( asDateTime.substr( 8, 2 ).c_str(), NULL, 10 );
- DateTime.wHour = ( unsigned short )strtol( asDateTime.substr( 11,2 ).c_str(), NULL, 10 );
- DateTime.wMinute = ( unsigned short )strtol( asDateTime.substr( 14,2 ).c_str(), NULL, 10 );
- DateTime.wSecond = ( unsigned short )strtol( asDateTime.substr( 17,2 ).c_str(), NULL, 10 );
+ DateTime.wDay = ( unsigned short )strtol( asDateTime.substr( 8, 2 ).c_str(), nullptr, 10 );
+ DateTime.wHour = ( unsigned short )strtol( asDateTime.substr( 11,2 ).c_str(), nullptr, 10 );
+ DateTime.wMinute = ( unsigned short )strtol( asDateTime.substr( 14,2 ).c_str(), nullptr, 10 );
+ DateTime.wSecond = ( unsigned short )strtol( asDateTime.substr( 17,2 ).c_str(), nullptr, 10 );
DateTime.wMilliseconds = 0;
//get Date info from structure
@@ -64,7 +64,7 @@ std::wstring iso8601_date_to_local_date(const std::wstring& isoDate )
LOCALE_SYSTEM_DEFAULT,
0,
&DateTime,
- NULL,
+ nullptr,
DateBuffer,
MAX_PATH );
@@ -80,7 +80,7 @@ std::wstring iso8601_date_to_local_date(const std::wstring& isoDate )
LOCALE_SYSTEM_DEFAULT,
0,
&DateTime,
- NULL,
+ nullptr,
TimeBuffer,
MAX_PATH );
diff --git a/shell/source/win32/shlxthandler/util/registry.cxx b/shell/source/win32/shlxthandler/util/registry.cxx
index f74b09f59f45..9a6480962aa8 100644
--- a/shell/source/win32/shlxthandler/util/registry.cxx
+++ b/shell/source/win32/shlxthandler/util/registry.cxx
@@ -43,7 +43,7 @@ bool SetRegistryKey(HKEY RootKey, const char* KeyName, const char* ValueName, co
// open or create the desired key
char dummy[] = "";
int rc = RegCreateKeyExA(
- RootKey, const_cast<char*>(KeyName), 0, dummy, REG_OPTION_NON_VOLATILE, KEY_WRITE, 0, &hSubKey, 0);
+ RootKey, KeyName, 0, dummy, REG_OPTION_NON_VOLATILE, KEY_WRITE, nullptr, &hSubKey, nullptr);
if (ERROR_SUCCESS == rc)
{
@@ -78,13 +78,13 @@ bool DeleteRegistryKey(HKEY RootKey, const char* KeyName)
DWORD nMaxSubKeyLen;
rc = RegQueryInfoKeyA(
- hKey, 0, 0, 0, 0,
+ hKey, nullptr, nullptr, nullptr, nullptr,
&nMaxSubKeyLen,
- 0, 0, 0, 0, 0, 0);
+ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr);
nMaxSubKeyLen++; // space for trailing '\0'
- SubKey = reinterpret_cast<char*>(
+ SubKey = static_cast<char*>(
_alloca(nMaxSubKeyLen*sizeof(char)));
while (ERROR_SUCCESS == rc)
@@ -96,7 +96,7 @@ bool DeleteRegistryKey(HKEY RootKey, const char* KeyName)
0, // always index zero
SubKey,
&nLen,
- 0, 0, 0, 0);
+ nullptr, nullptr, nullptr, nullptr);
if (ERROR_NO_MORE_ITEMS == rc)
{
@@ -130,7 +130,7 @@ bool HasSubkeysRegistryKey(HKEY RootKey, const char* KeyName, /* out */ bool& bR
{
DWORD nSubKeys = 0;
- rc = RegQueryInfoKeyA(hKey, 0, 0, 0, &nSubKeys, 0, 0, 0, 0, 0, 0, 0);
+ rc = RegQueryInfoKeyA(hKey, nullptr, nullptr, nullptr, &nSubKeys, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr);
bResult = (nSubKeys > 0);
}
@@ -142,7 +142,7 @@ bool HasSubkeysRegistryKey(HKEY RootKey, const char* KeyName, /* out */ bool& bR
std::string ClsidToString(const CLSID& clsid)
{
// Get CLSID
- LPOLESTR wszCLSID = NULL;
+ LPOLESTR wszCLSID = nullptr;
StringFromCLSID(clsid, &wszCLSID);
char buff[39];
@@ -170,7 +170,7 @@ bool QueryRegistryKey(HKEY RootKey, const char* KeyName, const char* ValueName,
if (ERROR_SUCCESS == rc)
{
rc = RegQueryValueExA(
- hKey, ValueName, NULL, NULL, (LPBYTE)pszData,&dwBufLen);
+ hKey, ValueName, nullptr, nullptr, reinterpret_cast<LPBYTE>(pszData),&dwBufLen);
RegCloseKey(hKey);
}
diff --git a/shell/source/win32/shlxthandler/util/utilities.cxx b/shell/source/win32/shlxthandler/util/utilities.cxx
index 574c419b3d21..78f960b07c11 100644
--- a/shell/source/win32/shlxthandler/util/utilities.cxx
+++ b/shell/source/win32/shlxthandler/util/utilities.cxx
@@ -33,9 +33,9 @@ const wchar_t SPACE_CHAR = L' ';
static std::wstring StringToWString(const std::string& String, int codepage)
{
int len = MultiByteToWideChar(
- codepage, 0, String.c_str(), -1, 0, 0);
+ codepage, 0, String.c_str(), -1, nullptr, 0);
- wchar_t* buff = reinterpret_cast<wchar_t*>(
+ wchar_t* buff = static_cast<wchar_t*>(
_alloca(len * sizeof(wchar_t)));
MultiByteToWideChar(
@@ -47,13 +47,13 @@ static std::wstring StringToWString(const std::string& String, int codepage)
static std::string WStringToString(const std::wstring& String, int codepage)
{
int len = WideCharToMultiByte(
- codepage, 0, String.c_str(), -1, 0, 0, 0, 0);
+ codepage, 0, String.c_str(), -1, nullptr, 0, nullptr, nullptr);
- char* buff = reinterpret_cast<char*>(
+ char* buff = static_cast<char*>(
_alloca(len * sizeof(char)));
WideCharToMultiByte(
- codepage, 0, String.c_str(), -1, buff, len, 0, 0);
+ codepage, 0, String.c_str(), -1, buff, len, nullptr, nullptr);
return std::string(buff);
}
@@ -104,7 +104,7 @@ bool is_windows_xp_or_above()
{
// the Win32 SDK 8.1 deprecates GetVersionEx()
#ifdef _WIN32_WINNT_WINBLUE
- return IsWindowsXPOrGreater() ? true : false;
+ return IsWindowsXPOrGreater();
#else
OSVERSIONINFO osvi;
ZeroMemory(&osvi, sizeof(osvi));
@@ -153,7 +153,7 @@ bool HasOnlySpaces(const std::wstring& String)
std::wstring getShortPathName( const std::wstring& aLongName )
{
std::wstring shortName = aLongName;
- long length = GetShortPathNameW( aLongName.c_str(), NULL, 0 );
+ long length = GetShortPathNameW( aLongName.c_str(), nullptr, 0 );
if ( length != 0 )
{
diff --git a/shell/source/win32/simplemail/senddoc.cxx b/shell/source/win32/simplemail/senddoc.cxx
index 0abea3d6ce63..cb25d7c57e0d 100644
--- a/shell/source/win32/simplemail/senddoc.cxx
+++ b/shell/source/win32/simplemail/senddoc.cxx
@@ -152,9 +152,9 @@ void initMapiMessage(
ZeroMemory(pMapiMessage, sizeof(MapiMessage));
try {
- rtl_uString *subject = NULL;
- rtl_uString_newFromAscii(&subject, const_cast<char*>(gSubject.c_str()));
- rtl_uString *decoded_subject = NULL;
+ rtl_uString *subject = nullptr;
+ rtl_uString_newFromAscii(&subject, gSubject.c_str());
+ rtl_uString *decoded_subject = nullptr;
rtl_uriDecode(subject, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8, &decoded_subject);
OUString ou_subject(decoded_subject);
pMapiMessage->lpszSubject = strdup(OUStringToOString(ou_subject, osl_getThreadTextEncoding(), RTL_UNICODETOTEXT_FLAGS_UNDEFINED_QUESTIONMARK).getStr());
@@ -162,9 +162,9 @@ void initMapiMessage(
catch (...) {
pMapiMessage->lpszSubject = const_cast<char*>(gSubject.c_str());
}
- pMapiMessage->lpszNoteText = (gBody.length() ? const_cast<char*>(gBody.c_str()) : NULL);
+ pMapiMessage->lpszNoteText = (gBody.length() ? const_cast<char*>(gBody.c_str()) : nullptr);
pMapiMessage->lpOriginator = aMapiOriginator;
- pMapiMessage->lpRecips = aMapiRecipientList.size() ? &aMapiRecipientList[0] : 0;
+ pMapiMessage->lpRecips = aMapiRecipientList.size() ? &aMapiRecipientList[0] : nullptr;
pMapiMessage->nRecipCount = aMapiRecipientList.size();
pMapiMessage->lpFiles = &aMapiAttachmentList[0];
pMapiMessage->nFileCount = aMapiAttachmentList.size();
@@ -274,7 +274,7 @@ int main(int argc, char* argv[])
initMapiOriginator(&mapiOriginator);
initRecipientList(&mapiRecipientList);
initAttachmentList(&mapiAttachmentList);
- initMapiMessage((gFrom.length() ? &mapiOriginator : NULL), mapiRecipientList, mapiAttachmentList, &mapiMsg);
+ initMapiMessage((gFrom.length() ? &mapiOriginator : nullptr), mapiRecipientList, mapiAttachmentList, &mapiMsg);
ulRet = mapi.MAPISendMail(hSession, 0, &mapiMsg, gMapiFlags, 0);
@@ -306,33 +306,33 @@ int main(int argc, char* argv[])
std::ostringstream oss;
if (gFrom.length() > 0)
- oss << "--from" << " " << gFrom << std::endl;
+ oss << "--from " << gFrom << std::endl;
if (gSubject.length() > 0)
- oss << "--subject" << " " << gSubject << std::endl;
+ oss << "--subject " << gSubject << std::endl;
if (gBody.length() > 0)
- oss << "--body" << " " << gBody << std::endl;
+ oss << "--body " << gBody << std::endl;
StringListIterator_t iter = gTo.begin();
StringListIterator_t iter_end = gTo.end();
for (/**/;iter != iter_end; ++iter)
- oss << "--to" << " " << *iter << std::endl;
+ oss << "--to " << *iter << std::endl;
iter = gCc.begin();
iter_end = gCc.end();
for (/**/;iter != iter_end; ++iter)
- oss << "--cc" << " " << *iter << std::endl;
+ oss << "--cc " << *iter << std::endl;
iter = gBcc.begin();
iter_end = gBcc.end();
for (/**/;iter != iter_end; ++iter)
- oss << "--bcc" << " " << *iter << std::endl;
+ oss << "--bcc " << *iter << std::endl;
iter = gAttachments.begin();
iter_end = gAttachments.end();
for (/**/;iter != iter_end; ++iter)
- oss << "--attach" << " " << *iter << std::endl;
+ oss << "--attach " << *iter << std::endl;
if (gMapiFlags & MAPI_DIALOG)
oss << "--mapi-dialog" << std::endl;
@@ -340,7 +340,7 @@ int main(int argc, char* argv[])
if (gMapiFlags & MAPI_LOGON_UI)
oss << "--mapi-logon-ui" << std::endl;
- MessageBox(NULL, oss.str().c_str(), "Arguments", MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, oss.str().c_str(), "Arguments", MB_OK | MB_ICONINFORMATION);
}
#endif
diff --git a/shell/source/win32/simplemail/simplemapi.cxx b/shell/source/win32/simplemail/simplemapi.cxx
index 71c5e6e320b8..316cb70660de 100644
--- a/shell/source/win32/simplemail/simplemapi.cxx
+++ b/shell/source/win32/simplemail/simplemapi.cxx
@@ -23,12 +23,12 @@
#include <stdexcept>
CSimpleMapi::CSimpleMapi() :
- m_lpfnMapiLogon(NULL),
- m_lpfnMapiLogoff(NULL),
- m_lpfnMapiSendMail(NULL)
+ m_lpfnMapiLogon(nullptr),
+ m_lpfnMapiLogoff(nullptr),
+ m_lpfnMapiSendMail(nullptr)
{
m_hMapiDll = LoadLibrary("mapi32.dll");
- if ((m_hMapiDll == INVALID_HANDLE_VALUE) || (m_hMapiDll == NULL))
+ if ((m_hMapiDll == INVALID_HANDLE_VALUE) || (m_hMapiDll == nullptr))
throw std::runtime_error("Couldn't load MAPI library");
m_lpfnMapiLogon = reinterpret_cast<LPMAPILOGON>(GetProcAddress(m_hMapiDll, "MAPILogon"));
diff --git a/shell/source/win32/simplemail/smplmailclient.cxx b/shell/source/win32/simplemail/smplmailclient.cxx
index a291ad0c3976..5fcc2fac700f 100644
--- a/shell/source/win32/simplemail/smplmailclient.cxx
+++ b/shell/source/win32/simplemail/smplmailclient.cxx
@@ -78,7 +78,7 @@ namespace /* private */
{
wchar_t buff[MAX_PATH];
LONG sz = sizeof(buff);
- lret = RegQueryValueW(hkey, NULL, buff, &sz);
+ lret = RegQueryValueW(hkey, nullptr, buff, &sz);
if (lret == ERROR_SUCCESS)
{
osl::FileBase::getFileURLFromSystemPath(reinterpret_cast<const sal_Unicode*>(buff), altSenddocUrl);
@@ -129,12 +129,12 @@ namespace /* private */
an array of pointers to rtl_uString's */
oslProcessError err = osl_executeProcess(
senddocUrl.pData,
- (rtl_uString**)&rCommandArgs[0],
+ const_cast<rtl_uString**>(reinterpret_cast<rtl_uString * const *>(&rCommandArgs[0])),
rCommandArgs.size(),
osl_Process_WAIT | osl_Process_DETACHED,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
0,
&proc);
diff --git a/shell/source/win32/simplemail/smplmailclient.hxx b/shell/source/win32/simplemail/smplmailclient.hxx
index 5d85596a9705..2da936a95340 100644
--- a/shell/source/win32/simplemail/smplmailclient.hxx
+++ b/shell/source/win32/simplemail/smplmailclient.hxx
@@ -30,10 +30,10 @@ class CSmplMailClient : public cppu::WeakImplHelper<css::system::XSimpleMailClie
{
public:
virtual css::uno::Reference<css::system::XSimpleMailMessage> SAL_CALL createSimpleMailMessage()
- throw (css::uno::RuntimeException);
+ throw (css::uno::RuntimeException) override;
virtual void SAL_CALL sendSimpleMailMessage(const css::uno::Reference<css::system::XSimpleMailMessage>& xSimpleMailMessage, sal_Int32 aFlag)
- throw (css::lang::IllegalArgumentException, css::uno::Exception, css::uno::RuntimeException);
+ throw (css::lang::IllegalArgumentException, css::uno::Exception, css::uno::RuntimeException) override;
private:
void validateParameter(const css::uno::Reference<css::system::XSimpleMailMessage>& xSimpleMailMessage, sal_Int32 aFlag);
diff --git a/shell/source/win32/simplemail/smplmailentry.cxx b/shell/source/win32/simplemail/smplmailentry.cxx
index f40cda9d1fff..752102f36908 100644
--- a/shell/source/win32/simplemail/smplmailentry.cxx
+++ b/shell/source/win32/simplemail/smplmailentry.cxx
@@ -46,14 +46,14 @@ extern "C"
SAL_DLLPUBLIC_EXPORT void* SAL_CALL smplmail_component_getFactory(
const sal_Char* pImplName, void* pSrvManager, void* /*pRegistryKey*/ )
{
- void* pRet = 0;
+ void* pRet = nullptr;
if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, COMP_IMPL_NAME ) ) )
{
Sequence< OUString > aSNS { COMP_SERVICE_NAME };
Reference< XSingleServiceFactory > xFactory ( createOneInstanceFactory(
- reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ),
+ static_cast< XMultiServiceFactory* > ( pSrvManager ),
OUString::createFromAscii( pImplName ),
createInstance,
aSNS ) );
diff --git a/shell/source/win32/simplemail/smplmailmsg.hxx b/shell/source/win32/simplemail/smplmailmsg.hxx
index d01fff0c5707..afdc9ec12a28 100644
--- a/shell/source/win32/simplemail/smplmailmsg.hxx
+++ b/shell/source/win32/simplemail/smplmailmsg.hxx
@@ -35,52 +35,52 @@ public:
CSmplMailMsg( );
virtual void SAL_CALL setBody( const ::rtl::OUString& aBody )
- throw (css::uno::RuntimeException);
+ throw (css::uno::RuntimeException) override;
virtual ::rtl::OUString SAL_CALL getBody( )
- throw (css::uno::RuntimeException);
+ throw (css::uno::RuntimeException) override;
virtual void SAL_CALL setRecipient( const OUString& aRecipient )
- throw (css::uno::RuntimeException);
+ throw (css::uno::RuntimeException) override;
virtual OUString SAL_CALL getRecipient( )
- throw (css::uno::RuntimeException);
+ throw (css::uno::RuntimeException) override;
virtual void SAL_CALL setCcRecipient( const css::uno::Sequence< OUString >& aCcRecipient )
- throw (css::uno::RuntimeException);
+ throw (css::uno::RuntimeException) override;
virtual css::uno::Sequence< OUString > SAL_CALL getCcRecipient( )
- throw (css::uno::RuntimeException);
+ throw (css::uno::RuntimeException) override;
virtual void SAL_CALL setBccRecipient( const css::uno::Sequence< OUString >& aBccRecipient )
- throw (css::uno::RuntimeException);
+ throw (css::uno::RuntimeException) override;
virtual css::uno::Sequence< OUString > SAL_CALL getBccRecipient( )
- throw (css::uno::RuntimeException);
+ throw (css::uno::RuntimeException) override;
virtual void SAL_CALL setOriginator( const OUString& aOriginator )
- throw (css::uno::RuntimeException);
+ throw (css::uno::RuntimeException) override;
virtual OUString SAL_CALL getOriginator( )
- throw (css::uno::RuntimeException);
+ throw (css::uno::RuntimeException) override;
virtual void SAL_CALL setSubject( const OUString& aSubject )
- throw (css::uno::RuntimeException);
+ throw (css::uno::RuntimeException) override;
virtual OUString SAL_CALL getSubject( )
- throw (css::uno::RuntimeException);
+ throw (css::uno::RuntimeException) override;
virtual void SAL_CALL setAttachement( const css::uno::Sequence< OUString >& aAttachement )
- throw (css::lang::IllegalArgumentException, css::uno::RuntimeException);
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException) override;
virtual css::uno::Sequence< OUString > SAL_CALL getAttachement( )
- throw (css::uno::RuntimeException);
+ throw (css::uno::RuntimeException) override;
private:
OUString m_aBody;
diff --git a/shell/source/win32/simplemail/smplmailsuppl.cxx b/shell/source/win32/simplemail/smplmailsuppl.cxx
index 4976f325c5a5..317ec942f7dd 100644
--- a/shell/source/win32/simplemail/smplmailsuppl.cxx
+++ b/shell/source/win32/simplemail/smplmailsuppl.cxx
@@ -59,7 +59,7 @@ Reference<XSimpleMailClient> SAL_CALL CSmplMailSuppl::querySimpleMailClient()
if a mail client is available */
Reference<XSimpleMailClient> xSmplMailClient;
HMODULE handle = LoadLibrary("mapi32.dll");
- if ((handle != INVALID_HANDLE_VALUE) && (handle != NULL))
+ if ((handle != INVALID_HANDLE_VALUE) && (handle != nullptr))
{
FreeLibrary(handle);
xSmplMailClient.set(new CSmplMailClient());
diff --git a/shell/source/win32/simplemail/smplmailsuppl.hxx b/shell/source/win32/simplemail/smplmailsuppl.hxx
index 4a280d826dbb..28414737f7b3 100644
--- a/shell/source/win32/simplemail/smplmailsuppl.hxx
+++ b/shell/source/win32/simplemail/smplmailsuppl.hxx
@@ -42,21 +42,21 @@ class CSmplMailSuppl :
{
public:
CSmplMailSuppl( );
- ~CSmplMailSuppl( );
+ ~CSmplMailSuppl( ) override;
// XSimpleMailClientSupplier
virtual css::uno::Reference< css::system::XSimpleMailClient > SAL_CALL querySimpleMailClient( )
- throw (css::uno::RuntimeException);
+ throw (css::uno::RuntimeException) override;
// XServiceInfo
virtual OUString SAL_CALL getImplementationName( )
- throw(css::uno::RuntimeException);
+ throw(css::uno::RuntimeException) override;
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
- throw(css::uno::RuntimeException);
+ throw(css::uno::RuntimeException) override;
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( )
- throw(css::uno::RuntimeException);
+ throw(css::uno::RuntimeException) override;
};
#endif
diff --git a/shell/source/win32/zipfile/zipexcptn.cxx b/shell/source/win32/zipfile/zipexcptn.cxx
index c30d38907bdc..2d1118f93fe7 100644
--- a/shell/source/win32/zipfile/zipexcptn.cxx
+++ b/shell/source/win32/zipfile/zipexcptn.cxx
@@ -56,7 +56,7 @@ ZipException::ZipException(int Error) :
*/
const char* ZipException::what() const throw()
{
- return 0;
+ return nullptr;
}
@@ -64,7 +64,7 @@ const char* ZipException::what() const throw()
*/
Win32Exception::Win32Exception(int Error) :
RuntimeException(Error),
- m_MsgBuff(0)
+ m_MsgBuff(nullptr)
{
}
@@ -82,18 +82,21 @@ Win32Exception::~Win32Exception() throw()
*/
const char* Win32Exception::what() const throw()
{
- FormatMessageA(
- FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- GetErrorCode(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- (LPSTR) &m_MsgBuff,
- 0,
- NULL);
-
- return reinterpret_cast<char*>(m_MsgBuff);
+ if (m_MsgBuff == nullptr)
+ {
+ FormatMessageA(
+ FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ nullptr,
+ GetErrorCode(),
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
+ reinterpret_cast<LPSTR>(&m_MsgBuff),
+ 0,
+ nullptr);
+ }
+
+ return m_MsgBuff;
}
diff --git a/shell/source/win32/zipfile/zipexcptn.hxx b/shell/source/win32/zipfile/zipexcptn.hxx
index ca7048911ce2..3aec38f36045 100644
--- a/shell/source/win32/zipfile/zipexcptn.hxx
+++ b/shell/source/win32/zipfile/zipexcptn.hxx
@@ -31,7 +31,7 @@ class RuntimeException : public std::exception
{
public:
explicit RuntimeException(int Error);
- virtual ~RuntimeException() throw();
+ virtual ~RuntimeException() throw() override;
int GetErrorCode() const;
@@ -47,7 +47,7 @@ class ZipException : public RuntimeException
public:
explicit ZipException(int Error);
- virtual const char* what() const throw();
+ virtual const char* what() const throw() override;
};
@@ -57,12 +57,12 @@ class Win32Exception : public RuntimeException
{
public:
explicit Win32Exception(int Error);
- virtual ~Win32Exception() throw();
+ virtual ~Win32Exception() throw() override;
- virtual const char* what() const throw();
+ virtual const char* what() const throw() override;
private:
- void* m_MsgBuff;
+ mutable char* m_MsgBuff;
};
diff --git a/shell/source/win32/zipfile/zipfile.cxx b/shell/source/win32/zipfile/zipfile.cxx
index f4cab6277ccc..3bba27c85d0e 100644
--- a/shell/source/win32/zipfile/zipfile.cxx
+++ b/shell/source/win32/zipfile/zipfile.cxx
@@ -105,7 +105,7 @@ struct CentralDirectoryEnd
// This little lot performs in a truly appalling way without
// buffering eg. on an IStream.
-static unsigned short readShort(StreamInterface *stream)
+unsigned short readShort(StreamInterface *stream)
{
if (!stream || stream->stell() == -1)
throw IOException(-1);
@@ -117,7 +117,7 @@ static unsigned short readShort(StreamInterface *stream)
return tmpBuf;
}
-static unsigned readInt(StreamInterface *stream)
+unsigned readInt(StreamInterface *stream)
{
if (!stream || stream->stell() == -1)
throw IOException(-1);
@@ -129,7 +129,7 @@ static unsigned readInt(StreamInterface *stream)
return tmpBuf;
}
-static std::string readString(StreamInterface *stream, unsigned long size)
+std::string readString(StreamInterface *stream, unsigned long size)
{
if (!stream || stream->stell() == -1)
throw IOException(-1);
@@ -141,12 +141,12 @@ static std::string readString(StreamInterface *stream, unsigned long size)
throw IOException(-1);
}
- std::string aStr((char *)tmp, size);
+ std::string aStr(reinterpret_cast<char *>(tmp), size);
delete [] tmp;
return aStr;
}
-static bool readCentralDirectoryEnd(StreamInterface *stream, CentralDirectoryEnd &end)
+bool readCentralDirectoryEnd(StreamInterface *stream, CentralDirectoryEnd &end)
{
try
{
@@ -170,7 +170,7 @@ static bool readCentralDirectoryEnd(StreamInterface *stream, CentralDirectoryEnd
return true;
}
-static bool readCentralDirectoryEntry(StreamInterface *stream, CentralDirectoryEntry &entry)
+bool readCentralDirectoryEntry(StreamInterface *stream, CentralDirectoryEntry &entry)
{
try
{
@@ -205,7 +205,7 @@ static bool readCentralDirectoryEntry(StreamInterface *stream, CentralDirectoryE
return true;
}
-static bool readLocalFileHeader(StreamInterface *stream, LocalFileHeader &header)
+bool readLocalFileHeader(StreamInterface *stream, LocalFileHeader &header)
{
try
{
@@ -233,7 +233,7 @@ static bool readLocalFileHeader(StreamInterface *stream, LocalFileHeader &header
return true;
}
-static bool areHeadersConsistent(const LocalFileHeader &header, const CentralDirectoryEntry &entry)
+bool areHeadersConsistent(const LocalFileHeader &header, const CentralDirectoryEntry &entry)
{
if (header.min_version != entry.min_version)
return false;
@@ -255,7 +255,7 @@ static bool areHeadersConsistent(const LocalFileHeader &header, const CentralDir
#define BLOCK_SIZE 0x800
-static bool findSignatureAtOffset(StreamInterface *stream, unsigned long nOffset)
+bool findSignatureAtOffset(StreamInterface *stream, unsigned long nOffset)
{
// read in reasonably sized chunk, and read more, to get overlapping sigs
unsigned char aBuffer[ BLOCK_SIZE + 4 ];
@@ -277,7 +277,7 @@ static bool findSignatureAtOffset(StreamInterface *stream, unsigned long nOffset
return false;
}
-static bool findCentralDirectoryEnd(StreamInterface *stream)
+bool findCentralDirectoryEnd(StreamInterface *stream)
{
if (!stream)
return false;
@@ -304,7 +304,7 @@ static bool findCentralDirectoryEnd(StreamInterface *stream)
}
}
-static bool isZipStream(StreamInterface *stream)
+bool isZipStream(StreamInterface *stream)
{
if (!findCentralDirectoryEnd(stream))
return false;
@@ -406,14 +406,14 @@ bool ZipFile::IsValidZipFileVersionNumber(void* /* stream*/)
with the used zlib version
*/
ZipFile::ZipFile(const std::string &FileName) :
- m_pStream(0),
+ m_pStream(nullptr),
m_bShouldFree(true)
{
m_pStream = new FileStream(FileName.c_str());
if (m_pStream && !isZipStream(m_pStream))
{
delete m_pStream;
- m_pStream = 0;
+ m_pStream = nullptr;
}
}
@@ -422,7 +422,7 @@ ZipFile::ZipFile(StreamInterface *stream) :
m_bShouldFree(false)
{
if (!isZipStream(stream))
- m_pStream = 0;
+ m_pStream = nullptr;
}
@@ -469,7 +469,7 @@ void ZipFile::GetUncompressedContent(
ContentBuffer.clear();
ContentBuffer = ZipContentBuffer_t(entry.uncompressed_size);
if (!entry.compression)
- m_pStream->sread((unsigned char *)&ContentBuffer[0], entry.uncompressed_size);
+ m_pStream->sread(reinterpret_cast<unsigned char *>(&ContentBuffer[0]), entry.uncompressed_size);
else
{
int ret;