diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-03 11:51:18 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-04 10:01:33 +0200 |
commit | bf6b64d5963002d52c3ed2093b064896a4316d0e (patch) | |
tree | f38cc694ab887f63e4cf41eaaf4f57d61cba31fd /unotools/source/config | |
parent | 8342e4a5c7bd436f869e6c1c23d248556087ebdf (diff) |
use more string_view in unotools
Change-Id: Id10d68f2eb016671be6842dfaa82909207b0708d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133754
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unotools/source/config')
-rw-r--r-- | unotools/source/config/configpaths.cxx | 12 | ||||
-rw-r--r-- | unotools/source/config/fontcfg.cxx | 8 |
2 files changed, 10 insertions, 10 deletions
diff --git a/unotools/source/config/configpaths.cxx b/unotools/source/config/configpaths.cxx index 9cf537738889..8efdf19b5519 100644 --- a/unotools/source/config/configpaths.cxx +++ b/unotools/source/config/configpaths.cxx @@ -232,10 +232,10 @@ OUString dropPrefixFromConfigurationPath(OUString const& _sNestedPath, } static -OUString lcl_wrapName(const OUString& _sContent, const OUString& _sType) +OUString lcl_wrapName(std::u16string_view _sContent, const OUString& _sType) { - const sal_Unicode * const pBeginContent = _sContent.getStr(); - const sal_Unicode * const pEndContent = pBeginContent + _sContent.getLength(); + const sal_Unicode * const pBeginContent = _sContent.data(); + const sal_Unicode * const pEndContent = pBeginContent + _sContent.size(); OSL_PRECOND(!_sType.isEmpty(), "Unexpected config type name: empty"); OSL_PRECOND(pBeginContent <= pEndContent, "Invalid config name: empty"); @@ -243,7 +243,7 @@ OUString lcl_wrapName(const OUString& _sContent, const OUString& _sType) if (pBeginContent == pEndContent) return _sType; - OUStringBuffer aNormalized(_sType.getLength() + _sContent.getLength() + 4); // reserve approximate size initially + OUStringBuffer aNormalized(_sType.getLength() + _sContent.size() + 4); // reserve approximate size initially // prefix: type, opening bracket and quote aNormalized.append( _sType + "['" ); @@ -268,12 +268,12 @@ OUString lcl_wrapName(const OUString& _sContent, const OUString& _sType) return aNormalized.makeStringAndClear(); } -OUString wrapConfigurationElementName(OUString const& _sElementName) +OUString wrapConfigurationElementName(std::u16string_view _sElementName) { return lcl_wrapName(_sElementName, "*" ); } -OUString wrapConfigurationElementName(OUString const& _sElementName, +OUString wrapConfigurationElementName(std::u16string_view _sElementName, OUString const& _sTypeName) { // todo: check that _sTypeName is valid diff --git a/unotools/source/config/fontcfg.cxx b/unotools/source/config/fontcfg.cxx index 371084708084..0a8ab40b3116 100644 --- a/unotools/source/config/fontcfg.cxx +++ b/unotools/source/config/fontcfg.cxx @@ -602,13 +602,13 @@ static bool ImplKillLeading( OUString& rName, const char* const* ppStr ) return false; } -static sal_Int32 ImplIsTrailing( const OUString& rName, const char* pStr ) +static sal_Int32 ImplIsTrailing( std::u16string_view rName, const char* pStr ) { - sal_Int32 nStrLen = static_cast<sal_Int32>(strlen( pStr )); - if( nStrLen >= rName.getLength() ) + size_t nStrLen = strlen( pStr ); + if( nStrLen >= rName.size() ) return 0; - const sal_Unicode* pEndName = rName.getStr() + rName.getLength(); + const sal_Unicode* pEndName = rName.data() + rName.size(); const sal_Unicode* pNameStr = pEndName - nStrLen; do if( *(pNameStr++) != *(pStr++) ) return 0; |