extensions/source/update/check/updatehdl.cxx | 13 ++++++++----- extensions/source/update/check/updatehdl.hxx | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-)
New commits: commit b12727e15a82216f709ccb6e37a9029d60ad4831 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Tue Apr 19 09:40:53 2022 +0200 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Tue Apr 19 11:32:56 2022 +0200 loplugin:stringviewparam Change-Id: I8f27a2260e7195dd0a7dbb0b5e3dd0064ef06c81 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133164 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/extensions/source/update/check/updatehdl.cxx b/extensions/source/update/check/updatehdl.cxx index b0ecb69e37f9..4ccf0f4fcc20 100644 --- a/extensions/source/update/check/updatehdl.cxx +++ b/extensions/source/update/check/updatehdl.cxx @@ -17,6 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <cstddef> #include "updatehdl.hxx" #include <helpids.h> @@ -240,13 +243,13 @@ void UpdateHandler::setErrorMessage( const OUString& rErrorMsg ) } -void UpdateHandler::setDownloadFile( const OUString& rFilePath ) +void UpdateHandler::setDownloadFile( std::u16string_view rFilePath ) { - sal_Int32 nLast = rFilePath.lastIndexOf( '/' ); - if ( nLast != -1 ) + std::size_t nLast = rFilePath.rfind( '/' ); + if ( nLast != std::u16string_view::npos ) { - msDownloadFile = rFilePath.copy( nLast+1 ); - const OUString aDownloadURL = rFilePath.copy( 0, nLast ); + msDownloadFile = rFilePath.substr( nLast+1 ); + const OUString aDownloadURL(rFilePath.substr( 0, nLast )); osl::FileBase::getSystemPathFromFileURL( aDownloadURL, msDownloadPath ); } } diff --git a/extensions/source/update/check/updatehdl.hxx b/extensions/source/update/check/updatehdl.hxx index 6597176468bd..297cf730ce4b 100644 --- a/extensions/source/update/check/updatehdl.hxx +++ b/extensions/source/update/check/updatehdl.hxx @@ -166,7 +166,7 @@ public: void setProgress( sal_Int32 nPercent ); void setNextVersion( const OUString &rNextVersion ) { msNextVersion = rNextVersion; } void setDownloadPath( const OUString &rPath ) { msDownloadPath = rPath; } - void setDownloadFile( const OUString &rPath ); + void setDownloadFile( std::u16string_view rPath ); void setErrorMessage( const OUString &rErrorMsg ); void setDescription( const OUString &rDescription ){ msDescriptionMsg = rDescription; }