From 33bd16b344e273c427091ee68e946bf67b371dd7 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Sun, 3 Apr 2022 10:34:37 +0200 Subject: 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 --- desktop/source/app/dispatchwatcher.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'desktop') diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx index 3d24a158261e..e4745f6761a5 100644 --- a/desktop/source/app/dispatchwatcher.cxx +++ b/desktop/source/app/dispatchwatcher.cxx @@ -243,16 +243,16 @@ void scriptCat(const Reference< XModel >& xDoc ) } // Perform batch print -void batchPrint( const OUString &rPrinterName, const Reference< XPrintable > &xDoc, +void batchPrint( std::u16string_view rPrinterName, const Reference< XPrintable > &xDoc, const INetURLObject &aObj, const OUString &aName ) { OUString aFilterOut; OUString aPrinterName; - sal_Int32 nPathIndex = rPrinterName.lastIndexOf( ';' ); - if( nPathIndex != -1 ) - aFilterOut=rPrinterName.copy( nPathIndex+1 ); + size_t nPathIndex = rPrinterName.rfind( ';' ); + if( nPathIndex != std::u16string_view::npos ) + aFilterOut=rPrinterName.substr( nPathIndex+1 ); if( nPathIndex != 0 ) - aPrinterName=rPrinterName.copy( 0, nPathIndex ); + aPrinterName=rPrinterName.substr( 0, nPathIndex ); INetURLObject aOutFilename( aObj ); aOutFilename.SetExtension( u"pdf" ); -- cgit