From e4ff847fe0796420ba8023b70cad8589f5f19e9f Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Sat, 9 Apr 2022 09:55:12 +0200 Subject: loplugin:stringview check for getToken and trim since we now have o3tl versions of those that work on string_view. Also improve those o3tl functions to support both string_view and u16string_view Change-Id: Iacab2996becec62aa78a5597c52d983bb784749a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132755 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sfx2/source/appl/newhelp.cxx | 9 +++++---- sfx2/source/bastyp/mieclip.cxx | 2 +- sfx2/source/doc/autoredactdialog.cxx | 3 ++- sfx2/source/doc/objmisc.cxx | 3 ++- 4 files changed, 10 insertions(+), 7 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index ff323c78cf78..e175b7458726 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -220,7 +221,7 @@ void ContentTabPage_Impl::InitRoot() sal_Int32 nIdx = 0; OUString aTitle = aRow.getToken( 0, '\t', nIdx ); OUString aURL = aRow.getToken( 0, '\t', nIdx ); - sal_Unicode cFolder = aRow.getToken( 0, '\t', nIdx )[0]; + sal_Unicode cFolder = o3tl::getToken(aRow, 0, '\t', nIdx )[0]; bool bIsFolder = ( '1' == cFolder ); OUString sId; if (bIsFolder) @@ -259,7 +260,7 @@ IMPL_LINK(ContentTabPage_Impl, ExpandingHdl, const weld::TreeIter&, rIter, bool) sal_Int32 nIdx = 0; OUString aTitle = aRow.getToken( 0, '\t', nIdx ); OUString aURL = aRow.getToken( 0, '\t', nIdx ); - sal_Unicode cFolder = aRow.getToken( 0, '\t', nIdx )[0]; + sal_Unicode cFolder = o3tl::getToken(aRow, 0, '\t', nIdx )[0]; bool bIsFolder = ( '1' == cFolder ); if ( bIsFolder ) { @@ -940,7 +941,7 @@ SearchTabPage_Impl::SearchTabPage_Impl(weld::Widget* pParent, SfxHelpIndexWindow while ( nIdx > 0 ) { m_xSearchED->append_text( INetURLObject::decode( - aUserData.getToken(0, ';', nIdx), + o3tl::getToken(aUserData, 0, ';', nIdx), INetURLObject::DecodeMechanism::WithCharset ) ); } } @@ -2328,7 +2329,7 @@ IMPL_LINK_NOARG(SfxHelpWindow_Impl, OpenHdl, LinkParamNone*, void) { sal_Int32 nIdx{ 0 }; aId = aEntry.getToken( 0, '#', nIdx ); - aAnchor += aEntry.getToken( 0, '#', nIdx ); + aAnchor += o3tl::getToken(aEntry, 0, '#', nIdx ); } else aId = aEntry; diff --git a/sfx2/source/bastyp/mieclip.cxx b/sfx2/source/bastyp/mieclip.cxx index 4d6d74e1fca0..3036b4eb488e 100644 --- a/sfx2/source/bastyp/mieclip.cxx +++ b/sfx2/source/bastyp/mieclip.cxx @@ -43,7 +43,7 @@ SvStream* MSE40HTMLClipFormatObj::IsValid( SvStream& rStream ) rStream.ResetError(); if( rStream.ReadLine( sLine ) && - sLine.getToken( 0, ':', nIndex ) == "Version" ) + o3tl::getToken(sLine, 0, ':', nIndex ) == "Version" ) { while( rStream.ReadLine( sLine ) ) { diff --git a/sfx2/source/doc/autoredactdialog.cxx b/sfx2/source/doc/autoredactdialog.cxx index ea1fa8fb218c..c789538dd4fd 100644 --- a/sfx2/source/doc/autoredactdialog.cxx +++ b/sfx2/source/doc/autoredactdialog.cxx @@ -18,6 +18,7 @@ #include #include #include +#include #include @@ -149,7 +150,7 @@ OUString TargetsTable::GetNameProposal() const RedactionTarget* pTarget = weld::fromId(m_xControl->get_id(i)); const OUString& sName = pTarget->sName; sal_Int32 nIndex = 0; - if (sName.getToken(0, ' ', nIndex) == sDefaultTargetName) + if (o3tl::getToken(sName, 0, ' ', nIndex) == sDefaultTargetName) { sal_Int32 nCurrTargetId = sName.getToken(0, ' ', nIndex).toInt32(); nHighestTargetId = std::max(nHighestTargetId, nCurrTargetId); diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 33c5213d25b1..7d3e2cb8262b 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -1469,7 +1470,7 @@ void SfxHeaderAttributes_Impl::SetAttribute( const SvKeyValue& rKV ) { sal_Int32 nIdx{ 0 }; const sal_Int32 nTime{ aValue.getToken( 0, ';', nIdx ).toInt32() }; - const OUString aURL{ comphelper::string::strip(aValue.getToken( 0, ';', nIdx ), ' ') }; + const OUString aURL{ comphelper::string::strip(o3tl::getToken(aValue, 0, ';', nIdx ), ' ') }; uno::Reference xDocProps( pDoc->getDocProperties()); if( aURL.startsWithIgnoreAsciiCase( "url=" ) ) -- cgit