summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-10-16 10:13:30 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-10-16 12:12:31 +0200
commit4a96fb8ec0130e1036913093836bcf28bc37a49b (patch)
treee7aad9be4ca417e9e64f688cc99bee0638037741 /sc/source
parentf33b6e341fb7dd1ab3acd4fe5457b716be316e89 (diff)
loplugin:bufferadd loosen some constraints
and extend O*StringView to have a constructor that takes a pointer and a length Change-Id: I6120e96280f030757e855a6596efdae438b7e1e8 Reviewed-on: https://gerrit.libreoffice.org/80872 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/tool/addincol.cxx18
-rw-r--r--sc/source/core/tool/interpr1.cxx4
-rw-r--r--sc/source/core/tool/unitconv.cxx5
-rw-r--r--sc/source/filter/excel/xehelper.cxx4
-rw-r--r--sc/source/filter/html/htmlexp.cxx7
-rw-r--r--sc/source/ui/view/viewutil.cxx6
6 files changed, 11 insertions, 33 deletions
diff --git a/sc/source/core/tool/addincol.cxx b/sc/source/core/tool/addincol.cxx
index 59a7cb6bb648..56e2c421d8c8 100644
--- a/sc/source/core/tool/addincol.cxx
+++ b/sc/source/core/tool/addincol.cxx
@@ -389,11 +389,7 @@ void ScUnoAddInCollection::ReadConfiguration()
ppFuncData[nFuncPos+nOld] = nullptr;
// stored function name: (service name).(function)
- OUStringBuffer aFuncNameBuffer( aServiceName.getLength()+1+pFuncNameArray[nFuncPos].getLength());
- aFuncNameBuffer.append(aServiceName);
- aFuncNameBuffer.append('.');
- aFuncNameBuffer.append(pFuncNameArray[nFuncPos]);
- OUString aFuncName = aFuncNameBuffer.makeStringAndClear();
+ OUString aFuncName = aServiceName + "." + pFuncNameArray[nFuncPos];
// skip the function if already known (read from old AddIn service)
@@ -786,11 +782,7 @@ void ScUnoAddInCollection::ReadFromAddIn( const uno::Reference<uno::XInterface>&
OUString aFuncU = xFunc->getName();
// stored function name: (service name).(function)
- OUStringBuffer aFuncNameBuffer( aServiceName.getLength()+1+aFuncU.getLength());
- aFuncNameBuffer.append(aServiceName);
- aFuncNameBuffer.append('.');
- aFuncNameBuffer.append(aFuncU);
- OUString aFuncName = aFuncNameBuffer.makeStringAndClear();
+ OUString aFuncName = aServiceName + "." + aFuncU;
bool bValid = true;
long nVisibleCount = 0;
@@ -988,11 +980,7 @@ void ScUnoAddInCollection::UpdateFromAddIn( const uno::Reference<uno::XInterface
OUString aFuncU = xFunc->getName();
// stored function name: (service name).(function)
- OUStringBuffer aFuncNameBuffer( rServiceName.getLength()+1+aFuncU.getLength());
- aFuncNameBuffer.append(rServiceName);
- aFuncNameBuffer.append('.');
- aFuncNameBuffer.append(aFuncU);
- OUString aFuncName = aFuncNameBuffer.makeStringAndClear();
+ OUString aFuncName = rServiceName + "." + aFuncU;
// internal names are skipped because no FuncData exists
ScUnoAddInFuncData* pOldData = const_cast<ScUnoAddInFuncData*>( GetFuncData( aFuncName ) );
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index df8821b84531..1c0e0237ad53 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -9144,7 +9144,7 @@ void ScInterpreter::ScFindB()
else
{
// create a string from sStr starting at nStart
- OUStringBuffer aBuf( lcl_RightB( aStr, nLen - nStart + 1 ) );
+ OUString aBuf = lcl_RightB( aStr, nLen - nStart + 1 );
// search aBuf for asStr
sal_Int32 nPos = aBuf.indexOf( asStr, 0 );
if ( nPos == -1 )
@@ -9152,7 +9152,7 @@ void ScInterpreter::ScFindB()
else
{
// obtain byte value of nPos
- int nBytePos = lcl_getLengthB( aBuf.makeStringAndClear(), nPos );
+ int nBytePos = lcl_getLengthB( aBuf, nPos );
PushDouble( nBytePos + nStart );
}
}
diff --git a/sc/source/core/tool/unitconv.cxx b/sc/source/core/tool/unitconv.cxx
index 354c1ca5ab36..9451db9c1809 100644
--- a/sc/source/core/tool/unitconv.cxx
+++ b/sc/source/core/tool/unitconv.cxx
@@ -37,10 +37,7 @@ ScUnitConverterData::ScUnitConverterData(
OUString ScUnitConverterData::BuildIndexString(
const OUString& rFromUnit, const OUString& rToUnit )
{
- OUStringBuffer aBuf(rFromUnit);
- aBuf.append(cDelim);
- aBuf.append(rToUnit);
- return aBuf.makeStringAndClear();
+ return rFromUnit + OUStringLiteral1(cDelim) + rToUnit;
}
// ScUnitConverter
diff --git a/sc/source/filter/excel/xehelper.cxx b/sc/source/filter/excel/xehelper.cxx
index aeffdfa0b4c2..a6e41f742ed8 100644
--- a/sc/source/filter/excel/xehelper.cxx
+++ b/sc/source/filter/excel/xehelper.cxx
@@ -975,9 +975,7 @@ OUString XclExpUrlHelper::EncodeUrl( const XclExpRoot& rRoot, const OUString& rA
OUString XclExpUrlHelper::EncodeDde( const OUString& rApplic, const OUString& rTopic )
{
- OUStringBuffer aBuf;
- aBuf.append(rApplic).append(EXC_DDE_DELIM).append(rTopic);
- return aBuf.makeStringAndClear();
+ return rApplic + OUStringLiteral1(EXC_DDE_DELIM) + rTopic;
}
// Cached Value Lists =========================================================
diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx
index 646b3d281c47..f40bea0967b7 100644
--- a/sc/source/filter/html/htmlexp.cxx
+++ b/sc/source/filter/html/htmlexp.cxx
@@ -1064,10 +1064,9 @@ void ScHTMLExport::WriteCell( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SC
if (pNote)
{
//create the comment indicator
- OStringBuffer aStr(OOO_STRING_SVTOOLS_HTML_anchor);
- aStr.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_class)
- .append("=\"").append("comment-indicator").append("\"");
- TAG_ON(aStr.makeStringAndClear().getStr());
+ OString aStr = OOO_STRING_SVTOOLS_HTML_anchor " "
+ OOO_STRING_SVTOOLS_HTML_O_class "=\"comment-indicator\"";
+ TAG_ON(aStr.getStr());
TAG_OFF(OOO_STRING_SVTOOLS_HTML_anchor);
OUT_LF();
diff --git a/sc/source/ui/view/viewutil.cxx b/sc/source/ui/view/viewutil.cxx
index ee13c2628c8b..2cbc0ec22ffe 100644
--- a/sc/source/ui/view/viewutil.cxx
+++ b/sc/source/ui/view/viewutil.cxx
@@ -148,13 +148,9 @@ bool ScViewUtil::IsActionShown( const ScChangeAction& rAction,
if ( rSettings.HasComment() )
{
- OUStringBuffer aBuf(rAction.GetComment());
- aBuf.append(" (");
OUString aTmp;
rAction.GetDescription(aTmp, &rDocument);
- aBuf.append(aTmp);
- aBuf.append(')');
- OUString aComStr = aBuf.makeStringAndClear();
+ OUString aComStr = rAction.GetComment() + " (" + aTmp + ")";
if(!rSettings.IsValidComment(&aComStr))
return false;