Kaydet (Commit) acb0cdee authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:sequentialassign in sal

Change-Id: I7bd1511a6acc105ab5b42c698c7578cfb9ce06b4
Reviewed-on: https://gerrit.libreoffice.org/70708
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst b6491f09
......@@ -482,9 +482,7 @@ oslFileError osl_psz_createDirectory(char const * pszPath, sal_uInt32 flags)
static oslFileError osl_psz_removeDirectory( const sal_Char* pszPath )
{
int nRet=0;
nRet = rmdir(pszPath);
int nRet = rmdir(pszPath);
if ( nRet < 0 )
{
......@@ -724,9 +722,7 @@ static oslFileError osl_unlinkFile(const sal_Char* pszPath)
static oslFileError osl_psz_moveFile(const sal_Char* pszPath, const sal_Char* pszDestPath)
{
int nRet = 0;
nRet = rename(pszPath,pszDestPath);
int nRet = rename(pszPath,pszDestPath);
if (nRet < 0)
{
......
......@@ -75,9 +75,7 @@ void SAL_CALL osl_destroyMutex(oslMutex pMutex)
if ( pMutex != nullptr )
{
int nRet=0;
nRet = pthread_mutex_destroy(&(pMutex->mutex));
int nRet = pthread_mutex_destroy(&(pMutex->mutex));
if ( nRet != 0 )
{
SAL_WARN("sal.osl.mutex", "pthread_mutex_destroy failed: " << UnixErrnoString(nRet));
......@@ -93,9 +91,7 @@ sal_Bool SAL_CALL osl_acquireMutex(oslMutex pMutex)
if ( pMutex != nullptr )
{
int nRet=0;
nRet = pthread_mutex_lock(&(pMutex->mutex));
int nRet = pthread_mutex_lock(&(pMutex->mutex));
if ( nRet != 0 )
{
SAL_WARN("sal.osl.mutex", "pthread_mutex_lock failed: " << UnixErrnoString(nRet));
......@@ -116,8 +112,7 @@ sal_Bool SAL_CALL osl_tryToAcquireMutex(oslMutex pMutex)
if ( pMutex )
{
int nRet = 0;
nRet = pthread_mutex_trylock(&(pMutex->mutex));
int nRet = pthread_mutex_trylock(&(pMutex->mutex));
if ( nRet == 0 )
result = true;
}
......@@ -131,8 +126,7 @@ sal_Bool SAL_CALL osl_releaseMutex(oslMutex pMutex)
if ( pMutex )
{
int nRet=0;
nRet = pthread_mutex_unlock(&(pMutex->mutex));
int nRet = pthread_mutex_unlock(&(pMutex->mutex));
if ( nRet != 0 )
{
SAL_WARN("sal.osl.mutex", "pthread_mutex_unlock failed: " << UnixErrnoString(nRet));
......
......@@ -491,9 +491,7 @@ sal_Bool SAL_CALL osl_writeProfileString(oslProfile Profile,
sal_Char* Line = nullptr;
osl_TProfileSection* pSec;
osl_TProfileImpl* pProfile = nullptr;
osl_TProfileImpl* pTmpProfile = nullptr;
pTmpProfile = static_cast<osl_TProfileImpl*>(Profile);
osl_TProfileImpl* pTmpProfile = static_cast<osl_TProfileImpl*>(Profile);
if ( pTmpProfile == nullptr )
{
......
......@@ -832,9 +832,7 @@ void SAL_CALL osl_getHostnameOfHostAddr (
const oslHostAddr Addr,
rtl_uString **ustrHostname)
{
const sal_Char* pHostname=nullptr;
pHostname = osl_psz_getHostnameOfHostAddr(Addr);
const sal_Char* pHostname = osl_psz_getHostnameOfHostAddr(Addr);
rtl_uString_newFromAscii (ustrHostname, pHostname);
}
......
......@@ -14235,8 +14235,7 @@ namespace rtl_OStringBuffer
public:
bool checkIfStrBufContainAtPosTheFloat(OStringBuffer const& _sStrBuf, sal_Int32 _nLen, float _nFloat)
{
OString sFloatValue;
sFloatValue = OString::number(_nFloat);
OString sFloatValue = OString::number(_nFloat);
OString sBufferString(_sStrBuf.getStr());
sal_Int32 nPos = sBufferString.indexOf(sFloatValue);
......@@ -15385,8 +15384,7 @@ namespace rtl_OStringBuffer
public:
bool checkIfStrBufContainAtPosTheDouble(OStringBuffer const& _sStrBuf, sal_Int32 _nLen, double _nDouble)
{
OString sDoubleValue;
sDoubleValue = OString::number(_nDouble);
OString sDoubleValue = OString::number(_nDouble);
OString sBufferString(_sStrBuf.getStr());
sal_Int32 nPos = sBufferString.indexOf(sDoubleValue);
......
......@@ -3762,7 +3762,7 @@ namespace osl_DirectoryItem
CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, nError1);
DirectoryItem copyItem;
copyItem = rItem; // assinment operator
copyItem = rItem; // assignment operator
FileStatus rFileStatus(osl_FileStatus_Mask_FileName);
nError1 = copyItem.getFileStatus(rFileStatus);
CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, nError1);
......@@ -4568,8 +4568,7 @@ namespace osl_Directory
if (_nMask == osl_VolumeInfo_Mask_FileSystemName)
{
// get file system name
OUString aFileSysName(aNullURL);
aFileSysName = _aVolumeInfo.getFileSystemName();
OUString aFileSysName = _aVolumeInfo.getFileSystemName();
bool bRes2 = compareFileName(aFileSysName, aNullURL);
CPPUNIT_ASSERT_EQUAL_MESSAGE("test for getVolumeInfo function: getVolumeInfo of root directory.",
......
......@@ -989,11 +989,9 @@ namespace osl_Thread
pThread->terminate();
p2Thread->terminate();
sal_Int32 nValueNormal = 0;
nValueNormal = pThread->getValue();
sal_Int32 nValueNormal = pThread->getValue();
sal_Int32 nValueNormal2 = 0;
nValueNormal2 = p2Thread->getValue();
sal_Int32 nValueNormal2 = p2Thread->getValue();
OString sPrio = getPrioName(_aPriority);
t_print("After 10 tenth seconds\n");
......@@ -1088,14 +1086,11 @@ namespace osl_Thread
//aBelowNormalThread->terminate();
//aLowestThread->terminate();
sal_Int32 nValueHighest = 0;
nValueHighest = aHighestThread.getValue();
sal_Int32 nValueHighest = aHighestThread.getValue();
sal_Int32 nValueAboveNormal = 0;
nValueAboveNormal = aAboveNormalThread.getValue();
sal_Int32 nValueAboveNormal = aAboveNormalThread.getValue();
sal_Int32 nValueNormal = 0;
nValueNormal = aNormalThread.getValue();
sal_Int32 nValueNormal = aNormalThread.getValue();
t_print("After 10 tenth seconds\n");
t_print("nValue in Highest Prio Thread is %d\n", static_cast<int>(nValueHighest));
......@@ -1163,20 +1158,15 @@ namespace osl_Thread
termAndJoinThread(&pBelowNormalThread);
termAndJoinThread(&pLowestThread);
sal_Int32 nValueHighest = 0;
nValueHighest = pHighestThread.getValue();
sal_Int32 nValueHighest = pHighestThread.getValue();
sal_Int32 nValueAboveNormal = 0;
nValueAboveNormal = pAboveNormalThread.getValue();
sal_Int32 nValueAboveNormal = pAboveNormalThread.getValue();
sal_Int32 nValueNormal = 0;
nValueNormal = pNormalThread.getValue();
sal_Int32 nValueNormal = pNormalThread.getValue();
sal_Int32 nValueBelowNormal = 0;
nValueBelowNormal = pBelowNormalThread.getValue();
sal_Int32 nValueBelowNormal = pBelowNormalThread.getValue();
sal_Int32 nValueLowest = 0;
nValueLowest = pLowestThread.getValue();
sal_Int32 nValueLowest = pLowestThread.getValue();
t_print("After 10 tenth seconds\n");
t_print("nValue in Highest Prio Thread is %d\n", static_cast<int>(nValueHighest));
......@@ -1251,17 +1241,13 @@ namespace osl_Thread
// sal_Int32 nValueHighest = 0;
// nValueHighest = pHighestThread->getValue();
sal_Int32 nValueAboveNormal = 0;
nValueAboveNormal = pAboveNormalThread.getValue();
sal_Int32 nValueAboveNormal = pAboveNormalThread.getValue();
sal_Int32 nValueNormal = 0;
nValueNormal = pNormalThread.getValue();
sal_Int32 nValueNormal = pNormalThread.getValue();
sal_Int32 nValueBelowNormal = 0;
nValueBelowNormal = pBelowNormalThread.getValue();
sal_Int32 nValueBelowNormal = pBelowNormalThread.getValue();
sal_Int32 nValueLowest = 0;
nValueLowest = pLowestThread.getValue();
sal_Int32 nValueLowest = pLowestThread.getValue();
t_print("After 5 tenth seconds\n");
t_print("nValue in AboveNormal Prio Thread is %d\n", static_cast<int>(nValueAboveNormal));
......@@ -1339,14 +1325,11 @@ namespace osl_Thread
// sal_Int32 nValueAboveNormal = 0;
// nValueAboveNormal = pAboveNormalThread->getValue();
sal_Int32 nValueNormal = 0;
nValueNormal = pNormalThread.getValue();
sal_Int32 nValueNormal = pNormalThread.getValue();
sal_Int32 nValueBelowNormal = 0;
nValueBelowNormal = pBelowNormalThread.getValue();
sal_Int32 nValueBelowNormal = pBelowNormalThread.getValue();
sal_Int32 nValueLowest = 0;
nValueLowest = pLowestThread.getValue();
sal_Int32 nValueLowest = pLowestThread.getValue();
t_print("After 5 tenth seconds\n");
t_print("nValue in Normal Prio Thread is %d\n", static_cast<int>(nValueNormal));
......
......@@ -36,14 +36,12 @@
using namespace osl;
using namespace rtl;
/** print a UNI_CODE String.
/** print a UNICODE String.
*/
static void printUString( const OUString & str )
{
OString aString;
//t_print("#printUString_u# " );
aString = OUStringToOString( str, RTL_TEXTENCODING_ASCII_US );
OString aString = OUStringToOString( str, RTL_TEXTENCODING_ASCII_US );
t_print("%s\n", aString.getStr( ) );
}
......
......@@ -150,19 +150,15 @@ namespace rtl_DoubleLocking
pThread->join();
p2Thread->join();
sal_Int32 nValueOK = 0;
nValueOK = pThread->getOK();
sal_Int32 nValueOK = pThread->getOK();
sal_Int32 nValueOK2 = 0;
nValueOK2 = p2Thread->getOK();
sal_Int32 nValueOK2 = p2Thread->getOK();
std::cout << "Value in Thread #1 is " << nValueOK << "\n";
std::cout << "Value in Thread #2 is " << nValueOK2 << "\n";
sal_Int32 nValueFails = 0;
nValueFails = pThread->getFails();
sal_Int32 nValueFails = pThread->getFails();
sal_Int32 nValueFails2 = 0;
nValueFails2 = p2Thread->getFails();
sal_Int32 nValueFails2 = p2Thread->getFails();
delete pThread;
delete p2Thread;
......
......@@ -125,8 +125,7 @@ private:
void number_double_test_impl(double _nValue)
{
OUString suValue;
suValue = OUString::number( _nValue );
OUString suValue = OUString::number( _nValue );
OString sValue;
sValue <<= suValue;
printf("nDouble := %.20f sValue := %s\n", _nValue, sValue.getStr());
......
......@@ -45,8 +45,7 @@ static void printUString( const OUString & str, const sal_Char * msg )
{
printf("#%s #printUString_u# ", msg );
}
OString aString;
aString = OUStringToOString( str, RTL_TEXTENCODING_ASCII_US );
OString aString = OUStringToOString( str, RTL_TEXTENCODING_ASCII_US );
printf("%s\n", aString.getStr( ) );
}
......
......@@ -237,10 +237,8 @@ static void readPool (
rtlRandomPool SAL_CALL rtl_random_createPool() SAL_THROW_EXTERN_C()
{
RandomPool_Impl *pImpl = nullptr;
/* try to get system random number, if it fail fall back on own pool */
pImpl = static_cast< RandomPool_Impl* >(rtl_allocateZeroMemory(sizeof(RandomPool_Impl)));
RandomPool_Impl *pImpl = static_cast< RandomPool_Impl* >(rtl_allocateZeroMemory(sizeof(RandomPool_Impl)));
if (pImpl)
{
char sanity[4];
......
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