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 /svtools | |
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 'svtools')
-rw-r--r-- | svtools/source/misc/imagemgr.cxx | 3 | ||||
-rw-r--r-- | svtools/source/svhtml/parhtml.cxx | 4 |
2 files changed, 4 insertions, 3 deletions
diff --git a/svtools/source/misc/imagemgr.cxx b/svtools/source/misc/imagemgr.cxx index 7ac01619162e..e4e933128485 100644 --- a/svtools/source/misc/imagemgr.cxx +++ b/svtools/source/misc/imagemgr.cxx @@ -36,6 +36,7 @@ #include <ucbhelper/content.hxx> #include <svtools/strings.hrc> #include <svtools/svtresid.hxx> +#include <o3tl/string_view.hxx> #include <bitmaps.hlst> #include <strings.hxx> @@ -388,7 +389,7 @@ static SvImageId GetImageId_Impl( return nImage; } else if ( aType == "image" ) - nImage = static_cast<SvImageId>(aURLPath.getToken( 1, '/' ).toInt32()); + nImage = static_cast<SvImageId>(o3tl::toInt32(o3tl::getToken(aURLPath, 1, '/' ))); } else { diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx index 7e589642d0f2..0c6e38ee9295 100644 --- a/svtools/source/svhtml/parhtml.cxx +++ b/svtools/source/svhtml/parhtml.cxx @@ -2021,8 +2021,8 @@ bool HTMLParser::ParseMetaOptionsImpl( if (comphelper::string::getTokenCount(aContent, ';') == 2) { sal_Int32 nIdx{ 0 }; - Date aDate(aContent.getToken(0, ';', nIdx).toInt32()); - auto nTime = aContent.getToken(0, ';', nIdx).toInt64(); + Date aDate(o3tl::toInt32(o3tl::getToken(aContent, 0, ';', nIdx))); + auto nTime = o3tl::toInt64(o3tl::getToken(aContent, 0, ';', nIdx)); if (nTime < 0) nTime = o3tl::saturating_toggle_sign(nTime); tools::Time aTime(nTime); |