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 /xmloff/source/chart | |
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 'xmloff/source/chart')
-rw-r--r-- | xmloff/source/chart/SchXMLExport.cxx | 3 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLTableContext.cxx | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index 8bc776e5e421..992989665952 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -45,6 +45,7 @@ #include <xmloff/SchXMLSeriesHelper.hxx> #include <rtl/math.hxx> #include <o3tl/sorted_vector.hxx> +#include <o3tl/string_view.hxx> #include <limits> #include <vector> @@ -772,7 +773,7 @@ struct lcl_SequenceToMapElement nIndex = aRangeRep.toInt32(); } else if( rContent.first.is()) //has labels - nIndex = rContent.first->getSourceRangeRepresentation().copy( sizeof("label ")).toInt32(); + nIndex = o3tl::toInt32(rContent.first->getSourceRangeRepresentation().subView( sizeof("label "))); return std::make_pair(nIndex, rContent); } }; diff --git a/xmloff/source/chart/SchXMLTableContext.cxx b/xmloff/source/chart/SchXMLTableContext.cxx index a59a28b2546b..9ee4016087fe 100644 --- a/xmloff/source/chart/SchXMLTableContext.cxx +++ b/xmloff/source/chart/SchXMLTableContext.cxx @@ -27,6 +27,7 @@ #include "transporttypes.hxx" #include <XMLStringBufferImportContext.hxx> #include <o3tl/safeint.hxx> +#include <o3tl/string_view.hxx> #include <sal/log.hxx> #include <xmloff/xmlnamespace.hxx> #include <xmloff/xmltoken.hxx> @@ -946,7 +947,7 @@ void SchXMLTableHelper::switchRangesFromOuterToInternalIfNecessary( if( xLabel.is() ) { aRange = xLabel->getSourceRangeRepresentation(); - const sal_Int32 nId {aRange.getToken(1, ' ').toInt32()}; + const sal_Int32 nId = o3tl::toInt32(o3tl::getToken(aRange, 1, ' ')); if( ::std::find( rTable.aHiddenColumns.begin(), rTable.aHiddenColumns.end(), nId ) == rTable.aHiddenColumns.end() ) bHasUnhiddenColumns = true; } |