Kaydet (Commit) 0e2a6e8e authored tarafından Noel Grandin's avatar Noel Grandin

remove some unnecessary use of OUStringBuffer

Change-Id: Ia4e02589d2fe79a27b83200a0e7a528a2c806519
Reviewed-on: https://gerrit.libreoffice.org/38508Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst e3828e7b
......@@ -26,8 +26,7 @@ HelpIndexer::HelpIndexer(OUString const &lang, OUString const &module,
OUString const &srcDir, OUString const &outDir)
: d_lang(lang), d_module(module)
{
d_indexDir = OUStringBuffer(outDir).append('/').
append(module).append(".idxl").makeStringAndClear();
d_indexDir = outDir + OUStringLiteral1('/') + module + ".idxl";
d_captionDir = srcDir + "/caption";
d_contentDir = srcDir + "/content";
}
......
......@@ -101,7 +101,7 @@ void TestBreakIterator::testLineBreaking()
{
const sal_Unicode HEBREW1[] = { 0x05DE, 0x05D9, 0x05DC, 0x05D9, 0x5DD };
OUString aWord(HEBREW1, SAL_N_ELEMENTS(HEBREW1));
OUString aTest(OUStringBuffer(aWord).append(' ').append(aWord).makeStringAndClear());
OUString aTest(aWord + " " + aWord);
aLocale.Language = "he";
aLocale.Country = "IL";
......
......@@ -35,7 +35,7 @@ OUString lclRemoveFileName( const OUString& rPath )
OUString lclAppendFileName( const OUString& rPath, const OUString& rFileName )
{
return rPath.isEmpty() ? rFileName :
OUStringBuffer( rPath ).append( '/' ).append( rFileName ).makeStringAndClear();
rPath + OUStringLiteral1('/') + rFileName;
}
OUString createOfficeDocRelationTypeTransitional(const OUString& rType)
......
......@@ -458,7 +458,7 @@ namespace {
OUString lclAddRelation( const Reference< XRelationshipAccess >& rRelations, sal_Int32 nId, const OUString& rType, const OUString& rTarget, bool bExternal )
{
OUString sId = OUStringBuffer().append( "rId" ).append( nId ).makeStringAndClear();
OUString sId = "rId" + OUString::number( nId );
Sequence< StringPair > aEntry( bExternal ? 3 : 2 );
aEntry[0].First = "Type";
......
......@@ -2373,7 +2373,7 @@ void XmlStreamObject::implDumpText( TextInputStream& rTextStrm )
{
while( (nPos < aElem.getLength()) && (aElem[ nPos ] >= 32) ) ++nPos;
if( nPos < aElem.getLength() )
aElem = OUStringBuffer( aElem.copy( 0, nPos ) ).append( ' ' ).append( aElem.copy( nPos ).trim() ).makeStringAndClear();
aElem = aElem.copy( 0, nPos ) + OUStringLiteral1(' ') + aElem.copy( nPos ).trim();
++nPos;
}
......
......@@ -786,7 +786,7 @@ void ChartExport::exportExternalData( const Reference< css::chart::XChartDocumen
if( nSepPos > 0)
{
relationPath = relationPath.copy( nSepPos, ::std::max< sal_Int32 >( externalDataPath.getLength(), 0 ) - nSepPos );
relationPath = OUStringBuffer( ".." ).append( relationPath ).makeStringAndClear();
relationPath = ".." + relationPath;
}
}
FSHelperPtr pFS = GetFS();
......
......@@ -873,7 +873,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle&
OString VMLExport::ShapeIdString( sal_uInt32 nId )
{
return OStringBuffer( 20 ).append( "shape_" ).append( sal_Int64( nId ) ).makeStringAndClear();
return "shape_" + OString::number( nId );
}
void VMLExport::AddFlipXY( )
......
......@@ -86,7 +86,7 @@ OUString ContainerHelper::getUnusedName(
OUString aNewName = rSuggestedName;
sal_Int32 nIndex = -1;
while( rxNameAccess->hasByName( aNewName ) )
aNewName = OUStringBuffer( rSuggestedName ).append( cSeparator ).append( nIndex++ ).makeStringAndClear();
aNewName = rSuggestedName + OUStringLiteral1(cSeparator) + OUString::number( nIndex++ );
return aNewName;
}
......
......@@ -119,7 +119,7 @@ OUString VbaControlNamesSet::generateDummyName()
OUString aCtrlName;
do
{
aCtrlName = OUStringBuffer( maDummyBaseName ).append( ++mnIndex ).makeStringAndClear();
aCtrlName = maDummyBaseName + OUString::number( ++mnIndex );
}
while( maCtrlNames.count( aCtrlName ) > 0 );
maCtrlNames.insert( aCtrlName );
......
......@@ -296,7 +296,7 @@ OUString ShapeBase::getShapeName() const
{
sal_Int32 nShapeIdx = mrDrawing.getLocalShapeIndex( getShapeId() );
if( nShapeIdx > 0 )
return OUStringBuffer( aBaseName ).append( ' ' ).append( nShapeIdx ).makeStringAndClear();
return aBaseName + OUStringLiteral1(' ') + OUString::number( nShapeIdx );
}
return OUString();
......
......@@ -297,8 +297,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
aResName = OutputFile( *aInputList[ 0 ], "res" );
if( ! bSetSrs )
{
aSrsName = OStringBuffer("-fp=").append(OutputFile(*aInputList[0], "srs")).
makeStringAndClear();
aSrsName = OString("-fp=") + OutputFile(*aInputList[0], "srs");
}
};
......
......@@ -93,7 +93,7 @@ OUString lclGetBaseName( sal_Unicode cBuiltinId )
OUString lclGetPrefixedName( sal_Unicode cBuiltinId )
{
return OUStringBuffer( spcOoxPrefix ).append( lclGetBaseName( cBuiltinId ) ).makeStringAndClear();
return spcOoxPrefix + lclGetBaseName( cBuiltinId );
}
/** returns the built-in name identifier from a prefixed built-in name, e.g. '_xlnm.Print_Area'. */
......
......@@ -105,7 +105,7 @@ void ExcelVbaProject::prepareImport()
OUString aCodeName;
do
{
aCodeName = OUStringBuffer( aIt->maPrefix ).append( nCounter++ ).makeStringAndClear();
aCodeName = aIt->maPrefix + OUString::number( nCounter++ );
}
while( aUsedCodeNames.count( aCodeName ) > 0 );
aUsedCodeNames.insert( aCodeName );
......
......@@ -2591,7 +2591,7 @@ void CellStyleBuffer::finalizeImport()
OUString aUnusedName;
do
{
aUnusedName = OUStringBuffer( aStyleName ).append( ' ' ).append( ++nIndex ).makeStringAndClear();
aUnusedName = aStyleName + OUStringLiteral1(' ') + OUString::number( ++nIndex );
}
while( aCellStyles.find( aUnusedName ) != aCellStyles.end() );
aCellStyles[ aUnusedName ] = *aIt;
......@@ -2877,7 +2877,7 @@ OUString StylesBuffer::createDxfStyle( sal_Int32 nDxfId ) const
if (Dxf* pDxf = maDxfs.get(nDxfId).get())
{
rStyleName = OUStringBuffer("ConditionalStyle_").append(nDxfId + 1).makeStringAndClear();
rStyleName = "ConditionalStyle_" + OUString::number(nDxfId + 1);
// Create a cell style. This may overwrite an existing style if
// one with the same name exists.
......
......@@ -379,7 +379,7 @@ OUString findUnusedName( const ScRangeName* pRangeName, const OUString& rSuggest
OUString aNewName = rSuggestedName;
sal_Int32 nIndex = 0;
while(pRangeName->findByUpperName(ScGlobal::pCharClass->uppercase(aNewName)))
aNewName = OUStringBuffer(rSuggestedName).append( '_' ).append( nIndex++ ).makeStringAndClear();
aNewName = rSuggestedName + OUStringLiteral1('_') + OUString::number( nIndex++ );
return aNewName;
}
......
......@@ -278,7 +278,7 @@ void SAL_CALL ScVbaSheetObjectBase::setPrintObject( sal_Bool /*bPrintObject*/ )
void ScVbaSheetObjectBase::setDefaultProperties( sal_Int32 nIndex )
{
OUString aName = OUStringBuffer( implGetBaseName() ).append( ' ' ).append( nIndex + 1 ).makeStringAndClear();
OUString aName = implGetBaseName() + OUStringLiteral1(' ') + OUString::number( nIndex + 1 );
setName( aName );
implSetDefaultProperties();
}
......
......@@ -234,7 +234,7 @@ namespace svx
);
aFileDlg.SetDisplayDirectory( impl_getCurrentURL() );
aFileDlg.AddFilter( m_sFilterUIName, OUStringBuffer().append( "*." ).append( m_aFilterExtensions[0] ).makeStringAndClear() );
aFileDlg.AddFilter( m_sFilterUIName, "*." + m_aFilterExtensions[0] );
aFileDlg.SetCurrentFilter( m_sFilterUIName );
if ( aFileDlg.Execute() == ERRCODE_NONE )
......
......@@ -1664,11 +1664,9 @@ void SwTOXBaseSection::UpdatePageNum_( SwTextNode* pNd,
// collect starts end ends of main entry character style
std::unique_ptr< std::vector<sal_uInt16> > xCharStyleIdx(pMainEntryNums ? new std::vector<sal_uInt16> : nullptr);
OUString sSrchStr = OUStringBuffer().append(C_NUM_REPL).
append(S_PAGE_DELI).append(C_NUM_REPL).makeStringAndClear();
OUString sSrchStr = OUStringLiteral1(C_NUM_REPL) + S_PAGE_DELI + OUStringLiteral1(C_NUM_REPL);
sal_Int32 nStartPos = pNd->GetText().indexOf(sSrchStr);
sSrchStr = OUStringBuffer().append(C_NUM_REPL).
append(C_END_PAGE_NUM).makeStringAndClear();
sSrchStr = OUStringLiteral1(C_NUM_REPL) + OUStringLiteral1(C_END_PAGE_NUM);
sal_Int32 nEndPos = pNd->GetText().indexOf(sSrchStr);
if (-1 == nEndPos || rNums.empty())
......
......@@ -708,26 +708,26 @@ void DocxExport::WriteHeaderFooter( const SwFormat& rFormat, bool bHeader, const
::sax_fastparser::FSHelperPtr pFS;
if ( bHeader )
{
OUString aName( OUStringBuffer().append("header").append( ++m_nHeaders ).append(".xml").makeStringAndClear() );
OUString aName( "header" + OUString::number( ++m_nHeaders ) + ".xml" );
aRelId = m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
oox::getRelationship(Relationship::HEADER),
aName );
pFS = m_pFilter->openFragmentStreamWithSerializer( OUStringBuffer().append("word/").append( aName ).makeStringAndClear(),
pFS = m_pFilter->openFragmentStreamWithSerializer( "word/" + aName,
"application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml" );
pFS->startElementNS( XML_w, XML_hdr, MainXmlNamespaces());
}
else
{
OUString aName( OUStringBuffer().append("footer").append( ++m_nFooters ).append(".xml").makeStringAndClear() );
OUString aName( "footer" + OUString::number( ++m_nFooters ) + ".xml" );
aRelId = m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
oox::getRelationship(Relationship::FOOTER),
aName );
pFS = m_pFilter->openFragmentStreamWithSerializer( OUStringBuffer().append("word/").append( aName ).makeStringAndClear(),
pFS = m_pFilter->openFragmentStreamWithSerializer( "word/" + aName,
"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml" );
pFS->startElementNS( XML_w, XML_ftr, MainXmlNamespaces());
......
......@@ -4069,7 +4069,7 @@ bool SwWW8ImplReader::ReadText(WW8_CP nStartCp, WW8_CP nTextLen, ManTypes nType)
if(m_pAktItemSet && !pFormat)
{
OUString sPrefix(OUStringBuffer("WW8Dropcap").append(m_nDropCap++).makeStringAndClear());
OUString sPrefix = "WW8Dropcap" + OUString::number(m_nDropCap++);
pNewSwCharFormat = m_rDoc.MakeCharFormat(sPrefix, m_rDoc.GetDfltCharFormat());
m_pAktItemSet->ClearItem(RES_CHRATR_ESCAPEMENT);
pNewSwCharFormat->SetFormatAttr( *m_pAktItemSet );
......
......@@ -327,7 +327,7 @@ static PathStatus getDerivedPath(
{
OSL_PRECOND(!_aBaseURL.endsWith(OUStringLiteral1(cURLSeparator)), "Unexpected: base URL ends in slash");
sDerivedURL = OUStringBuffer(_aBaseURL).append(cURLSeparator).append(_sRelativeURL).makeStringAndClear();
sDerivedURL = _aBaseURL + OUStringLiteral1(cURLSeparator) + _sRelativeURL;
// a derived (nested) URL can only exist or have a lesser status, if the parent exists
if (aStatus == Bootstrap::PATH_EXISTS)
......
......@@ -431,7 +431,7 @@ void FieldParamExporter::Export()
{
sal_Int32 nValue = 0;
aValue >>= nValue;
ExportParameter(rParameter, OUStringBuffer().append(nValue).makeStringAndClear());
ExportParameter(rParameter, OUString::number(nValue));
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment