Kaydet (Commit) b712b1f6 authored tarafından Michael Weghorn's avatar Michael Weghorn Kaydeden (comit) Noel Grandin

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/17926Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst 93cd7b78
...@@ -122,8 +122,7 @@ HRESULT doTest() ...@@ -122,8 +122,7 @@ HRESULT doTest()
extern Reference<XMultiServiceFactory> MultiServiceFactory; extern Reference<XMultiServiceFactory> MultiServiceFactory;
DWORD WINAPI MTAFunc( void* threadData) DWORD WINAPI MTAFunc( void* threadData)
{ {
HRESULT hr= S_OK; HRESULT hr= CoInitializeEx( NULL, COINIT_MULTITHREADED);
hr= CoInitializeEx( NULL, COINIT_MULTITHREADED);
ATLASSERT( FAILED(hr) ); ATLASSERT( FAILED(hr) );
MSG msg; MSG msg;
// force the creation of a message queue // force the creation of a message queue
......
...@@ -284,8 +284,7 @@ ShowProgressUI(bool indeterminate, bool initUIStrings) ...@@ -284,8 +284,7 @@ ShowProgressUI(bool indeterminate, bool initUIStrings)
actx.lpSource = appPath; actx.lpSource = appPath;
actx.lpResourceName = MAKEINTRESOURCE(IDR_COMCTL32_MANIFEST); actx.lpResourceName = MAKEINTRESOURCE(IDR_COMCTL32_MANIFEST);
HANDLE hactx = INVALID_HANDLE_VALUE; HANDLE hactx = CreateActCtxW(&actx);
hactx = CreateActCtxW(&actx);
ULONG_PTR actxCookie = NULL; ULONG_PTR actxCookie = NULL;
if (hactx != INVALID_HANDLE_VALUE) { if (hactx != INVALID_HANDLE_VALUE) {
// Push the specified activation context to the top of the activation stack. // Push the specified activation context to the top of the activation stack.
......
...@@ -904,11 +904,10 @@ RegError ORegistry::deleteSubkeysAndValues(ORegKey* pKey) ...@@ -904,11 +904,10 @@ RegError ORegistry::deleteSubkeysAndValues(ORegKey* pKey)
RegError ORegistry::loadKey(RegKeyHandle hKey, const OUString& regFileName, RegError ORegistry::loadKey(RegKeyHandle hKey, const OUString& regFileName,
bool bWarnings, bool bReport) bool bWarnings, bool bReport)
{ {
RegError _ret = RegError::NO_ERROR;
ORegKey* pKey = static_cast< ORegKey* >(hKey); ORegKey* pKey = static_cast< ORegKey* >(hKey);
std::unique_ptr< ORegistry > pReg (new ORegistry()); 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) if (_ret != RegError::NO_ERROR)
return _ret; return _ret;
ORegKey* pRootKey = pReg->getRootKey(); ORegKey* pRootKey = pReg->getRootKey();
...@@ -952,11 +951,10 @@ RegError ORegistry::loadKey(RegKeyHandle hKey, const OUString& regFileName, ...@@ -952,11 +951,10 @@ RegError ORegistry::loadKey(RegKeyHandle hKey, const OUString& regFileName,
RegError ORegistry::saveKey(RegKeyHandle hKey, const OUString& regFileName, RegError ORegistry::saveKey(RegKeyHandle hKey, const OUString& regFileName,
bool bWarnings, bool bReport) bool bWarnings, bool bReport)
{ {
RegError _ret = RegError::NO_ERROR;
ORegKey* pKey = static_cast< ORegKey* >(hKey); ORegKey* pKey = static_cast< ORegKey* >(hKey);
std::unique_ptr< ORegistry > pReg (new ORegistry()); 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) if (_ret != RegError::NO_ERROR)
return _ret; return _ret;
ORegKey* pRootKey = pReg->getRootKey(); ORegKey* pRootKey = pReg->getRootKey();
......
...@@ -269,8 +269,7 @@ public: ...@@ -269,8 +269,7 @@ public:
rtl_Locale* pData1 = rtl_locale_register(rtl::OUString("en").getStr(), rtl::OUString("US").getStr(), rtl::OUString().getStr()); 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()); rtl_Locale* pData2 = rtl_locale_register(rtl::OUString("en").getStr(), rtl::OUString("US").getStr(), rtl::OUString().getStr());
bool bLocaleAreEqual = false; bool bLocaleAreEqual = (pData1 == pData2);
bLocaleAreEqual = (pData1 == pData2);
CPPUNIT_ASSERT_MESSAGE("check operator ==()", bLocaleAreEqual); CPPUNIT_ASSERT_MESSAGE("check operator ==()", bLocaleAreEqual);
} }
......
...@@ -2455,10 +2455,8 @@ void print_error( const ::rtl::OString& str, FileBase::RC rc ) ...@@ -2455,10 +2455,8 @@ void print_error( const ::rtl::OString& str, FileBase::RC rc )
int MAIN( int argc, char* argv[] ) int MAIN( int argc, char* argv[] )
{ {
sal_Bool fSuccess=sal_False;
//Initialization //Initialization
fSuccess=Initialize(); sal_Bool fSuccess=Initialize();
if ( !fSuccess ) if ( !fSuccess )
{ {
printf("Error during Initialization"); printf("Error during Initialization");
......
...@@ -125,12 +125,11 @@ namespace /* private */ ...@@ -125,12 +125,11 @@ namespace /* private */
return false; return false;
oslProcess proc; oslProcess proc;
oslProcessError err = osl_Process_E_Unknown;
/* for efficiency reasons we are using a 'bad' cast here /* for efficiency reasons we are using a 'bad' cast here
as a vector or OUStrings is nothing else than as a vector or OUStrings is nothing else than
an array of pointers to rtl_uString's */ an array of pointers to rtl_uString's */
err = osl_executeProcess( oslProcessError err = osl_executeProcess(
senddocUrl.pData, senddocUrl.pData,
(rtl_uString**)&rCommandArgs[0], (rtl_uString**)&rCommandArgs[0],
rCommandArgs.size(), rCommandArgs.size(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment