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 throw FileFormatException( //TODO
"", "Illegal UNOIDL identifier \"" + name + "\""); "", "Illegal UNOIDL identifier \"" + name + "\"");
} }
OUString uri(uri_ + buf.makeStringAndClear()); OUString uri(uri_ + buf);
rtl::Reference<Entity> ent; rtl::Reference<Entity> ent;
// Prevent conflicts between foo/ and Foo.idl on case-preserving file // Prevent conflicts between foo/ and Foo.idl on case-preserving file
// systems: // 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(static_cast<sal_Int32>(static_cast<sal_uInt16>(eLang)), 16);
aMsg.append(" -> "); aMsg.append(" -> ");
aMsg.append(aBackLanguageTag.getBcp47()); aMsg.append(aBackLanguageTag.getBcp47());
outputCheckMessage( aMsg.makeStringAndClear() ); outputCheckMessage( aMsg );
} }
eLang = LANGUAGE_DONTKNOW; eLang = LANGUAGE_DONTKNOW;
} }

View file

@ -855,8 +855,9 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS
int count = 2; int count = 2;
// Feed the destination text to a stream. // Feed the destination text to a stream.
OString aStr = OUStringToOString(m_aStates.top().getDestinationText().makeStringAndClear(), auto& rDestinationTextBuffer = m_aStates.top().getDestinationText();
RTL_TEXTENCODING_ASCII_US); OString aStr = OUStringToOString(rDestinationTextBuffer, RTL_TEXTENCODING_ASCII_US);
rDestinationTextBuffer.setLength(0);
for (int i = 0; i < aStr.getLength(); ++i) for (int i = 0; i < aStr.getLength(); ++i)
{ {
char ch = aStr[i]; char ch = aStr[i];
@ -2551,12 +2552,13 @@ RTFError RTFDocumentImpl::beforePopState(RTFParserState& rState)
{ {
if (m_bFormField) if (m_bFormField)
{ {
if (&m_aStates.top().getDestinationText() OUStringBuffer* pCurrentDestinationText
!= m_aStates.top().getCurrentDestinationText()) = m_aStates.top().getCurrentDestinationText();
if (&m_aStates.top().getDestinationText() != pCurrentDestinationText)
break; // not for nested group break; // not for nested group
OString aStr = OUStringToOString( OString aStr
m_aStates.top().getCurrentDestinationText()->makeStringAndClear(), = OUStringToOString(*pCurrentDestinationText, rState.getCurrentEncoding());
rState.getCurrentEncoding()); pCurrentDestinationText->setLength(0);
// decode hex dump // decode hex dump
OStringBuffer aBuf; OStringBuffer aBuf;
int b = 0; int b = 0;
@ -2638,8 +2640,13 @@ RTFError RTFDocumentImpl::beforePopState(RTFParserState& rState)
!= m_aStates.top().getCurrentDestinationText()) != m_aStates.top().getCurrentDestinationText())
break; // not for nested group break; // not for nested group
if (m_xDocumentProperties.is()) 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; break;
case Destination::COMMENT: case Destination::COMMENT:
if (&m_aStates.top().getDestinationText() if (&m_aStates.top().getDestinationText()
@ -2757,13 +2764,12 @@ RTFError RTFDocumentImpl::beforePopState(RTFParserState& rState)
break; break;
case Destination::ANNOTATIONDATE: case Destination::ANNOTATIONDATE:
{ {
if (&m_aStates.top().getDestinationText() OUStringBuffer* pCurrentDestinationText = m_aStates.top().getCurrentDestinationText();
!= m_aStates.top().getCurrentDestinationText()) if (&m_aStates.top().getDestinationText() != pCurrentDestinationText)
break; // not for nested group break; // not for nested group
OUString aStr(OStringToOUString( OUString aStr(OStringToOUString(DTTM22OString(o3tl::toInt32(*pCurrentDestinationText)),
DTTM22OString( rState.getCurrentEncoding()));
m_aStates.top().getCurrentDestinationText()->makeStringAndClear().toInt32()), pCurrentDestinationText->setLength(0);
rState.getCurrentEncoding()));
auto pValue = new RTFValue(aStr); auto pValue = new RTFValue(aStr);
RTFSprms aAnnAttributes; RTFSprms aAnnAttributes;
aAnnAttributes.set(NS_ooxml::LN_CT_TrackChange_date, pValue); aAnnAttributes.set(NS_ooxml::LN_CT_TrackChange_date, pValue);
@ -3620,9 +3626,9 @@ RTFError RTFDocumentImpl::popState()
RTFError RTFDocumentImpl::handleEmbeddedObject() RTFError RTFDocumentImpl::handleEmbeddedObject()
{ {
OString aStr OUStringBuffer* pCurrentDestinationText = m_aStates.top().getCurrentDestinationText();
= OUStringToOString(m_aStates.top().getCurrentDestinationText()->makeStringAndClear(), OString aStr = OUStringToOString(*pCurrentDestinationText, RTL_TEXTENCODING_ASCII_US);
RTL_TEXTENCODING_ASCII_US); pCurrentDestinationText->setLength(0);
std::unique_ptr<SvStream> pStream(new SvMemoryStream()); std::unique_ptr<SvStream> pStream(new SvMemoryStream());
if (!msfilter::rtfutil::ExtractOLE2FromObjdata(aStr, *pStream)) if (!msfilter::rtfutil::ExtractOLE2FromObjdata(aStr, *pStream))
return RTFError::HEX_INVALID; return RTFError::HEX_INVALID;

View file

@ -8,6 +8,7 @@
*/ */
#include "rtftokenizer.hxx" #include "rtftokenizer.hxx"
#include <o3tl/string_view.hxx>
#include <tools/stream.hxx> #include <tools/stream.hxx>
#include <svx/dialmgr.hxx> #include <svx/dialmgr.hxx>
#include <svx/strings.hrc> #include <svx/strings.hrc>
@ -237,7 +238,7 @@ RTFError RTFTokenizer::resolveKeyword()
break; break;
} }
} }
nParam = aParameter.makeStringAndClear().toInt32(); nParam = o3tl::toInt32(aParameter);
if (bNeg) if (bNeg)
nParam = -nParam; nParam = -nParam;
} }