diff options
Diffstat (limited to 'filter/source')
-rw-r--r-- | filter/source/msfilter/util.cxx | 14 | ||||
-rw-r--r-- | filter/source/xsltdialog/typedetectionimport.cxx | 23 | ||||
-rw-r--r-- | filter/source/xsltdialog/xmlfiltercommon.hxx | 2 | ||||
-rw-r--r-- | filter/source/xsltdialog/xmlfiltersettingsdialog.cxx | 12 |
4 files changed, 26 insertions, 25 deletions
diff --git a/filter/source/msfilter/util.cxx b/filter/source/msfilter/util.cxx index a1d3929a218c..7747c9a0ecd1 100644 --- a/filter/source/msfilter/util.cxx +++ b/filter/source/msfilter/util.cxx @@ -309,19 +309,19 @@ const ApiPaperSize& PaperSizeConv::getApiSizeForMSPaperSizeIndex( sal_Int32 nMSO return spPaperSizeTable[ nMSOPaperIndex ]; } -OUString findQuotedText( const OUString& rCommand, +std::u16string_view findQuotedText( std::u16string_view rCommand, const char* cStartQuote, const sal_Unicode uEndQuote ) { - OUString sRet; + std::u16string_view sRet; OUString sStartQuote( OUString::createFromAscii(cStartQuote) ); - sal_Int32 nStartIndex = rCommand.indexOf( sStartQuote ); - if( nStartIndex >= 0 ) + size_t nStartIndex = rCommand.find( sStartQuote ); + if( nStartIndex != std::u16string_view::npos ) { sal_Int32 nStartLength = sStartQuote.getLength(); - sal_Int32 nEndIndex = rCommand.indexOf( uEndQuote, nStartIndex + nStartLength); - if( nEndIndex > nStartIndex ) + size_t nEndIndex = rCommand.find( uEndQuote, nStartIndex + nStartLength); + if( nEndIndex != std::u16string_view::npos && nEndIndex > nStartIndex ) { - sRet = rCommand.copy( nStartIndex + nStartLength, nEndIndex - nStartIndex - nStartLength); + sRet = rCommand.substr( nStartIndex + nStartLength, nEndIndex - nStartIndex - nStartLength); } } return sRet; diff --git a/filter/source/xsltdialog/typedetectionimport.cxx b/filter/source/xsltdialog/typedetectionimport.cxx index bba302de703c..5fc5ae582951 100644 --- a/filter/source/xsltdialog/typedetectionimport.cxx +++ b/filter/source/xsltdialog/typedetectionimport.cxx @@ -22,6 +22,7 @@ #include <com/sun/star/xml/sax/XAttributeList.hpp> #include <tools/diagnose_ex.h> #include <rtl/ref.hxx> +#include <o3tl/string_view.hxx> #include "typedetectionimport.hxx" #include "xmlfiltercommon.hxx" @@ -80,18 +81,18 @@ void TypeDetectionImporter::fillFilterVector( std::vector< std::unique_ptr<filt maTypeNodes.clear(); } -static OUString getSubdata( int index, sal_Unicode delimiter, const OUString& rData ) +static std::u16string_view getSubdata( int index, sal_Unicode delimiter, std::u16string_view rData ) { sal_Int32 nLastIndex = 0; - sal_Int32 nNextIndex = rData.indexOf( delimiter ); + size_t nNextIndex = rData.find( delimiter ); - OUString aSubdata; + std::u16string_view aSubdata; while( index ) { - nLastIndex = nNextIndex + 1; - nNextIndex = rData.indexOf( delimiter, nLastIndex ); + nLastIndex = nNextIndex == std::u16string_view::npos ? 0 : nNextIndex + 1; + nNextIndex = rData.find( delimiter, nLastIndex ); index--; @@ -99,13 +100,13 @@ static OUString getSubdata( int index, sal_Unicode delimiter, const OUString& rD return aSubdata; } - if( nNextIndex == -1 ) + if( nNextIndex == std::u16string_view::npos ) { - aSubdata = rData.copy( nLastIndex ); + aSubdata = rData.substr( nLastIndex ); } else { - aSubdata = rData.copy( nLastIndex, nNextIndex - nLastIndex ); + aSubdata = rData.substr( nLastIndex, nNextIndex - nLastIndex ); } return aSubdata; @@ -136,7 +137,7 @@ std::unique_ptr<filter_info_impl> TypeDetectionImporter::createFilterForNode( No pFilter->maDocumentService = getSubdata( 2, aComma, aData ); OUString aFilterService( getSubdata( 3, aComma, aData ) ); - pFilter->maFlags = getSubdata( 4, aComma, aData ).toInt32(); + pFilter->maFlags = o3tl::toInt32(getSubdata( 4, aComma, aData )); // parse filter user data sal_Unicode aDelim(';'); @@ -144,7 +145,7 @@ std::unique_ptr<filter_info_impl> TypeDetectionImporter::createFilterForNode( No OUString aAdapterService( getSubdata( 0, aDelim, aFilterUserData ) ); //Import/ExportService - pFilter->mbNeedsXSLT2 = getSubdata( 1, aDelim, aFilterUserData ).toBoolean(); + pFilter->mbNeedsXSLT2 = OUString(getSubdata( 1, aDelim, aFilterUserData )).toBoolean(); pFilter->maImportService = getSubdata( 2, aDelim, aFilterUserData ); pFilter->maExportService = getSubdata( 3, aDelim, aFilterUserData ); pFilter->maImportXSLT = getSubdata( 4, aDelim, aFilterUserData ); @@ -161,7 +162,7 @@ std::unique_ptr<filter_info_impl> TypeDetectionImporter::createFilterForNode( No pFilter->maDocType = getSubdata( 2, aComma, aTypeUserData ); pFilter->maExtension = getSubdata( 4, aComma, aTypeUserData ); - pFilter->mnDocumentIconID = getSubdata( 5, aComma, aTypeUserData ).toInt32(); + pFilter->mnDocumentIconID = o3tl::toInt32(getSubdata( 5, aComma, aTypeUserData )); } bool bOk = true; diff --git a/filter/source/xsltdialog/xmlfiltercommon.hxx b/filter/source/xsltdialog/xmlfiltercommon.hxx index 0d340fa12e0f..4ac225183e60 100644 --- a/filter/source/xsltdialog/xmlfiltercommon.hxx +++ b/filter/source/xsltdialog/xmlfiltercommon.hxx @@ -30,7 +30,7 @@ extern OUString string_encode( const OUString & rText ); extern OUString string_decode( const OUString & rText ); bool copyStreams( const css::uno::Reference< css::io::XInputStream >& xIS, const css::uno::Reference< css::io::XOutputStream >& xOS ); -bool createDirectory( OUString const & rURL ); +bool createDirectory( std::u16string_view rURL ); class filter_info_impl diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx index a112544c83c6..eaf0444850ce 100644 --- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx @@ -1371,15 +1371,15 @@ bool copyStreams( const Reference< XInputStream >& xIS, const Reference< XOutput return false; } -bool createDirectory( OUString const & rURL ) +bool createDirectory( std::u16string_view rURL ) { - sal_Int32 nLastIndex = sizeof( "file:///" ) - 2; - while( nLastIndex != -1 ) + size_t nLastIndex = sizeof( "file:///" ) - 2; + while( nLastIndex != std::u16string_view::npos ) { - nLastIndex = rURL.indexOf( '/', nLastIndex + 1); - if( nLastIndex != -1 ) + nLastIndex = rURL.find( '/', nLastIndex + 1); + if( nLastIndex != std::u16string_view::npos ) { - OUString aDirURL( rURL.copy( 0, nLastIndex ) ); + OUString aDirURL( rURL.substr( 0, nLastIndex ) ); Directory aDir( aDirURL ); Directory::RC rc = aDir.open(); if( rc == Directory::E_NOENT ) |