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 /unotools | |
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 'unotools')
-rw-r--r-- | unotools/qa/unit/testGetEnglishSearchName.cxx | 11 | ||||
-rw-r--r-- | unotools/source/config/historyoptions.cxx | 14 | ||||
-rw-r--r-- | unotools/source/config/lingucfg.cxx | 2 | ||||
-rw-r--r-- | unotools/source/config/saveopt.cxx | 2 |
4 files changed, 15 insertions, 14 deletions
diff --git a/unotools/qa/unit/testGetEnglishSearchName.cxx b/unotools/qa/unit/testGetEnglishSearchName.cxx index da59fc377f51..18bec28f7521 100644 --- a/unotools/qa/unit/testGetEnglishSearchName.cxx +++ b/unotools/qa/unit/testGetEnglishSearchName.cxx @@ -45,23 +45,24 @@ void Test::testSingleElement() //for Japanese fontname // IPAMincho - sal_Unicode const aIPAMincho[]=u"ipa\u660e\u671d"; + static OUStringLiteral const aIPAMincho=u"ipa\u660e\u671d"; OUString test_ja_JP1 = GetEnglishSearchFontName(aIPAMincho); CPPUNIT_ASSERT_EQUAL( OUString("ipamincho"),test_ja_JP1); // IPAGothic - sal_Unicode const aIPAGothic[]=u"ipa\u30b4\u30b7\u30c3\u30af"; + static OUStringLiteral const aIPAGothic=u"ipa\u30b4\u30b7\u30c3\u30af"; OUString test_ja_JP2 = GetEnglishSearchFontName(aIPAGothic); CPPUNIT_ASSERT_EQUAL( OUString("ipagothic"),test_ja_JP2); // HiraginoKakuGothic - sal_Unicode const aHiraginoKakuGothic[]=u"\u30D2\u30E9\u30AE\u30CE\u89D2\u30B4\u30B7\u30C3\u30AF"; + static OUStringLiteral const aHiraginoKakuGothic=u"\u30D2\u30E9\u30AE\u30CE\u89D2\u30B4\u30B7\u30C3\u30AF"; OUString test_ja_JP3 = GetEnglishSearchFontName(aHiraginoKakuGothic); CPPUNIT_ASSERT_EQUAL( OUString("hiraginosans"),test_ja_JP3); // HiraginoMincho Pro N - sal_Unicode const aHiraginoMinchoProN[]=u"\u30D2\u30E9\u30AE\u30CE\u660E\u671Dpron"; + static OUStringLiteral const aHiraginoMinchoProN=u"\u30D2\u30E9\u30AE\u30CE\u660E\u671Dpron"; OUString test_ja_JP4 = GetEnglishSearchFontName(aHiraginoMinchoProN); CPPUNIT_ASSERT_EQUAL( OUString("hiraginominchopron"),test_ja_JP4); // HiraginoMaruGothic Pro N - sal_Unicode const aHiraginoMaruGothicProN[]=u"\u30D2\u30E9\u30AE\u30CE\u4E38\u30B4pron"; + static OUStringLiteral const aHiraginoMaruGothicProN + =u"\u30D2\u30E9\u30AE\u30CE\u4E38\u30B4pron"; OUString test_ja_JP5 = GetEnglishSearchFontName(aHiraginoMaruGothicProN); CPPUNIT_ASSERT_EQUAL( OUString("hiraginomarugothicpron"),test_ja_JP5); } diff --git a/unotools/source/config/historyoptions.cxx b/unotools/source/config/historyoptions.cxx index 4e6aac18caf7..91c8861b2f52 100644 --- a/unotools/source/config/historyoptions.cxx +++ b/unotools/source/config/historyoptions.cxx @@ -50,13 +50,13 @@ namespace { const ::sal_Int32 s_nOffsetPassword = 3; const ::sal_Int32 s_nOffsetThumbnail = 4; - const char s_sItemList[] = "ItemList"; - const char s_sOrderList[] = "OrderList"; - const char s_sHistoryItemRef[] = "HistoryItemRef"; - const char s_sFilter[] = "Filter"; - const char s_sTitle[] = "Title"; - const char s_sPassword[] = "Password"; - const char s_sThumbnail[] = "Thumbnail"; + const OUStringLiteral s_sItemList = u"ItemList"; + const OUStringLiteral s_sOrderList = u"OrderList"; + const OUStringLiteral s_sHistoryItemRef = u"HistoryItemRef"; + const OUStringLiteral s_sFilter = u"Filter"; + const OUStringLiteral s_sTitle = u"Title"; + const OUStringLiteral s_sPassword = u"Password"; + const OUStringLiteral s_sThumbnail = u"Thumbnail"; class theHistoryOptionsMutex : public rtl::Static<osl::Mutex, theHistoryOptionsMutex>{}; } diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx index be0e52e769e0..c0a8438792fd 100644 --- a/unotools/source/config/lingucfg.cxx +++ b/unotools/source/config/lingucfg.cxx @@ -803,7 +803,7 @@ bool SvtLinguConfigItem::IsReadOnly( sal_Int32 nPropertyHandle ) const static SvtLinguConfigItem *pCfgItem = nullptr; static sal_Int32 nCfgItemRefCount = 0; -const char aG_Dictionaries[] = "Dictionaries"; +const OUStringLiteral aG_Dictionaries = u"Dictionaries"; SvtLinguConfig::SvtLinguConfig() { diff --git a/unotools/source/config/saveopt.cxx b/unotools/source/config/saveopt.cxx index d8f4d37dd790..e8bb2aade654 100644 --- a/unotools/source/config/saveopt.cxx +++ b/unotools/source/config/saveopt.cxx @@ -714,7 +714,7 @@ public: } -const char cUserDefinedSettings[] = "UserDefinedSettings"; +const OUStringLiteral cUserDefinedSettings = u"UserDefinedSettings"; SvtLoadOptions_Impl::SvtLoadOptions_Impl() : ConfigItem( "Office.Common/Load" ) |