summaryrefslogtreecommitdiff
path: root/sc/source/core
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-10-14 14:27:57 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-10-15 14:33:57 +0200
commitf13c6ad5f020a196a0e3aa6f28bda3dc185d465b (patch)
treef9aaab122974d36c134fb1723ec3c1c8df51eeef /sc/source/core
parent9270f74466d0eb841babaa24997f608631c70341 (diff)
new loplugin:bufferadd
look for OUStringBuffer append sequences that can be turned into creating an OUString with + operations Change-Id: Ica840dc096000307b4a105fb4d9ec7588a15ade6 Reviewed-on: https://gerrit.libreoffice.org/80809 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/core')
-rw-r--r--sc/source/core/data/documen8.cxx9
-rw-r--r--sc/source/core/data/document.cxx5
-rw-r--r--sc/source/core/data/dpoutput.cxx5
-rw-r--r--sc/source/core/tool/chartarr.cxx5
-rw-r--r--sc/source/core/tool/chartlis.cxx4
-rw-r--r--sc/source/core/tool/chgtrack.cxx14
-rw-r--r--sc/source/core/tool/interpr1.cxx24
7 files changed, 20 insertions, 46 deletions
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index d7fff9711e0e..5068656aab39 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -843,13 +843,12 @@ void ScDocument::UpdateExternalRefLinks(weld::Window* pWin)
INetURLObject aUrl(aFile,INetURLObject::EncodeMechanism::WasEncoded);
aFile = aUrl.GetMainURL(INetURLObject::DecodeMechanism::Unambiguous);
- OUStringBuffer aBuf;
- aBuf.append(ScResId(SCSTR_EXTDOC_NOT_LOADED));
- aBuf.append("\n\n");
- aBuf.append(aFile);
+ OUString sMessage = ScResId(SCSTR_EXTDOC_NOT_LOADED) +
+ "\n\n" +
+ aFile;
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWin,
VclMessageType::Warning, VclButtonsType::Ok,
- aBuf.makeStringAndClear()));
+ sMessage));
xBox->run();
}
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index e94d0b4f0db5..cc961b20b1a4 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -408,10 +408,7 @@ void ScDocument::CreateValidTabName(OUString& rName) const
for ( SCTAB i = static_cast<SCTAB>(maTabs.size())+1; !bOk ; i++ )
{
- OUStringBuffer aBuf;
- aBuf.append(aStrTable);
- aBuf.append(static_cast<sal_Int32>(i));
- rName = aBuf.makeStringAndClear();
+ rName = aStrTable + OUString::number(static_cast<sal_Int32>(i));
if (bPrefix)
bOk = ValidNewTabName( rName );
else
diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx
index 558d4bde8d4b..60b423aec6c6 100644
--- a/sc/source/core/data/dpoutput.cxx
+++ b/sc/source/core/data/dpoutput.cxx
@@ -1507,10 +1507,7 @@ OUString lcl_GetDataFieldName( const OUString& rSourceName, sal_Int16 eFunc )
if (!pStrId)
return OUString();
- OUStringBuffer aRet(ScResId(pStrId));
- aRet.append(" - ");
- aRet.append(rSourceName);
- return aRet.makeStringAndClear();
+ return ScResId(pStrId) + " - " + rSourceName;
}
}
diff --git a/sc/source/core/tool/chartarr.cxx b/sc/source/core/tool/chartarr.cxx
index bdd30ad3dfe2..5a3d21c69c33 100644
--- a/sc/source/core/tool/chartarr.cxx
+++ b/sc/source/core/tool/chartarr.cxx
@@ -374,14 +374,11 @@ std::unique_ptr<ScMemChart> ScChartArray::CreateMemChartMulti()
if (aString.isEmpty())
{
- OUStringBuffer aBuf(ScResId(STR_ROW));
- aBuf.append(' ');
if ( pPos )
nPosRow = pPos->Row() + 1;
else
nPosRow++;
- aBuf.append(static_cast<sal_Int32>(nPosRow));
- aString = aBuf.makeStringAndClear();
+ aString = ScResId(STR_ROW) + " " + OUString::number(static_cast<sal_Int32>(nPosRow));
}
pMemChart->SetRowText( nRow, aString);
}
diff --git a/sc/source/core/tool/chartlis.cxx b/sc/source/core/tool/chartlis.cxx
index 5717f297c38d..79f164f87a5e 100644
--- a/sc/source/core/tool/chartlis.cxx
+++ b/sc/source/core/tool/chartlis.cxx
@@ -420,9 +420,7 @@ OUString ScChartListenerCollection::getUniqueName(const OUString& rPrefix) const
{
for (sal_Int32 nNum = 1; nNum < 10000; ++nNum) // arbitrary limit to prevent infinite loop.
{
- OUStringBuffer aBuf(rPrefix);
- aBuf.append(nNum);
- OUString aTestName = aBuf.makeStringAndClear();
+ OUString aTestName = rPrefix + OUString::number(nNum);
if (m_Listeners.find(aTestName) == m_Listeners.end())
return aTestName;
}
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index d7f92341a634..991c25615def 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -1197,9 +1197,7 @@ void ScChangeActionMove::GetDescription(
aRsc = aRsc.replaceAt(nPos, 2, aTmpStr);
}
- OUStringBuffer aBuf(rStr); // append to the original string.
- aBuf.append(aRsc);
- rStr = aBuf.makeStringAndClear();
+ rStr += aRsc; // append to the original string.
}
void ScChangeActionMove::GetRefString(
@@ -1470,9 +1468,7 @@ void ScChangeActionContent::GetDescription(
aRsc = aRsc.replaceAt(nPos, 2, aTmpStr);
}
- OUStringBuffer aBuf(rStr); // append to the original string.
- aBuf.append(aRsc);
- rStr = aBuf.makeStringAndClear();
+ rStr += aRsc; // append to the original string.
}
void ScChangeActionContent::GetRefString(
@@ -1502,11 +1498,7 @@ void ScChangeActionContent::GetRefString(
if ( IsDeletedIn() )
{
// Insert the parentheses.
- OUStringBuffer aBuf;
- aBuf.append('(');
- aBuf.append(rStr);
- aBuf.append(')');
- rStr = aBuf.makeStringAndClear();
+ rStr = "(" + rStr + ")";
}
}
else
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 2f17b222aaa1..df8821b84531 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -2323,16 +2323,14 @@ void ScInterpreter::ScCell()
else if( aInfoType == "COORD" )
{ // address, lotus 1-2-3 formatted: $TABLE:$COL$ROW
// Yes, passing tab as col is intentional!
- OUStringBuffer aFuncResult;
- OUString aCellStr =
- ScAddress( static_cast<SCCOL>(aCellPos.Tab()), 0, 0 ).Format(
- (ScRefFlags::COL_ABS|ScRefFlags::COL_VALID), nullptr, pDok->GetAddressConvention() );
- aFuncResult.append(aCellStr);
- aFuncResult.append(':');
- aCellStr = aCellPos.Format((ScRefFlags::COL_ABS|ScRefFlags::COL_VALID|ScRefFlags::ROW_ABS|ScRefFlags::ROW_VALID),
+ OUString aCellStr1 =
+ ScAddress( static_cast<SCCOL>(aCellPos.Tab()), 0, 0 ).Format(
+ (ScRefFlags::COL_ABS|ScRefFlags::COL_VALID), nullptr, pDok->GetAddressConvention() );
+ OUString aCellStr2 =
+ aCellPos.Format((ScRefFlags::COL_ABS|ScRefFlags::COL_VALID|ScRefFlags::ROW_ABS|ScRefFlags::ROW_VALID),
nullptr, pDok->GetAddressConvention());
- aFuncResult.append(aCellStr);
- PushString( aFuncResult.makeStringAndClear() );
+ OUString aFuncResult = aCellStr1 + ":" + aCellStr2;
+ PushString( aFuncResult );
}
// *** CELL PROPERTIES ***
@@ -2493,12 +2491,8 @@ void ScInterpreter::ScCellExternal()
return;
}
- OUStringBuffer aBuf;
- aBuf.append('\'');
- aBuf.append(*p);
- aBuf.append("'#$");
- aBuf.append(aTabName);
- PushString(aBuf.makeStringAndClear());
+ OUString aBuf = "'" + *p + "'#$" + aTabName;
+ PushString(aBuf);
}
else if ( aInfoType == "CONTENTS" )
{