diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-06-07 18:12:15 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-06-07 20:00:02 +0200 |
commit | 7a3736f908c0ae207567603c61ce0f617339bac0 (patch) | |
tree | 18b52e6a1ca9cacfa416f41dc94660c9becf3976 /extensions | |
parent | 2d15e6808a217aea9ac7c56e0c4c8ef2dc58ec94 (diff) |
New loplugin:elidestringvar
Quoting compilerplugins/clang/elidestringvar.cxx (and see there for a
rationale): "Find cases where a variable of a string type (at least for now,
only OUString) is initialized with a literal value (incl. as an empty string)
and used only once."
(This commit includes fixes that become necessary in code changed after the
preceding "Upcoming loplugin:elidestringvar" commits.)
As a follow-up TODO, uses of the
explicit OUString( sal_Unicode value )
ctor where value is char or char16_t literal should be detected too, so that
e.g. one_quote would have been treated like two_quote in
4b85108773f9851f358a4daa8869eeadc638d103 "Upcoming loplugin:elidestringvar: sc"
> --- a/sc/source/core/tool/compiler.cxx
> +++ b/sc/source/core/tool/compiler.cxx
> @@ -1902,9 +1902,8 @@ void ScCompiler::CheckTabQuotes( OUString& rString,
> if( bNeedsQuote )
> {
> const OUString one_quote('\'');
> - const OUString two_quote("''");
> // escape embedded quotes
> - rString = rString.replaceAll( one_quote, two_quote );
> + rString = rString.replaceAll( one_quote, "''" );
> }
> break;
> }
Change-Id: I7b74f1735a07540e3d789df1d14c84081c824b6c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95696
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/source/propctrlr/selectlabeldialog.cxx | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/extensions/source/propctrlr/selectlabeldialog.cxx b/extensions/source/propctrlr/selectlabeldialog.cxx index a1ddce7b10b4..bc1d16111c14 100644 --- a/extensions/source/propctrlr/selectlabeldialog.cxx +++ b/extensions/source/propctrlr/selectlabeldialog.cxx @@ -104,10 +104,9 @@ namespace pcr // insert the root OUString sRootName(PcrRes(RID_STR_FORMS)); - OUString aFormImage(RID_EXTBMP_FORMS); m_xControlTree->insert(nullptr, -1, &sRootName, nullptr, nullptr, nullptr, false, m_xScratchIter.get()); - m_xControlTree->set_image(*m_xScratchIter, aFormImage); + m_xControlTree->set_image(*m_xScratchIter, RID_EXTBMP_FORMS); // build the tree m_xInitialSelection.reset(); @@ -179,11 +178,9 @@ namespace pcr Reference< XIndexAccess > xCont(xAsSet, UNO_QUERY); if (xCont.is() && xCont->getCount()) { // yes -> step down - OUString aFormImage(RID_EXTBMP_FORM); - m_xControlTree->insert(&rContainerEntry, -1, &sName, nullptr, nullptr, nullptr, false, m_xScratchIter.get()); - m_xControlTree->set_image(*m_xScratchIter, aFormImage); + m_xControlTree->set_image(*m_xScratchIter, RID_EXTBMP_FORM); auto xIter = m_xControlTree->make_iterator(&rContainerEntry); m_xControlTree->iter_nth_child(*xIter, nChildren); sal_Int32 nContChildren = InsertEntries(xCont, *xIter); |