[Libreoffice-commits] core.git: 11 commits - comphelper/source embedserv/source extensions/source include/comphelper sal/osl sfx2/source vcl/inc vcl/opengl vcl/win xmlsecurity/source

Stephan Bergmann sbergman at redhat.com
Fri Aug 18 08:16:20 UTC 2017


 comphelper/source/windows/windows_process.cxx |   26 ++----
 embedserv/source/embed/ed_ipersiststr.cxx     |   12 +-
 extensions/source/activex/SOActiveX.cxx       |    2 
 include/comphelper/windowsStart.hxx           |    5 +
 sal/osl/w32/pipe.cxx                          |    1 
 sfx2/source/doc/guisaveas.cxx                 |    2 
 vcl/inc/win/saldata.hxx                       |    4 
 vcl/opengl/win/gdiimpl.cxx                    |    2 
 vcl/win/gdi/salfont.cxx                       |    3 
 vcl/win/window/salframe.cxx                   |  106 +++++++++++++-------------
 xmlsecurity/source/xmlsec/mscrypt/akmngr.cxx  |   48 +++++------
 11 files changed, 105 insertions(+), 106 deletions(-)

New commits:
commit e5eedf7af4fcb38162773bff74c89243923a04eb
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Aug 18 10:13:06 2017 +0200

    loplugin:implicitboolconversion (clang-cl)
    
    ...after 2bb282656a19a399a101dbeadf157d10d4d5e4f4 "SalFrame Handle* methods can
    return bool"
    
    Change-Id: I15659eafc27e8402aeb407418e656d546c554f06

diff --git a/vcl/inc/win/saldata.hxx b/vcl/inc/win/saldata.hxx
index 9ad5d9cfddf1..4d8361d57325 100644
--- a/vcl/inc/win/saldata.hxx
+++ b/vcl/inc/win/saldata.hxx
@@ -184,8 +184,8 @@ void EmitTimerCallback();
 
 void SalTestMouseLeave();
 
-long ImplHandleSalObjKeyMsg( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam );
-long ImplHandleSalObjSysCharMsg( HWND hWnd, WPARAM wParam, LPARAM lParam );
+bool ImplHandleSalObjKeyMsg( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam );
+bool ImplHandleSalObjSysCharMsg( HWND hWnd, WPARAM wParam, LPARAM lParam );
 bool ImplHandleGlobalMsg( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam, LRESULT& rlResult );
 
 WinSalObject* ImplFindSalObject( HWND hWndChild );
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index e0ec83c37e4c..4bcb1d6e09da 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -2996,12 +2996,12 @@ void WinSalFrame::EndSetClipRegion()
     }
 }
 
-static long ImplHandleMouseMsg( HWND hWnd, UINT nMsg,
+static bool ImplHandleMouseMsg( HWND hWnd, UINT nMsg,
                                 WPARAM wParam, LPARAM lParam )
 {
     WinSalFrame* pFrame = GetWindowPtr( hWnd );
     if ( !pFrame )
-        return 0;
+        return false;
 
     if( nMsg == WM_LBUTTONDOWN || nMsg == WM_MBUTTONDOWN || nMsg == WM_RBUTTONDOWN )
     {
@@ -3013,11 +3013,11 @@ static long ImplHandleMouseMsg( HWND hWnd, UINT nMsg,
         {
             BOOL const ret = PostMessageW( hWnd, nMsg, wParam, lParam );
             SAL_WARN_IF(0 == ret, "vcl", "ERROR: PostMessage() failed!");
-            return 1;
+            return true;
         }
     }
     SalMouseEvent   aMouseEvt;
-    long            nRet;
+    bool            nRet;
     SalEvent        nEvent = SalEvent::NONE;
     bool            bCall = TRUE;
 
@@ -3056,7 +3056,7 @@ static long ImplHandleMouseMsg( HWND hWnd, UINT nMsg,
                 {
                     if ( (aTempMsg.message == WM_MOUSEMOVE) &&
                          (aTempMsg.wParam == wParam) )
-                        return 1;
+                        return true;
                 }
             }
 
@@ -3142,7 +3142,7 @@ static long ImplHandleMouseMsg( HWND hWnd, UINT nMsg,
     // check if this window was destroyed - this might happen if we are the help window
     // and sent a mouse leave message to the application which killed the help window, ie ourselves
     if( !IsWindow( hWnd ) )
-        return 0;
+        return false;
 
     if ( bCall )
     {
@@ -3157,24 +3157,24 @@ static long ImplHandleMouseMsg( HWND hWnd, UINT nMsg,
             SetCursor( pFrame->mhCursor );
     }
     else
-        nRet = 0;
+        nRet = false;
 
     return nRet;
 }
 
-static long ImplHandleMouseActivateMsg( HWND hWnd )
+static bool ImplHandleMouseActivateMsg( HWND hWnd )
 {
     WinSalFrame* pFrame = GetWindowPtr( hWnd );
     if ( !pFrame )
-        return 0;
+        return false;
 
     if ( pFrame->mbFloatWin )
-        return TRUE;
+        return true;
 
     return pFrame->CallCallback( SalEvent::MouseActivate, nullptr );
 }
 
-static long ImplHandleWheelMsg( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam )
+static bool ImplHandleWheelMsg( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam )
 {
     DBG_ASSERT( nMsg == WM_MOUSEWHEEL ||
                 nMsg == WM_MOUSEHWHEEL,
@@ -3182,7 +3182,7 @@ static long ImplHandleWheelMsg( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lPar
 
     ImplSalYieldMutexAcquireWithWait();
 
-    long        nRet = 0;
+    bool nRet = false;
     WinSalFrame*   pFrame = GetWindowPtr( hWnd );
     if ( pFrame )
     {
@@ -3334,7 +3334,7 @@ bool WinSalFrame::MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangT
     return bRet;
 }
 
-static long ImplHandleKeyMsg( HWND hWnd, UINT nMsg,
+static bool ImplHandleKeyMsg( HWND hWnd, UINT nMsg,
                               WPARAM wParam, LPARAM lParam, LRESULT& rResult )
 {
     static bool         bIgnoreCharMsg  = FALSE;
@@ -3353,12 +3353,12 @@ static long ImplHandleKeyMsg( HWND hWnd, UINT nMsg,
     if ( nMsg == WM_DEADCHAR )
     {
         nDeadChar = wParam;
-        return 0;
+        return false;
     }
 
     WinSalFrame* pFrame = GetWindowPtr( hWnd );
     if ( !pFrame )
-        return 0;
+        return false;
 
     // reset the background mode for each text input,
     // as some tools such as RichWin may have changed it
@@ -3390,15 +3390,15 @@ static long ImplHandleKeyMsg( HWND hWnd, UINT nMsg,
             // also return zero if a system menubar is available that might process this hotkey
             // this also applies to the OLE inplace embedding where we are a child window
             if( (GetWindowStyle( hWnd ) & WS_CHILD) || GetMenu( hWnd ) || (wParam == 0x20) )
-                return 0;
+                return false;
             else
-                return 1;
+                return true;
         }
 
         // ignore backspace as a single key, so that
         // we do not get problems for combinations w/ a DeadKey
         if ( wParam == 0x08 )    // BACKSPACE
-            return 0;
+            return false;
 
         // only "free flying" WM_CHAR messages arrive here, that are
         // created by typing a ALT-NUMPAD combination
@@ -3426,7 +3426,7 @@ static long ImplHandleKeyMsg( HWND hWnd, UINT nMsg,
         aKeyEvt.mnRepeat    = nRepeat;
         nLastChar = 0;
         nLastVKChar = 0;
-        long nRet = pFrame->CallCallback( SalEvent::KeyInput, &aKeyEvt );
+        bool nRet = pFrame->CallCallback( SalEvent::KeyInput, &aKeyEvt );
         pFrame->CallCallback( SalEvent::KeyUp, &aKeyEvt );
         return nRet;
     }
@@ -3437,7 +3437,7 @@ static long ImplHandleKeyMsg( HWND hWnd, UINT nMsg,
          if(wParam == UNICODE_NOCHAR)
         {
             rResult = TRUE; // ssa: this will actually return TRUE to windows
-            return 1;       // ...but this will only avoid calling the defwindowproc
+            return true;    // ...but this will only avoid calling the defwindowproc
         }
 
          SalKeyEvent aKeyEvt;
@@ -3459,7 +3459,7 @@ static long ImplHandleKeyMsg( HWND hWnd, UINT nMsg,
 
          nLastChar = 0;
          nLastVKChar = 0;
-         long nRet = pFrame->CallCallback( SalEvent::KeyInput, &aKeyEvt );
+         bool nRet = pFrame->CallCallback( SalEvent::KeyInput, &aKeyEvt );
          pFrame->CallCallback( SalEvent::KeyUp, &aKeyEvt );
 
          return nRet;
@@ -3538,7 +3538,7 @@ static long ImplHandleKeyMsg( HWND hWnd, UINT nMsg,
                     {
                         PeekMessageW( &aCharMsg, hWnd,
                                          nCharMsg, nCharMsg, PM_REMOVE | PM_NOYIELD );
-                        return 0;
+                        return false;
                     }
                 }
                 else
@@ -3579,7 +3579,7 @@ static long ImplHandleKeyMsg( HWND hWnd, UINT nMsg,
                 aKeyEvt.mnRepeat    = nRepeat;
 
                 bIgnoreCharMsg = bCharPeek ? TRUE : FALSE;
-                long nRet = pFrame->CallCallback( nEvent, &aKeyEvt );
+                bool nRet = pFrame->CallCallback( nEvent, &aKeyEvt );
                 // independent part only reacts on keyup but Windows does not send
                 // keyup for VK_HANJA
                 if( aKeyEvt.mnCode == KEY_HANGUL_HANJA )
@@ -3603,19 +3603,19 @@ static long ImplHandleKeyMsg( HWND hWnd, UINT nMsg,
                 return nRet;
             }
             else
-                return 0;
+                return false;
         }
     }
 }
 
-long ImplHandleSalObjKeyMsg( HWND hWnd, UINT nMsg,
+bool ImplHandleSalObjKeyMsg( HWND hWnd, UINT nMsg,
                              WPARAM wParam, LPARAM lParam )
 {
     if ( (nMsg == WM_KEYDOWN) || (nMsg == WM_KEYUP) )
     {
         WinSalFrame* pFrame = GetWindowPtr( hWnd );
         if ( !pFrame )
-            return 0;
+            return false;
 
         sal_uInt16  nRepeat     = LOWORD( lParam )-1;
         sal_uInt16  nModCode    = 0;
@@ -3647,22 +3647,22 @@ long ImplHandleSalObjKeyMsg( HWND hWnd, UINT nMsg,
 
                 aKeyEvt.mnCode     |= nModCode;
                 aKeyEvt.mnRepeat    = nRepeat;
-                long nRet = pFrame->CallCallback( nEvent, &aKeyEvt );
+                bool nRet = pFrame->CallCallback( nEvent, &aKeyEvt );
                 return nRet;
             }
             else
-                return 0;
+                return false;
         }
     }
 
-    return 0;
+    return false;
 }
 
-long ImplHandleSalObjSysCharMsg( HWND hWnd, WPARAM wParam, LPARAM lParam )
+bool ImplHandleSalObjSysCharMsg( HWND hWnd, WPARAM wParam, LPARAM lParam )
 {
     WinSalFrame* pFrame = GetWindowPtr( hWnd );
     if ( !pFrame )
-        return 0;
+        return false;
 
     sal_uInt16  nRepeat     = LOWORD( lParam )-1;
     sal_uInt16  nModCode    = 0;
@@ -3688,7 +3688,7 @@ long ImplHandleSalObjSysCharMsg( HWND hWnd, WPARAM wParam, LPARAM lParam )
     aKeyEvt.mnCode     |= nModCode;
     aKeyEvt.mnCharCode  = ImplGetCharCode( pFrame, cKeyCode );
     aKeyEvt.mnRepeat    = nRepeat;
-    long nRet = pFrame->CallCallback( SalEvent::KeyInput, &aKeyEvt );
+    bool nRet = pFrame->CallCallback( SalEvent::KeyInput, &aKeyEvt );
     pFrame->CallCallback( SalEvent::KeyUp, &aKeyEvt );
     return nRet;
 }
@@ -4030,9 +4030,9 @@ static void ImplHandleCloseMsg( HWND hWnd )
         }
 }
 
-static long ImplHandleShutDownMsg( HWND hWnd )
+static bool ImplHandleShutDownMsg( HWND hWnd )
 {
-    long nRet = 0;
+    bool nRet = false;
     WinSalFrame* pFrame = ProcessOrDeferMessage( hWnd, 0, 0, DeferPolicy::Blocked );
     if ( pFrame )
     {
@@ -4657,13 +4657,13 @@ static bool ImplHandleMenuActivate( HWND hWnd, WPARAM wParam, LPARAM )
     else
         aMenuEvt.mpMenu = nullptr;
 
-    long nRet = pFrame->CallCallback( SalEvent::MenuActivate, &aMenuEvt );
+    bool nRet = pFrame->CallCallback( SalEvent::MenuActivate, &aMenuEvt );
     if( nRet )
         nRet = pFrame->CallCallback( SalEvent::MenuDeactivate, &aMenuEvt );
     if( nRet )
         pFrame->mLastActivatedhMenu = hMenu;
 
-    return (nRet!=0);
+    return nRet;
 }
 
 static bool ImplHandleMenuSelect( HWND hWnd, WPARAM wParam, LPARAM lParam )
@@ -4685,7 +4685,7 @@ static bool ImplHandleMenuSelect( HWND hWnd, WPARAM wParam, LPARAM lParam )
     if( nFlags & MF_POPUP )
         bByPosition = TRUE;
 
-    long nRet = 0;
+    bool nRet = false;
     if ( hMenu && !pFrame->mLastActivatedhMenu )
     {
         // we never activated a menu (ie, no WM_INITMENUPOPUP has occurred yet)
@@ -4741,7 +4741,7 @@ static bool ImplHandleMenuSelect( HWND hWnd, WPARAM wParam, LPARAM lParam )
         nRet = pFrame->CallCallback( SalEvent::MenuHighlight, &aMenuEvt );
     }
 
-    return (nRet != 0);
+    return nRet;
 }
 
 static bool ImplHandleCommand( HWND hWnd, WPARAM wParam, LPARAM )
@@ -4750,7 +4750,7 @@ static bool ImplHandleCommand( HWND hWnd, WPARAM wParam, LPARAM )
     if ( !pFrame )
         return false;
 
-    long nRet = 0;
+    bool nRet = false;
     if( !HIWORD(wParam) )
     {
         // Menu command
@@ -4768,14 +4768,14 @@ static bool ImplHandleCommand( HWND hWnd, WPARAM wParam, LPARAM )
             nRet = pFrame->CallCallback( SalEvent::MenuCommand, &aMenuEvt );
         }
     }
-    return (nRet != 0);
+    return nRet;
 }
 
-static int ImplHandleSysCommand( HWND hWnd, WPARAM wParam, LPARAM lParam )
+static bool ImplHandleSysCommand( HWND hWnd, WPARAM wParam, LPARAM lParam )
 {
     WinSalFrame* pFrame = GetWindowPtr( hWnd );
     if ( !pFrame )
-        return 0;
+        return false;
 
     WPARAM nCommand = wParam & 0xFFF0;
 
@@ -4788,7 +4788,7 @@ static int ImplHandleSysCommand( HWND hWnd, WPARAM wParam, LPARAM lParam )
              (!bMaximize && (nCommand == SC_MAXIMIZE)) ||
              (bMaximize && (nCommand == SC_RESTORE)) )
         {
-            return TRUE;
+            return true;
         }
     }
 
@@ -4797,7 +4797,7 @@ static int ImplHandleSysCommand( HWND hWnd, WPARAM wParam, LPARAM lParam )
         // do not process SC_KEYMENU if we have a native menu
         // Windows should handle this
         if( GetMenu( hWnd ) )
-            return FALSE;
+            return false;
 
         // Process here KeyMenu events only for Alt to activate the MenuBar,
         // or if a SysChild window is in focus, as Alt-key-combinations are
@@ -4810,22 +4810,22 @@ static int ImplHandleSysCommand( HWND hWnd, WPARAM wParam, LPARAM lParam )
             // Also 32 for space, 99 for c, 100 for d, ...
             // As this is not documented, we check the state of the space-bar
             if ( GetKeyState( VK_SPACE ) & 0x8000 )
-                return 0;
+                return false;
 
             // to avoid activating the MenuBar for Alt+MouseKey
             if ( (GetKeyState( VK_LBUTTON ) & 0x8000) ||
                  (GetKeyState( VK_RBUTTON ) & 0x8000) ||
                  (GetKeyState( VK_MBUTTON ) & 0x8000) ||
                  (GetKeyState( VK_SHIFT )   & 0x8000) )
-                return 1;
+                return true;
 
             SalKeyEvent aKeyEvt;
             aKeyEvt.mnCode      = KEY_MENU;
             aKeyEvt.mnCharCode  = 0;
             aKeyEvt.mnRepeat    = 0;
-            long nRet = pFrame->CallCallback( SalEvent::KeyInput, &aKeyEvt );
+            bool nRet = pFrame->CallCallback( SalEvent::KeyInput, &aKeyEvt );
             pFrame->CallCallback( SalEvent::KeyUp, &aKeyEvt );
-            return int(nRet != 0);
+            return nRet;
         }
         else
         {
@@ -4857,15 +4857,15 @@ static int ImplHandleSysCommand( HWND hWnd, WPARAM wParam, LPARAM lParam )
                     aKeyEvt.mnCode     |= nModCode;
                     aKeyEvt.mnCharCode  = cKeyCode;
                     aKeyEvt.mnRepeat    = 0;
-                    long nRet = pFrame->CallCallback( SalEvent::KeyInput, &aKeyEvt );
+                    bool nRet = pFrame->CallCallback( SalEvent::KeyInput, &aKeyEvt );
                     pFrame->CallCallback( SalEvent::KeyUp, &aKeyEvt );
-                    return int(nRet != 0);
+                    return nRet;
                 }
             }
         }
     }
 
-    return FALSE;
+    return false;
 }
 
 static void ImplHandleInputLangChange( HWND hWnd, WPARAM, LPARAM lParam )
@@ -5509,7 +5509,7 @@ LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lP
             if ( LOWORD( lParam ) == HTCLIENT )
             {
                 ImplSalYieldMutexAcquireWithWait();
-                nRet = ImplHandleMouseActivateMsg( hWnd );
+                nRet = LRESULT(ImplHandleMouseActivateMsg( hWnd ));
                 ImplSalYieldMutexRelease();
                 if ( nRet )
                 {
@@ -5569,7 +5569,7 @@ LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lP
 
         case WM_SYSCOMMAND:
             ImplSalYieldMutexAcquireWithWait();
-            nRet = ImplHandleSysCommand( hWnd, wParam, lParam );
+            nRet = LRESULT(ImplHandleSysCommand( hWnd, wParam, lParam ));
             ImplSalYieldMutexRelease();
             if ( nRet )
                 rDef = FALSE;
commit 7742f5142b3bb598c103ed15b46bfcb50873a6a8
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Aug 18 10:10:51 2017 +0200

    loplugin:oncevar (clang-cl)
    
    Change-Id: I118da42ad7a42e4d081fd9901e230a0318a77f73

diff --git a/vcl/opengl/win/gdiimpl.cxx b/vcl/opengl/win/gdiimpl.cxx
index 41cbda7e7165..0836a3f27c4f 100644
--- a/vcl/opengl/win/gdiimpl.cxx
+++ b/vcl/opengl/win/gdiimpl.cxx
@@ -589,7 +589,7 @@ bool WinOpenGLContext::ImplInit()
 
     // now setup the shared context; this needs a temporary context already
     // set up in order to work
-    int attribs [] =
+    int const attribs [] =
     {
 #ifdef DBG_UTIL
         WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_DEBUG_BIT_ARB,
diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 9757c9692add..1eebd3b8f6f2 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -1144,11 +1144,10 @@ static bool ImplGetFontAttrFromFile( const OUString& rFontFileURL,
     rDFA.SetPitch(PITCH_DONTKNOW);
 
     // Create temporary file name
-    char aFileName[] = "soAAT.fot";
     char aResourceName[512];
     int nMaxLen = sizeof(aResourceName)/sizeof(*aResourceName) - 16;
     int nLen = ::GetTempPathA( nMaxLen, aResourceName );
-    ::strncpy( aResourceName + nLen, aFileName, std::max( 0, nMaxLen - nLen ));
+    ::strncpy( aResourceName + nLen, "soAAT.fot", std::max( 0, nMaxLen - nLen ));
     ::DeleteFileA( aResourceName );
 
     // Create font resource file (typically with a .fot file name extension).
commit 8106bea9e929922a1d97b0ef37b6474333fc1b85
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Aug 18 10:10:00 2017 +0200

    loplugin:nullptr (clang-cl)
    
    Change-Id: I2d4aea9829cc8057849ba4fb0b8a60b4f4d2054d

diff --git a/xmlsecurity/source/xmlsec/mscrypt/akmngr.cxx b/xmlsecurity/source/xmlsec/mscrypt/akmngr.cxx
index 38f37afdb538..17bf08e243ff 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/akmngr.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/akmngr.cxx
@@ -37,39 +37,39 @@
  */
 xmlSecKeysMngrPtr xmlSecMSCryptoAppliedKeysMngrCreate()
 {
-    xmlSecKeysMngrPtr        keyMngr = NULL ;
-    xmlSecKeyStorePtr        keyStore = NULL ;
+    xmlSecKeysMngrPtr        keyMngr = nullptr ;
+    xmlSecKeyStorePtr        keyStore = nullptr ;
 
     keyStore = xmlSecKeyStoreCreate(xmlSecMSCryptoKeysStoreId) ;
-    if (keyStore == NULL)
+    if (keyStore == nullptr)
     {
         xmlSecError(XMLSEC_ERRORS_HERE,
-                    NULL,
+                    nullptr,
                     "xmlSecKeyStoreCreate",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE) ;
-        return NULL ;
+        return nullptr ;
     }
 
     /*-
      * At present, MS Crypto engine do not provide a way to setup a key store.
      */
-    if (keyStore != NULL)
+    if (keyStore != nullptr)
     {
         /*TODO: binding key store.*/
     }
 
     keyMngr = xmlSecKeysMngrCreate() ;
-    if (keyMngr == NULL)
+    if (keyMngr == nullptr)
     {
         xmlSecError(XMLSEC_ERRORS_HERE,
-                    NULL,
+                    nullptr,
                     "xmlSecKeysMngrCreate",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE) ;
 
         xmlSecKeyStoreDestroy(keyStore) ;
-        return NULL ;
+        return nullptr ;
     }
 
     /*-
@@ -86,7 +86,7 @@ xmlSecKeysMngrPtr xmlSecMSCryptoAppliedKeysMngrCreate()
 
         xmlSecKeyStoreDestroy(keyStore) ;
         xmlSecKeysMngrDestroy(keyMngr) ;
-        return NULL ;
+        return nullptr ;
     }
 
     /*-
@@ -95,13 +95,13 @@ xmlSecKeysMngrPtr xmlSecMSCryptoAppliedKeysMngrCreate()
     if (xmlSecMSCryptoKeysMngrInit(keyMngr) < 0)
     {
         xmlSecError(XMLSEC_ERRORS_HERE,
-                    NULL,
+                    nullptr,
                     "xmlSecMSCryptoKeysMngrInit",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE) ;
 
         xmlSecKeysMngrDestroy(keyMngr) ;
-        return NULL ;
+        return nullptr ;
     }
 
     /*-
@@ -127,14 +127,14 @@ xmlSecMSCryptoAppliedKeysMngrAdoptKeyStore(
 {
     xmlSecKeyDataStorePtr x509Store ;
 
-    xmlSecAssert2(mngr != NULL, -1) ;
-    xmlSecAssert2(keyStore != NULL, -1) ;
+    xmlSecAssert2(mngr != nullptr, -1) ;
+    xmlSecAssert2(keyStore != nullptr, -1) ;
 
     x509Store = xmlSecKeysMngrGetDataStore(mngr, xmlSecMSCryptoX509StoreId) ;
-    if (x509Store == NULL)
+    if (x509Store == nullptr)
     {
         xmlSecError(XMLSEC_ERRORS_HERE,
-                    NULL,
+                    nullptr,
                     "xmlSecKeysMngrGetDataStore",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE) ;
@@ -162,14 +162,14 @@ xmlSecMSCryptoAppliedKeysMngrAdoptTrustedStore(
 {
     xmlSecKeyDataStorePtr x509Store ;
 
-    xmlSecAssert2(mngr != NULL, -1) ;
-    xmlSecAssert2(trustedStore != NULL, -1) ;
+    xmlSecAssert2(mngr != nullptr, -1) ;
+    xmlSecAssert2(trustedStore != nullptr, -1) ;
 
     x509Store = xmlSecKeysMngrGetDataStore(mngr, xmlSecMSCryptoX509StoreId) ;
-    if (x509Store == NULL)
+    if (x509Store == nullptr)
     {
         xmlSecError(XMLSEC_ERRORS_HERE,
-                    NULL,
+                    nullptr,
                     "xmlSecKeysMngrGetDataStore",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE) ;
@@ -197,14 +197,14 @@ xmlSecMSCryptoAppliedKeysMngrAdoptUntrustedStore(
 {
     xmlSecKeyDataStorePtr x509Store ;
 
-    xmlSecAssert2(mngr != NULL, -1) ;
-    xmlSecAssert2(untrustedStore != NULL, -1) ;
+    xmlSecAssert2(mngr != nullptr, -1) ;
+    xmlSecAssert2(untrustedStore != nullptr, -1) ;
 
     x509Store = xmlSecKeysMngrGetDataStore(mngr, xmlSecMSCryptoX509StoreId) ;
-    if (x509Store == NULL)
+    if (x509Store == nullptr)
     {
         xmlSecError(XMLSEC_ERRORS_HERE,
-                    NULL,
+                    nullptr,
                     "xmlSecKeysMngrGetDataStore",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE) ;
commit c38b3a9a12c4011505834580f29772ab539410f2
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Aug 18 10:09:25 2017 +0200

    loplugin:nullptr (clang-cl)
    
    Change-Id: I8eddd2cb43631d15a04f3edd3cf218232bda45af

diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index 21d1f2e4b74c..d6eb070dea0f 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -1166,7 +1166,7 @@ OUString ModelData_Impl::GetRecommendedDir( const OUString& aSuggestedDir )
         if( !bIsInTempPath )
         {
             wchar_t sPath[MAX_PATH+1];
-            HRESULT hRes = SHGetFolderPathW( NULL, CSIDL_INTERNET_CACHE, NULL, SHGFP_TYPE_CURRENT, sPath );
+            HRESULT hRes = SHGetFolderPathW( nullptr, CSIDL_INTERNET_CACHE, nullptr, SHGFP_TYPE_CURRENT, sPath );
             if( SUCCEEDED(hRes) )
             {
                 OUString sTempINetFiles;
commit a100b31f0de13ab8fbf66d77dd24a798ae96d9dd
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Aug 18 10:07:56 2017 +0200

    loplugin:oncevar (clang-cl)
    
    Change-Id: I36c97d99d268b0ebedfd0eebc4722cabc6e51220

diff --git a/extensions/source/activex/SOActiveX.cxx b/extensions/source/activex/SOActiveX.cxx
index c42683dfbc1f..9bcc32da5be4 100644
--- a/extensions/source/activex/SOActiveX.cxx
+++ b/extensions/source/activex/SOActiveX.cxx
@@ -158,7 +158,7 @@ CSOActiveX::CSOActiveX()
 , mbReadyForActivation( FALSE )
 , mbDrawLocked( FALSE )
 {
-    CLSID clsFactory = {0x82154420,0x0FBF,0x11d4,{0x83, 0x13,0x00,0x50,0x04,0x52,0x6A,0xB4}};
+    CLSID const clsFactory = {0x82154420,0x0FBF,0x11d4,{0x83, 0x13,0x00,0x50,0x04,0x52,0x6A,0xB4}};
     HRESULT hr = CoCreateInstance( clsFactory, nullptr, CLSCTX_ALL, __uuidof(IDispatch), reinterpret_cast<void**>(&mpDispFactory));
     if( !SUCCEEDED( hr ) )
         OutputError_Impl( nullptr, hr );
commit fd924b397b17e69dbf5721665d493d08c35fad59
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Aug 18 10:07:30 2017 +0200

    loplugin:oncevar (clang-cl)
    
    Change-Id: I0cbd9a87880070e2c1381ecd385c1fe4c3ad7505

diff --git a/embedserv/source/embed/ed_ipersiststr.cxx b/embedserv/source/embed/ed_ipersiststr.cxx
index 17d0bc002497..59099e572225 100644
--- a/embedserv/source/embed/ed_ipersiststr.cxx
+++ b/embedserv/source/embed/ed_ipersiststr.cxx
@@ -70,7 +70,7 @@ uno::Reference< io::XInputStream > createTempXInStreamFromIStream(
     uno::Reference < io::XOutputStream > xTempOut( io::TempFile::create(comphelper::getComponentContext(xFactory)),
                                                             uno::UNO_QUERY_THROW );
     ULARGE_INTEGER nNewPos;
-    LARGE_INTEGER aZero = { 0L, 0L };
+    LARGE_INTEGER const aZero = { 0L, 0L };
     HRESULT hr = pStream->Seek( aZero, STREAM_SEEK_SET, &nNewPos );
     if ( FAILED( hr ) ) return xResult;
 
@@ -129,10 +129,10 @@ HRESULT copyXTempOutToIStream( uno::Reference< io::XOutputStream > const & xTemp
 
     // Seek to zero and truncate the stream
     ULARGE_INTEGER nNewPos;
-    LARGE_INTEGER aZero = { 0L, 0L };
+    LARGE_INTEGER const aZero = { 0L, 0L };
     HRESULT hr = pStream->Seek( aZero, STREAM_SEEK_SET, &nNewPos );
     if ( FAILED( hr ) ) return E_FAIL;
-    ULARGE_INTEGER aUZero = { 0L, 0L };
+    ULARGE_INTEGER const aUZero = { 0L, 0L };
     hr = pStream->SetSize( aUZero );
     if ( FAILED( hr ) ) return E_FAIL;
 
@@ -505,7 +505,7 @@ STDMETHODIMP EmbedDocument_Impl::Load( IStorage *pStg )
     if ( SUCCEEDED( hr ) )
     {
         ULARGE_INTEGER nNewPos;
-        LARGE_INTEGER aZero = { 0L, 0L };
+        LARGE_INTEGER const aZero = { 0L, 0L };
         hr = m_pExtStream->Seek( aZero, STREAM_SEEK_SET, &nNewPos );
         if ( SUCCEEDED( hr ) )
         {
@@ -632,7 +632,7 @@ STDMETHODIMP EmbedDocument_Impl::Save( IStorage *pStgSave, BOOL fSameAsLoad )
             {
                 // no need to truncate the stream, the size of the stream is always the same
                 ULARGE_INTEGER nNewPos;
-                LARGE_INTEGER aZero = { 0L, 0L };
+                LARGE_INTEGER const aZero = { 0L, 0L };
                 hr = pNewExtStream->Seek( aZero, STREAM_SEEK_SET, &nNewPos );
                 if ( SUCCEEDED( hr ) )
                 {
@@ -810,7 +810,7 @@ STDMETHODIMP EmbedDocument_Impl::Load( LPCOLESTR pszFileName, DWORD /*dwMode*/ )
             {
                 // no need to truncate the stream, the size of the stream is always the same
                 ULARGE_INTEGER nNewPos;
-                LARGE_INTEGER aZero = { 0L, 0L };
+                LARGE_INTEGER const aZero = { 0L, 0L };
                 hr = m_pExtStream->Seek( aZero, STREAM_SEEK_SET, &nNewPos );
                 if ( SUCCEEDED( hr ) )
                 {
commit 8a62efcc846d27e5db2d37095bb79216a3230b9d
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Aug 18 10:05:56 2017 +0200

    missing include (--disable-pch)
    
    Change-Id: I4e8ae42e2e0c285d34098bebd637ad6d4abaf6a0

diff --git a/sal/osl/w32/pipe.cxx b/sal/osl/w32/pipe.cxx
index 8dfdec0831e8..0bb884785a00 100644
--- a/sal/osl/w32/pipe.cxx
+++ b/sal/osl/w32/pipe.cxx
@@ -27,6 +27,7 @@
 #include <osl/interlck.h>
 #include <osl/process.h>
 #include <rtl/alloc.h>
+#include <sal/log.hxx>
 
 #include <cassert>
 #include <string.h>
commit e1a75dc228fa7bb7c4c42dc9370fc3e51ff5e936
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Aug 18 10:05:20 2017 +0200

    loplugin:unreffun (clang-cl)
    
    Change-Id: I6e5789982789adc68a2e003aa6acff57639d5b5d

diff --git a/comphelper/source/windows/windows_process.cxx b/comphelper/source/windows/windows_process.cxx
index c9a41f5fc5d6..16ba61399b87 100644
--- a/comphelper/source/windows/windows_process.cxx
+++ b/comphelper/source/windows/windows_process.cxx
@@ -9,6 +9,8 @@
 #include <cstring>
 #include <cwchar>
 
+#include <comphelper/windowsStart.hxx>
+
 // Needed for CreateEnvironmentBlock
 #include <userenv.h>
 #pragma comment(lib, "userenv.lib")
@@ -163,17 +165,6 @@ MakeCommandLine(int argc, wchar_t **argv)
     return s;
 }
 
-/**
- * Launch a child process with the specified arguments.
- * @note argv[0] is ignored
- * @note The form of this function that takes char **argv expects UTF-8
- */
-BOOL
-WinLaunchChild(const wchar_t *exePath,
-               int argc, wchar_t **argv,
-               HANDLE userToken = nullptr,
-               HANDLE *hProcess = nullptr);
-
 BOOL
 WinLaunchChild(const wchar_t *exePath,
                int argc,
diff --git a/include/comphelper/windowsStart.hxx b/include/comphelper/windowsStart.hxx
index ce66ef933b68..590402528f7a 100644
--- a/include/comphelper/windowsStart.hxx
+++ b/include/comphelper/windowsStart.hxx
@@ -10,6 +10,11 @@
 #include <windows.h>
 #endif
 
+/**
+ * Launch a child process with the specified arguments.
+ * @note argv[0] is ignored
+ * @note The form of this function that takes char **argv expects UTF-8
+ */
 
 BOOL
 WinLaunchChild(const wchar_t *exePath, int argc,
commit 454c4380a4ab5574d5454d9659b7167845823c48
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Aug 18 10:04:43 2017 +0200

    loplugin:cstylecast (clang-cl)
    
    Change-Id: Id3f66842829a4b86f7980f0c1cbfe6e56e958e9c

diff --git a/comphelper/source/windows/windows_process.cxx b/comphelper/source/windows/windows_process.cxx
index 1a404785536a..c9a41f5fc5d6 100644
--- a/comphelper/source/windows/windows_process.cxx
+++ b/comphelper/source/windows/windows_process.cxx
@@ -143,7 +143,7 @@ MakeCommandLine(int argc, wchar_t **argv)
     if (len == 0)
         len = 1;
 
-    wchar_t *s = (wchar_t*) malloc(len * sizeof(wchar_t));
+    wchar_t *s = static_cast<wchar_t*>(malloc(len * sizeof(wchar_t)));
     if (!s)
         return nullptr;
 
@@ -259,7 +259,7 @@ WinLaunchChild(const wchar_t *exePath,
                       nullptr,
                       GetLastError(),
                       MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
-                      (LPTSTR) &lpMsgBuf,
+                      reinterpret_cast<LPTSTR>(&lpMsgBuf),
                       0,
                       nullptr);
         wprintf(L"Error restarting: %s\n", lpMsgBuf ? lpMsgBuf : L"(null)");
commit dd066778de7d367b8990874d5472374fa5577b90
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Aug 18 10:03:16 2017 +0200

    -Werror,-Wmissing-field-initializers (clang-cl)
    
    Change-Id: I77b6fb2b9fe8e93f279f29a19f67079f5f81d1b7

diff --git a/comphelper/source/windows/windows_process.cxx b/comphelper/source/windows/windows_process.cxx
index bd77f70eabdc..1a404785536a 100644
--- a/comphelper/source/windows/windows_process.cxx
+++ b/comphelper/source/windows/windows_process.cxx
@@ -6,6 +6,7 @@
 #include <shellapi.h>
 
 #include <cstddef>
+#include <cstring>
 #include <cwchar>
 
 // Needed for CreateEnvironmentBlock
@@ -189,10 +190,12 @@ WinLaunchChild(const wchar_t *exePath,
         return FALSE;
     }
 
-    STARTUPINFOW si = {0};
+    STARTUPINFOW si;
+    std::memset(&si, 0, sizeof si);
     si.cb = sizeof(STARTUPINFOW);
     si.lpDesktop = const_cast<LPWSTR>(L"winsta0\\Default");
-    PROCESS_INFORMATION pi = {0};
+    PROCESS_INFORMATION pi;
+    std::memset(&pi, 0, sizeof pi);
 
     if (userToken == nullptr)
     {
commit 210f57d026e5e534e64e7bd84f5750b7248f79d2
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Aug 18 10:01:28 2017 +0200

    -Werror,-Wwritable-strings (clang-cl)
    
    Change-Id: Ic3a23c8290021b4bffe770651269ccf792b7c632

diff --git a/comphelper/source/windows/windows_process.cxx b/comphelper/source/windows/windows_process.cxx
index b7fa19373dc2..bd77f70eabdc 100644
--- a/comphelper/source/windows/windows_process.cxx
+++ b/comphelper/source/windows/windows_process.cxx
@@ -191,7 +191,7 @@ WinLaunchChild(const wchar_t *exePath,
 
     STARTUPINFOW si = {0};
     si.cb = sizeof(STARTUPINFOW);
-    si.lpDesktop = L"winsta0\\Default";
+    si.lpDesktop = const_cast<LPWSTR>(L"winsta0\\Default");
     PROCESS_INFORMATION pi = {0};
 
     if (userToken == nullptr)


More information about the Libreoffice-commits mailing list