summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-05-03 14:09:20 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-05-03 15:32:53 +0200
commitc5a0b7af847a71fd50f713934b29305f8ce96c6b (patch)
treed7c0193bc183250c36e467f830a4327ab94dc24e /sc/source
parentd19dbcc139d18771e5e20e82a694f1512476e41c (diff)
loplugin:stringadd improvement for appending numbers
I was wrong, the Concat framework already optimised appending numbers by stack-allocating small buffers, so include them in the plugin Change-Id: I922edbdde273c89abfe21d51c5d25dc01c97db25 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115037 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/tool/compiler.cxx4
-rw-r--r--sc/source/filter/excel/xehelper.cxx2
-rw-r--r--sc/source/filter/html/htmlexp.cxx11
-rw-r--r--sc/source/filter/oox/formulabase.cxx4
-rw-r--r--sc/source/filter/oox/querytablebuffer.cxx2
-rw-r--r--sc/source/ui/dbgui/asciiopt.cxx12
-rw-r--r--sc/source/ui/miscdlgs/dataproviderdlg.cxx2
-rw-r--r--sc/source/ui/view/tabview.cxx12
8 files changed, 24 insertions, 25 deletions
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 9e8f8929dc12..76a60156fd16 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -1616,7 +1616,7 @@ r1c1_add_col( OUStringBuffer &rBuf, const ScSingleRefData& rRef, const ScAddress
{
SCCOL nCol = rRef.Col();
if (nCol != 0)
- rBuf.append("[").append(static_cast<sal_Int32>(nCol)).append("]");
+ rBuf.append("[" + OUString::number(nCol) + "]");
}
else
rBuf.append( static_cast<sal_Int32>(rAbsRef.Col() + 1) );
@@ -1629,7 +1629,7 @@ r1c1_add_row( OUStringBuffer &rBuf, const ScSingleRefData& rRef, const ScAddress
{
if (rRef.Row() != 0)
{
- rBuf.append("[").append(rRef.Row() ).append("]");
+ rBuf.append("[" + OUString::number(rRef.Row()) + "]");
}
}
else
diff --git a/sc/source/filter/excel/xehelper.cxx b/sc/source/filter/excel/xehelper.cxx
index d841789e8b5e..cae981a5e622 100644
--- a/sc/source/filter/excel/xehelper.cxx
+++ b/sc/source/filter/excel/xehelper.cxx
@@ -760,7 +760,7 @@ void XclExpHFConverter::AppendPortion( const EditTextObject* pTextObj, sal_Unico
aNewData.mnHeight = (aNewData.mnHeight + 10) / 20;
bool bFontHtChanged = (aFontData.mnHeight != aNewData.mnHeight);
if( bFontHtChanged )
- aParaText.append("&").append( static_cast<sal_Int32>(aNewData.mnHeight) );
+ aParaText.append("&" + OUString::number(aNewData.mnHeight));
// update maximum paragraph height, convert to twips
nParaHeight = ::std::max< sal_Int32 >( nParaHeight, aNewData.mnHeight * 20 );
diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx
index ca93cdc02f34..9fd6e737fab5 100644
--- a/sc/source/filter/html/htmlexp.cxx
+++ b/sc/source/filter/html/htmlexp.cxx
@@ -496,8 +496,7 @@ OString ScHTMLExport::BorderToStyle(const char* pBorderName,
int nWidth = pLine->GetWidth();
int nPxWidth = (nWidth > 0) ?
std::max(o3tl::convert(nWidth, o3tl::Length::twip, o3tl::Length::px), sal_Int64(1)) : 0;
- aOut.append(static_cast<sal_Int32>(nPxWidth)).
- append("px ");
+ aOut.append(OString::number(nPxWidth) + "px ");
switch (pLine->GetBorderLineStyle())
{
case SvxBorderLineStyle::SOLID:
@@ -722,8 +721,8 @@ void ScHTMLExport::WriteTables()
// ALIGN=LEFT allow text and graphics to flow around
// CELLSPACING
aByteStrOut.append(" " OOO_STRING_SVTOOLS_HTML_O_cellspacing
- "=\"").
- append(static_cast<sal_Int32>(nCellSpacing)).append('"');
+ "=\"" +
+ OString::number(nCellSpacing) + "\"");
// BORDER=0, we do the styling of the cells in <TD>
aByteStrOut.append(" " OOO_STRING_SVTOOLS_HTML_O_border "=\"0\"");
@@ -935,8 +934,8 @@ void ScHTMLExport::WriteCell( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SC
if ( bTableDataHeight )
{
- aStrTD.append(" " OOO_STRING_SVTOOLS_HTML_O_height "=\"").
- append(static_cast<sal_Int32>(nHeightPixel)).append('"');
+ aStrTD.append(" " OOO_STRING_SVTOOLS_HTML_O_height "=\"" +
+ OString::number(nHeightPixel) + "\"");
}
const SvxFontItem& rFontItem = static_cast<const SvxFontItem&>( pAttr->GetItem(
diff --git a/sc/source/filter/oox/formulabase.cxx b/sc/source/filter/oox/formulabase.cxx
index a6e058c5c453..9d009dd301fe 100644
--- a/sc/source/filter/oox/formulabase.cxx
+++ b/sc/source/filter/oox/formulabase.cxx
@@ -1272,8 +1272,8 @@ bool OpCodeProviderImpl::initOpCode( sal_Int32& ornOpCode, const OpCodeEntrySequ
ornOpCode = rEntrySeq[ nSpecialId ].Token.OpCode;
return true;
}
- OSL_FAIL( OStringBuffer( "OpCodeProviderImpl::initOpCode - opcode for special offset " ).
- append( nSpecialId ).append( " not found" ).getStr() );
+ OSL_FAIL( OString( OString::Concat("OpCodeProviderImpl::initOpCode - opcode for special offset ") +
+ OString::number( nSpecialId ) + " not found" ).getStr() );
return false;
}
diff --git a/sc/source/filter/oox/querytablebuffer.cxx b/sc/source/filter/oox/querytablebuffer.cxx
index 14974c30da71..82f9821fcee9 100644
--- a/sc/source/filter/oox/querytablebuffer.cxx
+++ b/sc/source/filter/oox/querytablebuffer.cxx
@@ -79,7 +79,7 @@ void lclAppendWebQueryTableIndex( OUStringBuffer& rTables, sal_Int32 nTableIndex
{
if( !rTables.isEmpty() )
rTables.append( ';' );
- rTables.append( "HTML_" ).append( nTableIndex );
+ rTables.append( "HTML_" + OUString::number( nTableIndex ) );
}
}
diff --git a/sc/source/ui/dbgui/asciiopt.cxx b/sc/source/ui/dbgui/asciiopt.cxx
index 270ca6b01069..4d9e8dea6fe8 100644
--- a/sc/source/ui/dbgui/asciiopt.cxx
+++ b/sc/source/ui/dbgui/asciiopt.cxx
@@ -211,24 +211,24 @@ OUString ScAsciiOptions::WriteToString() const
aOutStr.append(ScGlobal::GetCharsetString( eCharSet ));
//Token 3: Number of start row.
- aOutStr.append(",").append(nStartRow).append(",");
+ aOutStr.append("," + OUString::number(nStartRow) + ",");
//Token 4: Column info.
for (size_t nInfo=0; nInfo<mvColStart.size(); nInfo++)
{
if (nInfo)
aOutStr.append("/");
- aOutStr.append(mvColStart[nInfo])
- .append("/")
- .append(static_cast<sal_Int32>(mvColFormat[nInfo]));
+ aOutStr.append(OUString::number(mvColStart[nInfo]) +
+ "/" +
+ OUString::number(mvColFormat[nInfo]));
}
// #i112025# the options string is used in macros and linked sheets,
// so new options must be added at the end, to remain compatible
- aOutStr.append(",")
+ aOutStr.append("," +
//Token 5: Language
- .append(static_cast<sal_Int32>(static_cast<sal_uInt16>(eLang))).append("," +
+ OUString::number(static_cast<sal_uInt16>(eLang)) + "," +
//Token 6: Import quoted field as text.
OUString::boolean( bQuotedFieldAsText ) + "," +
//Token 7: Detect special numbers.
diff --git a/sc/source/ui/miscdlgs/dataproviderdlg.cxx b/sc/source/ui/miscdlgs/dataproviderdlg.cxx
index fe8809f144e1..85d58a907527 100644
--- a/sc/source/ui/miscdlgs/dataproviderdlg.cxx
+++ b/sc/source/ui/miscdlgs/dataproviderdlg.cxx
@@ -301,7 +301,7 @@ ScMergeColumnTransformationControl::ScMergeColumnTransformationControl(
aBuffer.append(static_cast<sal_Int32>(nStartCol + 1));
for ( SCCOL nCol = nStartCol + 1; nCol <= nEndCol; ++nCol)
{
- aBuffer.append(";").append(static_cast<sal_Int32>(nCol + 1));
+ aBuffer.append(";" + OUString::number(nCol + 1));
}
mxEdColumns->set_text(aBuffer.makeStringAndClear());
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index b727d817e185..4fb5d812c8af 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -2410,12 +2410,12 @@ void lcl_createGroupsData(
bool bGroupHidden = pEntry->IsHidden();
- rGroupsBuffer
- .append("{ \"level\": ").append(sal_Int32(nLevel + 1)).append(", "
- "\"index\": ").append(sal_Int32(nIndex)).append(", "
- "\"startPos\": ").append(rGroupStartPositions[nLevel]).append(", "
- "\"endPos\": ").append(nTotalPx).append(", "
- "\"hidden\": ").append(sal_Int32(bGroupHidden ? 1 : 0)).append(" }");
+ rGroupsBuffer.append(
+ "{ \"level\": " + OString::number(nLevel + 1) + ", "
+ "\"index\": " + OString::number(nIndex) + ", "
+ "\"startPos\": " + OString::number(rGroupStartPositions[nLevel]) + ", "
+ "\"endPos\": " + OString::number(nTotalPx) + ", "
+ "\"hidden\": " + OString::number(bGroupHidden ? 1 : 0) + " }");
// look for the next visible group control at level nLevel
bool bFound = false;