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>
This commit is contained in:
Noel Grandin 2022-07-21 18:51:02 +02:00 committed by Noel Grandin
parent aa2067dda6
commit 42572c6d0d
4 changed files with 28 additions and 21 deletions

View file

@ -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:

View file

@ -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;
}

View file

@ -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;

View file

@ -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;
}