diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-29 11:06:33 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-01 08:30:18 +0200 |
commit | 5200a73627d13e2997f81b53f61e143e77e328ee (patch) | |
tree | f95c8346d061ecd0ad33d574895d18e169662785 /xmlhelp | |
parent | b90d3d316dd9c720c83180b31f6bbd7003fead78 (diff) |
use more string_view in various
found by examining uses of OUString::copy() for likely places
Change-Id: I6ff20e7b273ad6005410b82719183c1122f8c018
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133617
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmlhelp')
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/urlparameter.cxx | 6 | ||||
-rw-r--r-- | xmlhelp/source/treeview/tvread.cxx | 17 |
2 files changed, 12 insertions, 11 deletions
diff --git a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx index 5eb9e6420b00..493618621c46 100644 --- a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx +++ b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx @@ -380,9 +380,9 @@ bool URLParameter::scheme() if( m_aExpr.startsWith("vnd.sun.star.help:///") ) { sal_Int32 nLen = m_aExpr.getLength(); - OUString aLastStr = - m_aExpr.copy(sal::static_int_cast<sal_uInt32>(nLen) - 6); - if( aLastStr == "DbPAR=" ) + std::u16string_view aLastStr = + m_aExpr.subView(sal::static_int_cast<sal_uInt32>(nLen) - 6); + if( aLastStr == u"DbPAR=" ) { m_aExpr = OUString::Concat(m_aExpr.subView( 0, 20 )) + "shared" + diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx index d7dd36714dea..60e207d109ea 100644 --- a/xmlhelp/source/treeview/tvread.cxx +++ b/xmlhelp/source/treeview/tvread.cxx @@ -22,6 +22,7 @@ #include <rtl/ustrbuf.hxx> #include <sal/log.hxx> #include <o3tl/safeint.hxx> +#include <o3tl/string_view.hxx> #include <osl/diagnose.h> #include <tvread.hxx> #include <expat.h> @@ -500,8 +501,8 @@ TVChildTarget::SearchAndInsert(std::unique_ptr<TVDom> p, TVDom* tvDom) Any SAL_CALL TVChildTarget::getByName( const OUString& aName ) { - OUString num( aName.copy( 2, aName.getLength()-4 ) ); - sal_Int32 idx = num.toInt32() - 1; + std::u16string_view num( aName.subView( 2, aName.getLength()-4 ) ); + sal_Int32 idx = o3tl::toInt32(num) - 1; if( idx < 0 || Elements.size() <= o3tl::make_unsigned( idx ) ) throw NoSuchElementException(); @@ -523,8 +524,8 @@ TVChildTarget::getElementNames( ) sal_Bool SAL_CALL TVChildTarget::hasByName( const OUString& aName ) { - OUString num( aName.copy( 2, aName.getLength()-4 ) ); - sal_Int32 idx = num.toInt32() - 1; + std::u16string_view num( aName.subView( 2, aName.getLength()-4 ) ); + sal_Int32 idx = o3tl::toInt32(num) - 1; if( idx < 0 || Elements.size() <= o3tl::make_unsigned( idx ) ) return false; @@ -540,8 +541,8 @@ TVChildTarget::getByHierarchicalName( const OUString& aName ) if( ( idx = aName.indexOf( '/' ) ) != -1 ) { - OUString num( aName.copy( 2, idx-4 ) ); - sal_Int32 pref = num.toInt32() - 1; + std::u16string_view num( aName.subView( 2, idx-4 ) ); + sal_Int32 pref = o3tl::toInt32(num) - 1; if( pref < 0 || Elements.size() <= o3tl::make_unsigned( pref ) ) throw NoSuchElementException(); @@ -559,8 +560,8 @@ TVChildTarget::hasByHierarchicalName( const OUString& aName ) if( ( idx = aName.indexOf( '/' ) ) != -1 ) { - OUString num( aName.copy( 2, idx-4 ) ); - sal_Int32 pref = num.toInt32() - 1; + std::u16string_view num( aName.subView( 2, idx-4 ) ); + sal_Int32 pref = o3tl::toInt32(num) - 1; if( pref < 0 || Elements.size() <= o3tl::make_unsigned( pref ) ) return false; |