diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-12-23 13:16:31 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-12-26 14:51:15 +0100 |
commit | a3d0091d185f39eddabf4d372ebe0ac3061dbb89 (patch) | |
tree | 4d70cedc274972ccc21b6b8e7105f042090cf5d6 /sc | |
parent | af791fb775e35c11ad01c42a7085dd121ab9c7a6 (diff) |
New loplugin:stringliteralvar
See the comment at the top of compilerplugins/clang/stringliteralvar.cxx for
details.
(Turned some affected variables in included files into inline variables, to
avoid GCC warnings about unused variables.)
Change-Id: Ie77219e6adfdaaceaa8b4e590b08971f2f04c83a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108239
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/helper/shared_test_impl.hxx | 4 | ||||
-rw-r--r-- | sc/qa/unit/tiledrendering/tiledrendering.cxx | 2 | ||||
-rw-r--r-- | sc/qa/unit/uicalc/uicalc.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/tool/autoform.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh.cxx | 14 | ||||
-rw-r--r-- | sc/source/ui/docshell/impex.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/vba/vbaborders.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/vba/vbainterior.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/vba/vbarange.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/vba/vbastyle.cxx | 2 |
11 files changed, 23 insertions, 23 deletions
diff --git a/sc/qa/unit/helper/shared_test_impl.hxx b/sc/qa/unit/helper/shared_test_impl.hxx index 92c05c6d7e9a..ae77d0ebf44e 100644 --- a/sc/qa/unit/helper/shared_test_impl.hxx +++ b/sc/qa/unit/helper/shared_test_impl.hxx @@ -278,11 +278,11 @@ void testCeilingFloor_Impl( ScDocument& rDoc ) { // Original test case document is ceiling-floor.xlsx // Sheet1.K1 has =AND(K3:K81) to evaluate all results. - const char pORef[] = "Sheet1.K1"; + static const OUStringLiteral pORef = u"Sheet1.K1"; ScAddress aPos; aPos.Parse(pORef, rDoc); ASSERT_FORMULA_EQUAL(rDoc, aPos, "AND(K3:K81)", "Wrong formula."); - CPPUNIT_ASSERT_MESSAGE( OString( pORef + OStringLiteral(" result is error.")).getStr(), + CPPUNIT_ASSERT_MESSAGE( OUString( pORef + " result is error.").toUtf8().getStr(), isFormulaWithoutError( rDoc, aPos)); CPPUNIT_ASSERT_EQUAL(1.0, rDoc.GetValue(aPos)); } diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 2cf0bb5821e9..7d4dc617b1ef 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -56,7 +56,7 @@ static std::ostream& operator<<(std::ostream& os, ViewShellId const & id) namespace { -char const DATA_DIRECTORY[] = "/sc/qa/unit/tiledrendering/data/"; +OUStringLiteral const DATA_DIRECTORY = u"/sc/qa/unit/tiledrendering/data/"; class ScTiledRenderingTest : public test::BootstrapFixture, public unotest::MacrosTest, public XmlTestTools { diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index 2376779b32f7..69170a814a0e 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -59,7 +59,7 @@ void ScUiCalcTest::checkCurrentCell(SCCOL nCol, SCROW nRow) CPPUNIT_ASSERT_EQUAL(sal_Int32(nRow), ScDocShell::GetViewData()->GetCurY()); } -char const DATA_DIRECTORY[] = "/sc/qa/unit/uicalc/data/"; +OUStringLiteral const DATA_DIRECTORY = u"/sc/qa/unit/uicalc/data/"; ScModelObj* ScUiCalcTest::createDoc(const char* pName) { diff --git a/sc/source/core/tool/autoform.cxx b/sc/source/core/tool/autoform.cxx index 22d32a82597a..f8bb63325318 100644 --- a/sc/source/core/tool/autoform.cxx +++ b/sc/source/core/tool/autoform.cxx @@ -64,7 +64,7 @@ * be synchronized with Writer's SwTableAutoFmtTbl sw/source/core/doc/tblafmt.cxx */ -const char sAutoTblFmtName[] = "autotbl.fmt"; +const OUStringLiteral sAutoTblFmtName = u"autotbl.fmt"; // till SO5PF const sal_uInt16 AUTOFORMAT_ID_X = 9501; diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 5a9915580725..7cb7cbf30b63 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -140,10 +140,10 @@ using ::std::vector; // Filter names (like in sclib.cxx) -const char pFilterSc50[] = "StarCalc 5.0"; +const OUStringLiteral pFilterSc50 = u"StarCalc 5.0"; const char pFilterXML[] = "StarOffice XML (Calc)"; -const char pFilterAscii[] = SC_TEXT_CSV_FILTER_NAME; -const char pFilterLotus[] = "Lotus"; +const OUStringLiteral pFilterAscii = u"" SC_TEXT_CSV_FILTER_NAME; +const OUStringLiteral pFilterLotus = u"Lotus"; const char pFilterQPro6[] = "Quattro Pro 6.0"; const char pFilterExcel4[] = "MS Excel 4.0"; const char pFilterEx4Temp[] = "MS Excel 4.0 Vorlage/Template"; @@ -153,11 +153,11 @@ const char pFilterExcel95[] = "MS Excel 95"; const char pFilterEx95Temp[] = "MS Excel 95 Vorlage/Template"; const char pFilterExcel97[] = "MS Excel 97"; const char pFilterEx97Temp[] = "MS Excel 97 Vorlage/Template"; -const char pFilterDBase[] = "dBase"; -const char pFilterDif[] = "DIF"; +const OUStringLiteral pFilterDBase = u"dBase"; +const OUStringLiteral pFilterDif = u"DIF"; const char pFilterSylk[] = "SYLK"; -const char pFilterHtml[] = "HTML (StarCalc)"; -const char pFilterHtmlWebQ[] = "calc_HTML_WebQuery"; +const OUStringLiteral pFilterHtml = u"HTML (StarCalc)"; +const OUStringLiteral pFilterHtmlWebQ = u"calc_HTML_WebQuery"; const char pFilterRtf[] = "Rich Text Format (StarCalc)"; #define ShellClass_ScDocShell diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index 0dfd3e67840a..54fc6ea0765e 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -1119,7 +1119,7 @@ static bool lcl_PutString( sal_Int16 nMonth = static_cast<sal_Int16>(aMStr.toInt32()); if (!nMonth) { - static const char aSepShortened[] = "SEP"; + static const OUStringLiteral aSepShortened = u"SEP"; uno::Sequence< i18n::CalendarItem2 > xMonths; sal_Int32 i, nMonthCount; // first test all month names from local international diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx index 43bc3b857346..5de763f8b4f4 100644 --- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx +++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx @@ -36,8 +36,8 @@ using namespace css; using namespace css::uno; -const char SETBORDERSTYLE[] = "SetBorderStyle"; -const char LINESTYLE[] = "LineStyle"; +const OStringLiteral SETBORDERSTYLE = "SetBorderStyle"; +const OStringLiteral LINESTYLE = "LineStyle"; // namespace open diff --git a/sc/source/ui/vba/vbaborders.cxx b/sc/source/ui/vba/vbaborders.cxx index 97034dec7a0b..be098444b670 100644 --- a/sc/source/ui/vba/vbaborders.cxx +++ b/sc/source/ui/vba/vbaborders.cxx @@ -42,7 +42,7 @@ typedef InheritedHelperInterfaceWeakImpl<excel::XBorder > ScVbaBorder_Base; // borders, the enumeration will match the order in this list const sal_Int16 supportedIndexTable[] = { XlBordersIndex::xlEdgeLeft, XlBordersIndex::xlEdgeTop, XlBordersIndex::xlEdgeBottom, XlBordersIndex::xlEdgeRight, XlBordersIndex::xlDiagonalDown, XlBordersIndex::xlDiagonalUp, XlBordersIndex::xlInsideVertical, XlBordersIndex::xlInsideHorizontal }; -const char sTableBorder[] = "TableBorder"; +const OUStringLiteral sTableBorder = u"TableBorder"; // Equiv widths in 1/100 mm const sal_Int32 OOLineThin = 35; diff --git a/sc/source/ui/vba/vbainterior.cxx b/sc/source/ui/vba/vbainterior.cxx index c4897d92328c..6a38df7d8ba4 100644 --- a/sc/source/ui/vba/vbainterior.cxx +++ b/sc/source/ui/vba/vbainterior.cxx @@ -34,9 +34,9 @@ using namespace ::com::sun::star; using namespace ::ooo::vba; using namespace ::ooo::vba::excel::XlPattern; -const char BACKCOLOR[] = "CellBackColor"; -const char PATTERN[] = "Pattern"; -const char PATTERNCOLOR[] = "PatternColor"; +const OUStringLiteral BACKCOLOR = u"CellBackColor"; +const OUStringLiteral PATTERN = u"Pattern"; +const OUStringLiteral PATTERNCOLOR = u"PatternColor"; static std::map< sal_Int32, sal_Int32 > aPatternMap { { xlPatternAutomatic, 0 }, diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index 323a4f394540..b67751245cc6 100644 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -670,7 +670,7 @@ public: } -const char ISVISIBLE[] = "IsVisible"; +const OUStringLiteral ISVISIBLE = u"IsVisible"; const char EQUALS[] = "="; const char NOTEQUALS[] = "<>"; const char GREATERTHAN[] = ">"; @@ -678,7 +678,7 @@ const char GREATERTHANEQUALS[] = ">="; const char LESSTHAN[] = "<"; const char LESSTHANEQUALS[] = "<="; constexpr OUStringLiteral STR_ERRORMESSAGE_APPLIESTOSINGLERANGEONLY(u"The command you chose cannot be performed with multiple selections.\nSelect a single range and click the command again"); -const char CELLSTYLE[] = "CellStyle"; +const OUStringLiteral CELLSTYLE = u"CellStyle"; namespace { @@ -967,7 +967,7 @@ public: } -const char sNA[] = "#N/A"; +const OUStringLiteral sNA = u"#N/A"; namespace { diff --git a/sc/source/ui/vba/vbastyle.cxx b/sc/source/ui/vba/vbastyle.cxx index fa026a907f62..638ee7bdd734 100644 --- a/sc/source/ui/vba/vbastyle.cxx +++ b/sc/source/ui/vba/vbastyle.cxx @@ -25,7 +25,7 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; -const char DISPLAYNAME[] = "DisplayName"; +const OUStringLiteral DISPLAYNAME = u"DisplayName"; uno::Reference< container::XNameAccess > ScVbaStyle::getStylesNameContainer( const uno::Reference< frame::XModel >& xModel ) |