summaryrefslogtreecommitdiff
path: root/desktop/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-04-10 20:17:54 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-04-11 14:45:38 +0200
commit85c2ed8dc790689ce69ff0a08ff5a4de98df54b7 (patch)
treef7d7f6fce51d1a4443608971da7d9c42b1201fa3 /desktop/source
parent117688bd3f51a7a50b2620aa7dcc0c065f29d402 (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 'desktop/source')
-rw-r--r--desktop/source/splash/splash.cxx27
1 files changed, 14 insertions, 13 deletions
diff --git a/desktop/source/splash/splash.cxx b/desktop/source/splash/splash.cxx
index 6402d9f7e99b..7875d29829f8 100644
--- a/desktop/source/splash/splash.cxx
+++ b/desktop/source/splash/splash.cxx
@@ -33,6 +33,7 @@
#include <rtl/math.hxx>
#include <vcl/introwin.hxx>
#include <vcl/virdev.hxx>
+#include <o3tl/string_view.hxx>
#include <mutex>
@@ -368,16 +369,16 @@ void SplashScreen::loadConfig()
{
sal_uInt8 nRed = 0;
sal_Int32 idx = 0;
- sal_Int32 temp = sProgressFrameColor.getToken( 0, ',', idx ).toInt32();
+ sal_Int32 temp = o3tl::toInt32(o3tl::getToken(sProgressFrameColor, 0, ',', idx ));
if ( idx != -1 )
{
nRed = static_cast< sal_uInt8 >( temp );
- temp = sProgressFrameColor.getToken( 0, ',', idx ).toInt32();
+ temp = o3tl::toInt32(o3tl::getToken(sProgressFrameColor, 0, ',', idx ));
}
if ( idx != -1 )
{
sal_uInt8 nGreen = static_cast< sal_uInt8 >( temp );
- sal_uInt8 nBlue = static_cast< sal_uInt8 >( sProgressFrameColor.getToken( 0, ',', idx ).toInt32() );
+ sal_uInt8 nBlue = static_cast< sal_uInt8 >( o3tl::toInt32(o3tl::getToken(sProgressFrameColor, 0, ',', idx )) );
_cProgressFrameColor = Color( nRed, nGreen, nBlue );
}
}
@@ -386,16 +387,16 @@ void SplashScreen::loadConfig()
{
sal_uInt8 nRed = 0;
sal_Int32 idx = 0;
- sal_Int32 temp = sProgressBarColor.getToken( 0, ',', idx ).toInt32();
+ sal_Int32 temp = o3tl::toInt32(o3tl::getToken(sProgressBarColor, 0, ',', idx ));
if ( idx != -1 )
{
nRed = static_cast< sal_uInt8 >( temp );
- temp = sProgressBarColor.getToken( 0, ',', idx ).toInt32();
+ temp = o3tl::toInt32(o3tl::getToken(sProgressBarColor, 0, ',', idx ));
}
if ( idx != -1 )
{
sal_uInt8 nGreen = static_cast< sal_uInt8 >( temp );
- sal_uInt8 nBlue = static_cast< sal_uInt8 >( sProgressBarColor.getToken( 0, ',', idx ).toInt32() );
+ sal_uInt8 nBlue = static_cast< sal_uInt8 >( o3tl::toInt32(o3tl::getToken(sProgressBarColor, 0, ',', idx )) );
_cProgressBarColor = Color( nRed, nGreen, nBlue );
}
}
@@ -404,16 +405,16 @@ void SplashScreen::loadConfig()
{
sal_uInt8 nRed = 0;
sal_Int32 idx = 0;
- sal_Int32 temp = sProgressTextColor.getToken( 0, ',', idx ).toInt32();
+ sal_Int32 temp = o3tl::toInt32(o3tl::getToken(sProgressTextColor, 0, ',', idx ));
if ( idx != -1 )
{
nRed = static_cast< sal_uInt8 >( temp );
- temp = sProgressTextColor.getToken( 0, ',', idx ).toInt32();
+ temp = o3tl::toInt32(o3tl::getToken(sProgressTextColor, 0, ',', idx ));
}
if ( idx != -1 )
{
sal_uInt8 nGreen = static_cast< sal_uInt8 >( temp );
- sal_uInt8 nBlue = static_cast< sal_uInt8 >( sProgressTextColor.getToken( 0, ',', idx ).toInt32() );
+ sal_uInt8 nBlue = static_cast< sal_uInt8 >( o3tl::toInt32(o3tl::getToken(sProgressTextColor, 0, ',', idx )) );
_cProgressTextColor = Color( nRed, nGreen, nBlue );
}
}
@@ -431,11 +432,11 @@ void SplashScreen::loadConfig()
if ( !sSize.isEmpty() )
{
sal_Int32 idx = 0;
- sal_Int32 temp = sSize.getToken( 0, ',', idx ).toInt32();
+ sal_Int32 temp = o3tl::toInt32(o3tl::getToken(sSize, 0, ',', idx ));
if ( idx != -1 )
{
_barwidth = temp;
- _barheight = sSize.getToken( 0, ',', idx ).toInt32();
+ _barheight = o3tl::toInt32(o3tl::getToken(sSize, 0, ',', idx ));
}
}
@@ -445,11 +446,11 @@ void SplashScreen::loadConfig()
if ( !sPosition.isEmpty() )
{
sal_Int32 idx = 0;
- sal_Int32 temp = sPosition.getToken( 0, ',', idx ).toInt32();
+ sal_Int32 temp = o3tl::toInt32(o3tl::getToken(sPosition, 0, ',', idx ));
if ( idx != -1 )
{
_tlx = temp;
- _tly = sPosition.getToken( 0, ',', idx ).toInt32();
+ _tly = o3tl::toInt32(o3tl::getToken(sPosition, 0, ',', idx ));
}
}
}