diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-09-27 09:37:44 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-09-27 14:06:42 +0200 |
commit | 97eccc5d55d8786f91c88a0f3de36640c112e68e (patch) | |
tree | acf3be78e6c95abd1e3c2c0881d4da1ae4dfb3c8 /cui | |
parent | f6bf58503dda832bad97b262e4feed633fdd4853 (diff) |
use more string_view in cui,extensions
Change-Id: I76253ae06af53f63206a47a84035317c6a5058b2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140637
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/dialogs/about.cxx | 4 | ||||
-rw-r--r-- | cui/source/dialogs/scriptdlg.cxx | 12 | ||||
-rw-r--r-- | cui/source/inc/about.hxx | 2 |
3 files changed, 9 insertions, 9 deletions
diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx index abeafa411865..9e5be496881e 100644 --- a/cui/source/dialogs/about.cxx +++ b/cui/source/dialogs/about.cxx @@ -136,8 +136,8 @@ AboutDialog::AboutDialog(weld::Window *pParent) AboutDialog::~AboutDialog() {} -bool AboutDialog::IsStringValidGitHash(const OUString &hash) { - for (int i = 0; i < hash.getLength(); i++) { +bool AboutDialog::IsStringValidGitHash(std::u16string_view hash) { + for (size_t i = 0; i < hash.size(); i++) { if (!std::isxdigit(hash[i])) { return false; } diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx index c7784393ac6b..9742bc2ebaab 100644 --- a/cui/source/dialogs/scriptdlg.cxx +++ b/cui/source/dialogs/scriptdlg.cxx @@ -1091,14 +1091,14 @@ namespace { OUString ReplaceString( const OUString& source, - const OUString& token, + std::u16string_view token, std::u16string_view value ) { sal_Int32 pos = source.indexOf( token ); if ( pos != -1 && !value.empty() ) { - return source.replaceAt( pos, token.getLength(), value ); + return source.replaceAt( pos, token.size(), value ); } else { @@ -1116,9 +1116,9 @@ OUString FormatErrorString( { OUString result = unformatted; - result = ReplaceString(result, "%LANGUAGENAME", language ); - result = ReplaceString(result, "%SCRIPTNAME", script ); - result = ReplaceString(result, "%LINENUMBER", line ); + result = ReplaceString(result, u"%LANGUAGENAME", language ); + result = ReplaceString(result, u"%SCRIPTNAME", script ); + result = ReplaceString(result, u"%LINENUMBER", line ); if ( !type.empty() ) { @@ -1239,7 +1239,7 @@ OUString GetErrorMessage( if ( sError.errorType == provider::ScriptFrameworkErrorType::NOTSUPPORTED ) { message = CuiResId(RID_CUISTR_ERROR_LANG_NOT_SUPPORTED); - message = ReplaceString(message, "%LANGUAGENAME", language ); + message = ReplaceString(message, u"%LANGUAGENAME", language ); } else diff --git a/cui/source/inc/about.hxx b/cui/source/inc/about.hxx index 2cfc65a894f4..42eae5467eab 100644 --- a/cui/source/inc/about.hxx +++ b/cui/source/inc/about.hxx @@ -46,7 +46,7 @@ private: static OUString GetMiscString(); static OUString GetCopyrightString(); - static bool IsStringValidGitHash(const OUString& hash); + static bool IsStringValidGitHash(std::u16string_view hash); DECL_LINK(HandleClick, weld::Button&, void); |