diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-12 12:43:11 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-13 08:38:53 +0200 |
commit | fdfd517a6f75e394ddcb1e195decbfed33ba56b9 (patch) | |
tree | e3bff14e5531affcd908415b4e85d7ceac4aa1fd /svtools | |
parent | e568c9dca8b93b96a8a130a8fb6f1bba1a33d6ea (diff) |
loplugin:stringviewparam whitelist some more functions
for which we have o3tl:: equivalents
Change-Id: I4670fd8b703ac47214be213f41e88d1c6ede7032
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132913
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/control/ctrlbox.cxx | 2 | ||||
-rw-r--r-- | svtools/source/control/ctrltool.cxx | 17 |
2 files changed, 10 insertions, 9 deletions
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index 1b27be221943..d679b7c46160 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -842,7 +842,7 @@ FontStyleBox::FontStyleBox(std::unique_ptr<weld::ComboBox> p) m_xComboBox->set_entry_width_chars(std::ceil(nMaxLen / m_xComboBox->get_approximate_digit_width())); } -void FontStyleBox::Fill( const OUString& rName, const FontList* pList ) +void FontStyleBox::Fill( std::u16string_view rName, const FontList* pList ) { m_xComboBox->freeze(); OUString aOldText = m_xComboBox->get_active_text(); diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx index d061c2773e3f..31c3c33b8004 100644 --- a/svtools/source/control/ctrltool.cxx +++ b/svtools/source/control/ctrltool.cxx @@ -34,6 +34,7 @@ #include <svtools/svtresid.hxx> #include <svtools/ctrltool.hxx> #include <o3tl/typed_flags_set.hxx> +#include <o3tl/string_view.hxx> #include <comphelper/lok.hxx> // Standard fontsizes for scalable Fonts @@ -157,13 +158,13 @@ static OUString ImplMakeSearchString(const OUString& rStr) return rStr.toAsciiLowerCase(); } -static OUString ImplMakeSearchStringFromName(const OUString& rStr) +static OUString ImplMakeSearchStringFromName(std::u16string_view rStr) { // check for features before alternate font separator - if (sal_Int32 nColon = rStr.indexOf(':'); nColon != -1) - if (sal_Int32 nSemiColon = rStr.indexOf(';'); nSemiColon == -1 || nColon < nSemiColon) - return ImplMakeSearchString(rStr.getToken( 0, ':' )); - return ImplMakeSearchString(rStr.getToken( 0, ';' )); + if (size_t nColon = rStr.find(':'); nColon != std::u16string_view::npos) + if (size_t nSemiColon = rStr.find(';'); nSemiColon == std::u16string_view::npos || nColon < nSemiColon) + return ImplMakeSearchString(OUString(o3tl::getToken(rStr, 0, ':' ))); + return ImplMakeSearchString(OUString(o3tl::getToken(rStr, 0, ';' ))); } ImplFontListNameInfo* FontList::ImplFind(std::u16string_view rSearchName, sal_uInt32* pIndex) const @@ -235,7 +236,7 @@ ImplFontListNameInfo* FontList::ImplFind(std::u16string_view rSearchName, sal_uI return const_cast<ImplFontListNameInfo*>(pFoundData); } -ImplFontListNameInfo* FontList::ImplFindByName(const OUString& rStr) const +ImplFontListNameInfo* FontList::ImplFindByName(std::u16string_view rStr) const { OUString aSearchName = ImplMakeSearchStringFromName(rStr); return ImplFind( aSearchName, nullptr ); @@ -709,7 +710,7 @@ FontMetric FontList::Get(const OUString& rName, return aInfo; } -bool FontList::IsAvailable(const OUString& rName) const +bool FontList::IsAvailable(std::u16string_view rName) const { return (ImplFindByName( rName ) != nullptr); } @@ -721,7 +722,7 @@ const FontMetric& FontList::GetFontName(size_t const nFont) const return *(m_Entries[nFont]->mpFirst); } -sal_Handle FontList::GetFirstFontMetric(const OUString& rName) const +sal_Handle FontList::GetFirstFontMetric(std::u16string_view rName) const { ImplFontListNameInfo* pData = ImplFindByName( rName ); if ( !pData ) |