[Libreoffice-commits] core.git: 3 commits - include/sfx2 sdext/source setup_native/source sfx2/source

Stephan Bergmann sbergman at redhat.com
Sun Oct 16 14:18:22 UTC 2016


 include/sfx2/app.hxx                                                              |    2 
 sdext/source/pdfimport/pdfparse/pdfparse.cxx                                      |    6 
 sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx                                |    2 
 setup_native/source/win32/customactions/indexingfilter/restartindexingservice.cxx |   20 -
 setup_native/source/win32/customactions/quickstarter/quickstarter.cxx             |   16 -
 setup_native/source/win32/customactions/quickstarter/remove_quickstart_link.cxx   |    2 
 setup_native/source/win32/customactions/reg4allmsdoc/reg4allmsi.cxx               |   44 +-
 setup_native/source/win32/customactions/regactivex/regactivex.cxx                 |   43 +-
 setup_native/source/win32/customactions/sellang/sellang.cxx                       |   18 -
 setup_native/source/win32/customactions/sellang/sorttree.cxx                      |   14 
 setup_native/source/win32/customactions/shellextensions/migrateinstallpath.cxx    |    4 
 setup_native/source/win32/customactions/shellextensions/shlxtmsi.hxx              |    4 
 setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx         |    2 
 setup_native/source/win32/customactions/shellextensions/upgrade.cxx               |   10 
 setup_native/source/win32/customactions/tools/checkversion.cxx                    |    8 
 setup_native/source/win32/customactions/tools/seterror.cxx                        |    6 
 sfx2/source/appl/appdde.cxx                                                       |   30 -
 sfx2/source/appl/lnkbase2.cxx                                                     |    4 
 sfx2/source/appl/shutdownicon.cxx                                                 |    2 
 sfx2/source/appl/shutdowniconw32.cxx                                              |  160 +++++-----
 sfx2/source/dialog/filedlghelper.cxx                                              |    2 
 sfx2/source/doc/graphhelp.cxx                                                     |   10 
 sfx2/source/doc/syspath.cxx                                                       |    5 
 sfx2/source/doc/syspathw32.cxx                                                    |   10 
 sfx2/source/doc/syspathw32.hxx                                                    |   33 ++
 sfx2/source/view/viewfrm.cxx                                                      |   24 -
 26 files changed, 247 insertions(+), 234 deletions(-)

New commits:
commit 6ac0e9f4d121584c75961bc5b1be739f9fa91f3b
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Oct 14 16:53:39 2016 +0200

    clang-cl loplugin: sdext
    
    Change-Id: I9f5e73b6f561ccb635217227787c6e8a574bdc97
    Reviewed-on: https://gerrit.libreoffice.org/29854
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/sdext/source/pdfimport/pdfparse/pdfparse.cxx b/sdext/source/pdfimport/pdfparse/pdfparse.cxx
index 6b9b0f8..7b2b44c 100644
--- a/sdext/source/pdfimport/pdfparse/pdfparse.cxx
+++ b/sdext/source/pdfimport/pdfparse/pdfparse.cxx
@@ -570,7 +570,7 @@ PDFEntry* PDFReader::read( const char* pBuffer, unsigned int nLen )
 #endif
     }
 
-    PDFEntry* pRet = NULL;
+    PDFEntry* pRet = nullptr;
     unsigned int nEntries = aGrammar.m_aObjectStack.size();
     if( nEntries == 1 )
     {
@@ -597,14 +597,14 @@ PDFEntry* PDFReader::read( const char* pFileName )
        So for the time being bite the bullet and read the whole file.
        FIXME: give Spirit 2.x another try when we upgrade boost again.
     */
-    PDFEntry* pRet = NULL;
+    PDFEntry* pRet = nullptr;
     FILE* fp = fopen( pFileName, "rb" );
     if( fp )
     {
         fseek( fp, 0, SEEK_END );
         unsigned int nLen = (unsigned int)ftell( fp );
         fseek( fp, 0, SEEK_SET );
-        char* pBuf = (char*)rtl_allocateMemory( nLen );
+        char* pBuf = static_cast<char*>(rtl_allocateMemory( nLen ));
         if( pBuf )
         {
             fread( pBuf, 1, nLen, fp );
diff --git a/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx b/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx
index 7d4806c..16db05a 100644
--- a/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx
+++ b/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx
@@ -71,7 +71,7 @@ int main(int argc, char **argv)
     globalParams = new GlobalParams();
     globalParams->setErrQuiet(gTrue);
 #if defined(_MSC_VER)
-    globalParams->setupBaseFonts(NULL);
+    globalParams->setupBaseFonts(nullptr);
 #endif
 
     // try to read a possible open password form stdin
commit 83d6099b7d89f91695d34a18b314f16092972efb
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Oct 14 16:53:32 2016 +0200

    clang-cl loplugin: setup_native
    
    Change-Id: I424164d19ba59697d39b3a3888ec2f743a3a832c
    Reviewed-on: https://gerrit.libreoffice.org/29853
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/setup_native/source/win32/customactions/indexingfilter/restartindexingservice.cxx b/setup_native/source/win32/customactions/indexingfilter/restartindexingservice.cxx
index d6bc4cb..fcae22f 100644
--- a/setup_native/source/win32/customactions/indexingfilter/restartindexingservice.cxx
+++ b/setup_native/source/win32/customactions/indexingfilter/restartindexingservice.cxx
@@ -47,12 +47,12 @@ typedef SC_HANDLE (__stdcall * OpenService_t)(SC_HANDLE, LPCSTR, DWORD);
 typedef BOOL (__stdcall * QueryServiceStatus_t)(SC_HANDLE, LPSERVICE_STATUS);
 typedef BOOL (__stdcall * StartService_t)(SC_HANDLE, DWORD, LPCSTR*);
 
-CloseServiceHandle_t CloseServiceHandle_ = NULL;
-ControlService_t ControlService_ = NULL;
-OpenSCManager_t OpenSCManager_ = NULL;
-OpenService_t OpenService_ = NULL;
-QueryServiceStatus_t QueryServiceStatus_ = NULL;
-StartService_t StartService_ = NULL;
+CloseServiceHandle_t CloseServiceHandle_ = nullptr;
+ControlService_t ControlService_ = nullptr;
+OpenSCManager_t OpenSCManager_ = nullptr;
+OpenService_t OpenService_ = nullptr;
+QueryServiceStatus_t QueryServiceStatus_ = nullptr;
+StartService_t StartService_ = nullptr;
 
 const char * const INDEXING_SERVICE_NAME = "cisvc";
 
@@ -104,7 +104,7 @@ bool StopIndexingService(SC_HANDLE hService)
 
 void StartIndexingService(SC_HANDLE hService)
 {
-    if (StartService_(hService, 0, NULL))
+    if (StartService_(hService, 0, nullptr))
     {
         SERVICE_STATUS status;
 
@@ -171,11 +171,11 @@ extern "C" UINT __stdcall RestartIndexingService(MSIHANDLE)
         return ERROR_SUCCESS;
 
     SC_HANDLE hSCManager = OpenSCManager_(
-        NULL, // local machine
-        NULL, // ServicesActive database
+        nullptr, // local machine
+        nullptr, // ServicesActive database
         SC_MANAGER_ALL_ACCESS);
 
-    if (hSCManager != NULL)
+    if (hSCManager != nullptr)
     {
         SC_HANDLE hIndexingService = OpenService_(
             hSCManager, INDEXING_SERVICE_NAME, SERVICE_QUERY_STATUS | SERVICE_START | SERVICE_STOP);
diff --git a/setup_native/source/win32/customactions/quickstarter/quickstarter.cxx b/setup_native/source/win32/customactions/quickstarter/quickstarter.cxx
index 8c919d6..8245d7f 100644
--- a/setup_native/source/win32/customactions/quickstarter/quickstarter.cxx
+++ b/setup_native/source/win32/customactions/quickstarter/quickstarter.cxx
@@ -39,7 +39,7 @@ std::wstring GetOfficeInstallationPathW(MSIHANDLE handle)
     {
         sz++; // space for the final '\0'
         DWORD nbytes = sz * sizeof(WCHAR);
-        PWSTR buff = reinterpret_cast<PWSTR>(_alloca(nbytes));
+        PWSTR buff = static_cast<PWSTR>(_alloca(nbytes));
         ZeroMemory(buff, nbytes);
         MsiGetPropertyW(handle, L"INSTALLLOCATION", buff, &sz);
         progpath = buff;
@@ -57,7 +57,7 @@ std::wstring GetOfficeProductNameW(MSIHANDLE handle)
     {
         sz++; // space for the final '\0'
         DWORD nbytes = sz * sizeof(WCHAR);
-        PWSTR buff = reinterpret_cast<PWSTR>(_alloca(nbytes));
+        PWSTR buff = static_cast<PWSTR>(_alloca(nbytes));
         ZeroMemory(buff, nbytes);
         MsiGetPropertyW(handle, L"ProductName", buff, &sz);
         productname = buff;
@@ -75,7 +75,7 @@ std::wstring GetQuickstarterLinkNameW(MSIHANDLE handle)
     {
         sz++; // space for the final '\0'
         DWORD nbytes = sz * sizeof(WCHAR);
-        PWSTR buff = reinterpret_cast<PWSTR>(_alloca(nbytes));
+        PWSTR buff = static_cast<PWSTR>(_alloca(nbytes));
         ZeroMemory(buff, nbytes);
         MsiGetPropertyW(handle, L"Quickstarterlinkname", buff, &sz);
         quickstarterlinkname = buff;
@@ -84,7 +84,7 @@ std::wstring GetQuickstarterLinkNameW(MSIHANDLE handle)
     {
         sz++; // space for the final '\0'
         DWORD nbytes = sz * sizeof(WCHAR);
-        PWSTR buff = reinterpret_cast<PWSTR>(_alloca(nbytes));
+        PWSTR buff = static_cast<PWSTR>(_alloca(nbytes));
         ZeroMemory(buff, nbytes);
         MsiGetPropertyW(handle, L"ProductName", buff, &sz);
         quickstarterlinkname = buff;
@@ -94,14 +94,14 @@ std::wstring GetQuickstarterLinkNameW(MSIHANDLE handle)
 
 inline bool IsValidHandle( HANDLE handle )
 {
-    return NULL != handle && INVALID_HANDLE_VALUE != handle;
+    return nullptr != handle && INVALID_HANDLE_VALUE != handle;
 }
 
-static DWORD WINAPI _GetModuleFileNameExW( HANDLE hProcess, HMODULE hModule, PWSTR lpFileName, DWORD nSize )
+static DWORD WINAPI GetModuleFileNameExW_( HANDLE hProcess, HMODULE hModule, PWSTR lpFileName, DWORD nSize )
 {
     typedef DWORD (WINAPI *FN_PROC)( HANDLE hProcess, HMODULE hModule, LPWSTR lpFileName, DWORD nSize );
 
-    static FN_PROC  lpProc = NULL;
+    static FN_PROC  lpProc = nullptr;
 
     if ( !lpProc )
     {
@@ -128,7 +128,7 @@ std::wstring GetProcessImagePathW( DWORD dwProcessId )
     {
         WCHAR szPathBuffer[MAX_PATH] = L"";
 
-        if ( _GetModuleFileNameExW( hProcess, NULL, szPathBuffer, sizeof(szPathBuffer)/sizeof(szPathBuffer[0]) ) )
+        if ( GetModuleFileNameExW_( hProcess, nullptr, szPathBuffer, sizeof(szPathBuffer)/sizeof(szPathBuffer[0]) ) )
             sImagePath = szPathBuffer;
 
         CloseHandle( hProcess );
diff --git a/setup_native/source/win32/customactions/quickstarter/remove_quickstart_link.cxx b/setup_native/source/win32/customactions/quickstarter/remove_quickstart_link.cxx
index 5939a0b..3e0f8d6 100644
--- a/setup_native/source/win32/customactions/quickstarter/remove_quickstart_link.cxx
+++ b/setup_native/source/win32/customactions/quickstarter/remove_quickstart_link.cxx
@@ -32,7 +32,7 @@ extern "C" UINT __stdcall RemoveQuickstarterLink( MSIHANDLE hMSI )
 {
     WCHAR    szStartupPath[MAX_PATH];
 
-    if ( SHGetSpecialFolderPathW( NULL, szStartupPath, CSIDL_STARTUP, FALSE ) )
+    if ( SHGetSpecialFolderPathW( nullptr, szStartupPath, CSIDL_STARTUP, FALSE ) )
     {
         std::wstring sQuickstartLinkPath = szStartupPath;
 
diff --git a/setup_native/source/win32/customactions/reg4allmsdoc/reg4allmsi.cxx b/setup_native/source/win32/customactions/reg4allmsdoc/reg4allmsi.cxx
index 1e3b742..e13ad91 100644
--- a/setup_native/source/win32/customactions/reg4allmsdoc/reg4allmsi.cxx
+++ b/setup_native/source/win32/customactions/reg4allmsdoc/reg4allmsi.cxx
@@ -64,7 +64,7 @@ static const CHAR* g_Extensions[] =
     ".dpt",     // Kingsoft Presentation Template
     ".vsd",     // Visio 2000/XP/2003 document
     ".vst",     // Visio 2000/XP/2003 template
-    0
+    nullptr
 };
 
 static const int WORD_START = 0;
@@ -97,7 +97,7 @@ static inline void OutputDebugStringFormatA( LPCSTR, ... )
 static BOOL CheckExtensionInRegistry( LPCSTR lpSubKey )
 {
     BOOL    bRet = false;
-    HKEY    hKey = NULL;
+    HKEY    hKey = nullptr;
     LONG    lResult = RegOpenKeyExA( HKEY_CLASSES_ROOT, lpSubKey, 0, KEY_QUERY_VALUE, &hKey );
 
     if ( ERROR_SUCCESS == lResult )
@@ -105,7 +105,7 @@ static BOOL CheckExtensionInRegistry( LPCSTR lpSubKey )
         CHAR    szBuffer[1024];
         DWORD   nSize = sizeof( szBuffer );
 
-        lResult = RegQueryValueExA( hKey, "", NULL, NULL, (LPBYTE)szBuffer, &nSize );
+        lResult = RegQueryValueExA( hKey, "", nullptr, nullptr, reinterpret_cast<LPBYTE>(szBuffer), &nSize );
         if ( ERROR_SUCCESS == lResult && nSize > 0 )
         {
             szBuffer[nSize] = '\0';
@@ -145,7 +145,7 @@ bool GetMsiPropA( MSIHANDLE handle, LPCSTR name, /*out*/std::string& value )
     {
         sz++;
         DWORD nbytes = sz * sizeof(CHAR);
-        LPSTR buff = reinterpret_cast<LPSTR>(_alloca(nbytes));
+        LPSTR buff = static_cast<LPSTR>(_alloca(nbytes));
         ZeroMemory(buff, nbytes);
         MsiGetPropertyA(handle, name, buff, &sz);
         value = buff;
@@ -179,7 +179,7 @@ static void registerForExtension( MSIHANDLE handle, const int nIndex, bool bRegi
 
 static void saveOldRegistration( LPCSTR lpSubKey )
 {
-    HKEY    hKey = NULL;
+    HKEY    hKey = nullptr;
     LONG    lResult = RegOpenKeyExA( HKEY_CLASSES_ROOT, lpSubKey, 0,
                                      KEY_QUERY_VALUE|KEY_SET_VALUE, &hKey );
 
@@ -188,7 +188,7 @@ static void saveOldRegistration( LPCSTR lpSubKey )
         CHAR    szBuffer[1024];
         DWORD   nSize = sizeof( szBuffer );
 
-        lResult = RegQueryValueExA( hKey, "", NULL, NULL, (LPBYTE)szBuffer, &nSize );
+        lResult = RegQueryValueExA( hKey, "", nullptr, nullptr, reinterpret_cast<LPBYTE>(szBuffer), &nSize );
         if ( ERROR_SUCCESS == lResult )
         {
             szBuffer[nSize] = '\0';
@@ -198,20 +198,20 @@ static void saveOldRegistration( LPCSTR lpSubKey )
             {
                 // Save the old association
                 RegSetValueExA( hKey, "LOBackupAssociation", 0,
-                                REG_SZ, (LPBYTE)szBuffer, nSize );
+                                REG_SZ, reinterpret_cast<LPBYTE>(szBuffer), nSize );
                 // Also save what the old association means, just so we can try to verify
                 // if/when restoring it that the old application still exists
-                HKEY hKey2 = NULL;
+                HKEY hKey2 = nullptr;
                 lResult = RegOpenKeyExA( HKEY_CLASSES_ROOT, szBuffer, 0,
                                          KEY_QUERY_VALUE, &hKey2 );
                 if ( ERROR_SUCCESS == lResult )
                 {
                     nSize = sizeof( szBuffer );
-                    lResult = RegQueryValueExA( hKey2, "", NULL, NULL, (LPBYTE)szBuffer, &nSize );
+                    lResult = RegQueryValueExA( hKey2, "", nullptr, nullptr, reinterpret_cast<LPBYTE>(szBuffer), &nSize );
                     if ( ERROR_SUCCESS == lResult )
                     {
                         RegSetValueExA( hKey, "LOBackupAssociationDeref", 0,
-                                        REG_SZ, (LPBYTE)szBuffer, nSize );
+                                        REG_SZ, reinterpret_cast<LPBYTE>(szBuffer), nSize );
                     }
                     RegCloseKey( hKey2 );
                 }
@@ -224,7 +224,7 @@ static void saveOldRegistration( LPCSTR lpSubKey )
 static void registerForExtensions( MSIHANDLE handle, BOOL bRegisterAll )
 { // Check all file extensions
     int nIndex = 0;
-    while ( g_Extensions[nIndex] != 0 )
+    while ( g_Extensions[nIndex] != nullptr )
     {
         saveOldRegistration( g_Extensions[nIndex] );
 
@@ -240,7 +240,7 @@ static bool checkSomeExtensionInRegistry( const int nStart, const int nEnd )
     int nIndex = nStart;
     bool bFound = false;
 
-    while ( !bFound && (nIndex < nEnd) && (g_Extensions[nIndex] != 0) )
+    while ( !bFound && (nIndex < nEnd) && (g_Extensions[nIndex] != nullptr) )
     {
         bFound = ! CheckExtensionInRegistry( g_Extensions[nIndex] );
 
@@ -256,7 +256,7 @@ static void registerSomeExtensions( MSIHANDLE handle, const int nStart, const in
 { // Check all file extensions
     int nIndex = nStart;
 
-    while ( (nIndex < nEnd) && (g_Extensions[nIndex] != 0) )
+    while ( (nIndex < nEnd) && (g_Extensions[nIndex] != nullptr) )
     {
         registerForExtension( handle, nIndex++, bRegister );
     }
@@ -457,7 +457,7 @@ extern "C" UINT __stdcall FindRegisteredExtensions( MSIHANDLE handle )
 
 static void restoreOldRegistration( LPCSTR lpSubKey )
 {
-    HKEY    hKey = NULL;
+    HKEY    hKey = nullptr;
     LONG    lResult = RegOpenKeyExA( HKEY_CLASSES_ROOT, lpSubKey, 0,
                                      KEY_QUERY_VALUE|KEY_SET_VALUE, &hKey );
 
@@ -466,11 +466,11 @@ static void restoreOldRegistration( LPCSTR lpSubKey )
         CHAR    szBuffer[1024];
         DWORD   nSize = sizeof( szBuffer );
 
-        lResult = RegQueryValueExA( hKey, "LOBackupAssociation", NULL, NULL,
-                                    (LPBYTE)szBuffer, &nSize );
+        lResult = RegQueryValueExA( hKey, "LOBackupAssociation", nullptr, nullptr,
+                                    reinterpret_cast<LPBYTE>(szBuffer), &nSize );
         if ( ERROR_SUCCESS == lResult )
         {
-            HKEY hKey2 = NULL;
+            HKEY hKey2 = nullptr;
             lResult = RegOpenKeyExA( HKEY_CLASSES_ROOT, szBuffer, 0,
                                      KEY_QUERY_VALUE, &hKey2 );
             if ( ERROR_SUCCESS == lResult )
@@ -478,21 +478,21 @@ static void restoreOldRegistration( LPCSTR lpSubKey )
                 CHAR   szBuffer2[1024];
                 DWORD  nSize2 = sizeof( szBuffer2 );
 
-                lResult = RegQueryValueExA( hKey2, "", NULL, NULL, (LPBYTE)szBuffer2, &nSize2 );
+                lResult = RegQueryValueExA( hKey2, "", nullptr, nullptr, reinterpret_cast<LPBYTE>(szBuffer2), &nSize2 );
                 if ( ERROR_SUCCESS == lResult )
                 {
                     CHAR   szBuffer3[1024];
                     DWORD  nSize3 = sizeof( szBuffer3 );
 
                     // Try to verify that the old association is OK to restore
-                    lResult = RegQueryValueExA( hKey, "LOBackupAssociationDeref", NULL, NULL,
-                                                (LPBYTE)szBuffer3, &nSize3 );
+                    lResult = RegQueryValueExA( hKey, "LOBackupAssociationDeref", nullptr, nullptr,
+                                                reinterpret_cast<LPBYTE>(szBuffer3), &nSize3 );
                     if ( ERROR_SUCCESS == lResult )
                     {
                         if ( nSize2 == nSize3 && strcmp (szBuffer2, szBuffer3) == 0)
                         {
                             // Yep. So restore it
-                            RegSetValueExA( hKey, "", 0, REG_SZ, (LPBYTE)szBuffer, nSize );
+                            RegSetValueExA( hKey, "", 0, REG_SZ, reinterpret_cast<LPBYTE>(szBuffer), nSize );
                         }
                     }
                 }
@@ -510,7 +510,7 @@ extern "C" UINT __stdcall RestoreRegAllMSDoc( MSIHANDLE /*handle*/ )
     OutputDebugStringFormatA( "RestoreRegAllMSDoc\n" );
 
     int nIndex = 0;
-    while ( g_Extensions[nIndex] != 0 )
+    while ( g_Extensions[nIndex] != nullptr )
     {
         restoreOldRegistration( g_Extensions[nIndex] );
         ++nIndex;
diff --git a/setup_native/source/win32/customactions/regactivex/regactivex.cxx b/setup_native/source/win32/customactions/regactivex/regactivex.cxx
index b437318..db486d1 100644
--- a/setup_native/source/win32/customactions/regactivex/regactivex.cxx
+++ b/setup_native/source/win32/customactions/regactivex/regactivex.cxx
@@ -43,13 +43,16 @@ typedef int ( __stdcall * DllNativeUnregProc ) ( int, BOOL, BOOL );
 
 BOOL UnicodeEquals( wchar_t const * pStr1, wchar_t const * pStr2 )
 {
-    if ( pStr1 == NULL && pStr2 == NULL )
+    if ( pStr1 == nullptr && pStr2 == nullptr )
         return TRUE;
-    else if ( pStr1 == NULL || pStr2 == NULL )
+    else if ( pStr1 == nullptr || pStr2 == nullptr )
         return FALSE;
 
     while( *pStr1 == *pStr2 && *pStr1 && *pStr2 )
-        pStr1++, pStr2++;
+    {
+        pStr1++;
+        pStr2++;
+    }
 
     return ( *pStr1 == 0 && *pStr2 == 0 );
 }
@@ -58,12 +61,12 @@ BOOL UnicodeEquals( wchar_t const * pStr1, wchar_t const * pStr2 )
 char* UnicodeToAnsiString( wchar_t* pUniString )
 {
     int len = WideCharToMultiByte(
-        CP_ACP, 0, pUniString, -1, 0, 0, 0, 0 );
+        CP_ACP, 0, pUniString, -1, nullptr, 0, nullptr, nullptr );
 
-    char* buff = reinterpret_cast<char*>( malloc( len ) );
+    char* buff = static_cast<char*>( malloc( len ) );
 
     WideCharToMultiByte(
-        CP_ACP, 0, pUniString, -1, buff, len, 0, 0 );
+        CP_ACP, 0, pUniString, -1, buff, len, nullptr, nullptr );
 
     return buff;
 }
@@ -71,17 +74,17 @@ char* UnicodeToAnsiString( wchar_t* pUniString )
 
 void RegisterActiveXNative( const char* pActiveXPath, int nMode, BOOL InstallForAllUser, BOOL InstallFor64Bit )
 {
-    HINSTANCE hModule = LoadLibraryExA( pActiveXPath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH );
+    HINSTANCE hModule = LoadLibraryExA( pActiveXPath, nullptr, LOAD_WITH_ALTERED_SEARCH_PATH );
     if( hModule )
     {
-        DllNativeRegProc pNativeProc = ( DllNativeRegProc )GetProcAddress( hModule, "DllRegisterServerNative" );
-        if( pNativeProc!=NULL )
+        DllNativeRegProc pNativeProc = reinterpret_cast<DllNativeRegProc>(GetProcAddress( hModule, "DllRegisterServerNative" ));
+        if( pNativeProc!=nullptr )
         {
             int nLen = strlen( pActiveXPath );
             int nRemoveLen = strlen( "\\so_activex.dll" );
             if ( nLen > nRemoveLen )
             {
-                char* pProgramPath = reinterpret_cast<char*>( malloc( nLen - nRemoveLen + 1 ) );
+                char* pProgramPath = static_cast<char*>( malloc( nLen - nRemoveLen + 1 ) );
                 strncpy( pProgramPath, pActiveXPath, nLen - nRemoveLen );
                 pProgramPath[ nLen - nRemoveLen ] = 0;
 
@@ -98,11 +101,11 @@ void RegisterActiveXNative( const char* pActiveXPath, int nMode, BOOL InstallFor
 
 void UnregisterActiveXNative( const char* pActiveXPath, int nMode, BOOL InstallForAllUser, BOOL InstallFor64Bit )
 {
-    HINSTANCE hModule = LoadLibraryExA( pActiveXPath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH );
+    HINSTANCE hModule = LoadLibraryExA( pActiveXPath, nullptr, LOAD_WITH_ALTERED_SEARCH_PATH );
     if( hModule )
     {
-        DllNativeUnregProc pNativeProc = ( DllNativeUnregProc )GetProcAddress( hModule, "DllUnregisterServerNative" );
-        if( pNativeProc!=NULL )
+        DllNativeUnregProc pNativeProc = reinterpret_cast<DllNativeUnregProc>(GetProcAddress( hModule, "DllUnregisterServerNative" ));
+        if( pNativeProc!=nullptr )
             ( *pNativeProc )( nMode, InstallForAllUser, InstallFor64Bit );
 
         FreeLibrary( hModule );
@@ -117,7 +120,7 @@ BOOL GetMsiPropW( MSIHANDLE hMSI, const wchar_t* pPropName, wchar_t** ppValue )
     {
            sz++;
            DWORD nbytes = sz * sizeof( wchar_t );
-           wchar_t* buff = reinterpret_cast<wchar_t*>( malloc( nbytes ) );
+           wchar_t* buff = static_cast<wchar_t*>( malloc( nbytes ) );
            ZeroMemory( buff, nbytes );
            MsiGetPropertyW( hMSI, pPropName, buff, &sz );
            *ppValue = buff;
@@ -131,7 +134,7 @@ BOOL GetMsiPropW( MSIHANDLE hMSI, const wchar_t* pPropName, wchar_t** ppValue )
 
 BOOL GetActiveXControlPath( MSIHANDLE hMSI, char** ppActiveXPath )
 {
-    wchar_t* pProgPath = NULL;
+    wchar_t* pProgPath = nullptr;
     if ( GetMsiPropW( hMSI, L"INSTALLLOCATION", &pProgPath ) && pProgPath )
        {
         char* pCharProgPath = UnicodeToAnsiString( pProgPath );
@@ -139,7 +142,7 @@ BOOL GetActiveXControlPath( MSIHANDLE hMSI, char** ppActiveXPath )
         if ( pCharProgPath )
         {
             int nLen = strlen( pCharProgPath );
-            *ppActiveXPath = reinterpret_cast<char*>( malloc( nLen + 23 ) );
+            *ppActiveXPath = static_cast<char*>( malloc( nLen + 23 ) );
             strncpy( *ppActiveXPath, pCharProgPath, nLen );
             strncpy( (*ppActiveXPath) + nLen, "program\\so_activex.dll", 22 );
             (*ppActiveXPath)[nLen+22] = 0;
@@ -258,7 +261,7 @@ BOOL GetDelta( MSIHANDLE hMSI, int& nOldInstallMode, int& nInstallMode, int& nDe
 BOOL MakeInstallForAllUsers( MSIHANDLE hMSI )
 {
     BOOL bResult = FALSE;
-    wchar_t* pVal = NULL;
+    wchar_t* pVal = nullptr;
     if ( GetMsiPropW( hMSI, L"ALLUSERS", &pVal ) && pVal )
     {
         bResult = UnicodeEquals( pVal , L"1" );
@@ -272,7 +275,7 @@ BOOL MakeInstallForAllUsers( MSIHANDLE hMSI )
 BOOL MakeInstallFor64Bit( MSIHANDLE hMSI )
 {
     BOOL bResult = FALSE;
-    wchar_t* pVal = NULL;
+    wchar_t* pVal = nullptr;
     if ( GetMsiPropW( hMSI, L"VersionNT64", &pVal ) && pVal )
     {
         bResult = TRUE;
@@ -295,7 +298,7 @@ extern "C" UINT __stdcall InstallActiveXControl( MSIHANDLE hMSI )
         BOOL bInstallForAllUser = MakeInstallForAllUsers( hMSI );
         BOOL bInstallFor64Bit = MakeInstallFor64Bit( hMSI );
 
-        char* pActiveXPath = NULL;
+        char* pActiveXPath = nullptr;
         if ( GetActiveXControlPath( hMSI, &pActiveXPath ) && pActiveXPath
         && GetDelta( hMSI, nOldInstallMode, nInstallMode, nDeinstallMode ) )
         {
@@ -336,7 +339,7 @@ extern "C" UINT __stdcall DeinstallActiveXControl( MSIHANDLE hMSI )
 
     if ( ERROR_SUCCESS == MsiGetFeatureState( hMSI, L"gm_o_Activexcontrol", &current_state, &future_state ) )
     {
-        char* pActiveXPath = NULL;
+        char* pActiveXPath = nullptr;
         if ( current_state == INSTALLSTATE_LOCAL && GetActiveXControlPath( hMSI, &pActiveXPath ) && pActiveXPath )
         {
             BOOL bInstallForAllUser = MakeInstallForAllUsers( hMSI );
diff --git a/setup_native/source/win32/customactions/sellang/sellang.cxx b/setup_native/source/win32/customactions/sellang/sellang.cxx
index 0d82244..e74e066 100644
--- a/setup_native/source/win32/customactions/sellang/sellang.cxx
+++ b/setup_native/source/win32/customactions/sellang/sellang.cxx
@@ -43,7 +43,7 @@ BOOL GetMsiPropA( MSIHANDLE hMSI, const char* pPropName, char** ppValue )
     if ( MsiGetPropertyA( hMSI, pPropName, const_cast<char *>(""), &sz ) == ERROR_MORE_DATA ) {
         sz++;
         DWORD nbytes = sz * sizeof( char );
-        char* buff = reinterpret_cast<char*>( malloc( nbytes ) );
+        char* buff = static_cast<char*>( malloc( nbytes ) );
         ZeroMemory( buff, nbytes );
         MsiGetPropertyA( hMSI, pPropName, buff, &sz );
         *ppValue = buff;
@@ -151,7 +151,7 @@ langid_to_string( LANGID langid )
         case MAKELANGID(LANG_NORWEGIAN, SUBLANG_NORWEGIAN_NYNORSK): return "nn";
         case MAKELANGID(LANG_SERBIAN, SUBLANG_SERBIAN_LATIN): return "sh";
         case MAKELANGID(LANG_SERBIAN, SUBLANG_SERBIAN_CYRILLIC): return "sr";
-        default: return 0;
+        default: return nullptr;
         }
     }
 }
@@ -164,7 +164,7 @@ static int num_ui_langs = 0;
 
 void add_ui_lang(char const * lang)
 {
-    if (lang != 0 && num_ui_langs != SAL_N_ELEMENTS(ui_langs)) {
+    if (lang != nullptr && num_ui_langs != SAL_N_ELEMENTS(ui_langs)) {
         ui_langs[num_ui_langs++] = lang;
     }
 }
@@ -172,7 +172,7 @@ void add_ui_lang(char const * lang)
 BOOL CALLBACK
 enum_ui_lang_proc (LPTSTR language, LONG_PTR /* unused_lParam */)
 {
-    long langid = strtol(language, NULL, 16);
+    long langid = strtol(language, nullptr, 16);
     if (langid > 0xFFFF)
         return TRUE;
     add_ui_lang(langid_to_string((LANGID) langid));
@@ -186,7 +186,7 @@ present_in_ui_langs(const char *lang)
 {
     for (int i = 0; i < num_ui_langs; i++)
     {
-        if (strchr (lang, '_') != NULL)
+        if (strchr (lang, '_') != nullptr)
             if (memcmp (ui_langs[i], lang, std::min(strlen(ui_langs[i]), strlen(lang))) == 0)
                 return TRUE;
         if (strcmp (ui_langs[i], lang) == 0)
@@ -215,7 +215,7 @@ void addMatchingDictionaries(
         if (strcmp(lang, setup_native::languageDictionaries[i].language) == 0) {
             for (char const * const * p = setup_native::languageDictionaries[i].
                      dictionaries;
-                 *p != NULL; ++p)
+                 *p != nullptr; ++p)
             {
                 for (int j = 0; j != ndicts; ++j) {
                     if (_stricmp(*p, dicts[j].lang) == 0) {
@@ -313,13 +313,13 @@ extern "C" UINT __stdcall SelectLanguage( MSIHANDLE handle )
     /* Keep track of what UI languages are relevant, either the ones explicitly
      * requested with the UI_LANGS property, or all available on the system:
      */
-    char* pVal = NULL;
+    char* pVal = nullptr;
     if ( (GetMsiPropA( handle, "UI_LANGS", &pVal )) && pVal ) {
         char *str_ptr;
         str_ptr = strtok(pVal, ",");
-        for(; str_ptr != NULL ;) {
+        for(; str_ptr != nullptr ;) {
             add_ui_lang(str_ptr);
-            str_ptr = strtok(NULL, ",");
+            str_ptr = strtok(nullptr, ",");
         }
     } else {
         add_ui_lang(langid_to_string(GetSystemDefaultUILanguage()));
diff --git a/setup_native/source/win32/customactions/sellang/sorttree.cxx b/setup_native/source/win32/customactions/sellang/sorttree.cxx
index 68bbb35..ed0c0c1 100644
--- a/setup_native/source/win32/customactions/sellang/sorttree.cxx
+++ b/setup_native/source/win32/customactions/sellang/sorttree.cxx
@@ -22,33 +22,33 @@ extern "C" UINT __stdcall SortTree(MSIHANDLE)
 {
     // Sort items (languages) in SelectionTree control, fdo#46355
 
-    HWND hwndMSI = FindWindowW(L"MsiDialogCloseClass", NULL);
-    if (hwndMSI == NULL)
+    HWND hwndMSI = FindWindowW(L"MsiDialogCloseClass", nullptr);
+    if (hwndMSI == nullptr)
     {
         OutputDebugStringA("SortTree: MsiDialogCloseClass not found\n");
         return ERROR_SUCCESS;
     }
-    HWND hwndTV = FindWindowExW(hwndMSI, NULL, L"SysTreeView32", NULL);
-    if (hwndTV == NULL)
+    HWND hwndTV = FindWindowExW(hwndMSI, nullptr, L"SysTreeView32", nullptr);
+    if (hwndTV == nullptr)
     {
         OutputDebugStringA("SortTree: SysTreeView32 not found\n");
         return ERROR_SUCCESS;
     }
     HTREEITEM optional = TreeView_GetRoot(hwndTV);
-    if (optional == NULL)
+    if (optional == nullptr)
     {
         OutputDebugStringA("SortTree: Optional Components branch not found\n");
         return ERROR_SUCCESS;
     }
     HTREEITEM dicts = TreeView_GetChild(hwndTV, optional);
-    if (dicts == NULL)
+    if (dicts == nullptr)
     {
         OutputDebugStringA("SortTree: Dictionaries branch not found\n");
         return ERROR_SUCCESS;
     }
     TreeView_SortChildren(hwndTV, dicts, TRUE);
     HTREEITEM langs = TreeView_GetNextSibling(hwndTV, optional);
-    if (langs == NULL)
+    if (langs == nullptr)
     {
         OutputDebugStringA("SortTree: Additional UI Languages branch not found\n");
         return ERROR_SUCCESS;
diff --git a/setup_native/source/win32/customactions/shellextensions/migrateinstallpath.cxx b/setup_native/source/win32/customactions/shellextensions/migrateinstallpath.cxx
index 3abea1b..4f2fb4e 100644
--- a/setup_native/source/win32/customactions/shellextensions/migrateinstallpath.cxx
+++ b/setup_native/source/win32/customactions/shellextensions/migrateinstallpath.cxx
@@ -38,7 +38,7 @@ extern "C" UINT __stdcall MigrateInstallPath( MSIHANDLE handle )
 
     if ( ERROR_SUCCESS == RegOpenKeyW( HKEY_CURRENT_USER,  sProductKey.c_str(), &hKey ) )
     {
-        if ( ERROR_SUCCESS == RegQueryValueExW( hKey, L"INSTALLLOCATION", NULL, NULL, (LPBYTE)szValue, &nValueSize ) )
+        if ( ERROR_SUCCESS == RegQueryValueExW( hKey, L"INSTALLLOCATION", nullptr, nullptr, reinterpret_cast<LPBYTE>(szValue), &nValueSize ) )
         {
             sInstDir = szValue;
             MsiSetPropertyW(handle, L"INSTALLLOCATION", sInstDir.c_str());
@@ -49,7 +49,7 @@ extern "C" UINT __stdcall MigrateInstallPath( MSIHANDLE handle )
     }
     else if ( ERROR_SUCCESS == RegOpenKeyW( HKEY_LOCAL_MACHINE,  sProductKey.c_str(), &hKey ) )
     {
-        if ( ERROR_SUCCESS == RegQueryValueExW( hKey, L"INSTALLLOCATION", NULL, NULL, (LPBYTE)szValue, &nValueSize ) )
+        if ( ERROR_SUCCESS == RegQueryValueExW( hKey, L"INSTALLLOCATION", nullptr, nullptr, reinterpret_cast<LPBYTE>(szValue), &nValueSize ) )
         {
             sInstDir = szValue;
             MsiSetPropertyW(handle, L"INSTALLLOCATION", sInstDir.c_str());
diff --git a/setup_native/source/win32/customactions/shellextensions/shlxtmsi.hxx b/setup_native/source/win32/customactions/shellextensions/shlxtmsi.hxx
index 66e3cb1..2da8171 100644
--- a/setup_native/source/win32/customactions/shellextensions/shlxtmsi.hxx
+++ b/setup_native/source/win32/customactions/shellextensions/shlxtmsi.hxx
@@ -44,7 +44,7 @@ static inline std::wstring GetMsiPropertyW( MSIHANDLE handle, const std::wstring
     if ( MsiGetPropertyW( handle, sProperty.c_str(), szDummy, &nChars ) == ERROR_MORE_DATA )
     {
         DWORD nBytes = ++nChars * sizeof(WCHAR);
-        PWSTR buffer = reinterpret_cast<PWSTR>(_alloca(nBytes));
+        PWSTR buffer = static_cast<PWSTR>(_alloca(nBytes));
         ZeroMemory( buffer, nBytes );
         MsiGetPropertyW( handle, sProperty.c_str(), buffer, &nChars );
         result = buffer;
@@ -60,7 +60,7 @@ static inline void SetMsiPropertyW( MSIHANDLE handle, const std::wstring& sPrope
 
 static inline void UnsetMsiPropertyW( MSIHANDLE handle, const std::wstring& sProperty )
 {
-    MsiSetPropertyW( handle, sProperty.c_str(), NULL );
+    MsiSetPropertyW( handle, sProperty.c_str(), nullptr );
 }
 
 #endif // INCLUDED_SETUP_NATIVE_SOURCE_WIN32_CUSTOMACTIONS_SHELLEXTENSIONS_SHLXTMSI_HXX
diff --git a/setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx b/setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx
index a9cd41a..22309d5 100644
--- a/setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx
+++ b/setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx
@@ -33,7 +33,7 @@ extern "C" UINT __stdcall InstallStartmenuFolderIcon( MSIHANDLE handle )
 
 // the Win32 SDK 8.1 deprecates GetVersionEx()
 #ifdef _WIN32_WINNT_WINBLUE
-    bool const bIsVistaOrLater = IsWindowsVistaOrGreater() ? true : false;
+    bool const bIsVistaOrLater = IsWindowsVistaOrGreater();
 #else
     OSVERSIONINFO   osverinfo;
     osverinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
diff --git a/setup_native/source/win32/customactions/shellextensions/upgrade.cxx b/setup_native/source/win32/customactions/shellextensions/upgrade.cxx
index 946c425..3a1cc76 100644
--- a/setup_native/source/win32/customactions/shellextensions/upgrade.cxx
+++ b/setup_native/source/win32/customactions/shellextensions/upgrade.cxx
@@ -54,7 +54,7 @@ namespace
 
     string Invert(const string& str)
     {
-        char* buff = reinterpret_cast<char*>(_alloca(str.length()));
+        char* buff = static_cast<char*>(_alloca(str.length()));
         strncpy(buff, str.c_str(), str.length());
 
         char* front = buff;
@@ -108,7 +108,7 @@ namespace
         if (MsiGetPropertyA(handle, sProperty.c_str(), szDummy, &nChars) == ERROR_MORE_DATA)
         {
             DWORD nBytes = ++nChars * sizeof(CHAR);
-            LPSTR buffer = reinterpret_cast<LPSTR>(_alloca(nBytes));
+            LPSTR buffer = static_cast<LPSTR>(_alloca(nBytes));
             ZeroMemory( buffer, nBytes );
             MsiGetPropertyA( handle, sProperty.c_str(), buffer, &nChars );
             result = buffer;
@@ -123,7 +123,7 @@ namespace
 
     inline void UnsetMsiPropertyA(MSIHANDLE handle, const string& sProperty)
     {
-        MsiSetPropertyA(handle, sProperty.c_str(), NULL);
+        MsiSetPropertyA(handle, sProperty.c_str(), nullptr);
     }
 
     inline void SetMsiPropertyA(MSIHANDLE handle, const string& sProperty)
@@ -141,9 +141,9 @@ namespace
             DWORD lLongestSubKey;
 
             if (RegQueryInfoKeyA(
-                hKey, NULL, NULL, NULL, &nSubKeys, &lLongestSubKey, NULL, NULL, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
+                hKey, nullptr, nullptr, nullptr, &nSubKeys, &lLongestSubKey, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr) == ERROR_SUCCESS)
             {
-                LPSTR buffer = reinterpret_cast<LPSTR>(_alloca(lLongestSubKey + 1));
+                LPSTR buffer = static_cast<LPSTR>(_alloca(lLongestSubKey + 1));
 
                 for (DWORD i = 0; i < nSubKeys; i++)
                 {
diff --git a/setup_native/source/win32/customactions/tools/checkversion.cxx b/setup_native/source/win32/customactions/tools/checkversion.cxx
index cd9599d..fdd3d91 100644
--- a/setup_native/source/win32/customactions/tools/checkversion.cxx
+++ b/setup_native/source/win32/customactions/tools/checkversion.cxx
@@ -43,7 +43,7 @@ BOOL GetMsiPropW( MSIHANDLE hMSI, const wchar_t* pPropName, wchar_t** ppValue )
        {
            sz++;
            DWORD nbytes = sz * sizeof( wchar_t );
-           wchar_t* buff = reinterpret_cast<wchar_t*>( malloc( nbytes ) );
+           wchar_t* buff = static_cast<wchar_t*>( malloc( nbytes ) );
            ZeroMemory( buff, nbytes );
            MsiGetPropertyW( hMSI, pPropName, buff, &sz );
            *ppValue = buff;
@@ -77,7 +77,7 @@ extern "C" UINT __stdcall CheckVersions( MSIHANDLE hMSI )
 {
     // MessageBoxW(NULL, L"CheckVersions", L"Information", MB_OK | MB_ICONINFORMATION);
 
-    wchar_t* pVal = NULL;
+    wchar_t* pVal = nullptr;
 
     if ( GetMsiPropW( hMSI, L"NEWPRODUCTS", &pVal ) && pVal )
     {
@@ -86,7 +86,7 @@ extern "C" UINT __stdcall CheckVersions( MSIHANDLE hMSI )
             SetMsiErrorCode( MSI_ERROR_NEW_VERSION_FOUND );
         free( pVal );
     }
-    pVal = NULL;
+    pVal = nullptr;
     if ( GetMsiPropW( hMSI, L"OLDPRODUCTS", &pVal ) && pVal )
     {
         OutputDebugStringFormatW( L"DEBUG: OLDPRODUCTS found [%s]", pVal );
@@ -94,7 +94,7 @@ extern "C" UINT __stdcall CheckVersions( MSIHANDLE hMSI )
             SetMsiErrorCode( MSI_ERROR_OLD_VERSION_FOUND );
         free( pVal );
     }
-    pVal = NULL;
+    pVal = nullptr;
 
     return ERROR_SUCCESS;
 }
diff --git a/setup_native/source/win32/customactions/tools/seterror.cxx b/setup_native/source/win32/customactions/tools/seterror.cxx
index 9a7afed..09aae22 100644
--- a/setup_native/source/win32/customactions/tools/seterror.cxx
+++ b/setup_native/source/win32/customactions/tools/seterror.cxx
@@ -65,17 +65,17 @@ void SetMsiErrorCode( int nErrorCode )
                     FALSE,                  // do not inherit the name
                     sMemMapName );          // name of mapping object
 
-    if ( hMapFile == NULL )                 // can not set error code
+    if ( hMapFile == nullptr )                 // can not set error code
     {
         OutputDebugStringFormatW( L"Could not open map file (%d).\n", GetLastError() );
         return;
     }
 
-    pBuf = (int*) MapViewOfFile( hMapFile,   // handle to map object
+    pBuf = static_cast<int*>(MapViewOfFile( hMapFile,   // handle to map object
                         FILE_MAP_ALL_ACCESS, // read/write permission
                         0,
                         0,
-                        sizeof( int ) );
+                        sizeof( int ) ));
     if ( pBuf )
     {
         *pBuf = nErrorCode;
commit 918d85a82d6535932118247a7fb754dde9f49cd1
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Oct 14 16:53:11 2016 +0200

    clang-cl loplugin: sfx2
    
    Change-Id: Ided50d3573a40d50bb980ccba78de7129c42cffd
    Reviewed-on: https://gerrit.libreoffice.org/29852
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/include/sfx2/app.hxx b/include/sfx2/app.hxx
index 99577e6..942d1ba 100644
--- a/include/sfx2/app.hxx
+++ b/include/sfx2/app.hxx
@@ -141,7 +141,7 @@ public:
 
     // DDE
 #if defined(_WIN32)
-    long                        DdeExecute( const OUString& rCmd );
+    static long                 DdeExecute( const OUString& rCmd );
 #endif
     bool                        InitializeDde();
     const DdeService*           GetDdeService() const;
diff --git a/sfx2/source/appl/appdde.cxx b/sfx2/source/appl/appdde.cxx
index 5c33b4d..0656904 100644
--- a/sfx2/source/appl/appdde.cxx
+++ b/sfx2/source/appl/appdde.cxx
@@ -77,11 +77,11 @@ public:
 
 namespace
 {
-    sal_Bool lcl_IsDocument( const OUString& rContent )
+    bool lcl_IsDocument( const OUString& rContent )
     {
         using namespace com::sun::star;
 
-        sal_Bool bRet = sal_False;
+        bool bRet = false;
         INetURLObject aObj( rContent );
         DBG_ASSERT( aObj.GetProtocol() != INetProtocol::NotValid, "Invalid URL!" );
 
@@ -121,7 +121,7 @@ bool ImplDdeService::MakeTopic( const OUString& rNm )
     // The Topic rNm is sought, do we have it?
     // First only loop over the ObjectShells to find those
     // with the specific name:
-    sal_Bool bRet = sal_False;
+    bool bRet = false;
     OUString sNm( rNm.toAsciiLowerCase() );
     SfxObjectShell* pShell = SfxObjectShell::GetFirst();
     while( pShell )
@@ -145,17 +145,17 @@ bool ImplDdeService::MakeTopic( const OUString& rNm )
         {
             // File exists? then try to load it:
             SfxStringItem aName( SID_FILE_NAME, aFile.GetMainURL( INetURLObject::NO_DECODE ) );
-            SfxBoolItem aNewView(SID_OPEN_NEW_VIEW, sal_True);
+            SfxBoolItem aNewView(SID_OPEN_NEW_VIEW, true);
 
-            SfxBoolItem aSilent(SID_SILENT, sal_True);
+            SfxBoolItem aSilent(SID_SILENT, true);
             SfxDispatcher* pDispatcher = SfxGetpApp()->GetDispatcher_Impl();
             const SfxPoolItem* pRet = pDispatcher->ExecuteList(SID_OPENDOC,
                     SfxCallMode::SYNCHRON,
                     { &aName, &aNewView, &aSilent });
 
             if( pRet && dynamic_cast< const SfxViewFrameItem *>( pRet ) !=  nullptr &&
-                ((SfxViewFrameItem*)pRet)->GetFrame() &&
-                0 != ( pShell = ((SfxViewFrameItem*)pRet)
+                static_cast<SfxViewFrameItem const *>(pRet)->GetFrame() &&
+                nullptr != ( pShell = static_cast<SfxViewFrameItem const *>(pRet)
                     ->GetFrame()->GetObjectShell() ) )
             {
                 SfxGetpApp()->AddDdeTopic( pShell );
@@ -190,7 +190,7 @@ OUString ImplDdeService::Topics()
 
 bool ImplDdeService::SysTopicExecute( const OUString* pStr )
 {
-    return SfxGetpApp()->DdeExecute( *pStr );
+    return SfxApplication::DdeExecute( *pStr );
 }
 #endif
 
@@ -243,7 +243,7 @@ namespace {
     rCmd = "Open(\"d:\doc\doc.sdw\")"
     rEvent = "Open"
 */
-sal_Bool SfxAppEvent_Impl( const OUString& rCmd, const OUString& rEvent,
+bool SfxAppEvent_Impl( const OUString& rCmd, const OUString& rEvent,
                            ApplicationEvent::Type eType )
 {
     OUString sEvent(rEvent + "(");
@@ -299,11 +299,11 @@ sal_Bool SfxAppEvent_Impl( const OUString& rCmd, const OUString& rEvent,
             }
 
             GetpApp()->AppEvent( ApplicationEvent(eType, aData) );
-            return sal_True;
+            return true;
         }
     }
 
-    return sal_False;
+    return false;
 }
 
 }
@@ -466,7 +466,7 @@ void SfxApplication::AddDdeTopic( SfxObjectShell* pSh )
 
     // prevent double submit
     OUString sShellNm;
-    sal_Bool bFnd = sal_False;
+    bool bFnd = false;
     for (size_t n = pImpl->pDocTopics->size(); n;)
     {
         if( (*pImpl->pDocTopics)[ --n ]->pSh == pSh )
@@ -474,7 +474,7 @@ void SfxApplication::AddDdeTopic( SfxObjectShell* pSh )
             // If the document is untitled, is still a new Topic is created!
             if( !bFnd )
             {
-                bFnd = sal_True;
+                bFnd = true;
                 sShellNm = pSh->GetTitle(SFX_TITLE_FULLNAME).toAsciiLowerCase();
             }
             OUString sNm( (*pImpl->pDocTopics)[ n ]->GetName() );
@@ -534,13 +534,13 @@ DdeData* SfxDdeDocTopic_Impl::Get(SotClipboardFormatId nFormat)
         return &aData;
     }
     aSeq.realloc( 0 );
-    return 0;
+    return nullptr;
 }
 
 bool SfxDdeDocTopic_Impl::Put( const DdeData* pData )
 {
     aSeq = css::uno::Sequence< sal_Int8 >(
-                            (sal_Int8*)pData->getData(), pData->getSize() );
+                            static_cast<sal_Int8 const *>(pData->getData()), pData->getSize() );
     bool bRet;
     if( aSeq.getLength() )
     {
diff --git a/sfx2/source/appl/lnkbase2.cxx b/sfx2/source/appl/lnkbase2.cxx
index d09823a..fd0d8fb 100644
--- a/sfx2/source/appl/lnkbase2.cxx
+++ b/sfx2/source/appl/lnkbase2.cxx
@@ -152,7 +152,7 @@ SvBaseLink::SvBaseLink( SfxLinkUpdateMode nUpdateMode, SotClipboardFormatId nCon
 static DdeTopic* FindTopic( const OUString & rLinkName, sal_uInt16* pItemStt )
 {
     if( rLinkName.isEmpty() )
-        return 0;
+        return nullptr;
 
     OUString sNm( rLinkName );
     sal_Int32 nTokenPos = 0;
@@ -178,7 +178,7 @@ static DdeTopic* FindTopic( const OUString & rLinkName, sal_uInt16* pItemStt )
             break;
         }
     }
-    return 0;
+    return nullptr;
 }
 
 SvBaseLink::SvBaseLink( const OUString& rLinkName, sal_uInt16 nObjectType, SvLinkSource* pObj )
diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx
index 86aa57c..d632672 100644
--- a/sfx2/source/appl/shutdownicon.cxx
+++ b/sfx2/source/appl/shutdownicon.cxx
@@ -485,7 +485,7 @@ IMPL_LINK( ShutdownIcon, DialogClosedHdl_Impl, FileDialogHelper*, /*unused*/, vo
     if ( SvtMiscOptions().UseSystemFileDialog() )
     {
         delete m_pFileDlg;
-        m_pFileDlg = NULL;
+        m_pFileDlg = nullptr;
     }
 #endif
 
diff --git a/sfx2/source/appl/shutdowniconw32.cxx b/sfx2/source/appl/shutdowniconw32.cxx
index 89117e4..4340061 100644
--- a/sfx2/source/appl/shutdowniconw32.cxx
+++ b/sfx2/source/appl/shutdowniconw32.cxx
@@ -74,9 +74,9 @@ using ::com::sun::star::beans::PropertyValue;
 
 #define SFX_TASKBAR_NOTIFICATION    WM_USER+1
 
-static HWND  aListenerWindow = NULL;
-static HWND  aExecuterWindow = NULL;
-static HMENU popupMenu = NULL;
+static HWND  aListenerWindow = nullptr;
+static HWND  aExecuterWindow = nullptr;
+static HMENU popupMenu = nullptr;
 
 static void OnMeasureItem(HWND hwnd, LPMEASUREITEMSTRUCT lpmis);
 static void OnDrawItem(HWND hwnd, LPDRAWITEMSTRUCT lpdis);
@@ -89,7 +89,7 @@ typedef struct tagMYITEM
 } MYITEM;
 
 
-static void addMenuItem( HMENU hMenu, UINT id, UINT iconId, const OUString& text, int& pos, int bOwnerdraw, const OUString& module )
+static void addMenuItem( HMENU hMenu, UINT id, UINT iconId, const OUString& text, int& pos, bool bOwnerdraw, const OUString& module )
 {
     MENUITEMINFOW mi;
     memset( &mi, 0, sizeof( MENUITEMINFOW ) );
@@ -113,7 +113,7 @@ static void addMenuItem( HMENU hMenu, UINT id, UINT iconId, const OUString& text
             pMyItem->text = text;
             pMyItem->iconId = iconId;
             pMyItem->module = module;
-            mi.dwItemData = (DWORD_PTR) pMyItem;
+            mi.dwItemData = reinterpret_cast<DWORD_PTR>(pMyItem);
         }
         else
         {
@@ -121,7 +121,7 @@ static void addMenuItem( HMENU hMenu, UINT id, UINT iconId, const OUString& text
             mi.fType=MFT_STRING;
             mi.fState=MFS_ENABLED;
             mi.wID = id;
-            mi.dwTypeData = (LPWSTR) text.getStr();
+            mi.dwTypeData = const_cast<sal_Unicode *>(text.getStr());
             mi.cch = text.getLength();
         }
 
@@ -144,7 +144,7 @@ static HMENU createSystrayMenu( )
     OSL_ENSURE( pShutdownIcon, "ShutdownIcon instance empty!");
 
     if( !pShutdownIcon )
-        return NULL;
+        return nullptr;
 
     // collect the URLs of the entries in the File/New menu
     ::std::set< OUString > aFileNewAppsAvailable;
@@ -194,7 +194,7 @@ static HMENU createSystrayMenu( )
             continue;
 
         addMenuItem( hMenu, aMenuItems[i].nMenuItemID, aMenuItems[i].nMenuIconID,
-            pShutdownIcon->GetUrlDescription( sURL ), pos, true, "" );
+            ShutdownIcon::GetUrlDescription( sURL ), pos, true, "" );
     }
 
 
@@ -202,7 +202,7 @@ static HMENU createSystrayMenu( )
     addMenuItem( hMenu, IDM_TEMPLATE, ICON_TEMPLATE,
         pShutdownIcon->GetResString( STR_QUICKSTART_FROMTEMPLATE ), pos, true, "");
     addMenuItem( hMenu, static_cast< UINT >( -1 ), 0, OUString(), pos, false, "" );
-    addMenuItem( hMenu, IDM_OPEN,   ICON_OPEN, pShutdownIcon->GetResString( STR_QUICKSTART_FILEOPEN ), pos, true, OUString("SHELL32"));
+    addMenuItem( hMenu, IDM_OPEN,   ICON_OPEN, pShutdownIcon->GetResString( STR_QUICKSTART_FILEOPEN ), pos, true, "SHELL32");
     addMenuItem( hMenu, static_cast< UINT >( -1 ), 0, OUString(), pos, false, "" );
     addMenuItem( hMenu, IDM_INSTALL,0, pShutdownIcon->GetResString( STR_QUICKSTART_PRELAUNCH ), pos, false, "" );
     addMenuItem( hMenu, static_cast< UINT >( -1 ), 0, OUString(), pos, false, "" );
@@ -228,7 +228,7 @@ static void deleteSystrayMenu( HMENU hMenu )
 
     while( GetMenuItemInfoW( hMenu, pos++, true, &mi ) )
     {
-        MYITEM *pMyItem = (MYITEM*) mi.dwItemData;
+        MYITEM *pMyItem = reinterpret_cast<MYITEM*>(mi.dwItemData);
         if( pMyItem )
         {
             (pMyItem->text).clear();
@@ -247,9 +247,9 @@ static void addTaskbarIcon( HWND hWnd )
 
     // add taskbar icon
     NOTIFYICONDATAW nid;
-    nid.hIcon = (HICON)LoadImageA( GetModuleHandle( NULL ), MAKEINTRESOURCE( ICON_LO_DEFAULT ),
+    nid.hIcon = static_cast<HICON>(LoadImageA( GetModuleHandle( nullptr ), MAKEINTRESOURCE( ICON_LO_DEFAULT ),
         IMAGE_ICON, GetSystemMetrics( SM_CXSMICON ), GetSystemMetrics( SM_CYSMICON ),
-        LR_DEFAULTCOLOR | LR_SHARED );
+        LR_DEFAULTCOLOR | LR_SHARED ));
 
     wcsncpy( nid.szTip, reinterpret_cast<LPCWSTR>(strTip.getStr()), 64 );
 
@@ -281,7 +281,7 @@ LRESULT CALLBACK listenerWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
 
                 // create the menu
                 if( !popupMenu )
-                    if( (popupMenu = createSystrayMenu( )) == NULL )
+                    if( (popupMenu = createSystrayMenu( )) == nullptr )
                         return -1;
 
                 // and the icon
@@ -289,16 +289,16 @@ LRESULT CALLBACK listenerWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
 
                 // disable shutdown
                 ShutdownIcon::getInstance()->SetVeto( true );
-                ShutdownIcon::getInstance()->addTerminateListener();
+                ShutdownIcon::addTerminateListener();
             }
             return 0;
 
         case WM_MEASUREITEM:
-            OnMeasureItem(hWnd, (LPMEASUREITEMSTRUCT) lParam);
+            OnMeasureItem(hWnd, reinterpret_cast<LPMEASUREITEMSTRUCT>(lParam));
             return TRUE;
 
         case WM_DRAWITEM:
-            OnDrawItem(hWnd, (LPDRAWITEMSTRUCT) lParam);
+            OnDrawItem(hWnd, reinterpret_cast<LPDRAWITEMSTRUCT>(lParam));
             return TRUE;
 
         case SFX_TASKBAR_NOTIFICATION:
@@ -306,7 +306,7 @@ LRESULT CALLBACK listenerWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
             {
                 case WM_LBUTTONDBLCLK:
                 {
-                    BOOL const ret = PostMessage(aExecuterWindow, WM_COMMAND, IDM_TEMPLATE, (LPARAM)hWnd);
+                    BOOL const ret = PostMessage(aExecuterWindow, WM_COMMAND, IDM_TEMPLATE, reinterpret_cast<LPARAM>(hWnd));
                     SAL_WARN_IF(0 == ret, "sfx.appl", "ERROR: PostMessage() failed!");
                     break;
                 }
@@ -324,7 +324,7 @@ LRESULT CALLBACK listenerWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
                     EnableMenuItem( popupMenu, IDM_OPEN, MF_BYCOMMAND | (ShutdownIcon::bModalMode ? MF_GRAYED : MF_ENABLED) );
                     EnableMenuItem( popupMenu, IDM_TEMPLATE, MF_BYCOMMAND | (ShutdownIcon::bModalMode ? MF_GRAYED : MF_ENABLED) );
                     int m = TrackPopupMenuEx( popupMenu, TPM_RETURNCMD|TPM_LEFTALIGN|TPM_RIGHTBUTTON,
-                                              pt.x, pt.y, hWnd, NULL );
+                                              pt.x, pt.y, hWnd, nullptr );
                     BOOL const ret = PostMessage( hWnd, 0, 0, 0 );
                     SAL_WARN_IF(0 == ret, "sfx.appl", "ERROR: PostMessage() failed!");
                     switch( m )
@@ -351,7 +351,7 @@ LRESULT CALLBACK listenerWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
                             break;
                     }
 
-                    BOOL const ret2 = PostMessage(aExecuterWindow, WM_COMMAND, m, (LPARAM)hWnd);
+                    BOOL const ret2 = PostMessage(aExecuterWindow, WM_COMMAND, m, reinterpret_cast<LPARAM>(hWnd));
                     SAL_WARN_IF(0 == ret2, "sfx.appl", "ERROR: PostMessage() failed!");
                 }
                 break;
@@ -377,7 +377,7 @@ LRESULT CALLBACK listenerWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
                 nid.uID = ID_QUICKSTART;
                 Shell_NotifyIconA(NIM_DELETE, &nid);
 
-                BOOL const ret = PostMessage(aExecuterWindow, WM_COMMAND, IDM_EXIT, (LPARAM)hWnd);
+                BOOL const ret = PostMessage(aExecuterWindow, WM_COMMAND, IDM_EXIT, reinterpret_cast<LPARAM>(hWnd));
                 SAL_WARN_IF(0 == ret, "sfx.appl", "ERROR: PostMessage() failed!");
             }
             else
@@ -404,22 +404,22 @@ LRESULT CALLBACK executerWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
                         ShutdownIcon::FileOpen();
                 break;
                 case IDM_WRITER:
-                    ShutdownIcon::OpenURL( OUString( WRITER_URL  ), OUString( "_default"  ) );
+                    ShutdownIcon::OpenURL( WRITER_URL, "_default" );
                 break;
                 case IDM_CALC:
-                    ShutdownIcon::OpenURL( OUString( CALC_URL  ), OUString( "_default"  ) );
+                    ShutdownIcon::OpenURL( CALC_URL, "_default" );
                 break;
                 case IDM_IMPRESS:
-                    ShutdownIcon::OpenURL( OUString( IMPRESS_WIZARD_URL  ), OUString( "_default"  ) );
+                    ShutdownIcon::OpenURL( IMPRESS_WIZARD_URL, "_default" );
                 break;
                 case IDM_DRAW:
-                    ShutdownIcon::OpenURL( OUString( DRAW_URL  ), OUString( "_default"  ) );
+                    ShutdownIcon::OpenURL( DRAW_URL, "_default" );
                 break;
                 case IDM_BASE:
-                    ShutdownIcon::OpenURL( OUString( BASE_URL  ), OUString( "_default"  ) );
+                    ShutdownIcon::OpenURL( BASE_URL, "_default" );
                 break;
                 case IDM_MATH:
-                    ShutdownIcon::OpenURL( OUString( MATH_URL  ), OUString( "_default"  ) );
+                    ShutdownIcon::OpenURL( MATH_URL, "_default" );
                 break;
                 case IDM_TEMPLATE:
                     if ( !ShutdownIcon::bModalMode )
@@ -456,15 +456,15 @@ DWORD WINAPI SystrayThread( LPVOID /*lpParam*/ )
         CW_USEDEFAULT,              // vertical position of window
         CW_USEDEFAULT,              // window width
         CW_USEDEFAULT,              // window height
-        (HWND) NULL,                // handle to parent or owner window
-        NULL,                       // menu handle or child identifier
-        (HINSTANCE) GetModuleHandle( NULL ),    // handle to application instance
-        NULL                        // window-creation data
+        nullptr,                    // handle to parent or owner window
+        nullptr,                    // menu handle or child identifier
+        GetModuleHandle( nullptr ), // handle to application instance
+        nullptr                     // window-creation data
         );
 
     MSG msg;
 
-    while ( GetMessage( &msg, NULL, 0, 0 ) )
+    while ( GetMessage( &msg, nullptr, 0, 0 ) )
     {
         TranslateMessage( &msg );
         DispatchMessage( &msg );
@@ -484,13 +484,13 @@ void win32_init_sys_tray()
         listenerClass.lpfnWndProc   = listenerWndProc;
         listenerClass.cbClsExtra    = 0;
         listenerClass.cbWndExtra    = 0;
-        listenerClass.hInstance     = (HINSTANCE) GetModuleHandle( NULL );
-        listenerClass.hIcon         = NULL;
-        listenerClass.hCursor       = NULL;
-        listenerClass.hbrBackground = NULL;
-        listenerClass.lpszMenuName  = NULL;
+        listenerClass.hInstance     = GetModuleHandle( nullptr );
+        listenerClass.hIcon         = nullptr;
+        listenerClass.hCursor       = nullptr;
+        listenerClass.hbrBackground = nullptr;
+        listenerClass.lpszMenuName  = nullptr;
         listenerClass.lpszClassName = QUICKSTART_CLASSNAME;
-        listenerClass.hIconSm       = NULL;
+        listenerClass.hIconSm       = nullptr;
 
         RegisterClassExA(&listenerClass);
 
@@ -500,13 +500,13 @@ void win32_init_sys_tray()
         executerClass.lpfnWndProc   = executerWndProc;
         executerClass.cbClsExtra    = 0;
         executerClass.cbWndExtra    = 0;
-        executerClass.hInstance     = (HINSTANCE) GetModuleHandle( NULL );
-        executerClass.hIcon         = NULL;
-        executerClass.hCursor       = NULL;
-        executerClass.hbrBackground = NULL;
-        executerClass.lpszMenuName  = NULL;
+        executerClass.hInstance     = GetModuleHandle( nullptr );
+        executerClass.hIcon         = nullptr;
+        executerClass.hCursor       = nullptr;
+        executerClass.hbrBackground = nullptr;
+        executerClass.lpszMenuName  = nullptr;
         executerClass.lpszClassName = EXECUTER_WINDOWCLASS;
-        executerClass.hIconSm       = NULL;
+        executerClass.hIconSm       = nullptr;
 
         RegisterClassExA( &executerClass );
 
@@ -518,14 +518,14 @@ void win32_init_sys_tray()
             CW_USEDEFAULT,              // vertical position of window
             CW_USEDEFAULT,              // window width
             CW_USEDEFAULT,              // window height
-            (HWND) NULL,                // handle to parent or owner window
-            NULL,                       // menu handle or child identifier
-            (HINSTANCE) GetModuleHandle( NULL ),    // handle to application instance
-            NULL                        // window-creation data
+            nullptr,                    // handle to parent or owner window
+            nullptr,                    // menu handle or child identifier
+            GetModuleHandle( nullptr ), // handle to application instance
+            nullptr                     // window-creation data
             );
 
         DWORD   dwThreadId;
-        CreateThread( NULL, 0, SystrayThread, NULL, 0, &dwThreadId );
+        CreateThread( nullptr, 0, SystrayThread, nullptr, 0, &dwThreadId );
     }
 }
 
@@ -537,19 +537,19 @@ void win32_shutdown_sys_tray()
         if( IsWindow( aListenerWindow ) )
         {
             DestroyWindow( aListenerWindow );
-            aListenerWindow = NULL;
+            aListenerWindow = nullptr;
             DestroyWindow( aExecuterWindow );
-            aExecuterWindow = NULL;
+            aExecuterWindow = nullptr;
         }
-        UnregisterClassA( QUICKSTART_CLASSNAME, GetModuleHandle( NULL ) );
-        UnregisterClassA( EXECUTER_WINDOWCLASS, GetModuleHandle( NULL ) );
+        UnregisterClassA( QUICKSTART_CLASSNAME, GetModuleHandle( nullptr ) );
+        UnregisterClassA( EXECUTER_WINDOWCLASS, GetModuleHandle( nullptr ) );
     }
 }
 
 
 void OnMeasureItem(HWND hwnd, LPMEASUREITEMSTRUCT lpmis)
 {
-    MYITEM *pMyItem = (MYITEM *) lpmis->itemData;
+    MYITEM *pMyItem = reinterpret_cast<MYITEM *>(lpmis->itemData);
     HDC hdc = GetDC(hwnd);
     SIZE size;
 
@@ -557,12 +557,12 @@ void OnMeasureItem(HWND hwnd, LPMEASUREITEMSTRUCT lpmis)
     memset(&ncm, 0, sizeof(ncm));
     ncm.cbSize = sizeof(ncm);
 
-    SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, (PVOID) &ncm, 0);
+    SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
 
     // Assume every menu item can be default and printed bold
     ncm.lfMenuFont.lfWeight = FW_BOLD;
 
-    HFONT hfntOld = (HFONT) SelectObject(hdc, (HFONT) CreateFontIndirect( &ncm.lfMenuFont ));
+    HFONT hfntOld = static_cast<HFONT>(SelectObject(hdc, CreateFontIndirect( &ncm.lfMenuFont )));
 
     GetTextExtentPoint32W(hdc, reinterpret_cast<LPCWSTR>(pMyItem->text.getStr()),
             pMyItem->text.getLength(), &size);
@@ -577,7 +577,7 @@ void OnMeasureItem(HWND hwnd, LPMEASUREITEMSTRUCT lpmis)
 
 void OnDrawItem(HWND /*hwnd*/, LPDRAWITEMSTRUCT lpdis)
 {
-    MYITEM *pMyItem = (MYITEM *) lpdis->itemData;
+    MYITEM *pMyItem = reinterpret_cast<MYITEM *>(lpdis->itemData);
     COLORREF clrPrevText, clrPrevBkgnd;
     HFONT hfntOld;
     HBRUSH hbrOld;
@@ -601,7 +601,7 @@ void OnDrawItem(HWND /*hwnd*/, LPDRAWITEMSTRUCT lpdis)
     else
         clrPrevBkgnd = SetBkColor( lpdis->hDC, GetSysColor(COLOR_MENU) );
 
-    hbrOld = (HBRUSH)SelectObject( lpdis->hDC, CreateSolidBrush( GetBkColor( lpdis->hDC ) ) );
+    hbrOld = static_cast<HBRUSH>(SelectObject( lpdis->hDC, CreateSolidBrush( GetBkColor( lpdis->hDC ) ) ));
 
     // Fill background
     PatBlt(lpdis->hDC, aRect.left, aRect.top, aRect.right-aRect.left, aRect.bottom-aRect.top, PATCOPY);
@@ -613,28 +613,28 @@ void OnDrawItem(HWND /*hwnd*/, LPDRAWITEMSTRUCT lpdis)
 
     int     cx = GetSystemMetrics( SM_CXSMICON );
     int     cy = GetSystemMetrics( SM_CYSMICON );
-    HICON   hIcon( 0 );
-    HMODULE hModule( GetModuleHandle( NULL ) );
+    HICON   hIcon( nullptr );
+    HMODULE hModule( GetModuleHandle( nullptr ) );
 
     if ( pMyItem->module.getLength() > 0 )
     {
         LPCWSTR pModuleName = reinterpret_cast<LPCWSTR>( pMyItem->module.getStr() );
         hModule = GetModuleHandleW( pModuleName );
-        if ( hModule == NULL )
+        if ( hModule == nullptr )
         {
             LoadLibraryW( pModuleName );
             hModule = GetModuleHandleW( pModuleName );
         }
     }
 
-    hIcon = (HICON) LoadImageA( hModule, MAKEINTRESOURCE( pMyItem->iconId ),
+    hIcon = static_cast<HICON>(LoadImageA( hModule, MAKEINTRESOURCE( pMyItem->iconId ),
                                 IMAGE_ICON, cx, cy,
-                                LR_DEFAULTCOLOR | LR_SHARED );
+                                LR_DEFAULTCOLOR | LR_SHARED ));
 
 
     HBRUSH hbrIcon = CreateSolidBrush( GetSysColor( COLOR_GRAYTEXT ) );
 
-    DrawStateW( lpdis->hDC, (HBRUSH)hbrIcon, (DRAWSTATEPROC)NULL, (LPARAM)hIcon, (WPARAM)0, x, y+(height-cy)/2, 0, 0, DST_ICON | (fDisabled ? (fSelected ? DSS_MONO : DSS_DISABLED) : DSS_NORMAL) );
+    DrawStateW( lpdis->hDC, hbrIcon, nullptr, reinterpret_cast<LPARAM>(hIcon), (WPARAM)0, x, y+(height-cy)/2, 0, 0, DST_ICON | (fDisabled ? (fSelected ? DSS_MONO : DSS_DISABLED) : DSS_NORMAL) );
 
     DeleteObject( hbrIcon );
 
@@ -645,19 +645,19 @@ void OnDrawItem(HWND /*hwnd*/, LPDRAWITEMSTRUCT lpdis)
     memset(&ncm, 0, sizeof(ncm));
     ncm.cbSize = sizeof(ncm);
 
-    SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, (PVOID) &ncm, 0);
+    SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
 
     // Print default menu entry with bold font
     if ( lpdis->itemState & ODS_DEFAULT )
         ncm.lfMenuFont.lfWeight = FW_BOLD;
 
-    hfntOld = (HFONT) SelectObject(lpdis->hDC, (HFONT) CreateFontIndirect( &ncm.lfMenuFont ));
+    hfntOld = static_cast<HFONT>(SelectObject(lpdis->hDC, CreateFontIndirect( &ncm.lfMenuFont )));
 
 
     SIZE    size;
     GetTextExtentPointW( lpdis->hDC, reinterpret_cast<LPCWSTR>(pMyItem->text.getStr()), pMyItem->text.getLength(), &size );
 
-    DrawStateW( lpdis->hDC, (HBRUSH)NULL, (DRAWSTATEPROC)NULL, (LPARAM)pMyItem->text.getStr(), (WPARAM)0, aRect.left, aRect.top + (height - size.cy)/2, 0, 0, DST_TEXT | (fDisabled && !fSelected ? DSS_DISABLED : DSS_NORMAL) );
+    DrawStateW( lpdis->hDC, nullptr, nullptr, reinterpret_cast<LPARAM>(pMyItem->text.getStr()), (WPARAM)0, aRect.left, aRect.top + (height - size.cy)/2, 0, 0, DST_TEXT | (fDisabled && !fSelected ? DSS_DISABLED : DSS_NORMAL) );
 
     // Restore the original font and colors.
     DeleteObject( SelectObject( lpdis->hDC, hbrOld ) );
@@ -670,7 +670,7 @@ void OnDrawItem(HWND /*hwnd*/, LPDRAWITEMSTRUCT lpdis)
 // code from setup2 project
 
 
-void _SHFree( void *pv )
+void SHFree_( void *pv )
 {
     IMalloc *pMalloc;
     if( NOERROR == SHGetMalloc(&pMalloc) )
@@ -680,14 +680,14 @@ void _SHFree( void *pv )
     }
 }
 
-#define ALLOC(type, n) ((type *) HeapAlloc(GetProcessHeap(), 0, sizeof(type) * n ))
+#define ALLOC(type, n) static_cast<type *>(HeapAlloc(GetProcessHeap(), 0, sizeof(type) * n ))
 #define FREE(p) HeapFree(GetProcessHeap(), 0, p)
 
-static OUString _SHGetSpecialFolder( int nFolderID )
+static OUString SHGetSpecialFolder( int nFolderID )
 {
 
     LPITEMIDLIST    pidl;
-    HRESULT         hHdl = SHGetSpecialFolderLocation( NULL, nFolderID, &pidl );
+    HRESULT         hHdl = SHGetSpecialFolderLocation( nullptr, nFolderID, &pidl );
     OUString        aFolder;
 
     if( hHdl == NOERROR )
@@ -699,14 +699,14 @@ static OUString _SHGetSpecialFolder( int nFolderID )
         aFolder = OUString( reinterpret_cast<const sal_Unicode*>(lpFolderA) );
 
         FREE( lpFolderA );
-        _SHFree( pidl );
+        SHFree_( pidl );
     }
     return aFolder;
 }
 
 OUString ShutdownIcon::GetAutostartFolderNameW32()
 {
-    return _SHGetSpecialFolder(CSIDL_STARTUP);
+    return SHGetSpecialFolder(CSIDL_STARTUP);
 }
 
 static HRESULT WINAPI SHCoCreateInstance( LPVOID lpszReserved, REFCLSID clsid, LPUNKNOWN pUnkUnknown, REFIID iid, LPVOID *ppv )
@@ -714,11 +714,11 @@ static HRESULT WINAPI SHCoCreateInstance( LPVOID lpszReserved, REFCLSID clsid, L
     HRESULT hResult = E_NOTIMPL;
     HMODULE hModShell = GetModuleHandle( "SHELL32" );
 
-    if ( hModShell != NULL )
+    if ( hModShell != nullptr )
     {
         typedef HRESULT (WINAPI *SHCoCreateInstance_PROC)( LPVOID lpszReserved, REFCLSID clsid, LPUNKNOWN pUnkUnknwon, REFIID iid, LPVOID *ppv );
 
-        SHCoCreateInstance_PROC lpfnSHCoCreateInstance = (SHCoCreateInstance_PROC)GetProcAddress( hModShell, MAKEINTRESOURCE(102) );
+        SHCoCreateInstance_PROC lpfnSHCoCreateInstance = reinterpret_cast<SHCoCreateInstance_PROC>(GetProcAddress( hModShell, MAKEINTRESOURCE(102) ));
 
         if ( lpfnSHCoCreateInstance )
             hResult = lpfnSHCoCreateInstance( lpszReserved, clsid, pUnkUnknown, iid, ppv );
@@ -734,10 +734,10 @@ BOOL CreateShortcut( const OUString& rAbsObject, const OUString& rAbsObjectPath,
     CLSID clsid_ShellLink = CLSID_ShellLink;
     CLSID clsid_IShellLink = IID_IShellLink;
 
-    hres = CoCreateInstance( clsid_ShellLink, NULL, CLSCTX_INPROC_SERVER,
-                             clsid_IShellLink, (void**)&psl );
+    hres = CoCreateInstance( clsid_ShellLink, nullptr, CLSCTX_INPROC_SERVER,
+                             clsid_IShellLink, reinterpret_cast<void**>(&psl) );
     if( FAILED(hres) )
-        hres = SHCoCreateInstance( NULL, clsid_ShellLink, NULL, clsid_IShellLink, (void**)&psl );
+        hres = SHCoCreateInstance( nullptr, clsid_ShellLink, nullptr, clsid_IShellLink, reinterpret_cast<void**>(&psl) );
 
     if( SUCCEEDED(hres) )
     {
@@ -749,7 +749,7 @@ BOOL CreateShortcut( const OUString& rAbsObject, const OUString& rAbsObjectPath,
             psl->SetArguments( OUStringToOString(rParameter, osl_getThreadTextEncoding()).getStr() );
 
         CLSID clsid_IPersistFile = IID_IPersistFile;
-        hres = psl->QueryInterface( clsid_IPersistFile, (void**)&ppf );
+        hres = psl->QueryInterface( clsid_IPersistFile, reinterpret_cast<void**>(&ppf) );
 
         if( SUCCEEDED(hres) )
         {
@@ -783,7 +783,7 @@ static bool FileExistsW( LPCWSTR lpPath )
 bool ShutdownIcon::IsQuickstarterInstalled()
 {
     wchar_t aPath[_MAX_PATH];
-    GetModuleFileNameW( NULL, aPath, _MAX_PATH-1);
+    GetModuleFileNameW( nullptr, aPath, _MAX_PATH-1);
 
     OUString aOfficepath( reinterpret_cast<const sal_Unicode*>(aPath) );
     int i = aOfficepath.lastIndexOf((sal_Char) '\\');
@@ -799,7 +799,7 @@ bool ShutdownIcon::IsQuickstarterInstalled()
 void ShutdownIcon::EnableAutostartW32( const OUString &aShortcut )
 {
     wchar_t aPath[_MAX_PATH];
-    GetModuleFileNameW( NULL, aPath, _MAX_PATH-1);
+    GetModuleFileNameW( nullptr, aPath, _MAX_PATH-1);
 
     OUString aOfficepath( reinterpret_cast<const sal_Unicode*>(aPath) );
     int i = aOfficepath.lastIndexOf((sal_Char) '\\');
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index 7f379f5..b24472d 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -1628,6 +1628,8 @@ void FileDialogHelper_Impl::verifyPath()
         maPath = SvtPathOptions().GetWorkPath();
         mxFileDlg->setDisplayDirectory( maPath );
     }
+#else
+    (void) this;
 #endif
 }
 
diff --git a/sfx2/source/doc/graphhelp.cxx b/sfx2/source/doc/graphhelp.cxx
index ba871c1..542c8ff 100644
--- a/sfx2/source/doc/graphhelp.cxx
+++ b/sfx2/source/doc/graphhelp.cxx
@@ -94,7 +94,7 @@ void* GraphicHelper::getEnhMetaFileFromGDI_Impl( const GDIMetaFile* pGDIMeta )
         if ( pStream )
         {
             Graphic aGraph( *pGDIMeta );
-            sal_Bool bFailed = (sal_Bool)GraphicConverter::Export( *pStream, aGraph, ConvertDataFormat::EMF );
+            bool bFailed = GraphicConverter::Export( *pStream, aGraph, ConvertDataFormat::EMF );
             pStream->Flush();
             delete pStream;
 
@@ -120,7 +120,7 @@ void* GraphicHelper::getWinMetaFileFromGDI_Impl( const GDIMetaFile* pGDIMeta, co
     {
         SvMemoryStream* pStream = new SvMemoryStream( 65535, 65535 );
         Graphic aGraph( *pGDIMeta );
-        sal_Bool bFailed = (sal_Bool)GraphicConverter::Export( *pStream, aGraph, ConvertDataFormat::WMF );
+        bool bFailed = GraphicConverter::Export( *pStream, aGraph, ConvertDataFormat::WMF );
         pStream->Flush();
         if ( !bFailed )
         {
@@ -128,7 +128,7 @@ void* GraphicHelper::getWinMetaFileFromGDI_Impl( const GDIMetaFile* pGDIMeta, co
             if ( nLength > 22 )
             {
                 HMETAFILE hMeta = SetMetaFileBitsEx( nLength - 22,
-                                ( reinterpret_cast< const unsigned char*>( pStream->GetData() ) ) + 22 );
+                                ( static_cast< const unsigned char*>( pStream->GetData() ) ) + 22 );
 
                 if ( hMeta )
                 {
@@ -136,7 +136,7 @@ void* GraphicHelper::getWinMetaFileFromGDI_Impl( const GDIMetaFile* pGDIMeta, co
 
                     if ( hMemory )
                     {
-                           METAFILEPICT* pMF = (METAFILEPICT*)GlobalLock( hMemory );
+                           METAFILEPICT* pMF = static_cast<METAFILEPICT*>(GlobalLock( hMemory ));
 
                            pMF->hMF = hMeta;
                            pMF->mm = MM_ANISOTROPIC;
@@ -159,7 +159,7 @@ void* GraphicHelper::getWinMetaFileFromGDI_Impl( const GDIMetaFile* pGDIMeta, co
                         }
 
                         GlobalUnlock( hMemory );
-                        pResult = (void*)hMemory;
+                        pResult = static_cast<void*>(hMemory);
                     }
                     else
                            DeleteMetaFile( hMeta );
diff --git a/sfx2/source/doc/syspath.cxx b/sfx2/source/doc/syspath.cxx
index 8b19b2b..32094d3 100644
--- a/sfx2/source/doc/syspath.cxx
+++ b/sfx2/source/doc/syspath.cxx
@@ -18,10 +18,7 @@
  */
 
 #include "syspath.hxx"
-
-#if defined(_WIN32)
-extern "C" bool GetUserTemplateLocation(sal_Unicode*, int nSize);
-#endif
+#include <syspathw32.hxx>
 
 bool SystemPath::GetUserTemplateLocation(sal_Unicode* pFolder, int nSize )
 {
diff --git a/sfx2/source/doc/syspathw32.cxx b/sfx2/source/doc/syspathw32.cxx
index a6ec72d..ce58390 100644
--- a/sfx2/source/doc/syspathw32.cxx
+++ b/sfx2/source/doc/syspathw32.cxx
@@ -28,10 +28,12 @@
 
 #include <shlobj.h>
 
-static bool _SHGetSpecialFolderW32( int nFolderID, WCHAR* pszFolder, int nSize )
+#include <syspathw32.hxx>
+
+static bool SHGetSpecialFolderW32( int nFolderID, WCHAR* pszFolder, int nSize )
 {
     LPITEMIDLIST    pidl;
-    HRESULT         hHdl = SHGetSpecialFolderLocation( NULL, nFolderID, &pidl );
+    HRESULT         hHdl = SHGetSpecialFolderLocation( nullptr, nFolderID, &pidl );
 
     if( hHdl == NOERROR )
     {
@@ -65,10 +67,10 @@ typedef unsigned short sal_uInt16;
     typedef sal_uInt16          sal_Unicode;
 #endif
 
-extern "C" bool GetUserTemplateLocation(sal_Unicode* pFolder, int nSize)
+bool GetUserTemplateLocation(sal_Unicode* pFolder, int nSize)
 {
 #ifdef _WIN32
-    return _SHGetSpecialFolderW32( CSIDL_TEMPLATES, reinterpret_cast<LPWSTR>(pFolder), nSize );
+    return SHGetSpecialFolderW32( CSIDL_TEMPLATES, reinterpret_cast<LPWSTR>(pFolder), nSize );
 #else
     (void)pFolder;
     (void)nSize;
diff --git a/sfx2/source/doc/syspathw32.hxx b/sfx2/source/doc/syspathw32.hxx
new file mode 100644
index 0000000..5707a80
--- /dev/null
+++ b/sfx2/source/doc/syspathw32.hxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SFX2_SOURCE_DOC_SYSPATHW32_HXX
+#define INCLUDED_SFX2_SOURCE_DOC_SYSPATHW32_HXX
+
+#include <sal/config.h>
+
+#include <sal/types.h>
+
+#if defined _WIN32
+bool GetUserTemplateLocation(sal_Unicode *, int nSize);
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 5406667..9f024b5 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -212,30 +212,6 @@ bool SfxViewFrame::IsDowning_Impl() const
     return m_pImpl->bIsDowning;
 }
 
-class SfxViewNotificatedFrameList_Impl :
-    public SfxListener, public SfxViewFrameArr_Impl
-{
-public:
-
-    void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
-};
-
-void SfxViewNotificatedFrameList_Impl::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
-{
-    switch( rHint.GetId() )
-    {
-        case SFX_HINT_DYING:
-            SfxViewFrame* pFrame = dynamic_cast<SfxViewFrame*>(&rBC);
-            if( pFrame )
-            {
-                iterator it = std::find( begin(), end(), pFrame );
-                if( it != end() )
-                    erase( it );
-            }
-        break;
-    }
-}
-
 void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
 {
     SfxFrame *pParent = GetFrame().GetParentFrame();


More information about the Libreoffice-commits mailing list