From af16aa625682b649e8843237652b9246d519cbae Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 13 May 2021 11:57:17 +0200 Subject: Improve loplugin:stringview Issue the "instead of O[U]String, pass [u16]string_view" diagnostic also for operator call arguments. (The "rather than copy, pass subView()" diagnostic is already part of handleSubExprThatCouldBeView, so no need to repeat it explicitly for operator call arguments.) (And many call sites don't even require an explicit [u16]string_view, esp. with the recent ad48b2b02f83eed41fb1eb8d16de7e804156fcf1 "Optimized OString operator += overloads". Just some test code in sal/qa/ that explicitly tests the O[U]String functionality had to be excluded.) Change-Id: I8d55ba5a7fa16a563f5ffe43d245125c88c793bc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115589 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- sw/source/core/layout/dbg_lay.cxx | 2 +- sw/source/filter/html/htmlatr.cxx | 2 +- sw/source/filter/html/htmlforw.cxx | 2 +- sw/source/filter/html/htmlnumwriter.cxx | 6 +++--- sw/source/filter/ww8/docxattributeoutput.cxx | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) (limited to 'sw/source') diff --git a/sw/source/core/layout/dbg_lay.cxx b/sw/source/core/layout/dbg_lay.cxx index 08d9c36c866c..4f1bc42ecc18 100644 --- a/sw/source/core/layout/dbg_lay.cxx +++ b/sw/source/core/layout/dbg_lay.cxx @@ -440,7 +440,7 @@ void SwImplProtocol::FileInit() aLine.clear(); } else - aLine += OString(c); + aLine += OStringChar(c); } if( !aLine.isEmpty() ) CheckLine( aLine ); // evaluate last line diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx index a15cd96519cb..bff41ee81471 100644 --- a/sw/source/filter/html/htmlatr.cxx +++ b/sw/source/filter/html/htmlatr.cxx @@ -3130,7 +3130,7 @@ static Writer& OutHTML_SwTextCharFormat( Writer& rWrt, const SfxPoolItem& rHt ) if( !pFormatInfo->aToken.isEmpty() ) sOut += pFormatInfo->aToken; else - sOut += OString(OOO_STRING_SVTOOLS_HTML_span); + sOut += OOO_STRING_SVTOOLS_HTML_span; if( rHTMLWrt.m_bCfgOutStyles && (!pFormatInfo->aClass.isEmpty() || pFormatInfo->bScriptDependent) ) diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx index fabccbb8a2e0..38c0418060e1 100644 --- a/sw/source/filter/html/htmlforw.cxx +++ b/sw/source/filter/html/htmlforw.cxx @@ -167,7 +167,7 @@ static void lcl_html_outEvents( SvStream& rStrm, OString sOut = " "; if( pOpt && (EXTENDED_STYPE != eScriptType || rDesc.AddListenerParam.isEmpty()) ) - sOut += OString(pOpt); + sOut += pOpt; else { sOut += OOO_STRING_SVTOOLS_HTML_O_sdevent + diff --git a/sw/source/filter/html/htmlnumwriter.cxx b/sw/source/filter/html/htmlnumwriter.cxx index ddfedd760923..2fa1e6aa3f6b 100644 --- a/sw/source/filter/html/htmlnumwriter.cxx +++ b/sw/source/filter/html/htmlnumwriter.cxx @@ -213,7 +213,7 @@ Writer& OutHTML_NumberBulletListStart( SwHTMLWriter& rWrt, if( SVX_NUM_CHAR_SPECIAL == eType ) { // ordered list:
    - sOut += OString(OOO_STRING_SVTOOLS_HTML_unorderlist); + sOut += OOO_STRING_SVTOOLS_HTML_unorderlist; // determine the type by the bullet character const char *pStr = nullptr; @@ -238,7 +238,7 @@ Writer& OutHTML_NumberBulletListStart( SwHTMLWriter& rWrt, else if( SVX_NUM_BITMAP == eType ) { // Unordered list:
      - sOut += OString(OOO_STRING_SVTOOLS_HTML_unorderlist); + sOut += OOO_STRING_SVTOOLS_HTML_unorderlist; rWrt.Strm().WriteOString( sOut ); OutHTML_BulletImage( rWrt, nullptr, @@ -248,7 +248,7 @@ Writer& OutHTML_NumberBulletListStart( SwHTMLWriter& rWrt, else { // Ordered list:
        - sOut += OString(OOO_STRING_SVTOOLS_HTML_orderlist); + sOut += OOO_STRING_SVTOOLS_HTML_orderlist; // determine the type by the format char cType = 0; diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 3c6b2616e13a..f0775d63f6b8 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -2722,7 +2722,7 @@ void DocxAttributeOutput::WriteCollectedRunProperties() { const char* pVal = nullptr; m_pColorAttrList->getAsChar(FSNS(XML_w, XML_val), pVal); - if (OString("auto") != pVal) + if (std::string_view("auto") != pVal) { m_pSerializer->startElementNS(XML_w14, XML_textFill); m_pSerializer->startElementNS(XML_w14, XML_solidFill); -- cgit