summaryrefslogtreecommitdiff
path: root/sc/source/core
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-04-23 16:07:32 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-04-27 14:07:56 +0200
commitc7c6f0af6c836ebe0968967a1e7c8320b0ac17d6 (patch)
tree4bc5b2fa623b9765b88bbfe7de10a7590c87d5c8 /sc/source/core
parent99482297c7dd497e41fad2e7193759043e305101 (diff)
loplugin:stringadd convert chained append to +
which can use the more efficient *StringConcat Also fix a crash in stringview plugin which started happening while I working on this. Change-Id: I91a5b9b7707d1594d27d80b73930f5afac8ae608 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114568 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/postit.cxx2
-rw-r--r--sc/source/core/tool/address.cxx2
-rw-r--r--sc/source/core/tool/chgtrack.cxx49
-rw-r--r--sc/source/core/tool/compiler.cxx4
4 files changed, 17 insertions, 40 deletions
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index 84633a640de8..882cc8c190bb 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -1169,7 +1169,7 @@ ScCaptionPtr ScNoteUtil::CreateTempCaption(
if( pNote && !pNote->IsCaptionShown() )
{
if( !aBuffer.isEmpty() )
- aBuffer.append( "\n--------\n" ).append( pNote->GetText() );
+ aBuffer.append( "\n--------\n" + pNote->GetText() );
pNoteCaption = pNote->GetOrCreateCaption( rPos );
}
diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx
index 06ffd08c7d44..283f45ee8d0a 100644
--- a/sc/source/core/tool/address.cxx
+++ b/sc/source/core/tool/address.cxx
@@ -2185,7 +2185,7 @@ static void lcl_ScRange_Format_XL_Header( OUStringBuffer& rString, const ScRange
default:
if (!aDocName.isEmpty())
{
- rString.append("[").append(aDocName).append("]");
+ rString.append("[" + aDocName + "]");
}
rString.append(aTabName);
break;
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index 7abcc01864ac..ebe614ed7b81 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -426,20 +426,15 @@ void ScChangeAction::GetDescription(
// not properly restored in formulas. See specification at
// http://specs.openoffice.org/calc/ease-of-use/redlining_comment.sxw
- OUStringBuffer aBuf(rStr); // Take the original string.
if (GetType() == SC_CAT_MOVE)
{
- aBuf.append(
- ScResId(STR_CHANGED_MOVE_REJECTION_WARNING)).append(" ");
- rStr = aBuf.makeStringAndClear();
+ rStr += ScResId(STR_CHANGED_MOVE_REJECTION_WARNING) + " ";
return;
}
if (IsInsertType())
{
- aBuf.append(
- ScResId(STR_CHANGED_DELETE_REJECTION_WARNING)).append(" ");
- rStr = aBuf.makeStringAndClear();
+ rStr += ScResId(STR_CHANGED_DELETE_REJECTION_WARNING) + " ";
return;
}
@@ -454,19 +449,13 @@ void ScChangeAction::GetDescription(
if (pReject->GetType() == SC_CAT_MOVE)
{
- aBuf.append(
- ScResId(STR_CHANGED_MOVE_REJECTION_WARNING));
- aBuf.append(' ');
- rStr = aBuf.makeStringAndClear();
+ rStr += ScResId(STR_CHANGED_MOVE_REJECTION_WARNING) + " ";
return;
}
if (pReject->IsDeleteType())
{
- aBuf.append(
- ScResId(STR_CHANGED_DELETE_REJECTION_WARNING));
- aBuf.append(' ');
- rStr = aBuf.makeStringAndClear();
+ rStr += ScResId(STR_CHANGED_DELETE_REJECTION_WARNING) + " ";
return;
}
@@ -482,15 +471,9 @@ void ScChangeAction::GetDescription(
return;
if( itChangeAction->second->GetType() == SC_CAT_MOVE)
- aBuf.append(
- ScResId(STR_CHANGED_MOVE_REJECTION_WARNING));
+ rStr += ScResId(STR_CHANGED_MOVE_REJECTION_WARNING) + " ";
else
- aBuf.append(
- ScResId(STR_CHANGED_DELETE_REJECTION_WARNING));
-
- aBuf.append(' ');
- rStr = aBuf.makeStringAndClear();
- return;
+ rStr += ScResId(STR_CHANGED_DELETE_REJECTION_WARNING) + " ";
}
OUString ScChangeAction::GetRefString(
@@ -707,15 +690,13 @@ void ScChangeActionIns::GetDescription(
return;
// Construct a range string to replace '#1' first.
- OUStringBuffer aBuf(ScResId(pWhatId));
- aBuf.append(' ');
- aBuf.append(GetRefString(GetBigRange(), rDoc));
- OUString aRangeStr = aBuf.makeStringAndClear();
+ OUString aRangeStr = ScResId(pWhatId) +
+ " " +
+ GetRefString(GetBigRange(), rDoc);
aRsc = aRsc.replaceAt(nPos, 2, aRangeStr); // replace '#1' with the range string.
- aBuf.append(rStr).append(aRsc);
- rStr = aBuf.makeStringAndClear();
+ rStr += aRsc;
}
bool ScChangeActionIns::IsEndOfList() const
@@ -955,15 +936,11 @@ void ScChangeActionDel::GetDescription(
return;
// Build a string to replace with.
- OUStringBuffer aBuf;
- aBuf.append(ScResId(pWhatId));
- aBuf.append(' ');
- aBuf.append(GetRefString(aTmpRange, rDoc));
- OUString aRangeStr = aBuf.makeStringAndClear();
+ OUString aRangeStr = ScResId(pWhatId) + " " +
+ GetRefString(aTmpRange, rDoc);
aRsc = aRsc.replaceAt(nPos, 2, aRangeStr); // replace '#1' with the string.
- aBuf.append(rStr).append(aRsc);
- rStr = aBuf.makeStringAndClear(); // append to the original.
+ rStr += aRsc; // append to the original.
}
bool ScChangeActionDel::Reject( ScDocument& rDoc )
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 233038b90c24..488e5ab1fd9f 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -688,7 +688,7 @@ static OUString lcl_makeExternalNameStr(const OUString& rFile, const OUString& r
OUStringBuffer aBuf(aFile.getLength() + aName.getLength() + 9);
if (bODF)
aBuf.append( '[');
- aBuf.append( "'" ).append( aFile ).append( "'" ).append( OUStringChar(cSep) );
+ aBuf.append( "'" + aFile + "'" + OUStringChar(cSep) );
if (bODF)
aBuf.append( "$$'" );
aBuf.append( aName);
@@ -952,7 +952,7 @@ struct ConventionOOO_A1 : public Convention_A1
else
aFile = INetURLObject::decode(rFileName, INetURLObject::DecodeMechanism::Unambiguous);
- rBuffer.append("'").append(aFile.replaceAll("'", "''")).append("'#");
+ rBuffer.append("'" + aFile.replaceAll("'", "''") + "'#");
if (!rRef.IsTabRel())
rBuffer.append('$');