diff options
author | Noel <noelgrandin@gmail.com> | 2020-11-25 08:14:07 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-11-30 12:32:14 +0100 |
commit | 8332d6d8200e8ca1f22dd98d9373efd5a431d09c (patch) | |
tree | dd45d452202998297b8562743ea6345462304d04 /sc | |
parent | d05a4cfbdcece491f7385dbeaa7eca03f2fdc1d5 (diff) |
loplugin:stringviewparam include comparisons with string literals
Change-Id: I8ba1214500dddaf413c506a4b82f43d63cda804b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106559
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/styleuno.hxx | 2 | ||||
-rw-r--r-- | sc/inc/tabprotection.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/tabprotection.cxx | 10 | ||||
-rw-r--r-- | sc/source/core/inc/addinhelpid.hxx | 4 | ||||
-rw-r--r-- | sc/source/core/tool/addinhelpid.cxx | 8 | ||||
-rw-r--r-- | sc/source/filter/html/htmlexp.cxx | 6 | ||||
-rw-r--r-- | sc/source/filter/inc/htmlexp.hxx | 2 | ||||
-rw-r--r-- | sc/source/filter/lotus/lotform.cxx | 4 | ||||
-rw-r--r-- | sc/source/filter/xml/XMLTableShapeImportHelper.cxx | 4 | ||||
-rw-r--r-- | sc/source/filter/xml/XMLTableShapeImportHelper.hxx | 2 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlcondformat.cxx | 16 | ||||
-rw-r--r-- | sc/source/ui/unoobj/styleuno.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/vba/vbaworkbooks.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/vba/vbaworkbooks.hxx | 2 |
14 files changed, 36 insertions, 36 deletions
diff --git a/sc/inc/styleuno.hxx b/sc/inc/styleuno.hxx index b4f95f0b6214..9921bbb4f108 100644 --- a/sc/inc/styleuno.hxx +++ b/sc/inc/styleuno.hxx @@ -58,7 +58,7 @@ private: ScStyleFamilyObj* GetObjectByType_Impl(SfxStyleFamily nType) const; ScStyleFamilyObj* GetObjectByIndex_Impl(sal_uInt32 nIndex) const; - ScStyleFamilyObj* GetObjectByName_Impl(const OUString& aName) const; + ScStyleFamilyObj* GetObjectByName_Impl(std::u16string_view aName) const; public: ScStyleFamiliesObj(ScDocShell* pDocSh); diff --git a/sc/inc/tabprotection.hxx b/sc/inc/tabprotection.hxx index caf408a0f35b..f4b856cc4782 100644 --- a/sc/inc/tabprotection.hxx +++ b/sc/inc/tabprotection.hxx @@ -67,7 +67,7 @@ namespace ScPassHashHelper OUString getHashURI(ScPasswordHash eHash); - ScPasswordHash getHashTypeFromURI(const OUString& rURI); + ScPasswordHash getHashTypeFromURI(std::u16string_view rURI); } class SAL_NO_VTABLE ScPassHashProtectable diff --git a/sc/source/core/data/tabprotection.cxx b/sc/source/core/data/tabprotection.cxx index 6c3de2bde15b..c0cc81852190 100644 --- a/sc/source/core/data/tabprotection.cxx +++ b/sc/source/core/data/tabprotection.cxx @@ -29,10 +29,10 @@ #define DEBUG_TAB_PROTECTION 0 -#define URI_SHA1 "http://www.w3.org/2000/09/xmldsig#sha1" -#define URI_SHA256_ODF12 "http://www.w3.org/2000/09/xmldsig#sha256" -#define URI_SHA256_W3C "http://www.w3.org/2001/04/xmlenc#sha256" -#define URI_XLS_LEGACY "http://docs.oasis-open.org/office/ns/table/legacy-hash-excel" +#define URI_SHA1 u"http://www.w3.org/2000/09/xmldsig#sha1" +#define URI_SHA256_ODF12 u"http://www.w3.org/2000/09/xmldsig#sha256" +#define URI_SHA256_W3C u"http://www.w3.org/2001/04/xmlenc#sha256" +#define URI_XLS_LEGACY u"http://docs.oasis-open.org/office/ns/table/legacy-hash-excel" using namespace ::com::sun::star; using ::com::sun::star::uno::Sequence; @@ -79,7 +79,7 @@ OUString ScPassHashHelper::getHashURI(ScPasswordHash eHash) return OUString(); } -ScPasswordHash ScPassHashHelper::getHashTypeFromURI(const OUString& rURI) +ScPasswordHash ScPassHashHelper::getHashTypeFromURI(std::u16string_view rURI) { if (rURI == URI_SHA256_ODF12 || rURI == URI_SHA256_W3C) return PASSHASH_SHA256; diff --git a/sc/source/core/inc/addinhelpid.hxx b/sc/source/core/inc/addinhelpid.hxx index 42b8c2d21128..878a0cf7e694 100644 --- a/sc/source/core/inc/addinhelpid.hxx +++ b/sc/source/core/inc/addinhelpid.hxx @@ -34,10 +34,10 @@ private: public: ScUnoAddInHelpIdGenerator() = delete; - ScUnoAddInHelpIdGenerator( const OUString& rServiceName ); + ScUnoAddInHelpIdGenerator( std::u16string_view rServiceName ); /** Sets service name of the AddIn. Has to be done before requesting help IDs. */ - void SetServiceName( const OUString& rServiceName ); + void SetServiceName( std::u16string_view rServiceName ); /** @return The help ID of the function with given built-in name or 0 if not found. */ OString GetHelpId( const OUString& rFuncName ) const; diff --git a/sc/source/core/tool/addinhelpid.cxx b/sc/source/core/tool/addinhelpid.cxx index cad2ca675c87..595d52fe060f 100644 --- a/sc/source/core/tool/addinhelpid.cxx +++ b/sc/source/core/tool/addinhelpid.cxx @@ -145,22 +145,22 @@ const ScUnoAddInHelpId pDateFuncHelpIds[] = { "getWeeksInYear" , HID_DAI_FUNC_WEEKSINYEAR } }; -ScUnoAddInHelpIdGenerator::ScUnoAddInHelpIdGenerator( const OUString& rServiceName ) +ScUnoAddInHelpIdGenerator::ScUnoAddInHelpIdGenerator( std::u16string_view rServiceName ) { SetServiceName( rServiceName ); } -void ScUnoAddInHelpIdGenerator::SetServiceName( const OUString& rServiceName ) +void ScUnoAddInHelpIdGenerator::SetServiceName( std::u16string_view rServiceName ) { pCurrHelpIds = nullptr; sal_uInt32 nSize = 0; - if ( rServiceName == "com.sun.star.sheet.addin.Analysis" ) + if ( rServiceName == u"com.sun.star.sheet.addin.Analysis" ) { pCurrHelpIds = pAnalysisHelpIds; nSize = sizeof( pAnalysisHelpIds ); } - else if ( rServiceName == "com.sun.star.sheet.addin.DateFunctions" ) + else if ( rServiceName == u"com.sun.star.sheet.addin.DateFunctions" ) { pCurrHelpIds = pDateFuncHelpIds; nSize = sizeof( pDateFuncHelpIds ); diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx index d66f9e3bdd69..684a6727839a 100644 --- a/sc/source/filter/html/htmlexp.cxx +++ b/sc/source/filter/html/htmlexp.cxx @@ -189,7 +189,7 @@ static OString lcl_makeHTMLColorTriplet(const Color& rColor) ScHTMLExport::ScHTMLExport( SvStream& rStrmP, const OUString& rBaseURL, ScDocument* pDocP, const ScRange& rRangeP, bool bAllP, - const OUString& rStreamPathP, const OUString& rFilterOptions ) : + const OUString& rStreamPathP, std::u16string_view rFilterOptions ) : ScExportBase( rStrmP, pDocP, rRangeP ), aBaseURL( rBaseURL ), aStreamPath( rStreamPathP ), @@ -212,11 +212,11 @@ ScHTMLExport::ScHTMLExport( SvStream& rStrmP, const OUString& rBaseURL, ScDocume eDestEnc = (pDoc->IsClipOrUndo() ? RTL_TEXTENCODING_UTF8 : rHtmlOptions.GetTextEncoding()); bCopyLocalFileToINet = rHtmlOptions.IsSaveGraphicsLocal(); - if (rFilterOptions == "SkipImages") + if (rFilterOptions == u"SkipImages") { mbSkipImages = true; } - else if (rFilterOptions == "SkipHeaderFooter") + else if (rFilterOptions == u"SkipHeaderFooter") { mbSkipHeaderFooter = true; } diff --git a/sc/source/filter/inc/htmlexp.hxx b/sc/source/filter/inc/htmlexp.hxx index 26e295afa207..10c420354287 100644 --- a/sc/source/filter/inc/htmlexp.hxx +++ b/sc/source/filter/inc/htmlexp.hxx @@ -175,7 +175,7 @@ class ScHTMLExport : public ScExportBase public: ScHTMLExport( SvStream&, const OUString&, ScDocument*, const ScRange&, - bool bAll, const OUString& aStreamPath, const OUString& rFilterOptions ); + bool bAll, const OUString& aStreamPath, std::u16string_view rFilterOptions ); virtual ~ScHTMLExport() override; void Write(); const OUString& GetNonConvertibleChars() const diff --git a/sc/source/filter/lotus/lotform.cxx b/sc/source/filter/lotus/lotform.cxx index 1013bdeb73bd..67e1954598eb 100644 --- a/sc/source/filter/lotus/lotform.cxx +++ b/sc/source/filter/lotus/lotform.cxx @@ -32,7 +32,7 @@ static const char* GetAddInName( const sal_uInt8 nIndex ); -static DefTokenId lcl_KnownAddIn(const OString& rTest); +static DefTokenId lcl_KnownAddIn(std::string_view rTest); void LotusToSc::DoFunc( DefTokenId eOc, sal_uInt8 nCnt, const char* pExtString ) { @@ -1988,7 +1988,7 @@ const char* GetAddInName( const sal_uInt8 n ) return pNames[ n ]; } -static DefTokenId lcl_KnownAddIn( const OString& rTest ) +static DefTokenId lcl_KnownAddIn( std::string_view rTest ) { DefTokenId eId = ocNoName; diff --git a/sc/source/filter/xml/XMLTableShapeImportHelper.cxx b/sc/source/filter/xml/XMLTableShapeImportHelper.cxx index 8c82e65b8732..32317e7ec86e 100644 --- a/sc/source/filter/xml/XMLTableShapeImportHelper.cxx +++ b/sc/source/filter/xml/XMLTableShapeImportHelper.cxx @@ -49,9 +49,9 @@ XMLTableShapeImportHelper::~XMLTableShapeImportHelper() { } -void XMLTableShapeImportHelper::SetLayer(const uno::Reference<drawing::XShape>& rShape, SdrLayerID nLayerID, const OUString& sType) +void XMLTableShapeImportHelper::SetLayer(const uno::Reference<drawing::XShape>& rShape, SdrLayerID nLayerID, std::u16string_view sType) { - if ( sType == "com.sun.star.drawing.ControlShape" ) + if ( sType == u"com.sun.star.drawing.ControlShape" ) nLayerID = SC_LAYER_CONTROLS; if (nLayerID != SDRLAYER_NOTFOUND) { diff --git a/sc/source/filter/xml/XMLTableShapeImportHelper.hxx b/sc/source/filter/xml/XMLTableShapeImportHelper.hxx index 720a7ca3ea0c..55d85f6ad919 100644 --- a/sc/source/filter/xml/XMLTableShapeImportHelper.hxx +++ b/sc/source/filter/xml/XMLTableShapeImportHelper.hxx @@ -38,7 +38,7 @@ public: explicit XMLTableShapeImportHelper( ScXMLImport& rImp ); virtual ~XMLTableShapeImportHelper() override; - static void SetLayer(const css::uno::Reference<css::drawing::XShape>& rShape, SdrLayerID nLayerID, const OUString& sType); + static void SetLayer(const css::uno::Reference<css::drawing::XShape>& rShape, SdrLayerID nLayerID, std::u16string_view sType); virtual void finishShape(css::uno::Reference< css::drawing::XShape >& rShape, const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList, css::uno::Reference< css::drawing::XShapes >& rShapes) override; diff --git a/sc/source/filter/xml/xmlcondformat.cxx b/sc/source/filter/xml/xmlcondformat.cxx index 42a96e04c195..a1b54c036c30 100644 --- a/sc/source/filter/xml/xmlcondformat.cxx +++ b/sc/source/filter/xml/xmlcondformat.cxx @@ -835,26 +835,26 @@ ScXMLCondContext::ScXMLCondContext( ScXMLImport& rImport, namespace { -void setColorEntryType(const OUString& rType, ScColorScaleEntry* pEntry, const OUString& rFormula, +void setColorEntryType(std::u16string_view rType, ScColorScaleEntry* pEntry, const OUString& rFormula, ScXMLImport& rImport) { - if(rType == "minimum") + if(rType == u"minimum") pEntry->SetType(COLORSCALE_MIN); - else if(rType == "maximum") + else if(rType == u"maximum") pEntry->SetType(COLORSCALE_MAX); - else if(rType == "percentile") + else if(rType == u"percentile") pEntry->SetType(COLORSCALE_PERCENTILE); - else if(rType == "percent") + else if(rType == u"percent") pEntry->SetType(COLORSCALE_PERCENT); - else if(rType == "formula") + else if(rType == u"formula") { pEntry->SetType(COLORSCALE_FORMULA); //position does not matter, only table is important pEntry->SetFormula(rFormula, *rImport.GetDocument(), ScAddress(0,0,rImport.GetTables().GetCurrentSheet()), formula::FormulaGrammar::GRAM_ODFF); } - else if(rType == "auto-minimum") + else if(rType == u"auto-minimum") pEntry->SetType(COLORSCALE_AUTO); - else if(rType == "auto-maximum") + else if(rType == u"auto-maximum") pEntry->SetType(COLORSCALE_AUTO); } diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx index 49c2f684816b..9dfddc407d77 100644 --- a/sc/source/ui/unoobj/styleuno.cxx +++ b/sc/source/ui/unoobj/styleuno.cxx @@ -380,8 +380,8 @@ static const SfxItemPropertyMap* lcl_GetFooterStyleMap() #define SC_STYLE_FAMILY_COUNT 2 -#define SC_FAMILYNAME_CELL "CellStyles" -#define SC_FAMILYNAME_PAGE "PageStyles" +#define SC_FAMILYNAME_CELL u"CellStyles" +#define SC_FAMILYNAME_PAGE u"PageStyles" const SfxStyleFamily aStyleFamilyTypes[SC_STYLE_FAMILY_COUNT] = { SfxStyleFamily::Para, SfxStyleFamily::Page }; @@ -453,7 +453,7 @@ ScStyleFamilyObj* ScStyleFamiliesObj::GetObjectByIndex_Impl(sal_uInt32 nIndex) c return nullptr; // invalid index } -ScStyleFamilyObj* ScStyleFamiliesObj::GetObjectByName_Impl(const OUString& aName) const +ScStyleFamilyObj* ScStyleFamiliesObj::GetObjectByName_Impl(std::u16string_view aName) const { if ( pDocShell ) { diff --git a/sc/source/ui/vba/vbaworkbooks.cxx b/sc/source/ui/vba/vbaworkbooks.cxx index 61edd810ba9c..a0bdc927deda 100644 --- a/sc/source/ui/vba/vbaworkbooks.cxx +++ b/sc/source/ui/vba/vbaworkbooks.cxx @@ -151,14 +151,14 @@ ScVbaWorkbooks::Close() } bool -ScVbaWorkbooks::isTextFile( const OUString& sType ) +ScVbaWorkbooks::isTextFile( std::u16string_view sType ) { // will return true if the file is // a) a variant of a text file // b) a csv file // c) unknown // returning true basically means treat this like a csv file - return sType == "generic_Text" || sType.isEmpty(); + return sType == u"generic_Text" || sType.empty(); } bool diff --git a/sc/source/ui/vba/vbaworkbooks.hxx b/sc/source/ui/vba/vbaworkbooks.hxx index 4191df49ce9a..1c6ae781d560 100644 --- a/sc/source/ui/vba/vbaworkbooks.hxx +++ b/sc/source/ui/vba/vbaworkbooks.hxx @@ -29,7 +29,7 @@ class ScVbaWorkbooks : public ScVbaWorkbooks_BASE { private: OUString getFileFilterType( const OUString& rString ); - static bool isTextFile( const OUString& rString ); + static bool isTextFile( std::u16string_view rString ); static bool isSpreadSheetFile( const OUString& rString ); static sal_Int16& getCurrentDelim(){ static sal_Int16 nDelim = 44; return nDelim; } public: |