summaryrefslogtreecommitdiff
path: root/pyuno/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-04-03 10:34:37 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-04-17 10:27:33 +0200
commit33bd16b344e273c427091ee68e946bf67b371dd7 (patch)
tree85fb383ea8e3d30f393bb197b5c74f73f6ca247f /pyuno/source
parentfe597a337914decd62480d3eba84258333116db9 (diff)
loplugin:stringviewparam convert methods using copy()
which converts to std::string_view::substr() Change-Id: I3f42213b41a97e77ddcc79d84d512f49d68ca559 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132729 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'pyuno/source')
-rw-r--r--pyuno/source/loader/pyuno_loader.cxx16
1 files changed, 8 insertions, 8 deletions
diff --git a/pyuno/source/loader/pyuno_loader.cxx b/pyuno/source/loader/pyuno_loader.cxx
index 0db6e637a2a7..f01d8a0529a3 100644
--- a/pyuno/source/loader/pyuno_loader.cxx
+++ b/pyuno/source/loader/pyuno_loader.cxx
@@ -133,25 +133,25 @@ static void setPythonHome ( const OUString & pythonHome )
Py_SetPythonHome(wide);
}
-static void prependPythonPath( const OUString & pythonPathBootstrap )
+static void prependPythonPath( std::u16string_view pythonPathBootstrap )
{
OUStringBuffer bufPYTHONPATH( 256 );
bool bAppendSep = false;
sal_Int32 nIndex = 0;
while( true )
{
- sal_Int32 nNew = pythonPathBootstrap.indexOf( ' ', nIndex );
- OUString fileUrl;
- if( nNew == -1 )
+ size_t nNew = pythonPathBootstrap.find( ' ', nIndex );
+ std::u16string_view fileUrl;
+ if( nNew == std::u16string_view::npos )
{
- fileUrl = pythonPathBootstrap.copy(nIndex);
+ fileUrl = pythonPathBootstrap.substr(nIndex);
}
else
{
- fileUrl = pythonPathBootstrap.copy(nIndex, nNew - nIndex);
+ fileUrl = pythonPathBootstrap.substr(nIndex, nNew - nIndex);
}
OUString systemPath;
- osl_getSystemPathFromFileURL( fileUrl.pData, &(systemPath.pData) );
+ osl_getSystemPathFromFileURL( OUString(fileUrl).pData, &(systemPath.pData) );
if (!systemPath.isEmpty())
{
if (bAppendSep)
@@ -159,7 +159,7 @@ static void prependPythonPath( const OUString & pythonPathBootstrap )
bufPYTHONPATH.append(systemPath);
bAppendSep = true;
}
- if( nNew == -1 )
+ if( nNew == std::u16string_view::npos )
break;
nIndex = nNew + 1;
}