summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2022-07-21 18:51:02 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-07-22 11:13:45 +0200
commit42572c6d0d1f1c84b3774f6c790e28e8abc7b45a (patch)
tree1a831ccd9363c89292f96dc7554a0cfa5ca7141c
parentaa2067dda63852b0eb84d5c32497f5a28177bb1c (diff)
elide some makeStringAndClear() calls
Change-Id: I3b7ae370b41638c0a67374d5132b7bdf56e7c672 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137311 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--unoidl/source/sourcetreeprovider.cxx2
-rw-r--r--unotools/source/i18n/localedatawrapper.cxx2
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx42
-rw-r--r--writerfilter/source/rtftok/rtftokenizer.cxx3
4 files changed, 28 insertions, 21 deletions
diff --git a/unoidl/source/sourcetreeprovider.cxx b/unoidl/source/sourcetreeprovider.cxx
index 399329f30e40..629e50fbf8f3 100644
--- a/unoidl/source/sourcetreeprovider.cxx
+++ b/unoidl/source/sourcetreeprovider.cxx
@@ -284,7 +284,7 @@ rtl::Reference<Entity> SourceTreeProvider::findEntity(OUString const & name)
throw FileFormatException( //TODO
"", "Illegal UNOIDL identifier \"" + name + "\"");
}
- OUString uri(uri_ + buf.makeStringAndClear());
+ OUString uri(uri_ + buf);
rtl::Reference<Entity> ent;
// Prevent conflicts between foo/ and Foo.idl on case-preserving file
// systems:
diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx
index 55cde4a360a4..220d850885cb 100644
--- a/unotools/source/i18n/localedatawrapper.cxx
+++ b/unotools/source/i18n/localedatawrapper.cxx
@@ -353,7 +353,7 @@ const std::vector< LanguageType >& LocaleDataWrapper::getInstalledLanguageTypes(
aMsg.append(static_cast<sal_Int32>(static_cast<sal_uInt16>(eLang)), 16);
aMsg.append(" -> ");
aMsg.append(aBackLanguageTag.getBcp47());
- outputCheckMessage( aMsg.makeStringAndClear() );
+ outputCheckMessage( aMsg );
}
eLang = LANGUAGE_DONTKNOW;
}
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index e8db8d68f12e..71e25f4571f8 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -855,8 +855,9 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS
int count = 2;
// Feed the destination text to a stream.
- OString aStr = OUStringToOString(m_aStates.top().getDestinationText().makeStringAndClear(),
- RTL_TEXTENCODING_ASCII_US);
+ auto& rDestinationTextBuffer = m_aStates.top().getDestinationText();
+ OString aStr = OUStringToOString(rDestinationTextBuffer, RTL_TEXTENCODING_ASCII_US);
+ rDestinationTextBuffer.setLength(0);
for (int i = 0; i < aStr.getLength(); ++i)
{
char ch = aStr[i];
@@ -2551,12 +2552,13 @@ RTFError RTFDocumentImpl::beforePopState(RTFParserState& rState)
{
if (m_bFormField)
{
- if (&m_aStates.top().getDestinationText()
- != m_aStates.top().getCurrentDestinationText())
+ OUStringBuffer* pCurrentDestinationText
+ = m_aStates.top().getCurrentDestinationText();
+ if (&m_aStates.top().getDestinationText() != pCurrentDestinationText)
break; // not for nested group
- OString aStr = OUStringToOString(
- m_aStates.top().getCurrentDestinationText()->makeStringAndClear(),
- rState.getCurrentEncoding());
+ OString aStr
+ = OUStringToOString(*pCurrentDestinationText, rState.getCurrentEncoding());
+ pCurrentDestinationText->setLength(0);
// decode hex dump
OStringBuffer aBuf;
int b = 0;
@@ -2638,8 +2640,13 @@ RTFError RTFDocumentImpl::beforePopState(RTFParserState& rState)
!= m_aStates.top().getCurrentDestinationText())
break; // not for nested group
if (m_xDocumentProperties.is())
- m_xDocumentProperties->setKeywords(comphelper::string::convertCommaSeparated(
- m_aStates.top().getCurrentDestinationText()->makeStringAndClear()));
+ {
+ OUStringBuffer* pCurrentDestinationText
+ = m_aStates.top().getCurrentDestinationText();
+ m_xDocumentProperties->setKeywords(
+ comphelper::string::convertCommaSeparated(*pCurrentDestinationText));
+ pCurrentDestinationText->setLength(0);
+ }
break;
case Destination::COMMENT:
if (&m_aStates.top().getDestinationText()
@@ -2757,13 +2764,12 @@ RTFError RTFDocumentImpl::beforePopState(RTFParserState& rState)
break;
case Destination::ANNOTATIONDATE:
{
- if (&m_aStates.top().getDestinationText()
- != m_aStates.top().getCurrentDestinationText())
+ OUStringBuffer* pCurrentDestinationText = m_aStates.top().getCurrentDestinationText();
+ if (&m_aStates.top().getDestinationText() != pCurrentDestinationText)
break; // not for nested group
- OUString aStr(OStringToOUString(
- DTTM22OString(
- m_aStates.top().getCurrentDestinationText()->makeStringAndClear().toInt32()),
- rState.getCurrentEncoding()));
+ OUString aStr(OStringToOUString(DTTM22OString(o3tl::toInt32(*pCurrentDestinationText)),
+ rState.getCurrentEncoding()));
+ pCurrentDestinationText->setLength(0);
auto pValue = new RTFValue(aStr);
RTFSprms aAnnAttributes;
aAnnAttributes.set(NS_ooxml::LN_CT_TrackChange_date, pValue);
@@ -3620,9 +3626,9 @@ RTFError RTFDocumentImpl::popState()
RTFError RTFDocumentImpl::handleEmbeddedObject()
{
- OString aStr
- = OUStringToOString(m_aStates.top().getCurrentDestinationText()->makeStringAndClear(),
- RTL_TEXTENCODING_ASCII_US);
+ OUStringBuffer* pCurrentDestinationText = m_aStates.top().getCurrentDestinationText();
+ OString aStr = OUStringToOString(*pCurrentDestinationText, RTL_TEXTENCODING_ASCII_US);
+ pCurrentDestinationText->setLength(0);
std::unique_ptr<SvStream> pStream(new SvMemoryStream());
if (!msfilter::rtfutil::ExtractOLE2FromObjdata(aStr, *pStream))
return RTFError::HEX_INVALID;
diff --git a/writerfilter/source/rtftok/rtftokenizer.cxx b/writerfilter/source/rtftok/rtftokenizer.cxx
index 4dc80416c64f..420c6d36f0c3 100644
--- a/writerfilter/source/rtftok/rtftokenizer.cxx
+++ b/writerfilter/source/rtftok/rtftokenizer.cxx
@@ -8,6 +8,7 @@
*/
#include "rtftokenizer.hxx"
+#include <o3tl/string_view.hxx>
#include <tools/stream.hxx>
#include <svx/dialmgr.hxx>
#include <svx/strings.hrc>
@@ -237,7 +238,7 @@ RTFError RTFTokenizer::resolveKeyword()
break;
}
}
- nParam = aParameter.makeStringAndClear().toInt32();
+ nParam = o3tl::toInt32(aParameter);
if (bNeg)
nParam = -nParam;
}