diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-04-23 16:07:32 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-04-27 14:07:56 +0200 |
commit | c7c6f0af6c836ebe0968967a1e7c8320b0ac17d6 (patch) | |
tree | 4bc5b2fa623b9765b88bbfe7de10a7590c87d5c8 /sd | |
parent | 99482297c7dd497e41fad2e7193759043e305101 (diff) |
loplugin:stringadd convert chained append to +
which can use the more efficient *StringConcat
Also fix a crash in stringview plugin which
started happening while I working on this.
Change-Id: I91a5b9b7707d1594d27d80b73930f5afac8ae608
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114568
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/filter/eppt/pptx-epptooxml.cxx | 24 | ||||
-rw-r--r-- | sd/source/filter/html/htmlex.cxx | 10 | ||||
-rw-r--r-- | sd/source/ui/remotecontrol/Communicator.cxx | 11 | ||||
-rw-r--r-- | sd/source/ui/remotecontrol/DiscoveryService.cxx | 7 |
4 files changed, 17 insertions, 35 deletions
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx index 13ec3572b701..afed524c0452 100644 --- a/sd/source/filter/eppt/pptx-epptooxml.cxx +++ b/sd/source/filter/eppt/pptx-epptooxml.cxx @@ -1746,20 +1746,12 @@ void PowerPointExport::WriteDefaultColorSchemes(const FSHelperPtr& pFS) break; } - OUString sOpenColorScheme = OUStringBuffer() - .append("<a:") - .append(sName) - .append(">") - .makeStringAndClear(); + OUString sOpenColorScheme = "<a:" + sName + ">"; pFS->write(sOpenColorScheme); pFS->singleElementNS(XML_a, XML_srgbClr, XML_val, I32SHEX(nColor)); - OUString sCloseColorScheme = OUStringBuffer() - .append("</a:") - .append(sName) - .append(">") - .makeStringAndClear(); + OUString sCloseColorScheme = "</a:" + sName + ">"; pFS->write(sCloseColorScheme); } } @@ -1799,20 +1791,12 @@ bool PowerPointExport::WriteColorSchemes(const FSHelperPtr& pFS, const OUString& } } - OUString sOpenColorScheme = OUStringBuffer() - .append("<a:") - .append(sName) - .append(">") - .makeStringAndClear(); + OUString sOpenColorScheme ="<a:" + sName + ">"; pFS->write(sOpenColorScheme); pFS->singleElementNS(XML_a, XML_srgbClr, XML_val, I32SHEX(nColor)); - OUString sCloseColorScheme = OUStringBuffer() - .append("</a:") - .append(sName) - .append(">") - .makeStringAndClear(); + OUString sCloseColorScheme = "</a:" + sName + ">"; pFS->write(sCloseColorScheme); } diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx index e9aba13346e3..78914a0adf14 100644 --- a/sd/source/filter/html/htmlex.cxx +++ b/sd/source/filter/html/htmlex.cxx @@ -325,9 +325,9 @@ OUString getParagraphStyle( SdrOutliner* pOutliner, sal_Int32 nPara ) void lclAppendStyle(OUStringBuffer& aBuffer, std::u16string_view aTag, std::u16string_view aStyle) { if (aStyle.empty()) - aBuffer.append("<").append(aTag).append(">"); + aBuffer.append(OUString::Concat("<") + aTag + ">"); else - aBuffer.append("<").append(aTag).append(" style=\"").append(aStyle).append("\">"); + aBuffer.append(OUString::Concat("<") + aTag + " style=\"" + aStyle + "\">"); } } // anonymous namespace @@ -1334,7 +1334,7 @@ void HtmlExport::WriteOutlinerParagraph(OUStringBuffer& aStr, SdrOutliner* pOutl lclAppendStyle(aStr, aTag, getParagraphStyle(pOutliner, nIndex)); aStr.append(aParaText); - aStr.append("</").append(aTag).append(">\r\n"); + aStr.append("</" + aTag + ">\r\n"); } else { @@ -1578,7 +1578,7 @@ bool HtmlExport::CreateHtmlForPresPages() // HTML Head OUStringBuffer aStr(gaHTMLHeader); aStr.append(CreateMetaCharset()); - aStr.append(" <title>" ).append( StringToHTMLString(maPageNames[nSdPage]) ).append("</title>\r\n"); + aStr.append(" <title>" + StringToHTMLString(maPageNames[nSdPage]) + "</title>\r\n"); // insert timing information pPage = maPages[ nSdPage ]; @@ -2793,7 +2793,7 @@ OUString HtmlExport::CreateHTMLPolygonArea( const ::basegfx::B2DPolyPolygon& rPo if (nPoint < nNoOfPoints - 1) aStr.append(','); } - aStr.append("\" href=\"").append(rHRef).append("\">\n"); + aStr.append(OUString::Concat("\" href=\"") + rHRef + "\">\n"); } return aStr.makeStringAndClear(); diff --git a/sd/source/ui/remotecontrol/Communicator.cxx b/sd/source/ui/remotecontrol/Communicator.cxx index a500d9191131..de55f38f8514 100644 --- a/sd/source/ui/remotecontrol/Communicator.cxx +++ b/sd/source/ui/remotecontrol/Communicator.cxx @@ -82,13 +82,12 @@ void Communicator::execute() Transmitter::PRIORITY_HIGH ); } - OStringBuffer aBuffer; - aBuffer - .append( "slideshow_info\n" ) - .append( OUStringToOString( ::comphelper::DocumentInfo::getDocumentTitle( xFrame->getController()->getModel() ), RTL_TEXTENCODING_UTF8 ) ) - .append("\n\n"); + OString aBuffer = + "slideshow_info\n" + + OUStringToOString( ::comphelper::DocumentInfo::getDocumentTitle( xFrame->getController()->getModel() ), RTL_TEXTENCODING_UTF8 ) + + "\n\n"; - pTransmitter->addMessage( aBuffer.makeStringAndClear(), Transmitter::PRIORITY_LOW ); + pTransmitter->addMessage( aBuffer.getStr(), Transmitter::PRIORITY_LOW ); } catch (uno::RuntimeException &) { diff --git a/sd/source/ui/remotecontrol/DiscoveryService.cxx b/sd/source/ui/remotecontrol/DiscoveryService.cxx index 90f88a6c5374..9ed2ae727761 100644 --- a/sd/source/ui/remotecontrol/DiscoveryService.cxx +++ b/sd/source/ui/remotecontrol/DiscoveryService.cxx @@ -164,10 +164,9 @@ void SAL_CALL DiscoveryService::run() OString aString( aBuffer, strlen( "LOREMOTE_SEARCH" ) ); if ( aString == "LOREMOTE_SEARCH" ) { - OStringBuffer aStringBuffer("LOREMOTE_ADVERTISE\n"); - aStringBuffer.append( OUStringToOString( - osl::SocketAddr::getLocalHostname(), RTL_TEXTENCODING_UTF8 ) ) - .append( "\n\n" ); + OString aStringBuffer = "LOREMOTE_ADVERTISE\n" + + OUStringToOString(osl::SocketAddr::getLocalHostname(), RTL_TEXTENCODING_UTF8 ) + + "\n\n"; if ( sendto( mSocket, aStringBuffer.getStr(), aStringBuffer.getLength(), 0, reinterpret_cast<sockaddr*>(&aAddr), sizeof(aAddr) ) <= 0 ) |