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 /cui/source | |
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 'cui/source')
-rw-r--r-- | cui/source/options/dbregister.cxx | 5 | ||||
-rw-r--r-- | cui/source/tabpages/chardlg.cxx | 9 |
2 files changed, 8 insertions, 6 deletions
diff --git a/cui/source/options/dbregister.cxx b/cui/source/options/dbregister.cxx index 8438fb3dcf2d..73f54d317e6f 100644 --- a/cui/source/options/dbregister.cxx +++ b/cui/source/options/dbregister.cxx @@ -36,6 +36,7 @@ #include <dialmgr.hxx> #include "dbregisterednamesconfig.hxx" #include <svx/databaseregistrationui.hxx> +#include <o3tl/string_view.hxx> #define COL_TYPE 0 @@ -179,11 +180,11 @@ void DbRegistrationOptionsPage::Reset( const SfxItemSet* rSet ) // restore column width std::vector<int> aWidths { - aUserData.getToken(0, ';', nIdx).toInt32() + o3tl::toInt32(o3tl::getToken(aUserData, 0, ';', nIdx)) }; m_xPathBox->set_column_fixed_widths(aWidths); // restore sort direction - bool bUp = aUserData.getToken(0, ';', nIdx).toInt32() != 0; + bool bUp = o3tl::toInt32(o3tl::getToken(aUserData, 0, ';', nIdx)) != 0; m_xPathBox->set_sort_order(bUp); m_xPathBox->set_sort_indicator(bUp ? TRISTATE_TRUE : TRISTATE_FALSE, COL_TYPE); } diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx index 5d71363f0299..4426d9ad8a4e 100644 --- a/cui/source/tabpages/chardlg.cxx +++ b/cui/source/tabpages/chardlg.cxx @@ -62,6 +62,7 @@ #include <sal/log.hxx> #include <osl/diagnose.h> #include <o3tl/unit_conversion.hxx> +#include <o3tl/string_view.hxx> using namespace ::com::sun::star; @@ -2651,10 +2652,10 @@ void SvxCharPositionPage::Reset( const SfxItemSet* rSet ) if ( !sUser.isEmpty() ) { sal_Int32 nIdx {0}; - m_nSuperEsc = static_cast<short>(sUser.getToken( 0, ';', nIdx ).toInt32()); - m_nSubEsc = static_cast<short>(sUser.getToken( 0, ';', nIdx ).toInt32()); - m_nSuperProp = static_cast<sal_uInt8>(sUser.getToken( 0, ';', nIdx ).toInt32()); - m_nSubProp = static_cast<sal_uInt8>(sUser.getToken( 0, ';', nIdx ).toInt32()); + m_nSuperEsc = static_cast<short>(o3tl::toInt32(o3tl::getToken(sUser, 0, ';', nIdx ))); + m_nSubEsc = static_cast<short>(o3tl::toInt32(o3tl::getToken(sUser, 0, ';', nIdx ))); + m_nSuperProp = static_cast<sal_uInt8>(o3tl::toInt32(o3tl::getToken(sUser, 0, ';', nIdx ))); + m_nSubProp = static_cast<sal_uInt8>(o3tl::toInt32(o3tl::getToken(sUser, 0, ';', nIdx ))); m_xHighLowMF->set_max(MAX_ESC_POS, FieldUnit::PERCENT); |