diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-10 20:17:54 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-11 14:45:38 +0200 |
commit | 85c2ed8dc790689ce69ff0a08ff5a4de98df54b7 (patch) | |
tree | f7d7f6fce51d1a4443608971da7d9c42b1201fa3 /dbaccess | |
parent | 117688bd3f51a7a50b2620aa7dcc0c065f29d402 (diff) |
loplugin:stringview add check for getToken().toInt32
where we can convert that to
o3tl::toInt32(o3tl::getToken(
and avoid the heap allocation of a temporary string
Change-Id: Ib11c19c6e6cdc0de3e551affd3578d181e292de4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132810
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/core/misc/dsntypes.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/TextConnectionHelper.cxx | 7 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/TextConnectionHelper.hxx | 2 |
3 files changed, 6 insertions, 5 deletions
diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx index 2758b0a6ed6a..b05cd467da81 100644 --- a/dbaccess/source/core/misc/dsntypes.cxx +++ b/dbaccess/source/core/misc/dsntypes.cxx @@ -42,7 +42,7 @@ namespace dbaccess { sal_Int32 nPos {0}; _sHostname = _sUrl.getToken(0, ':', nPos); - _nPortNumber = _sUrl.getToken(0, ':', nPos).toInt32(); + _nPortNumber = o3tl::toInt32(o3tl::getToken(_sUrl, 0, ':', nPos)); } } } diff --git a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx index 432f8b6cc150..1dee8a1f57e2 100644 --- a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx +++ b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx @@ -28,6 +28,7 @@ #include <vcl/svapp.hxx> #include <vcl/weld.hxx> #include <vcl/mnemonic.hxx> +#include <o3tl/string_view.hxx> namespace { @@ -350,7 +351,7 @@ namespace dbaui return sExtension; } - OUString OTextConnectionHelper::GetSeparator(const weld::ComboBox& rBox, const OUString& rList) + OUString OTextConnectionHelper::GetSeparator(const weld::ComboBox& rBox, std::u16string_view rList) { sal_Unicode const nTok = '\t'; int nPos(rBox.find_text(rBox.get_active_text())); @@ -360,7 +361,7 @@ namespace dbaui if ( m_xTextSeparator.get() != &rBox || nPos != (rBox.get_count()-1) ) return OUString( - static_cast< sal_Unicode >( rList.getToken((nPos*2)+1, nTok ).toInt32() )); + static_cast< sal_Unicode >( o3tl::toInt32(o3tl::getToken(rList, (nPos*2)+1, nTok )) )); // somewhat strange ... translates for instance an "32" into " " return OUString(); } @@ -373,7 +374,7 @@ namespace dbaui for(sal_Int32 nIdx {0}; nIdx>=0;) { sal_Int32 nPrevIdx {nIdx}; - if (static_cast<sal_Unicode>(rList.getToken(1, '\t', nIdx).toInt32()) == nVal) + if (static_cast<sal_Unicode>(o3tl::toInt32(o3tl::getToken(rList, 1, '\t', nIdx))) == nVal) { rBox.set_entry_text(rList.getToken(0, '\t', nPrevIdx)); return; diff --git a/dbaccess/source/ui/dlg/TextConnectionHelper.hxx b/dbaccess/source/ui/dlg/TextConnectionHelper.hxx index 41921f092f82..5fface3d0512 100644 --- a/dbaccess/source/ui/dlg/TextConnectionHelper.hxx +++ b/dbaccess/source/ui/dlg/TextConnectionHelper.hxx @@ -71,7 +71,7 @@ namespace dbaui DECL_LINK(OnSetExtensionHdl, weld::Toggleable&, void); DECL_LINK(OnEditModified, weld::Entry&, void); - OUString GetSeparator(const weld::ComboBox& rBox, const OUString& rList); + OUString GetSeparator(const weld::ComboBox& rBox, std::u16string_view rList); void SetSeparator(weld::ComboBox& rBox, const OUString& rList, const OUString& rVal); void SetExtension(const OUString& _rVal); |