diff options
author | Noel <noelgrandin@gmail.com> | 2020-11-06 20:01:50 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-11-11 11:58:37 +0100 |
commit | 93c64a61f2c84e684050294a1391cd32425b7837 (patch) | |
tree | 00aad2cb8f3ee29ba4ac99e159e26fb8d71d2f33 /filter | |
parent | make sure mpAlphaVDev is drawn when drawing lines (tdf#137974) (diff) | |
download | core-93c64a61f2c84e684050294a1391cd32425b7837.tar.gz core-93c64a61f2c84e684050294a1391cd32425b7837.zip |
loplugin:stringview
Add new methods "subView" to O(U)String to return substring views
of the underlying data.
Add a clang plugin to warn when replacing existing calls to copy()
would be better to use subView().
Change-Id: I03a5732431ce60808946f2ce2c923b22845689ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105420
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/config/cache/filterfactory.cxx | 2 | ||||
-rw-r--r-- | filter/source/graphicfilter/idxf/dxfreprd.cxx | 4 | ||||
-rw-r--r-- | filter/source/msfilter/msvbahelper.cxx | 4 | ||||
-rw-r--r-- | filter/source/msfilter/util.cxx | 2 | ||||
-rw-r--r-- | filter/source/xsltdialog/xmlfiltertestdialog.cxx | 4 |
5 files changed, 8 insertions, 8 deletions
diff --git a/filter/source/config/cache/filterfactory.cxx b/filter/source/config/cache/filterfactory.cxx index d379857c7310..079be5723c81 100644 --- a/filter/source/config/cache/filterfactory.cxx +++ b/filter/source/config/cache/filterfactory.cxx @@ -148,7 +148,7 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL FilterFactory::crea if (pos != -1) { OSL_FAIL("DEPRECATED!\nPlease use new query format: 'matchByDocumentService=...'"); - OUString sPatchedQuery("matchByDocumentService=" + sNewQuery.copy(7)); + OUString sPatchedQuery(OUString::Concat("matchByDocumentService=") + sNewQuery.subView(7)); sNewQuery = sPatchedQuery; } diff --git a/filter/source/graphicfilter/idxf/dxfreprd.cxx b/filter/source/graphicfilter/idxf/dxfreprd.cxx index e20e407cc013..d03bf4cf702f 100644 --- a/filter/source/graphicfilter/idxf/dxfreprd.cxx +++ b/filter/source/graphicfilter/idxf/dxfreprd.cxx @@ -459,7 +459,7 @@ OUString DXFRepresentation::ToOUString(const OString& s) const { char ch = static_cast<char>(asciiNum.toUInt32()); OUString codePt(&ch, 1, mEnc); - result = result.replaceAll(result.copy(pos, 5), codePt, pos); + result = result.replaceAll(result.subView(pos, 5), codePt, pos); } pos = result.indexOf("%%", pos + 1); } @@ -473,7 +473,7 @@ OUString DXFRepresentation::ToOUString(const OString& s) const lcl_isHex(codePtNum[3])) { OUString codePt(static_cast<sal_Unicode>(codePtNum.toUInt32(16))); - result = result.replaceAll(result.copy(pos, 7), codePt, pos); + result = result.replaceAll(result.subView(pos, 7), codePt, pos); } pos = result.indexOf("\\U+", pos + 1); } diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx index 4614d4306aff..1d1c877c652c 100644 --- a/filter/source/msfilter/msvbahelper.cxx +++ b/filter/source/msfilter/msvbahelper.cxx @@ -147,10 +147,10 @@ static SfxObjectShell* findShellForUrl( const OUString& sMacroURLOrPath ) sal_Int32 lastSlashIndex = xModel->getURL().lastIndexOf( '/' ); if ( lastSlashIndex > -1 ) { - bDocNameNoPathMatch = xModel->getURL().copy( lastSlashIndex + 1 ) == aURL; + bDocNameNoPathMatch = xModel->getURL().subView( lastSlashIndex + 1 ) == aURL; if ( !bDocNameNoPathMatch ) { - OUString aTmpName = "'" + xModel->getURL().copy( lastSlashIndex + 1 ) + "'"; + OUString aTmpName = OUString::Concat("'") + xModel->getURL().subView( lastSlashIndex + 1 ) + "'"; bDocNameNoPathMatch = aTmpName == aURL; } } diff --git a/filter/source/msfilter/util.cxx b/filter/source/msfilter/util.cxx index 8ea3be35dba9..c72a2802c7be 100644 --- a/filter/source/msfilter/util.cxx +++ b/filter/source/msfilter/util.cxx @@ -523,7 +523,7 @@ static EquationResult Read_SubF_Combined(WW8ReadFieldParams& rReadParam) if (nBegin != -1 && nEnd != -1) { sCombinedCharacters += - sPart.copy(nBegin+1,nEnd-nBegin-1); + sPart.subView(nBegin+1,nEnd-nBegin-1); } } } diff --git a/filter/source/xsltdialog/xmlfiltertestdialog.cxx b/filter/source/xsltdialog/xmlfiltertestdialog.cxx index 4f804f6a7e2c..c00301bacfc3 100644 --- a/filter/source/xsltdialog/xmlfiltertestdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltertestdialog.cxx @@ -538,11 +538,11 @@ void XMLFilterTestDialog::onImportBrowse() if( nLastIndex == -1 ) { - aExtensions += m_xFilterInfo->maExtension.copy( nCurrentIndex ); + aExtensions += m_xFilterInfo->maExtension.subView( nCurrentIndex ); } else { - aExtensions += m_xFilterInfo->maExtension.copy( nCurrentIndex, nLastIndex - nCurrentIndex ); + aExtensions += m_xFilterInfo->maExtension.subView( nCurrentIndex, nLastIndex - nCurrentIndex ); nCurrentIndex = nLastIndex + 1; nLastIndex = nCurrentIndex; } |