diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-10-16 10:13:30 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-10-16 12:12:31 +0200 |
commit | 4a96fb8ec0130e1036913093836bcf28bc37a49b (patch) | |
tree | e7aad9be4ca417e9e64f688cc99bee0638037741 /sw | |
parent | f33b6e341fb7dd1ab3acd4fe5457b716be316e89 (diff) |
loplugin:bufferadd loosen some constraints
and extend O*StringView to have a constructor that takes a pointer and a
length
Change-Id: I6120e96280f030757e855a6596efdae438b7e1e8
Reviewed-on: https://gerrit.libreoffice.org/80872
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/html/htmlbas.cxx | 16 | ||||
-rw-r--r-- | sw/source/filter/html/htmlfldw.cxx | 11 | ||||
-rw-r--r-- | sw/source/filter/html/htmlflywriter.cxx | 10 | ||||
-rw-r--r-- | sw/source/filter/html/htmlftn.cxx | 18 | ||||
-rw-r--r-- | sw/source/filter/html/htmltabw.cxx | 6 | ||||
-rw-r--r-- | sw/source/filter/html/wrthtml.cxx | 25 | ||||
-rw-r--r-- | sw/source/uibase/app/applab.cxx | 10 |
7 files changed, 48 insertions, 48 deletions
diff --git a/sw/source/filter/html/htmlbas.cxx b/sw/source/filter/html/htmlbas.cxx index aaa7dbbbaa89..7be428fe3957 100644 --- a/sw/source/filter/html/htmlbas.cxx +++ b/sw/source/filter/html/htmlbas.cxx @@ -278,14 +278,14 @@ void SwHTMLWriter::OutBasic() { bFirst = false; OutNewLine(); - OStringBuffer sOut; - sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_meta) - .append(' ').append(OOO_STRING_SVTOOLS_HTML_O_httpequiv) - .append("=\"") - .append(OOO_STRING_SVTOOLS_HTML_META_content_script_type) - .append("\" ").append(OOO_STRING_SVTOOLS_HTML_O_content) - .append("=\"text/x-"); - Strm().WriteOString( sOut.makeStringAndClear() ); + OString sOut = + "<" OOO_STRING_SVTOOLS_HTML_meta + " " OOO_STRING_SVTOOLS_HTML_O_httpequiv + "=\"" + OOO_STRING_SVTOOLS_HTML_META_content_script_type + "\" " OOO_STRING_SVTOOLS_HTML_O_content + "=\"text/x-"; + Strm().WriteOString( sOut ); // Entities aren't welcome here Strm().WriteOString( OUStringToOString(sLang, m_eDestEnc) ) .WriteCharPtr( "\">" ); diff --git a/sw/source/filter/html/htmlfldw.cxx b/sw/source/filter/html/htmlfldw.cxx index 0a581c6e06e9..2f153fdd3b79 100644 --- a/sw/source/filter/html/htmlfldw.cxx +++ b/sw/source/filter/html/htmlfldw.cxx @@ -509,12 +509,13 @@ Writer& OutHTML_SwFormatField( Writer& rWrt, const SfxPoolItem& rHt ) if( !bWritten ) { OUString sComment(convertLineEnd(rComment, GetSystemLineEnd())); - OStringBuffer sOut; // TODO: ??? - sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_comment) - .append(' ').append(OUStringToOString(sComment, - static_cast<SwHTMLWriter&>(rWrt).m_eDestEnc)).append(" -->"); - rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); + OString sOut = + "<" OOO_STRING_SVTOOLS_HTML_comment + " " + + OUStringToOString(sComment, static_cast<SwHTMLWriter&>(rWrt).m_eDestEnc) + + " -->"; + rWrt.Strm().WriteOString( sOut ); } } else if( SwFieldIds::Script == pFieldTyp->Which() ) diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx index 8f2465c06871..09d9593a5f12 100644 --- a/sw/source/filter/html/htmlflywriter.cxx +++ b/sw/source/filter/html/htmlflywriter.cxx @@ -1660,11 +1660,11 @@ static Writer& OutHTML_FrameFormatAsSpacer( Writer& rWrt, const SwFrameFormat& r if( rHTMLWrt.m_bLFPossible ) rHTMLWrt.OutNewLine( true ); - OStringBuffer sOut; - sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_spacer).append(' ') - .append(OOO_STRING_SVTOOLS_HTML_O_type).append("=\"") - .append(OOO_STRING_SVTOOLS_HTML_SPTYPE_block).append("\""); - rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); + OString sOut = + "<" OOO_STRING_SVTOOLS_HTML_spacer " " + OOO_STRING_SVTOOLS_HTML_O_type "=\"" + OOO_STRING_SVTOOLS_HTML_SPTYPE_block "\""; + rWrt.Strm().WriteOString( sOut ); // ALIGN, WIDTH, HEIGHT OString aEndTags = rHTMLWrt.OutFrameFormatOptions(rFrameFormat, OUString(), HTML_FRMOPTS_SPACER); diff --git a/sw/source/filter/html/htmlftn.cxx b/sw/source/filter/html/htmlftn.cxx index 85b5ffcb057e..f0f2f6c5ac0f 100644 --- a/sw/source/filter/html/htmlftn.cxx +++ b/sw/source/filter/html/htmlftn.cxx @@ -333,10 +333,10 @@ void SwHTMLWriter::OutFootEndNotes() if( m_bLFPossible ) OutNewLine(); - OStringBuffer sOut; - sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_division) - .append(' ').append(OOO_STRING_SVTOOLS_HTML_O_id).append("=\""); - Strm().WriteOString( sOut.makeStringAndClear() ); + OString sOut = + "<" OOO_STRING_SVTOOLS_HTML_division + " " OOO_STRING_SVTOOLS_HTML_O_id "=\""; + Strm().WriteOString( sOut ); HTMLOutFuncs::Out_String( Strm(), sFootnoteName, m_eDestEnc, &m_aNonConvertableCharacters ); Strm().WriteCharPtr( "\">" ); @@ -510,11 +510,11 @@ static void lcl_html_outFootEndNoteInfo( Writer& rWrt, OUString const *pParts, } rHTMLWrt.OutNewLine(); - OStringBuffer sOut; - sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_meta).append(' ') - .append(OOO_STRING_SVTOOLS_HTML_O_name).append("=\"").append(pName) - .append("\" ").append(OOO_STRING_SVTOOLS_HTML_O_content).append("=\""); - rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); + OString sOut = + "<" OOO_STRING_SVTOOLS_HTML_meta " " + OOO_STRING_SVTOOLS_HTML_O_name "=\"" + rtl::OStringView(pName) + + "\" " OOO_STRING_SVTOOLS_HTML_O_content "=\""; + rWrt.Strm().WriteOString( sOut ); HTMLOutFuncs::Out_String( rWrt.Strm(), aContent.makeStringAndClear(), rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); rWrt.Strm().WriteCharPtr( "\">" ); } diff --git a/sw/source/filter/html/htmltabw.cxx b/sw/source/filter/html/htmltabw.cxx index da33a4bbb6eb..c0ce2183f00a 100644 --- a/sw/source/filter/html/htmltabw.cxx +++ b/sw/source/filter/html/htmltabw.cxx @@ -1063,9 +1063,9 @@ Writer& OutHTML_SwTableNode( Writer& rWrt, SwTableNode & rNode, HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_center ); else { - OStringBuffer sOut(OOO_STRING_SVTOOLS_HTML_division); - sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_align).append("=\"") - .append(OOO_STRING_SVTOOLS_HTML_AL_right).append("\""); + OString sOut = OOO_STRING_SVTOOLS_HTML_division + " " OOO_STRING_SVTOOLS_HTML_O_align "=\"" + OOO_STRING_SVTOOLS_HTML_AL_right "\""; HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), rHTMLWrt.GetNamespace() + sOut.getStr() ); } rHTMLWrt.IncIndentLevel(); // indent content of <CENTER> diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index 2ccdcc932ab9..9fc8d8298dd5 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -410,12 +410,11 @@ ErrCode SwHTMLWriter::WriteStream() pSNd->GetSection().GetSectionName(), m_eDestEnc, &m_aNonConvertableCharacters ); - OStringBuffer sOut; - sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_division) - .append(' ').append(OOO_STRING_SVTOOLS_HTML_O_id) - .append("=\"").append(aName).append('\"').append('>') - .append(aStartTags); - aStartTags = sOut.makeStringAndClear(); + aStartTags = + "<" OOO_STRING_SVTOOLS_HTML_division + " " OOO_STRING_SVTOOLS_HTML_O_id + "=\"" + aName + "\">" + + aStartTags; } // FindSectionNode() on a SectionNode return the same! pSNd = pSNd->StartOfSectionNode()->FindSectionNode(); @@ -1261,9 +1260,9 @@ void SwHTMLWriter::OutBackground( const SvxBrushItem *pBrushItem, bool bGraphic /// only checking, if transparency is not set. if( rBackColor != COL_TRANSPARENT ) { - OStringBuffer sOut; - sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_bgcolor).append('='); - Strm().WriteOString( sOut.makeStringAndClear() ); + OString sOut = + " " OOO_STRING_SVTOOLS_HTML_O_bgcolor "="; + Strm().WriteOString( sOut ); HTMLOutFuncs::Out_Color( Strm(), rBackColor); } @@ -1375,10 +1374,10 @@ void SwHTMLWriter::OutDirection( SvxFrameDirection nDir ) OString sConverted = convertDirection(nDir); if (!sConverted.isEmpty()) { - OStringBuffer sOut; - sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_dir) - .append("=\"").append(sConverted).append('\"'); - Strm().WriteOString( sOut.makeStringAndClear() ); + OString sOut = + " " OOO_STRING_SVTOOLS_HTML_O_dir + "=\"" + sConverted + "\""; + Strm().WriteOString( sOut ); } } diff --git a/sw/source/uibase/app/applab.cxx b/sw/source/uibase/app/applab.cxx index da1e18009143..d59ad9cd171e 100644 --- a/sw/source/uibase/app/applab.cxx +++ b/sw/source/uibase/app/applab.cxx @@ -340,11 +340,11 @@ void SwModule::InsertLab(SfxRequest& rReq, bool bLabel) { SwSectionData aSect(FILE_LINK_SECTION, pSh->GetUniqueSectionName()); - OUStringBuffer sLinkName; - sLinkName.append(sfx2::cTokenSeparator); - sLinkName.append(sfx2::cTokenSeparator); - sLinkName.append(MASTER_LABEL); - aSect.SetLinkFileName(sLinkName.makeStringAndClear()); + OUString sLinkName = + OUStringLiteral1(sfx2::cTokenSeparator) + + OUStringLiteral1(sfx2::cTokenSeparator) + + MASTER_LABEL; + aSect.SetLinkFileName(sLinkName); aSect.SetProtectFlag(true); pSh->Insert("."); // Dummytext to allocate the Section pSh->StartOfSection(); |