diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-03 14:09:20 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-03 15:32:53 +0200 |
commit | c5a0b7af847a71fd50f713934b29305f8ce96c6b (patch) | |
tree | d7c0193bc183250c36e467f830a4327ab94dc24e /sfx2 | |
parent | d19dbcc139d18771e5e20e82a694f1512476e41c (diff) |
loplugin:stringadd improvement for appending numbers
I was wrong, the Concat framework already optimised appending
numbers by stack-allocating small buffers, so include
them in the plugin
Change-Id: I922edbdde273c89abfe21d51c5d25dc01c97db25
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115037
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/appl/newhelp.cxx | 8 | ||||
-rw-r--r-- | sfx2/source/control/unoctitm.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/view/lokhelper.cxx | 6 |
3 files changed, 10 insertions, 10 deletions
diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index 102738a8705e..78be4e455894 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -937,10 +937,10 @@ SearchTabPage_Impl::SearchTabPage_Impl(weld::Widget* pParent, SfxHelpIndexWindow SearchTabPage_Impl::~SearchTabPage_Impl() { SvtViewOptions aViewOpt( EViewType::TabPage, CONFIGNAME_SEARCHPAGE ); - OUStringBuffer aUserData; - aUserData.append(static_cast<sal_Int32>(m_xFullWordsCB->get_active() ? 1 : 0)) - .append(";") - .append( static_cast<sal_Int32>(m_xScopeCB->get_active() ? 1 : 0) ); + OUStringBuffer aUserData = + OUString::number(m_xFullWordsCB->get_active() ? 1 : 0) + + ";" + + OUString::number(m_xScopeCB->get_active() ? 1 : 0); sal_Int32 nCount = std::min(m_xSearchED->get_count(), 10); // save only 10 entries for ( sal_Int32 i = 0; i < nCount; ++i ) diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index 830df11c319b..a7e4346c0d48 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -538,7 +538,7 @@ void UsageInfo::save() OStringBuffer aUsageInfoMsg("Document Type;Command;Count"); for (auto const& elem : maUsage) - aUsageInfoMsg.append("\n" + elem.first.toUtf8() + ";").append(static_cast<sal_Int32>(elem.second)); + aUsageInfoMsg.append("\n" + elem.first.toUtf8() + ";" + OString::number(elem.second)); sal_uInt64 written = 0; auto s = aUsageInfoMsg.makeStringAndClear(); @@ -1267,7 +1267,7 @@ static void InterceptLOKStateChangeEvent(sal_uInt16 nSID, SfxViewFrame* pViewFra if (aEvent.IsEnabled && (aEvent.State >>= aPoint)) { - aBuffer.append(aPoint.X).append(" / ").append(aPoint.Y); + aBuffer.append( OUString::number(aPoint.X) + " / " + OUString::number(aPoint.Y)); } } else if (aEvent.FeatureURL.Path == "Size") @@ -1276,7 +1276,7 @@ static void InterceptLOKStateChangeEvent(sal_uInt16 nSID, SfxViewFrame* pViewFra if (aEvent.IsEnabled && (aEvent.State >>= aSize)) { - aBuffer.append(aSize.Width).append(" x ").append(aSize.Height); + aBuffer.append( OUString::number(aSize.Width) + " x " + OUString::number(aSize.Height) ); } } else if (aEvent.FeatureURL.Path == "LanguageStatus" || diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index d334177d71e6..0487ff96922e 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -475,9 +475,9 @@ void SfxLokHelper::notifyWindow(const SfxViewShell* pThisView, if (nLOKWindowId == 0 || DisableCallbacks::disabled()) return; - OStringBuffer aPayload; - aPayload.append("{ \"id\": \"").append(static_cast<sal_Int64>(nLOKWindowId)).append('"'); - aPayload.append(", \"action\": \"" + OUStringToOString(rAction, RTL_TEXTENCODING_UTF8) + "\""); + OStringBuffer aPayload = + "{ \"id\": \"" + OString::number(nLOKWindowId) + "\"" + ", \"action\": \"" + OUStringToOString(rAction, RTL_TEXTENCODING_UTF8) + "\""; for (const auto& rItem: rPayload) { |