summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-04-13 14:57:07 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-04-13 21:14:34 +0200
commitacb0cdeedafc5fd38703d4a0a545a33058f1673f (patch)
tree8700522058d85e7174f42419433b79ba4adc47ba /sal
parentb6491f09e9dc3e41d571abce3c4f16467cb60c9c (diff)
loplugin:sequentialassign in sal
Change-Id: I7bd1511a6acc105ab5b42c698c7578cfb9ce06b4 Reviewed-on: https://gerrit.libreoffice.org/70708 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/unx/file_misc.cxx8
-rw-r--r--sal/osl/unx/mutex.cxx14
-rw-r--r--sal/osl/unx/profile.cxx4
-rw-r--r--sal/osl/unx/socket.cxx4
-rw-r--r--sal/qa/OStringBuffer/rtl_OStringBuffer.cxx6
-rw-r--r--sal/qa/osl/file/osl_File.cxx5
-rw-r--r--sal/qa/osl/process/osl_Thread.cxx51
-rw-r--r--sal/qa/osl/security/osl_Security.cxx6
-rw-r--r--sal/qa/rtl/doublelock/rtl_doublelocking.cxx12
-rw-r--r--sal/qa/rtl/oustring/rtl_OUString2.cxx3
-rw-r--r--sal/qa/rtl/process/rtl_Process.cxx3
-rw-r--r--sal/rtl/random.cxx4
12 files changed, 38 insertions, 82 deletions
diff --git a/sal/osl/unx/file_misc.cxx b/sal/osl/unx/file_misc.cxx
index 167877e5d670..31641593e781 100644
--- a/sal/osl/unx/file_misc.cxx
+++ b/sal/osl/unx/file_misc.cxx
@@ -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)
{
diff --git a/sal/osl/unx/mutex.cxx b/sal/osl/unx/mutex.cxx
index 3f7fda0c7099..72bcc370eebb 100644
--- a/sal/osl/unx/mutex.cxx
+++ b/sal/osl/unx/mutex.cxx
@@ -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));
diff --git a/sal/osl/unx/profile.cxx b/sal/osl/unx/profile.cxx
index e06ff82aef32..44e7243c4b13 100644
--- a/sal/osl/unx/profile.cxx
+++ b/sal/osl/unx/profile.cxx
@@ -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 )
{
diff --git a/sal/osl/unx/socket.cxx b/sal/osl/unx/socket.cxx
index 1dd62e330029..0984acb86aae 100644
--- a/sal/osl/unx/socket.cxx
+++ b/sal/osl/unx/socket.cxx
@@ -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);
}
diff --git a/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx b/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx
index a2111854850a..6d6d2034d188 100644
--- a/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx
+++ b/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx
@@ -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);
diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx
index 23ae3359961d..66aa45ad35a8 100644
--- a/sal/qa/osl/file/osl_File.cxx
+++ b/sal/qa/osl/file/osl_File.cxx
@@ -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.",
diff --git a/sal/qa/osl/process/osl_Thread.cxx b/sal/qa/osl/process/osl_Thread.cxx
index bfd17db06174..5d63f64032b6 100644
--- a/sal/qa/osl/process/osl_Thread.cxx
+++ b/sal/qa/osl/process/osl_Thread.cxx
@@ -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));
diff --git a/sal/qa/osl/security/osl_Security.cxx b/sal/qa/osl/security/osl_Security.cxx
index 676c15a4c086..40eef7a6b940 100644
--- a/sal/qa/osl/security/osl_Security.cxx
+++ b/sal/qa/osl/security/osl_Security.cxx
@@ -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( ) );
}
diff --git a/sal/qa/rtl/doublelock/rtl_doublelocking.cxx b/sal/qa/rtl/doublelock/rtl_doublelocking.cxx
index af70e989d6b2..17e39f79cb20 100644
--- a/sal/qa/rtl/doublelock/rtl_doublelocking.cxx
+++ b/sal/qa/rtl/doublelock/rtl_doublelocking.cxx
@@ -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;
diff --git a/sal/qa/rtl/oustring/rtl_OUString2.cxx b/sal/qa/rtl/oustring/rtl_OUString2.cxx
index b932e371be3d..b3e972692a46 100644
--- a/sal/qa/rtl/oustring/rtl_OUString2.cxx
+++ b/sal/qa/rtl/oustring/rtl_OUString2.cxx
@@ -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());
diff --git a/sal/qa/rtl/process/rtl_Process.cxx b/sal/qa/rtl/process/rtl_Process.cxx
index eba07659ccff..acb8f9501f08 100644
--- a/sal/qa/rtl/process/rtl_Process.cxx
+++ b/sal/qa/rtl/process/rtl_Process.cxx
@@ -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( ) );
}
diff --git a/sal/rtl/random.cxx b/sal/rtl/random.cxx
index 836d30889b80..c9cc0f841ea9 100644
--- a/sal/rtl/random.cxx
+++ b/sal/rtl/random.cxx
@@ -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];