[Libreoffice-commits] core.git: 12 commits - canvas/source connectivity/source dtrans/source embedserv/source extensions/source fpicker/source sal/osl shell/source tools/source vcl/opengl vcl/qa vcl/win winaccessibility/source xmlsecurity/source

Stephan Bergmann sbergman at redhat.com
Mon Jul 3 12:05:17 UTC 2017


 canvas/source/directx/dx_9rm.cxx                              |    6 -
 connectivity/source/drivers/ado/ADatabaseMetaData.cxx         |    4 -
 connectivity/source/drivers/ado/APreparedStatement.cxx        |    3 
 connectivity/source/drivers/ado/Awrapado.cxx                  |    6 -
 dtrans/source/win32/clipb/MtaOleClipb.cxx                     |    4 -
 dtrans/source/win32/dtobj/FetcList.cxx                        |    3 
 embedserv/source/embed/docholder.cxx                          |    3 
 embedserv/source/embed/ed_ioleobject.cxx                      |    4 -
 extensions/source/abpilot/typeselectionpage.cxx               |    8 +-
 extensions/source/ole/oleobjw.cxx                             |    6 -
 extensions/source/ole/unoobjw.cxx                             |   32 ++--------
 extensions/source/ole/unotypewrapper.cxx                      |    6 -
 fpicker/source/win32/filepicker/VistaFilePicker.cxx           |    3 
 sal/osl/w32/file.cxx                                          |    4 -
 sal/osl/w32/process.cxx                                       |    5 -
 sal/osl/w32/profile.cxx                                       |    4 -
 sal/osl/w32/salinit.cxx                                       |    4 -
 sal/osl/w32/security.cxx                                      |    3 
 sal/osl/w32/socket.cxx                                        |    3 
 shell/source/backends/wininetbe/wininetbackend.cxx            |    4 -
 shell/source/win32/simplemail/senddoc.cxx                     |    2 
 tools/source/generic/fract.cxx                                |    6 +
 vcl/opengl/win/WinDeviceInfo.cxx                              |    6 -
 vcl/qa/cppunit/blocklistparsertest.cxx                        |   10 +--
 vcl/win/app/salinfo.cxx                                       |    4 -
 vcl/win/app/saltimer.cxx                                      |    2 
 vcl/win/gdi/salfont.cxx                                       |    2 
 vcl/win/gdi/salgdi.cxx                                        |    2 
 winaccessibility/source/UAccCOM/AccEditableText.cxx           |    3 
 winaccessibility/source/service/AccContainerEventListener.cxx |    3 
 xmlsecurity/source/pdfio/pdfdocument.cxx                      |    3 
 xmlsecurity/source/xmlsec/nss/nssinitializer.cxx              |    8 +-
 32 files changed, 64 insertions(+), 102 deletions(-)

New commits:
commit bce779932b59990fbdf8278993f8bb9514781de2
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Jul 3 14:04:38 2017 +0200

    loplugin:oncevar (clang-cl): xmlsecurity
    
    Change-Id: Ic5e4dac2626474dd3d44ef5097522bc7e2207cd1

diff --git a/xmlsecurity/source/pdfio/pdfdocument.cxx b/xmlsecurity/source/pdfio/pdfdocument.cxx
index 5420196df7d8..68619d7047f7 100644
--- a/xmlsecurity/source/pdfio/pdfdocument.cxx
+++ b/xmlsecurity/source/pdfio/pdfdocument.cxx
@@ -805,8 +805,7 @@ bool ValidateSignature(SvStream& rStream, vcl::filter::PDFObjectElement* pSignat
              * { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9)
              *   smime(16) id-aa(2) 47 }
              */
-            OString aOid("1.2.840.113549.1.9.16.2.47");
-            if (aOid == rAttr.pszObjId)
+            if (OString("1.2.840.113549.1.9.16.2.47") == rAttr.pszObjId)
             {
                 rInformation.bHasSigningCertificate = true;
                 break;
diff --git a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
index f4f5a7212373..e9ba525ff2f5 100644
--- a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
+++ b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
@@ -239,8 +239,6 @@ OString getMozillaCurrentProfile( const css::uno::Reference< css::uno::XComponen
 //was successful and therefore NSS_Shutdown should be called when terminating.
 bool nsscrypto_initialize( const css::uno::Reference< css::uno::XComponentContext > &rxContext, bool & out_nss_init )
 {
-    bool return_value = true;
-
     // this method must be called only once, no need for additional lock
     OString sCertDir;
 
@@ -290,6 +288,8 @@ bool nsscrypto_initialize( const css::uno::Reference< css::uno::XComponentContex
     out_nss_init = true;
 
 #ifdef XMLSEC_CRYPTO_NSS
+    bool return_value = true;
+
 #if defined SYSTEM_NSS
     if (!SECMOD_HasRootCerts())
 #endif
@@ -343,9 +343,11 @@ bool nsscrypto_initialize( const css::uno::Reference< css::uno::XComponentContex
             return_value = false;
         }
     }
-#endif
 
     return return_value;
+#else
+    return true;
+#endif
 }
 
 } // namespace
commit 015269478d77da29dd21e35348d7296fbf4ad903
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Jul 3 14:04:30 2017 +0200

    loplugin:oncevar (clang-cl): winaccessibility
    
    Change-Id: I26dca32ba03c7fe163886ebcd4a6a8bc4871b065

diff --git a/winaccessibility/source/UAccCOM/AccEditableText.cxx b/winaccessibility/source/UAccCOM/AccEditableText.cxx
index e2cf3d3729be..5e63597bf937 100644
--- a/winaccessibility/source/UAccCOM/AccEditableText.cxx
+++ b/winaccessibility/source/UAccCOM/AccEditableText.cxx
@@ -228,11 +228,10 @@ STDMETHODIMP CAccEditableText::setAttributes(long startOffset, long endOffset, B
     ::rtl::OUString ouStr(reinterpret_cast<sal_Unicode const *>(*attributes));
 
     sal_Int32 nIndex = 0;
-    sal_Unicode cTok = ';';
     vector< ::rtl::OUString > vecAttr;
     do
     {
-        ::rtl::OUString ouToken = ouStr.getToken(0, cTok, nIndex);
+        ::rtl::OUString ouToken = ouStr.getToken(0, ';', nIndex);
         vecAttr.push_back(ouToken);
     }
     while(nIndex >= 0);
diff --git a/winaccessibility/source/service/AccContainerEventListener.cxx b/winaccessibility/source/service/AccContainerEventListener.cxx
index b26ee70fd85a..f275eafcf51f 100644
--- a/winaccessibility/source/service/AccContainerEventListener.cxx
+++ b/winaccessibility/source/service/AccContainerEventListener.cxx
@@ -429,7 +429,6 @@ void AccContainerEventListener::HandleValueChangedEvent(Any, Any)
 
 bool AccContainerEventListener::IsEditable(Reference<XAccessibleContext> const & xContext)
 {
-    bool ret = false;
     Reference< XAccessibleStateSet > pRState = xContext->getAccessibleStateSet();
     if( !pRState.is() )
         return false;
@@ -441,7 +440,7 @@ bool AccContainerEventListener::IsEditable(Reference<XAccessibleContext> const &
         if(pStates[iIndex] == AccessibleStateType::EDITABLE)
             return true;
     }
-    return ret;
+    return false;
 }
 
 bool AccContainerEventListener::NotifyChildEvent(short nWinEvent,const Any &Value)
commit d6b625058404cfc0bbccf8180c27419812f8d7ba
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Jul 3 14:04:23 2017 +0200

    loplugin:oncevar (clang-cl): vcl
    
    Change-Id: I0459978c2cfb61cd7251f0e8d9a30f1f19c02c11

diff --git a/vcl/opengl/win/WinDeviceInfo.cxx b/vcl/opengl/win/WinDeviceInfo.cxx
index 8dfca479626b..383cce8d6b98 100644
--- a/vcl/opengl/win/WinDeviceInfo.cxx
+++ b/vcl/opengl/win/WinDeviceInfo.cxx
@@ -626,7 +626,6 @@ void WinOpenGLDeviceInfo::GetData()
         DWORD memberIndex = 0;
 
         devinfoData.cbSize = sizeof(devinfoData);
-        OUString aDriverKeyPre("System\\CurrentControlSet\\Control\\Class\\");
         /* enumerate device information elements in the device information set */
         while (SetupDiEnumDeviceInfo(devinfo, memberIndex++, &devinfoData))
         {
@@ -639,7 +638,7 @@ void WinOpenGLDeviceInfo::GetData()
                         sizeof(value),
                         nullptr))
             {
-                OUString  driverKey(aDriverKeyPre);
+                OUString  driverKey("System\\CurrentControlSet\\Control\\Class\\");
                 driverKey += SAL_U(value);
                 result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, SAL_W(driverKey.getStr()), 0, KEY_QUERY_VALUE, &key);
                 if (result == ERROR_SUCCESS)
@@ -715,7 +714,6 @@ void WinOpenGLDeviceInfo::GetData()
             uint32_t adapterVendorID2;
             uint32_t adapterDeviceID2;
 
-            OUString aDriverKeyPre("System\\CurrentControlSet\\Control\\Class\\");
             /* enumerate device information elements in the device information set */
             while (SetupDiEnumDeviceInfo(devinfo, memberIndex++, &devinfoData))
             {
@@ -728,7 +726,7 @@ void WinOpenGLDeviceInfo::GetData()
                             sizeof(value),
                             nullptr))
                 {
-                    OUString driverKey2(aDriverKeyPre);
+                    OUString driverKey2("System\\CurrentControlSet\\Control\\Class\\");
                     driverKey2 += SAL_U(value);
                     result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, SAL_W(driverKey2.getStr()), 0, KEY_QUERY_VALUE, &key);
                     if (result == ERROR_SUCCESS)
diff --git a/vcl/qa/cppunit/blocklistparsertest.cxx b/vcl/qa/cppunit/blocklistparsertest.cxx
index ddad53b94a27..228e4bad9377 100644
--- a/vcl/qa/cppunit/blocklistparsertest.cxx
+++ b/vcl/qa/cppunit/blocklistparsertest.cxx
@@ -118,11 +118,11 @@ void BlocklistParserTest::testEvaluate()
     OUString vendorIntel = WinOpenGLDeviceInfo::GetDeviceVendor(wgl::VendorIntel);
     OUString vendorMicrosoft = WinOpenGLDeviceInfo::GetDeviceVendor(wgl::VendorMicrosoft);
 
-    uint32_t osWindowsXP = 0x00050001;
-    uint32_t osWindowsVista = 0x00060000;
-    uint32_t osWindows7 = 0x00060001;
-    uint32_t osWindows8 = 0x00060002;
-    uint32_t osWindows10 = 0x000A0000;
+    uint32_t const osWindowsXP = 0x00050001;
+    uint32_t const osWindowsVista = 0x00060000;
+    uint32_t const osWindows7 = 0x00060001;
+    uint32_t const osWindows8 = 0x00060002;
+    uint32_t const osWindows10 = 0x000A0000;
 
     // Check OS
     CPPUNIT_ASSERT_EQUAL(true, WinOpenGLDeviceInfo::FindBlocklistedDeviceInList(
diff --git a/vcl/win/app/salinfo.cxx b/vcl/win/app/salinfo.cxx
index 06729eca4713..815582c8e2a5 100644
--- a/vcl/win/app/salinfo.cxx
+++ b/vcl/win/app/salinfo.cxx
@@ -166,14 +166,12 @@ tools::Rectangle WinSalSystem::GetDisplayScreenPosSizePixel( unsigned int nScree
 
 int WinSalSystem::ShowNativeMessageBox(const OUString& rTitle, const OUString& rMessage)
 {
-    int nFlags = MB_TASKMODAL | MB_SETFOREGROUND | MB_ICONWARNING | MB_DEFBUTTON1;
-
     ImplHideSplash();
     return MessageBoxW(
         nullptr,
         reinterpret_cast<LPCWSTR>(rMessage.getStr()),
         reinterpret_cast<LPCWSTR>(rTitle.getStr()),
-        nFlags);
+        MB_TASKMODAL | MB_SETFOREGROUND | MB_ICONWARNING | MB_DEFBUTTON1);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/win/app/saltimer.cxx b/vcl/win/app/saltimer.cxx
index 8a21780e6d1e..de213deaee7b 100644
--- a/vcl/win/app/saltimer.cxx
+++ b/vcl/win/app/saltimer.cxx
@@ -150,7 +150,7 @@ void EmitTimerCallback()
     // try this a short time later again.
     if (pSVData->mpSalTimer && ImplSalYieldMutexTryToAcquire())
     {
-        bool idle = true; // TODO
+        bool const idle = true; // TODO
         pSVData->mpSalTimer->CallCallback( idle );
         ImplSalYieldMutexRelease();
 
diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 942898364291..9757c9692add 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -1078,7 +1078,7 @@ bool ImplAddTempFont( SalData& rSalData, const OUString& rFontFileURL )
         aFileName[2] = sal::static_int_cast<char>('A' + (15 & (nCounter>>4)));
         aFileName[3] = sal::static_int_cast<char>('A' + (15 & nCounter));
         char aResourceName[512];
-        int nMaxLen = sizeof(aResourceName)/sizeof(*aResourceName) - 16;
+        int const nMaxLen = sizeof(aResourceName)/sizeof(*aResourceName) - 16;
         int nLen = ::GetTempPathA( nMaxLen, aResourceName );
         ::strncpy( aResourceName + nLen, aFileName, sizeof( aResourceName )- nLen );
         // security: end buffer in any case
diff --git a/vcl/win/gdi/salgdi.cxx b/vcl/win/gdi/salgdi.cxx
index 4b60ad681d88..0a85a3059ea5 100644
--- a/vcl/win/gdi/salgdi.cxx
+++ b/vcl/win/gdi/salgdi.cxx
@@ -225,7 +225,7 @@ void ImplInitSalGDI()
         if( pSalData->mhDitherPal )
         {
             // create DIBPattern for 8Bit dithering
-            long nSize = sizeof( BITMAPINFOHEADER ) + ( 256 * sizeof( short ) ) + 64;
+            long const nSize = sizeof( BITMAPINFOHEADER ) + ( 256 * sizeof( short ) ) + 64;
             long n;
 
             pSalData->mhDitherDIB = GlobalAlloc( GMEM_FIXED, nSize );
commit 1e5e504b2f88fb29a823663fae505863ac00f593
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Jul 3 14:04:18 2017 +0200

    loplugin:oncevar (clang-cl): tools
    
    Change-Id: I6670c2fd0c5897939b16874ed2106475fa948d2d

diff --git a/tools/source/generic/fract.cxx b/tools/source/generic/fract.cxx
index afcb2e60ba42..7f35dd00907b 100644
--- a/tools/source/generic/fract.cxx
+++ b/tools/source/generic/fract.cxx
@@ -483,10 +483,11 @@ static int impl_NumberOfBits( unsigned long nNum )
     nNum |= ( nNum >> 16 );
 
     sal_uInt32 nNumber;
-    int nBonus = 0;
+    int nBonus;
 
 #if SAL_TYPES_SIZEOFLONG == 4
     nNumber = nNum;
+    nBonus = 0;
 #elif SAL_TYPES_SIZEOFLONG == 8
     nNum |= ( nNum >> 32 );
 
@@ -499,7 +500,10 @@ static int impl_NumberOfBits( unsigned long nNum )
             return 32;
     }
     else
+    {
         nNumber = sal_uInt32( nNum & 0xFFFFFFFF );
+        nBonus = 0;
+    }
 #else
 #error "Unknown size of long!"
 #endif
commit 6507c0271f081d93ddf68dac25abfe4bd46f0554
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Jul 3 14:04:11 2017 +0200

    loplugin:oncevar (clang-cl): shell
    
    Change-Id: I594596f27aa6f223d2294586357b11595377e1fe

diff --git a/shell/source/backends/wininetbe/wininetbackend.cxx b/shell/source/backends/wininetbe/wininetbackend.cxx
index cfc7787f4c67..d6af801ad9b0 100644
--- a/shell/source/backends/wininetbe/wininetbackend.cxx
+++ b/shell/source/backends/wininetbe/wininetbackend.cxx
@@ -166,10 +166,8 @@ WinInetBackend::WinInetBackend()
             OUString aProxyBypassList = OUString::createFromAscii( lpi->lpszProxyBypass );
 
             // override default for ProxyType, which is "0" meaning "No proxies".
-            sal_Int32 nProperties = 1;
-
             valueProxyType_.IsPresent = true;
-            valueProxyType_.Value <<= nProperties;
+            valueProxyType_.Value <<= sal_Int32(1);
 
             // fill proxy bypass list
             if( aProxyBypassList.getLength() > 0 )
diff --git a/shell/source/win32/simplemail/senddoc.cxx b/shell/source/win32/simplemail/senddoc.cxx
index 1b0327dc18c8..bd78f26e5635 100644
--- a/shell/source/win32/simplemail/senddoc.cxx
+++ b/shell/source/win32/simplemail/senddoc.cxx
@@ -264,7 +264,7 @@ int main(int argc, char* argv[])
         // selection dialog must appear because we specify no
         // profile name, so the user has to specify a profile
 
-        LHANDLE hSession = 0;
+        LHANDLE const hSession = 0;
 
         MapiRecipDesc mapiOriginator;
         MapiRecipientList_t mapiRecipientList;
commit a3bb6af1c2520b4bbb98a49bd7beed497d2d08b1
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Jul 3 14:04:06 2017 +0200

    loplugin:oncevar (clang-cl): sal
    
    Change-Id: Ib43dd6f8c96274d251bbf5935888789964ba3f9b

diff --git a/sal/osl/w32/file.cxx b/sal/osl/w32/file.cxx
index a2fea0ce1fed..43f04ba92310 100644
--- a/sal/osl/w32/file.cxx
+++ b/sal/osl/w32/file.cxx
@@ -711,7 +711,7 @@ oslFileError SAL_CALL osl_openFile(
     if (result != osl_File_E_None)
         return result;
 
-    DWORD dwAccess = GENERIC_READ, dwShare = FILE_SHARE_READ, dwCreation = 0, dwAttributes = 0;
+    DWORD dwAccess = GENERIC_READ, dwShare = FILE_SHARE_READ, dwCreation = 0;
 
     if (uFlags & osl_File_OpenFlag_Write)
         dwAccess |= GENERIC_WRITE;
@@ -728,7 +728,7 @@ oslFileError SAL_CALL osl_openFile(
 
     HANDLE hFile = CreateFileW(
         SAL_W(rtl_uString_getStr(strSysPath)),
-        dwAccess, dwShare, nullptr, dwCreation, dwAttributes, nullptr);
+        dwAccess, dwShare, nullptr, dwCreation, 0, nullptr);
 
     // @@@ ERROR HANDLING @@@
     if (!IsValidHandle(hFile))
diff --git a/sal/osl/w32/process.cxx b/sal/osl/w32/process.cxx
index 6d86ae58bad8..528d6ad2409b 100644
--- a/sal/osl/w32/process.cxx
+++ b/sal/osl/w32/process.cxx
@@ -76,7 +76,7 @@ oslProcessError SAL_CALL osl_terminateProcess(oslProcess Process)
     // that the handle doesn't have the appropriate level of access...
 
     // see https://msdn.microsoft.com/en-au/library/windows/desktop/ms684880(v=vs.85).aspx
-    DWORD dwAccessFlags = (PROCESS_CREATE_THREAD | PROCESS_QUERY_INFORMATION | PROCESS_VM_OPERATION
+    DWORD const dwAccessFlags = (PROCESS_CREATE_THREAD | PROCESS_QUERY_INFORMATION | PROCESS_VM_OPERATION
                                     | PROCESS_VM_WRITE | PROCESS_VM_READ);
 
     BOOL bHaveDuplHdl = DuplicateHandle(GetCurrentProcess(),    // handle to process that has handle
@@ -105,7 +105,6 @@ oslProcessError SAL_CALL osl_terminateProcess(oslProcess Process)
         // process
 
         DWORD dwTID = 0;    // dummy variable as we don't need to track the thread ID
-        UINT uExitCode = 0; // dummy variable... ExitProcess has no return value
 
         // Note: we want to call on ExitProcess() and not TerminateProcess() - this is
         // because with ExitProcess() Windows notifies all attached dlls that the process
@@ -121,7 +120,7 @@ oslProcessError SAL_CALL osl_terminateProcess(oslProcess Process)
                             0,                  /* initial size of stack in bytes is default
                                                    size for executable */
                             reinterpret_cast<LPTHREAD_START_ROUTINE>(pfnExitProc), /* Win32 ExitProcess() */
-                            reinterpret_cast<PVOID>(uExitCode),   /* ExitProcess() dummy return... */
+                            reinterpret_cast<PVOID>(UINT(0)), /* ExitProcess(UINT uExitCode) argument */
                             0,                  /* value of 0 tells thread to run immediately
                                                    after creation */
                             &dwTID);            /* new remote thread's identifier */
diff --git a/sal/osl/w32/profile.cxx b/sal/osl/w32/profile.cxx
index 66db4be6386b..97eb10f1eb07 100644
--- a/sal/osl/w32/profile.cxx
+++ b/sal/osl/w32/profile.cxx
@@ -1744,8 +1744,6 @@ static osl_TFile* osl_openTmpProfileImpl(osl_TProfileImpl* pProfile)
 
 static bool osl_ProfileSwapProfileNames(osl_TProfileImpl* pProfile)
 {
-    bool bRet = false;
-
     rtl_uString* ustrBakFile=nullptr;
     rtl_uString* ustrTmpFile=nullptr;
     rtl_uString* ustrIniFile=nullptr;
@@ -1778,7 +1776,7 @@ static bool osl_ProfileSwapProfileNames(osl_TProfileImpl* pProfile)
     /* rename tmp ini */
     MoveFileExW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( ustrTmpFile )), reinterpret_cast<LPCWSTR>(rtl_uString_getStr( ustrIniFile )), MOVEFILE_COPY_ALLOWED | MOVEFILE_WRITE_THROUGH );
 
-    return bRet;
+    return false;
 }
 
 static rtl_uString* osl_ProfileGenerateExtension(rtl_uString* ustrFileName, rtl_uString* ustrExtension)
diff --git a/sal/osl/w32/salinit.cxx b/sal/osl/w32/salinit.cxx
index 2b7d338589f6..e3bd9208fc86 100644
--- a/sal/osl/w32/salinit.cxx
+++ b/sal/osl/w32/salinit.cxx
@@ -65,8 +65,8 @@ void sal_detail_initialize(int argc, char ** argv)
     error = WSAStartup(wVersionRequested, &wsaData);
     if ( 0 == error )
     {
-        WORD wMajorVersionRequired = 1;
-        WORD wMinorVersionRequired = 1;
+        WORD const wMajorVersionRequired = 1;
+        WORD const wMinorVersionRequired = 1;
 
         if ((LOBYTE(wsaData.wVersion) <  wMajorVersionRequired) ||
             ((LOBYTE(wsaData.wVersion) == wMajorVersionRequired) &&
diff --git a/sal/osl/w32/security.cxx b/sal/osl/w32/security.cxx
index 591e6b6b42c9..eba02216fa70 100644
--- a/sal/osl/w32/security.cxx
+++ b/sal/osl/w32/security.cxx
@@ -335,7 +335,6 @@ sal_Bool SAL_CALL osl_getUserIdent(oslSecurity Security, rtl_uString **strIdent)
                 PSID pSid = reinterpret_cast<PTOKEN_USER>(pInfoBuffer)->User.Sid;
                 PSID_IDENTIFIER_AUTHORITY psia;
                 DWORD dwSubAuthorities;
-                DWORD dwSidRev=SID_REVISION;
                 DWORD dwCounter;
                 DWORD dwSidSize;
                 PUCHAR pSSACount;
@@ -351,7 +350,7 @@ sal_Bool SAL_CALL osl_getUserIdent(oslSecurity Security, rtl_uString **strIdent)
                 Ident=static_cast<sal_Char *>(malloc(88*sizeof(sal_Char)));
 
                 /* prepare S-SID_REVISION- */
-                dwSidSize=wsprintf(Ident, TEXT("S-%lu-"), dwSidRev);
+                dwSidSize=wsprintf(Ident, TEXT("S-%lu-"), SID_REVISION);
 
                 /* prepare SidIdentifierAuthority */
                 if ((psia->Value[0] != 0) || (psia->Value[1] != 0))
diff --git a/sal/osl/w32/socket.cxx b/sal/osl/w32/socket.cxx
index c1f5b461fc24..9074de45353b 100644
--- a/sal/osl/w32/socket.cxx
+++ b/sal/osl/w32/socket.cxx
@@ -1888,7 +1888,6 @@ sal_Int32 SAL_CALL osl_demultiplexSocketEvents (
     oslSocketSet OutOfBandSet,
     const TimeValue* pTimeout)
 {
-    int             MaxHandle= 0;
     struct timeval  tv;
 
     if(pTimeout)
@@ -1898,7 +1897,7 @@ sal_Int32 SAL_CALL osl_demultiplexSocketEvents (
         tv.tv_usec = pTimeout->Nanosec / 1000L;
     }
 
-    return select(MaxHandle,                /* redundant in WIN32 */
+    return select(0,                /* redundant in WIN32 */
                   IncomingSet ? &IncomingSet->m_Set : nullptr,
                   OutgoingSet ? &OutgoingSet->m_Set : nullptr,
                   OutOfBandSet ? &OutOfBandSet->m_Set : nullptr,
commit 065a8ea524dacb8bda2ee00d0a6a08964823e0f5
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Jul 3 14:04:00 2017 +0200

    loplugin:oncevar (clang-cl): fpicker
    
    Change-Id: I13e11f07a8022b315ffa80282575472bcb0c3acc

diff --git a/fpicker/source/win32/filepicker/VistaFilePicker.cxx b/fpicker/source/win32/filepicker/VistaFilePicker.cxx
index f0481f5a756b..449be62fb848 100644
--- a/fpicker/source/win32/filepicker/VistaFilePicker.cxx
+++ b/fpicker/source/win32/filepicker/VistaFilePicker.cxx
@@ -243,9 +243,8 @@ void VistaFilePicker::ensureInit()
 
     if ( !bInitialized )
     {
-        sal_Int16 nTemplateDescription = css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE;
         css::uno::Sequence < css::uno::Any > aInitArguments(1);
-        aInitArguments[0] <<= nTemplateDescription;
+        aInitArguments[0] <<= css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE;
         initialize(aInitArguments);
     }
 }
commit 602867578e1e1c1d2cd89a6ef619c729482a0617
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Jul 3 14:03:53 2017 +0200

    loplugin:oncevar (clang-cl): extensions
    
    Change-Id: I70cac146d09f015db3f7889f3cdd46c00c45c41a

diff --git a/extensions/source/abpilot/typeselectionpage.cxx b/extensions/source/abpilot/typeselectionpage.cxx
index f96a509cee32..1a730477b6ea 100644
--- a/extensions/source/abpilot/typeselectionpage.cxx
+++ b/extensions/source/abpilot/typeselectionpage.cxx
@@ -66,12 +66,11 @@ namespace abp
         // - MORK, THUNDERBIRD
         // - OTHER
 
+#if !defined(_WIN32)
         bool bHaveEvolution = false;
         bool bHaveKab = false;
         bool bHaveMacab = false;
 
-#if !defined(_WIN32)
-
         Reference< XDriverManager2 > xManager = DriverManager::create( _pParent->getORB() );
 
         try
@@ -106,7 +105,10 @@ namespace abp
         catch(...)
         {
         }
-
+#else
+        bool const bHaveEvolution = false;
+        bool const bHaveKab = false;
+        bool const bHaveMacab = false;
 #endif
 
         // Items are displayed in list order
diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx
index b7c2664a2ebf..414e707c9b15 100644
--- a/extensions/source/ole/oleobjw.cxx
+++ b/extensions/source/ole/oleobjw.cxx
@@ -1389,10 +1389,9 @@ uno::Any SAL_CALL IUnknownWrapper_Impl::directInvoke( const OUString& aName, con
 
         dispparams.rgvarg = arArgs;
         // invoking OLE method
-        DWORD localeId = LOCALE_USER_DEFAULT;
         hInvRes = m_spDispatch->Invoke( dispid,
                                         IID_NULL,
-                                        localeId,
+                                        LOCALE_USER_DEFAULT,
                                         ::sal::static_int_cast< WORD, INVOKEKIND >( pInvkinds[nStep] ),
                                         &dispparams,
                                         &varResult,
@@ -1957,10 +1956,9 @@ Any  IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc,
     }
     dispparams.rgvarg= arArgs;
     // invoking OLE method
-    DWORD localeId = LOCALE_USER_DEFAULT;
     result = m_spDispatch->Invoke(aFuncDesc->memid,
                                  IID_NULL,
-                                 localeId,
+                                 LOCALE_USER_DEFAULT,
                                  ::sal::static_int_cast< WORD, INVOKEKIND >( aFuncDesc->invkind ),
                                  &dispparams,
                                  &varResult,
diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx
index be441c67e3a3..816360853cca 100644
--- a/extensions/source/ole/unoobjw.cxx
+++ b/extensions/source/ole/unoobjw.cxx
@@ -1156,9 +1156,7 @@ HRESULT InterfaceOleWrapper_Impl::InvokeGeneral( DISPID dispidMember, unsigned s
 
 STDMETHODIMP InterfaceOleWrapper_Impl::GetDispID(BSTR /*bstrName*/, DWORD /*grfdex*/, DISPID __RPC_FAR* /*pid*/)
 {
-    HRESULT ret = ResultFromScode(E_NOTIMPL);
-
-    return ret;
+    return ResultFromScode(E_NOTIMPL);
 }
 
 STDMETHODIMP InterfaceOleWrapper_Impl::InvokeEx(
@@ -1170,25 +1168,19 @@ STDMETHODIMP InterfaceOleWrapper_Impl::InvokeEx(
     /* [out] */ EXCEPINFO __RPC_FAR* /*pei*/,
     /* [unique][in] */ IServiceProvider __RPC_FAR* /*pspCaller*/)
 {
-    HRESULT ret = ResultFromScode(E_NOTIMPL);
-
-    return ret;
+    return ResultFromScode(E_NOTIMPL);
 }
 
 STDMETHODIMP InterfaceOleWrapper_Impl::DeleteMemberByName(
     /* [in] */ BSTR /*bstr*/,
     /* [in] */ DWORD /*grfdex*/)
 {
-    HRESULT ret = ResultFromScode(E_NOTIMPL);
-
-    return ret;
+    return ResultFromScode(E_NOTIMPL);
 }
 
 STDMETHODIMP InterfaceOleWrapper_Impl::DeleteMemberByDispID(DISPID /*id*/)
 {
-    HRESULT ret = ResultFromScode(E_NOTIMPL);
-
-    return ret;
+    return ResultFromScode(E_NOTIMPL);
 }
 
 STDMETHODIMP InterfaceOleWrapper_Impl::GetMemberProperties(
@@ -1196,18 +1188,14 @@ STDMETHODIMP InterfaceOleWrapper_Impl::GetMemberProperties(
     /* [in] */ DWORD /*grfdexFetch*/,
     /* [out] */ DWORD __RPC_FAR* /*pgrfdex*/)
 {
-    HRESULT ret = ResultFromScode(E_NOTIMPL);
-
-    return ret;
+    return ResultFromScode(E_NOTIMPL);
 }
 
 STDMETHODIMP InterfaceOleWrapper_Impl::GetMemberName(
     /* [in] */ DISPID /*id*/,
     /* [out] */ BSTR __RPC_FAR* /*pbstrName*/)
 {
-    HRESULT ret = ResultFromScode(E_NOTIMPL);
-
-    return ret;
+    return ResultFromScode(E_NOTIMPL);
 }
 
 STDMETHODIMP InterfaceOleWrapper_Impl::GetNextDispID(
@@ -1215,17 +1203,13 @@ STDMETHODIMP InterfaceOleWrapper_Impl::GetNextDispID(
     /* [in] */ DISPID /*id*/,
     /* [out] */ DISPID __RPC_FAR* /*pid*/)
 {
-    HRESULT ret = ResultFromScode(E_NOTIMPL);
-
-    return ret;
+    return ResultFromScode(E_NOTIMPL);
 }
 
 STDMETHODIMP InterfaceOleWrapper_Impl::GetNameSpaceParent(
     /* [out] */ IUnknown __RPC_FAR *__RPC_FAR* /*ppunk*/)
 {
-    HRESULT ret = ResultFromScode(E_NOTIMPL);
-
-    return ret;
+    return ResultFromScode(E_NOTIMPL);
 }
 
 // UnoObjectWrapperRemoteOpt ---------------------------------------------------
diff --git a/extensions/source/ole/unotypewrapper.cxx b/extensions/source/ole/unotypewrapper.cxx
index ef576a11aaa4..da1d13207615 100644
--- a/extensions/source/ole/unotypewrapper.cxx
+++ b/extensions/source/ole/unotypewrapper.cxx
@@ -140,22 +140,20 @@ STDMETHODIMP UnoTypeWrapper::Invoke( DISPID dispIdMember,
 STDMETHODIMP UnoTypeWrapper::put_Name(BSTR  val)
 {
      Lock();
-     HRESULT hr = S_OK;
     m_sName = val;
      Unlock();
-     return hr;
+     return S_OK;
 }
 
 // (UnoTypeWrapper-----------------------
 STDMETHODIMP UnoTypeWrapper::get_Name(BSTR  *pVal)
 {
      Lock();
-    HRESULT hr = S_OK;
      if( !pVal)
          return E_POINTER;
     *pVal = m_sName.Copy();
      Unlock();
-     return hr;
+     return S_OK;
 }
 
 
commit a81c6eb5ffc055ce6e299eb6606095538a858d27
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Jul 3 14:03:45 2017 +0200

    loplugin:oncevar (clang-cl): embedserv
    
    Change-Id: Icc9d01b46975505c54a6395edfbeb15cf25c8700

diff --git a/embedserv/source/embed/docholder.cxx b/embedserv/source/embed/docholder.cxx
index d11f662ddc3f..14e95f26d45b 100644
--- a/embedserv/source/embed/docholder.cxx
+++ b/embedserv/source/embed/docholder.cxx
@@ -501,12 +501,11 @@ void DocumentHolder::UIDeactivate()
 void CopyToOLEMenu(HMENU hOrig,WORD origPos,HMENU hDest,WORD destPos)
 {
     HMENU subMenu(nullptr);
-    UINT uTemp = MF_BYPOSITION | MF_POPUP;
     char buffer[256];
 
     subMenu = GetSubMenu(hOrig,origPos);
     GetMenuString(hOrig,origPos,buffer,256,MF_BYPOSITION);
-    InsertMenu(hDest,destPos,uTemp,
+    InsertMenu(hDest,destPos,MF_BYPOSITION | MF_POPUP,
                reinterpret_cast<UINT_PTR>(subMenu),LPCTSTR(buffer));
 
     MENUITEMINFOW mi;
diff --git a/embedserv/source/embed/ed_ioleobject.cxx b/embedserv/source/embed/ed_ioleobject.cxx
index e71d528d44ca..56ba1ecf5d4c 100644
--- a/embedserv/source/embed/ed_ioleobject.cxx
+++ b/embedserv/source/embed/ed_ioleobject.cxx
@@ -89,8 +89,6 @@ STDMETHODIMP EmbedDocument_Impl::Close( DWORD dwSaveOption )
 
 HRESULT EmbedDocument_Impl::OLENotifyClosing()
 {
-    HRESULT hr = S_OK;
-
     AdviseSinkHashMap aAHM(m_aAdviseHashMap);
 
     for ( AdviseSinkHashMapIterator iAdvise = aAHM.begin();
@@ -100,7 +98,7 @@ HRESULT EmbedDocument_Impl::OLENotifyClosing()
             iAdvise->second->OnClose();
     }
 
-    return hr;
+    return S_OK;
 
 }
 
commit 663376dee3b8c0ea0f6f8079e14a512b060ecb24
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Jul 3 14:03:34 2017 +0200

    loplugin:oncevar (clang-cl): dtrans
    
    Change-Id: I2ec41f641f3784ef86322c25481e6794e29eb889

diff --git a/dtrans/source/win32/clipb/MtaOleClipb.cxx b/dtrans/source/win32/clipb/MtaOleClipb.cxx
index 6c8ec203295f..aa7681267129 100644
--- a/dtrans/source/win32/clipb/MtaOleClipb.cxx
+++ b/dtrans/source/win32/clipb/MtaOleClipb.cxx
@@ -427,8 +427,6 @@ bool CMtaOleClipboard::registerClipViewer( LPFNC_CLIPVIEWER_CALLBACK_t pfncClipV
         return false;
     }
 
-    bool bRet = false;
-
     OSL_ENSURE( GetCurrentThreadId( ) != m_uOleThreadId, "registerClipViewer from within the OleThread called" );
 
     MsgCtx  aMsgCtx;
@@ -439,7 +437,7 @@ bool CMtaOleClipboard::registerClipViewer( LPFNC_CLIPVIEWER_CALLBACK_t pfncClipV
 
     aMsgCtx.aCondition.wait( /* infinite */ );
 
-    return bRet;
+    return false;
 }
 
 // register a clipboard viewer
diff --git a/dtrans/source/win32/dtobj/FetcList.cxx b/dtrans/source/win32/dtobj/FetcList.cxx
index c5744730323a..e26ceeac0072 100644
--- a/dtrans/source/win32/dtobj/FetcList.cxx
+++ b/dtrans/source/win32/dtobj/FetcList.cxx
@@ -214,9 +214,8 @@ void SAL_CALL CFormatRegistrar::RegisterFormats(
                 aFormatEtcContainer.addFormatEtc( fetc );
 
                 // and HTML Format
-                OUString htmlFormat( "HTML Format" );
                 aFormatEtcContainer.addFormatEtc(
-                    CDataFormatTranslator::getFormatEtcForClipformatName( htmlFormat ) );
+                    CDataFormatTranslator::getFormatEtcForClipformatName( "HTML Format" ) );
             }
         }
     }
commit 97e2369562f3dbca8568983a2d47ce953fa79acf
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Jul 3 14:03:27 2017 +0200

    loplugin:oncevar (clang-cl): connectivity
    
    Change-Id: I76dcc99c29302b49a1d66fa22db8b28714421a98

diff --git a/connectivity/source/drivers/ado/ADatabaseMetaData.cxx b/connectivity/source/drivers/ado/ADatabaseMetaData.cxx
index f0a6165f8e8b..93376f97196c 100644
--- a/connectivity/source/drivers/ado/ADatabaseMetaData.cxx
+++ b/connectivity/source/drivers/ado/ADatabaseMetaData.cxx
@@ -910,13 +910,13 @@ OUString SAL_CALL ODatabaseMetaData::getSQLKeywords(  )
 
         aRecordset.MoveFirst();
         OLEVariant  aValue;
-        OUString aRet, aComma(",");
+        OUString aRet;
         while(!aRecordset.IsAtEOF())
         {
             WpOLEAppendCollection<ADOFields, ADOField, WpADOField>  aFields(aRecordset.GetFields());
             WpADOField aField(aFields.GetItem(0));
             aField.get_Value(aValue);
-            aRet = aRet + aValue.getString() + aComma;
+            aRet = aRet + aValue.getString() + ",";
             aRecordset.MoveNext();
         }
         aRecordset.Close();
diff --git a/connectivity/source/drivers/ado/APreparedStatement.cxx b/connectivity/source/drivers/ado/APreparedStatement.cxx
index 8f4ef082aed4..97f2f615deb0 100644
--- a/connectivity/source/drivers/ado/APreparedStatement.cxx
+++ b/connectivity/source/drivers/ado/APreparedStatement.cxx
@@ -66,8 +66,7 @@ OPreparedStatement::OPreparedStatement( OConnection* _pConnection, const OUStrin
         //  we recursive replace all occurrences of ? in the statement and
         //  replace them with name like "parame" */
         sal_Int32 nParameterCount = 0;
-        OUString sDefaultName( "parame" );
-        replaceParameterNodeName(pNode,sDefaultName,nParameterCount);
+        replaceParameterNodeName(pNode,"parame",nParameterCount);
         pNode->parseNodeToStr( sNewSql, _pConnection );
         delete pNode;
     }
diff --git a/connectivity/source/drivers/ado/Awrapado.cxx b/connectivity/source/drivers/ado/Awrapado.cxx
index 44383f4ec132..34e5ea8a9692 100644
--- a/connectivity/source/drivers/ado/Awrapado.cxx
+++ b/connectivity/source/drivers/ado/Awrapado.cxx
@@ -480,9 +480,8 @@ sal_Int32 WpADOField::GetAttributes() const
 sal_Int32 WpADOField::GetStatus() const
 {
     assert(pInterface);
-    sal_Int32 eADOSFieldAttributes=0;
     //  pInterface->get_Status(&eADOSFieldAttributes);
-    return eADOSFieldAttributes;
+    return 0;
 }
 
 sal_Int32 WpADOField::GetDefinedSize() const
@@ -1978,13 +1977,12 @@ ADORecordset* WpADOConnection::getTables( const css::uno::Any& catalog,
 
     ++nPos;
     OUStringBuffer aTypes;
-    OUString aComma( "," );
     const OUString* pIter = types.getConstArray();
     const OUString* pEnd = pIter + types.getLength();
     for( ; pIter != pEnd ; ++pIter)
     {
         if ( aTypes.getLength() )
-            aTypes.append(aComma);
+            aTypes.append(",");
         aTypes.append(*pIter);
     }
 
commit a93ca8021af8f3fc570cedce2e0bf639807b04e0
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Jul 3 14:03:20 2017 +0200

    loplugin:oncevar (clang-cl): canvas
    
    Change-Id: I0fde86dbaa4bfa9377445800db176a82211aad17

diff --git a/canvas/source/directx/dx_9rm.cxx b/canvas/source/directx/dx_9rm.cxx
index c12f64a9be05..ce1d7d03b6d2 100644
--- a/canvas/source/directx/dx_9rm.cxx
+++ b/canvas/source/directx/dx_9rm.cxx
@@ -531,10 +531,9 @@ namespace dxcanvas
             maPageSize=aPageSize;
 
             IDirect3DVertexBuffer9 *pVB(nullptr);
-            DWORD aFVF(D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1);
             if( FAILED(mpDevice->CreateVertexBuffer(sizeof(dxvertex)*maNumVertices,
                                                     D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY,
-                                                    aFVF,
+                                                    D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1,
                                                     D3DPOOL_DEFAULT,
                                                     &pVB,
                                                     nullptr)) )
@@ -864,10 +863,9 @@ namespace dxcanvas
                     if(SUCCEEDED(hr))
                     {
                         IDirect3DVertexBuffer9 *pVB(nullptr);
-                        DWORD aFVF(D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1);
                         if( FAILED(mpDevice->CreateVertexBuffer(sizeof(dxvertex)*maNumVertices,
                                                                 D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY,
-                                                                aFVF,
+                                                                D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1,
                                                                 D3DPOOL_DEFAULT,
                                                                 &pVB,
                                                                 nullptr)) )


More information about the Libreoffice-commits mailing list