[Libreoffice-commits] core.git: dtrans/test onlineupdate/source registry/source sal/qa sal/workben shell/source

Michael Weghorn m.weghorn at posteo.de
Sat Aug 22 23:03:02 PDT 2015


 dtrans/test/win32/dnd/dndTest.cxx                     |    3 +--
 onlineupdate/source/update/updater/progressui_win.cxx |    3 +--
 registry/source/regimpl.cxx                           |    6 ++----
 sal/qa/rtl/locale/rtl_locale.cxx                      |    3 +--
 sal/workben/testfile.cxx                              |    4 +---
 shell/source/win32/simplemail/smplmailclient.cxx      |    3 +--
 6 files changed, 7 insertions(+), 15 deletions(-)

New commits:
commit b712b1f63492a311e4a51cffd516b3e202a140e6
Author: Michael Weghorn <m.weghorn at posteo.de>
Date:   Sat Aug 22 16:50:56 2015 +0200

    tdf#39440 cppcheck: redundantAssignment
    
    This addresses some of cppcheck's "redundantAssignment" warnings
    ("Variable '<varName>' is reassigned a value before the old one
    has been used").
    
    Change-Id: I8fd2950d5aa1a3f4bd9e1c4c336abe465d1f657e
    Reviewed-on: https://gerrit.libreoffice.org/17926
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/dtrans/test/win32/dnd/dndTest.cxx b/dtrans/test/win32/dnd/dndTest.cxx
index d026132..aae5851 100644
--- a/dtrans/test/win32/dnd/dndTest.cxx
+++ b/dtrans/test/win32/dnd/dndTest.cxx
@@ -122,8 +122,7 @@ HRESULT doTest()
 extern Reference<XMultiServiceFactory> MultiServiceFactory;
 DWORD WINAPI MTAFunc( void* threadData)
 {
-    HRESULT hr= S_OK;
-    hr= CoInitializeEx( NULL, COINIT_MULTITHREADED);
+    HRESULT hr= CoInitializeEx( NULL, COINIT_MULTITHREADED);
     ATLASSERT( FAILED(hr) );
     MSG msg;
     // force the creation of a message queue
diff --git a/onlineupdate/source/update/updater/progressui_win.cxx b/onlineupdate/source/update/updater/progressui_win.cxx
index 3cbbc6b..49ae81e 100644
--- a/onlineupdate/source/update/updater/progressui_win.cxx
+++ b/onlineupdate/source/update/updater/progressui_win.cxx
@@ -284,8 +284,7 @@ ShowProgressUI(bool indeterminate, bool initUIStrings)
   actx.lpSource = appPath;
   actx.lpResourceName = MAKEINTRESOURCE(IDR_COMCTL32_MANIFEST);
 
-  HANDLE hactx = INVALID_HANDLE_VALUE;
-  hactx = CreateActCtxW(&actx);
+  HANDLE hactx = CreateActCtxW(&actx);
   ULONG_PTR actxCookie = NULL;
   if (hactx != INVALID_HANDLE_VALUE) {
     // Push the specified activation context to the top of the activation stack.
diff --git a/registry/source/regimpl.cxx b/registry/source/regimpl.cxx
index 3499a5a..92a4187 100644
--- a/registry/source/regimpl.cxx
+++ b/registry/source/regimpl.cxx
@@ -904,11 +904,10 @@ RegError ORegistry::deleteSubkeysAndValues(ORegKey* pKey)
 RegError ORegistry::loadKey(RegKeyHandle hKey, const OUString& regFileName,
                             bool bWarnings, bool bReport)
 {
-    RegError _ret = RegError::NO_ERROR;
     ORegKey* pKey = static_cast< ORegKey* >(hKey);
 
     std::unique_ptr< ORegistry > pReg (new ORegistry());
-    _ret = pReg->initRegistry(regFileName, RegAccessMode::READONLY);
+    RegError _ret = pReg->initRegistry(regFileName, RegAccessMode::READONLY);
     if (_ret != RegError::NO_ERROR)
         return _ret;
     ORegKey* pRootKey = pReg->getRootKey();
@@ -952,11 +951,10 @@ RegError ORegistry::loadKey(RegKeyHandle hKey, const OUString& regFileName,
 RegError ORegistry::saveKey(RegKeyHandle hKey, const OUString& regFileName,
                             bool bWarnings, bool bReport)
 {
-    RegError _ret = RegError::NO_ERROR;
     ORegKey* pKey = static_cast< ORegKey* >(hKey);
 
     std::unique_ptr< ORegistry > pReg (new ORegistry());
-    _ret = pReg->initRegistry(regFileName, RegAccessMode::READWRITE, true/*bCreate*/);
+    RegError _ret = pReg->initRegistry(regFileName, RegAccessMode::READWRITE, true/*bCreate*/);
     if (_ret != RegError::NO_ERROR)
         return _ret;
     ORegKey* pRootKey = pReg->getRootKey();
diff --git a/sal/qa/rtl/locale/rtl_locale.cxx b/sal/qa/rtl/locale/rtl_locale.cxx
index ef8d7e3..f2b03fe 100644
--- a/sal/qa/rtl/locale/rtl_locale.cxx
+++ b/sal/qa/rtl/locale/rtl_locale.cxx
@@ -269,8 +269,7 @@ public:
         rtl_Locale* pData1 = rtl_locale_register(rtl::OUString("en").getStr(), rtl::OUString("US").getStr(), rtl::OUString().getStr());
         rtl_Locale* pData2 = rtl_locale_register(rtl::OUString("en").getStr(), rtl::OUString("US").getStr(), rtl::OUString().getStr());
 
-        bool bLocaleAreEqual = false;
-        bLocaleAreEqual = (pData1 == pData2);
+        bool bLocaleAreEqual = (pData1 == pData2);
 
         CPPUNIT_ASSERT_MESSAGE("check operator ==()", bLocaleAreEqual);
     }
diff --git a/sal/workben/testfile.cxx b/sal/workben/testfile.cxx
index addb1b6..dd9448b 100644
--- a/sal/workben/testfile.cxx
+++ b/sal/workben/testfile.cxx
@@ -2455,10 +2455,8 @@ void print_error( const ::rtl::OString& str, FileBase::RC rc )
 
 int MAIN( int argc, char* argv[] )
 {
-    sal_Bool fSuccess=sal_False;
-
     //Initialization
-    fSuccess=Initialize();
+    sal_Bool fSuccess=Initialize();
     if ( !fSuccess )
     {
         printf("Error during Initialization");
diff --git a/shell/source/win32/simplemail/smplmailclient.cxx b/shell/source/win32/simplemail/smplmailclient.cxx
index d7504c5..359cc25 100644
--- a/shell/source/win32/simplemail/smplmailclient.cxx
+++ b/shell/source/win32/simplemail/smplmailclient.cxx
@@ -125,12 +125,11 @@ namespace /* private */
             return false;
 
         oslProcess proc;
-        oslProcessError err = osl_Process_E_Unknown;
 
         /* for efficiency reasons we are using a 'bad' cast here
         as a vector or OUStrings is nothing else than
         an array of pointers to rtl_uString's */
-        err = osl_executeProcess(
+        oslProcessError err = osl_executeProcess(
             senddocUrl.pData,
             (rtl_uString**)&rCommandArgs[0],
             rCommandArgs.size(),


More information about the Libreoffice-commits mailing list