loplugin:stringviewparam

Change-Id: I8f27a2260e7195dd0a7dbb0b5e3dd0064ef06c81
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133164
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann
2022-04-19 09:40:53 +02:00
parent 7321d43155
commit b12727e15a
2 changed files with 9 additions and 6 deletions

View File

@@ -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 );
}
}

View File

@@ -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; }