summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-06-02 11:43:33 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-06-02 13:06:27 +0200
commit733a6b4f8eac9d9b93d7ea9c605bebab9f5345dd (patch)
tree7040cc7515cd9eef8d0e463c2a124fcf15f79e91 /xmloff
parentd79c527c2a599c7821d27cf03b95cb79e2abe685 (diff)
elide some makeStringAndClear() class
when we are passing the result to a string_view, it is pointless. Change-Id: I1e11d2610d70ed49c0b00d0c908829e8f1252bab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135298 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/core/DocumentSettingsContext.cxx6
-rw-r--r--xmloff/source/core/XMLBase64ImportContext.cxx8
-rw-r--r--xmloff/source/draw/animationexport.cxx12
-rw-r--r--xmloff/source/draw/xexptran.cxx5
-rw-r--r--xmloff/source/draw/ximppage.cxx4
-rw-r--r--xmloff/source/meta/xmlmetai.cxx2
-rw-r--r--xmloff/source/style/xmlnumfi.cxx13
-rw-r--r--xmloff/source/text/XMLChangeInfoContext.cxx3
-rw-r--r--xmloff/source/text/XMLTextFrameContext.cxx6
-rw-r--r--xmloff/source/text/txtfldi.cxx4
10 files changed, 38 insertions, 25 deletions
diff --git a/xmloff/source/core/DocumentSettingsContext.cxx b/xmloff/source/core/DocumentSettingsContext.cxx
index bf3a8f7f6472..b21010b07c81 100644
--- a/xmloff/source/core/DocumentSettingsContext.cxx
+++ b/xmloff/source/core/DocumentSettingsContext.cxx
@@ -19,6 +19,7 @@
#include <sal/config.h>
+#include <o3tl/string_view.hxx>
#include <officecfg/Office/Common.hxx>
#include <sax/tools/converter.hxx>
@@ -408,9 +409,10 @@ void XMLConfigItemContext::endFastElement(sal_Int32 )
uno::Sequence<sal_Int8> aDecoded;
if (IsXMLToken(msType, XML_BASE64BINARY))
{
- OUString sChars = maCharBuffer.makeStringAndClear().trim();
- if( !sChars.isEmpty() )
+ std::u16string_view sChars = o3tl::trim(maCharBuffer);
+ if( !sChars.empty() )
::comphelper::Base64::decodeSomeChars( aDecoded, sChars );
+ maCharBuffer.setLength(0);
}
else
sValue = maCharBuffer.makeStringAndClear();
diff --git a/xmloff/source/core/XMLBase64ImportContext.cxx b/xmloff/source/core/XMLBase64ImportContext.cxx
index 301865a26c10..81d2498bbabd 100644
--- a/xmloff/source/core/XMLBase64ImportContext.cxx
+++ b/xmloff/source/core/XMLBase64ImportContext.cxx
@@ -20,6 +20,7 @@
#include <com/sun/star/io/XOutputStream.hpp>
#include <comphelper/base64.hxx>
+#include <o3tl/string_view.hxx>
#include <xmloff/xmlimp.hxx>
#include <xmloff/XMLBase64ImportContext.hxx>
@@ -43,13 +44,14 @@ XMLBase64ImportContext::~XMLBase64ImportContext()
void XMLBase64ImportContext::endFastElement(sal_Int32 )
{
- OUString sChars = maCharBuffer.makeStringAndClear().trim();
- if( !sChars.isEmpty() )
+ std::u16string_view sChars = o3tl::trim(maCharBuffer);
+ if( !sChars.empty() )
{
- Sequence< sal_Int8 > aBuffer( (sChars.getLength() / 4) * 3 );
+ Sequence< sal_Int8 > aBuffer( (sChars.size() / 4) * 3 );
::comphelper::Base64::decodeSomeChars( aBuffer, sChars );
xOut->writeBytes( aBuffer );
}
+ maCharBuffer.setLength(0);
xOut->closeOutput();
}
diff --git a/xmloff/source/draw/animationexport.cxx b/xmloff/source/draw/animationexport.cxx
index 62781694e28f..2a48e16c34f5 100644
--- a/xmloff/source/draw/animationexport.cxx
+++ b/xmloff/source/draw/animationexport.cxx
@@ -1485,7 +1485,8 @@ void AnimationsExporterImpl::convertValue( XMLTokenEnum eAttributeName, OUString
if( !sTmp.isEmpty() )
sTmp.append( ';' );
convertValue( eAttributeName, sTmp2, *pAny );
- sTmp.append( sTmp2.makeStringAndClear() );
+ sTmp.append( sTmp2 );
+ sTmp2.setLength(0);
}
}
else
@@ -1567,7 +1568,8 @@ void AnimationsExporterImpl::convertTiming( OUStringBuffer& sTmp, const Any& rVa
if( !sTmp.isEmpty() )
sTmp.append( ';' );
convertTiming( sTmp2, *pAny );
- sTmp.append( sTmp2.makeStringAndClear() );
+ sTmp.append( sTmp2 );
+ sTmp2.setLength(0);
}
}
else if( auto x = o3tl::tryAccess<double>(rValue) )
@@ -1593,7 +1595,8 @@ void AnimationsExporterImpl::convertTiming( OUStringBuffer& sTmp, const Any& rVa
SvXMLUnitConverter::convertEnum( sTmp2, pEvent->Trigger, aAnimations_EnumMap_EventTrigger );
- sTmp.append( sTmp2.makeStringAndClear() );
+ sTmp.append( sTmp2 );
+ sTmp2.setLength(0);
}
if( pEvent->Offset.hasValue() )
@@ -1603,7 +1606,8 @@ void AnimationsExporterImpl::convertTiming( OUStringBuffer& sTmp, const Any& rVa
if( !sTmp.isEmpty() )
sTmp.append( '+' );
- sTmp.append( sTmp2.makeStringAndClear() );
+ sTmp.append( sTmp2 );
+ sTmp2.setLength(0);
}
}
else
diff --git a/xmloff/source/draw/xexptran.cxx b/xmloff/source/draw/xexptran.cxx
index c8e7f51bb403..776401fb2840 100644
--- a/xmloff/source/draw/xexptran.cxx
+++ b/xmloff/source/draw/xexptran.cxx
@@ -129,11 +129,10 @@ static double Imp_GetDoubleChar(std::u16string_view rStr, sal_Int32& rPos, const
if(!sNumberString.isEmpty())
{
if(bLookForUnits)
- rConv.convertDouble(fRetval, sNumberString.makeStringAndClear());
+ rConv.convertDouble(fRetval, sNumberString);
else
{
- ::sax::Converter::convertDouble(fRetval,
- sNumberString.makeStringAndClear());
+ ::sax::Converter::convertDouble(fRetval, sNumberString);
}
}
diff --git a/xmloff/source/draw/ximppage.cxx b/xmloff/source/draw/ximppage.cxx
index c37b2de99f6c..3d5cdf006f45 100644
--- a/xmloff/source/draw/ximppage.cxx
+++ b/xmloff/source/draw/ximppage.cxx
@@ -202,11 +202,11 @@ void DrawAnnotationContext::endFastElement(sal_Int32)
mxAnnotation->setInitials( maInitialsBuffer.makeStringAndClear() );
util::DateTime aDateTime;
- if (::sax::Converter::parseDateTime(aDateTime,
- maDateBuffer.makeStringAndClear()))
+ if (::sax::Converter::parseDateTime(aDateTime, maDateBuffer))
{
mxAnnotation->setDateTime(aDateTime);
}
+ maDateBuffer.setLength(0);
}
}
diff --git a/xmloff/source/meta/xmlmetai.cxx b/xmloff/source/meta/xmlmetai.cxx
index 912073011c39..3dc240cd107e 100644
--- a/xmloff/source/meta/xmlmetai.cxx
+++ b/xmloff/source/meta/xmlmetai.cxx
@@ -292,7 +292,7 @@ void SvXMLMetaDocumentContext::setBuildId(OUString const& i_rBuildId, const uno:
}
if (!sNumber.isEmpty())
{
- sBuildId += ";" + sNumber.makeStringAndClear();
+ sBuildId += ";" + sNumber;
}
}
diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
index 9e40fada98fa..e5e9a25828fa 100644
--- a/xmloff/source/style/xmlnumfi.cxx
+++ b/xmloff/source/style/xmlnumfi.cxx
@@ -875,13 +875,15 @@ void SvXMLNumFmtElementContext::endFastElement(sal_Int32 )
if ( !aContent.isEmpty() )
{
lcl_EnquoteIfNecessary( aContent, rParent );
- rParent.AddToCode( aContent.makeStringAndClear() );
+ rParent.AddToCode( aContent );
+ aContent.setLength(0);
}
else
{
// Quoted empty text may be significant to separate.
aContent.append("\"\"");
- rParent.AddToCode( aContent.makeStringAndClear() );
+ rParent.AddToCode( aContent );
+ aContent.setLength(0);
rParent.SetHasTrailingEmptyText(true); // *after* AddToCode()
}
break;
@@ -1028,7 +1030,7 @@ void SvXMLNumFmtElementContext::endFastElement(sal_Int32 )
rParent.AddNumber( aNumInfo ); // number without decimals
OUStringBuffer sIntegerFractionDelimiter(aNumInfo.aIntegerFractionDelimiter);
lcl_EnquoteIfNecessary( sIntegerFractionDelimiter, rParent );
- rParent.AddToCode( sIntegerFractionDelimiter.makeStringAndClear() ); // default is ' '
+ rParent.AddToCode( sIntegerFractionDelimiter ); // default is ' '
}
//! build string and add at once
@@ -1509,7 +1511,8 @@ sal_Int32 SvXMLNumFormatContext::CreateAndInsert(SvNumberFormatter* pFormatter)
aFormatCode.truncate( nBufLen - 2);
}
- aFormatCode.insert( 0, aConditions.makeStringAndClear() );
+ aFormatCode.insert( 0, aConditions );
+ aConditions.setLength(0);
OUString sFormat = aFormatCode.makeStringAndClear();
// test special cases
@@ -2062,7 +2065,7 @@ void SvXMLNumFormatContext::AddColor( Color const nColor )
{
aColName.insert( 0, '[' );
aColName.append( ']' );
- aFormatCode.insert( 0, aColName.makeStringAndClear() );
+ aFormatCode.insert( 0, aColName );
}
}
diff --git a/xmloff/source/text/XMLChangeInfoContext.cxx b/xmloff/source/text/XMLChangeInfoContext.cxx
index 9a005016fb51..9dddbad72a67 100644
--- a/xmloff/source/text/XMLChangeInfoContext.cxx
+++ b/xmloff/source/text/XMLChangeInfoContext.cxx
@@ -77,7 +77,8 @@ void XMLChangeInfoContext::endFastElement(sal_Int32 )
// set values at changed region context
rChangedRegion.SetChangeInfo(rType, sAuthorBuffer.makeStringAndClear(),
sCommentBuffer.makeStringAndClear(),
- sDateTimeBuffer.makeStringAndClear());
+ sDateTimeBuffer);
+ sDateTimeBuffer.setLength(0);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx
index dcb8200576dc..b248598607a4 100644
--- a/xmloff/source/text/XMLTextFrameContext.cxx
+++ b/xmloff/source/text/XMLTextFrameContext.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <o3tl/string_view.hxx>
#include <osl/diagnose.h>
#include <sal/log.hxx>
#include <tools/diagnose_ex.h>
@@ -1090,8 +1091,8 @@ void XMLTextFrameContext_Impl::endFastElement(sal_Int32 )
XML_TEXT_FRAME_GRAPHIC == nType) &&
!xPropSet.is() && !bCreateFailed )
{
- OUString sTrimmedChars = maUrlBuffer.makeStringAndClear().trim();
- if( !sTrimmedChars.isEmpty() )
+ std::u16string_view sTrimmedChars = o3tl::trim(maUrlBuffer);
+ if( !sTrimmedChars.empty() )
{
if( !xBase64Stream.is() )
{
@@ -1128,6 +1129,7 @@ void XMLTextFrameContext_Impl::endFastElement(sal_Int32 )
sBase64CharsLeft = sChars.copy( nCharsDecoded );
}
}
+ maUrlBuffer.setLength(0);
}
CreateIfNotThere();
diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx
index 43a9a2d34485..7e99d0c38cc9 100644
--- a/xmloff/source/text/txtfldi.cxx
+++ b/xmloff/source/text/txtfldi.cxx
@@ -3309,8 +3309,7 @@ void XMLAnnotationImportContext::PrepareField(
xPropertySet->setPropertyValue("Resolved", Any(bTmp));
util::DateTime aDateTime;
- if (::sax::Converter::parseDateTime(aDateTime,
- aDateBuffer.makeStringAndClear()))
+ if (::sax::Converter::parseDateTime(aDateTime, aDateBuffer))
{
/*
Date aDate;
@@ -3322,6 +3321,7 @@ void XMLAnnotationImportContext::PrepareField(
// why is there no UNO_NAME_DATE_TIME, but only UNO_NAME_DATE_TIME_VALUE?
xPropertySet->setPropertyValue(sAPI_date_time_value, Any(aDateTime));
}
+ aDateBuffer.setLength(0);
OUString sBuffer = aTextBuffer.makeStringAndClear();
if ( sBuffer.getLength() )