diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2015-06-13 10:09:21 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-06-15 13:34:14 +0200 |
commit | 4ea281a3ccb5bd21e1808d8cb127a91a1bb72691 (patch) | |
tree | 183a2ab634d770b7ef777323fa6851fc38e14011 /sal | |
parent | 943f4b4ff1c524c514584c459b899ba3e9dfb71f (diff) |
cppcheck:redundantAssignment
Change-Id: I1167d0ce6b6f6e48309d0551c1d2a283d79546a7
Diffstat (limited to 'sal')
-rw-r--r-- | sal/osl/w32/file_dirvol.cxx | 8 | ||||
-rw-r--r-- | sal/osl/w32/profile.cxx | 13 | ||||
-rw-r--r-- | sal/qa/osl/file/osl_File.cxx | 20 | ||||
-rw-r--r-- | sal/qa/osl/security/osl_Security.cxx | 1 |
4 files changed, 17 insertions, 25 deletions
diff --git a/sal/osl/w32/file_dirvol.cxx b/sal/osl/w32/file_dirvol.cxx index a5d060509463..d882c3d9962f 100644 --- a/sal/osl/w32/file_dirvol.cxx +++ b/sal/osl/w32/file_dirvol.cxx @@ -600,9 +600,7 @@ static DWORD create_dir_with_callback( // user specified callback function. On success // the function returns ERROR_SUCCESS else a Win32 error code. - BOOL bCreated = FALSE; - - bCreated = CreateDirectoryW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( dir_path )), NULL ); + BOOL bCreated = CreateDirectoryW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( dir_path )), NULL ); if ( bCreated ) { @@ -702,9 +700,7 @@ oslFileError osl_createDirectoryWithFlags(rtl_uString * strPath, sal_uInt32) if ( osl_File_E_None == error ) { - BOOL bCreated = FALSE; - - bCreated = CreateDirectoryW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( strSysPath )), NULL ); + BOOL bCreated = CreateDirectoryW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( strSysPath )), NULL ); if ( !bCreated ) { diff --git a/sal/osl/w32/profile.cxx b/sal/osl/w32/profile.cxx index eb9b779b14d0..0f51db39f032 100644 --- a/sal/osl/w32/profile.cxx +++ b/sal/osl/w32/profile.cxx @@ -1925,19 +1925,16 @@ static sal_Bool osl_ProfileSwapProfileNames(osl_TProfileImpl* pProfile) static rtl_uString* osl_ProfileGenerateExtension(rtl_uString* ustrFileName, rtl_uString* ustrExtension) { - rtl_uString* ustrNewFileName=0; + rtl_uString* ustrNewFileName = 0; rtl_uString* ustrOldExtension = 0; - sal_Unicode* pExtensionBuf = 0; - sal_Unicode* pFileNameBuf = 0; - sal_Int32 nIndex = -1; - pFileNameBuf = rtl_uString_getStr(ustrFileName); + sal_Unicode* pFileNameBuf = rtl_uString_getStr(ustrFileName); - rtl_uString_newFromAscii(&ustrOldExtension,"."); + rtl_uString_newFromAscii(&ustrOldExtension, "."); - pExtensionBuf = rtl_uString_getStr(ustrOldExtension); + sal_Unicode* pExtensionBuf = rtl_uString_getStr(ustrOldExtension); - nIndex = rtl_ustr_lastIndexOfChar(pFileNameBuf,*pExtensionBuf); + sal_Int32 nIndex = rtl_ustr_lastIndexOfChar(pFileNameBuf, *pExtensionBuf); rtl_uString_newReplaceStrAt(&ustrNewFileName, ustrFileName, diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx index 60ed44ac839d..eb3159bf68c7 100644 --- a/sal/qa/osl/file/osl_File.cxx +++ b/sal/qa/osl/file/osl_File.cxx @@ -313,9 +313,9 @@ inline bool ifFileExist( const ::rtl::OUString & str ) //check if the file can be written inline bool ifFileCanWrite( const ::rtl::OUString & str ) { - bool bCheckResult = false; //on Windows, the file has no write right, but can be written #ifdef WNT + bool bCheckResult = false; ::rtl::OUString aUStr = str.copy( 0 ); if ( isURL( str ) ) ::osl::FileBase::getSystemPathFromFileURL( str, aUStr ); @@ -327,7 +327,7 @@ inline bool ifFileCanWrite( const ::rtl::OUString & str ) //on UNX, just test if open success with osl_File_OpenFlag_Write #else ::osl::File testFile( str ); - bCheckResult = (osl::FileBase::E_None == testFile.open( osl_File_OpenFlag_Write )); + bool bCheckResult = (osl::FileBase::E_None == testFile.open( osl_File_OpenFlag_Write )); #endif return bCheckResult; } @@ -1397,13 +1397,13 @@ namespace osl_FileStatus void isValid_002() { createTestFile( aTmpName6 ); - sal_uInt32 mask_file = ( osl_FileStatus_Mask_Type | osl_FileStatus_Mask_Attributes | + sal_uInt32 mask_file = osl_FileStatus_Mask_Type | osl_FileStatus_Mask_Attributes | osl_FileStatus_Mask_CreationTime | osl_FileStatus_Mask_AccessTime | osl_FileStatus_Mask_ModifyTime | osl_FileStatus_Mask_FileSize | - osl_FileStatus_Mask_FileName | osl_FileStatus_Mask_FileURL) ; - ::osl::FileStatus rFileStatus( mask_file ); - ::osl::FileBase::RC nError1 = ::osl::DirectoryItem::get( aTmpName6, rItem_file ); - nError1 = rItem_file.getFileStatus( rFileStatus ); + osl_FileStatus_Mask_FileName | osl_FileStatus_Mask_FileURL; + ::osl::FileStatus rFileStatus( mask_file ); + ::osl::DirectoryItem::get( aTmpName6, rItem_file ); + ::osl::FileBase::RC nError1 = rItem_file.getFileStatus( rFileStatus ); CPPUNIT_ASSERT_MESSAGE( errorToStr(nError1).getStr(), ::osl::FileBase::E_None == nError1 ); @@ -1413,7 +1413,7 @@ namespace osl_FileStatus // sal_Bool bOk = rFileStatus.isValid( mask_file ); - check_FileStatus(rFileStatus); + check_FileStatus(rFileStatus); deleteTestFile( aTmpName6 ); // CPPUNIT_ASSERT_MESSAGE( "test for isValid function: regular file mask fields test, #osl_FileStatus_Mask_CreationTime# should be valid field for regular file, but feedback is invalid", @@ -2232,8 +2232,8 @@ namespace osl_File nError1 = testFile.open( osl_File_OpenFlag_Create ); bool bOK = ( File::E_ACCES == nError1 ); -#if defined (WNT ) - bOK = sal_True; /// in Windows, you can create file in c:/ any way. +#ifdef WNT + bOK = true; /// in Windows, you can create file in c:/ any way. testFile.close(); deleteTestFile( aTestFile); #endif diff --git a/sal/qa/osl/security/osl_Security.cxx b/sal/qa/osl/security/osl_Security.cxx index adba5867725c..46b884a3b9ed 100644 --- a/sal/qa/osl/security/osl_Security.cxx +++ b/sal/qa/osl/security/osl_Security.cxx @@ -359,7 +359,6 @@ void MyTestPlugInImpl::initialize( CPPUNIT_NS::TestFactoryRegistry *, TCHAR tchBuffer[BUFSIZE]; // buffer for string lpszSystemInfo = tchBuffer; - cchBuff = BUFSIZE; if( GetUserNameA(lpszSystemInfo, &cchBuff) ) strUserName = ::rtl::OUString::createFromAscii( lpszSystemInfo ); |