diff options
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx | 3 | ||||
-rw-r--r-- | chart2/source/model/main/BaseCoordinateSystem.cxx | 2 | ||||
-rw-r--r-- | chart2/source/tools/AxisHelper.cxx | 5 | ||||
-rw-r--r-- | chart2/source/tools/CommonConverters.cxx | 3 | ||||
-rw-r--r-- | chart2/source/tools/DiagramHelper.cxx | 7 | ||||
-rw-r--r-- | chart2/source/tools/InternalData.cxx | 5 | ||||
-rw-r--r-- | chart2/source/tools/ObjectIdentifier.cxx | 7 | ||||
-rw-r--r-- | chart2/source/tools/RegressionCurveHelper.cxx | 3 | ||||
-rw-r--r-- | chart2/source/view/axes/VCartesianAxis.cxx | 3 | ||||
-rw-r--r-- | chart2/source/view/charttypes/AreaChart.cxx | 3 | ||||
-rw-r--r-- | chart2/source/view/charttypes/NetChart.cxx | 3 | ||||
-rw-r--r-- | chart2/source/view/charttypes/VSeriesPlotter.cxx | 5 |
12 files changed, 30 insertions, 19 deletions
diff --git a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx index 51c917751fbd..40e4df69c603 100644 --- a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx @@ -39,6 +39,7 @@ #include "WrappedTextRotationProperty.hxx" #include <unonames.hxx> +#include <o3tl/safeint.hxx> #include <rtl/math.hxx> #include <algorithm> @@ -560,7 +561,7 @@ rtl::Reference< DataSeries > DataSeriesPointWrapper::getDataSeries() std::vector< rtl::Reference< DataSeries > > aSeriesList = ::chart::DiagramHelper::getDataSeriesFromDiagram( xDiagram ); - if( m_nSeriesIndexInNewAPI >= 0 && m_nSeriesIndexInNewAPI < static_cast<sal_Int32>(aSeriesList.size()) ) + if( m_nSeriesIndexInNewAPI >= 0 && o3tl::make_unsigned(m_nSeriesIndexInNewAPI) < aSeriesList.size() ) xSeries = aSeriesList[m_nSeriesIndexInNewAPI]; } diff --git a/chart2/source/model/main/BaseCoordinateSystem.cxx b/chart2/source/model/main/BaseCoordinateSystem.cxx index 95faaed01bfd..41c7c766840c 100644 --- a/chart2/source/model/main/BaseCoordinateSystem.cxx +++ b/chart2/source/model/main/BaseCoordinateSystem.cxx @@ -264,7 +264,7 @@ const rtl::Reference< Axis > & BaseCoordinateSystem::getAxisByDimension2( OSL_ASSERT( m_aAllAxis.size() == static_cast< size_t >( m_nDimensionCount)); - if( nAxisIndex < 0 || nAxisIndex > static_cast<sal_Int32>(m_aAllAxis[ nDimensionIndex ].size()) ) + if( nAxisIndex < 0 || o3tl::make_unsigned(nAxisIndex) > m_aAllAxis[ nDimensionIndex ].size() ) throw lang::IndexOutOfBoundsException(); return m_aAllAxis[ nDimensionIndex ][nAxisIndex]; diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx index 95b50a9640f3..e34870052cec 100644 --- a/chart2/source/tools/AxisHelper.cxx +++ b/chart2/source/tools/AxisHelper.cxx @@ -38,6 +38,7 @@ #include <unonames.hxx> #include <BaseCoordinateSystem.hxx> +#include <o3tl/safeint.hxx> #include <unotools/saveopt.hxx> #include <com/sun/star/chart/ChartAxisPosition.hpp> @@ -561,7 +562,7 @@ rtl::Reference< ::chart::BaseCoordinateSystem > AxisHelper::getCoordinateSystemB if(!xDiagram.is()) return nullptr; auto & rCooSysList = xDiagram->getBaseCoordinateSystems(); - if(0<=nIndex && nIndex < static_cast<sal_Int32>(rCooSysList.size())) + if(0<=nIndex && o3tl::make_unsigned(nIndex) < rCooSysList.size()) return rCooSysList[nIndex]; return nullptr; } @@ -1048,7 +1049,7 @@ rtl::Reference< ChartType > AxisHelper::getChartTypeByIndex( const rtl::Referenc if( xCooSys.is() ) { const std::vector< rtl::Reference< ChartType > > aChartTypeList( xCooSys->getChartTypes2() ); - if( nIndex >= 0 && nIndex < static_cast<sal_Int32>(aChartTypeList.size()) ) + if( nIndex >= 0 && o3tl::make_unsigned(nIndex) < aChartTypeList.size() ) xChartType = aChartTypeList[nIndex]; } diff --git a/chart2/source/tools/CommonConverters.cxx b/chart2/source/tools/CommonConverters.cxx index d61a635d425d..b68cd17e20c3 100644 --- a/chart2/source/tools/CommonConverters.cxx +++ b/chart2/source/tools/CommonConverters.cxx @@ -24,6 +24,7 @@ #include <com/sun/star/chart2/data/XDataSequence.hpp> #include <com/sun/star/chart2/data/XNumericalDataSequence.hpp> #include <com/sun/star/chart2/data/XTextualDataSequence.hpp> +#include <o3tl/safeint.hxx> #include <osl/diagnose.h> #include <basegfx/matrix/b3dhommatrix.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> @@ -227,7 +228,7 @@ drawing::Position3D getPointFromPoly( const std::vector<std::vector<css::drawing { drawing::Position3D aRet(0.0,0.0,0.0); - if( nPolyIndex>=0 && nPolyIndex<static_cast<sal_Int32>(rPolygon.size())) + if( nPolyIndex>=0 && o3tl::make_unsigned(nPolyIndex)<rPolygon.size()) { if(nPointIndex<static_cast<sal_Int32>(rPolygon[nPolyIndex].size())) { diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx index 4526550a9e99..258dff61d8db 100644 --- a/chart2/source/tools/DiagramHelper.cxx +++ b/chart2/source/tools/DiagramHelper.cxx @@ -50,6 +50,7 @@ #include <com/sun/star/util/NumberFormat.hpp> #include <com/sun/star/util/XNumberFormatsSupplier.hpp> +#include <o3tl/safeint.hxx> #include <unotools/saveopt.hxx> #include <rtl/math.hxx> #include <svl/numformat.hxx> @@ -655,7 +656,7 @@ rtl::Reference< ChartType > for( rtl::Reference< BaseCoordinateSystem > const & coords : xDiagram->getBaseCoordinateSystems() ) { const std::vector< rtl::Reference< ChartType > > & aChartTypeList( coords->getChartTypes2() ); - if( nIndex >= 0 && nIndex < static_cast<sal_Int32>(nTypesSoFar + aChartTypeList.size()) ) + if( nIndex >= 0 && o3tl::make_unsigned(nIndex) < nTypesSoFar + aChartTypeList.size() ) { xChartType = aChartTypeList[nIndex - nTypesSoFar]; break; @@ -1211,7 +1212,7 @@ bool lcl_moveSeriesOrCheckIfMoveIsAllowed( else nNewSeriesIndex++; - if( nNewSeriesIndex >= 0 && nNewSeriesIndex < static_cast<sal_Int32>(aSeriesList.size()) ) + if( nNewSeriesIndex >= 0 && o3tl::make_unsigned(nNewSeriesIndex) < aSeriesList.size() ) { //move series in the same charttype bMovedOrMoveAllowed = true; @@ -1232,7 +1233,7 @@ bool lcl_moveSeriesOrCheckIfMoveIsAllowed( { std::vector< rtl::Reference< DataSeries > > aOtherSeriesList = xFormerChartType->getDataSeries2(); sal_Int32 nOtherSeriesIndex = aOtherSeriesList.size()-1; - if( nOtherSeriesIndex >= 0 && nOtherSeriesIndex < static_cast<sal_Int32>(aOtherSeriesList.size()) ) + if( nOtherSeriesIndex >= 0 && o3tl::make_unsigned(nOtherSeriesIndex) < aOtherSeriesList.size() ) { rtl::Reference< DataSeries > xExchangeSeries( aOtherSeriesList[nOtherSeriesIndex] ); aOtherSeriesList[nOtherSeriesIndex] = xGivenDataSeries; diff --git a/chart2/source/tools/InternalData.cxx b/chart2/source/tools/InternalData.cxx index dd48289e831c..b6fc1e09044f 100644 --- a/chart2/source/tools/InternalData.cxx +++ b/chart2/source/tools/InternalData.cxx @@ -22,6 +22,7 @@ #include <strings.hrc> #include <comphelper/sequence.hxx> +#include <o3tl/safeint.hxx> #include <osl/diagnose.h> #ifdef DEBUG_CHART2_TOOLS @@ -202,7 +203,7 @@ void InternalData::setComplexColumnLabel( sal_Int32 nColumnIndex, vector< uno::A { if( nColumnIndex < 0 ) return; - if( nColumnIndex >= static_cast< sal_Int32 >( m_aColumnLabels.size() ) ) + if( o3tl::make_unsigned(nColumnIndex) >= m_aColumnLabels.size() ) { m_aColumnLabels.resize(nColumnIndex+1); enlargeData( nColumnIndex+1, 0 ); @@ -216,7 +217,7 @@ void InternalData::setComplexRowLabel( sal_Int32 nRowIndex, vector< uno::Any >&& { if( nRowIndex < 0 ) return; - if( nRowIndex >= static_cast< sal_Int32 >( m_aRowLabels.size() ) ) + if( o3tl::make_unsigned(nRowIndex) >= m_aRowLabels.size() ) { m_aRowLabels.resize(nRowIndex+1); enlargeData( 0, nRowIndex+1 ); diff --git a/chart2/source/tools/ObjectIdentifier.cxx b/chart2/source/tools/ObjectIdentifier.cxx index a4bf8bf43650..a8622e3ff4c4 100644 --- a/chart2/source/tools/ObjectIdentifier.cxx +++ b/chart2/source/tools/ObjectIdentifier.cxx @@ -42,6 +42,7 @@ #include <rtl/ustrbuf.hxx> #include <tools/diagnose_ex.h> +#include <o3tl/safeint.hxx> #include <o3tl/string_view.hxx> namespace com::sun::star::drawing { class XShape; } @@ -222,7 +223,7 @@ void lcl_getDiagramAndCooSys( const OUString& rObjectCID if( nCooSysIndex > -1 ) { const std::vector< rtl::Reference< BaseCoordinateSystem > > aCooSysList( xDiagram->getBaseCoordinateSystems() ); - if( nCooSysIndex < static_cast<sal_Int32>(aCooSysList.size()) ) + if( o3tl::make_unsigned(nCooSysIndex) < aCooSysList.size() ) xCooSys = aCooSysList[nCooSysIndex]; } } @@ -1211,7 +1212,7 @@ Reference< beans::XPropertySet > ObjectIdentifier::getObjectPropertySet( sal_Int32 nIndex = o3tl::toInt32(aParticleID); const std::vector< rtl::Reference< RegressionCurveModel > > & aCurveList = xRegressionContainer->getRegressionCurves2(); - if( nIndex >= 0 && nIndex < static_cast<sal_Int32>(aCurveList.size()) ) + if( nIndex >= 0 && o3tl::make_unsigned(nIndex) < aCurveList.size() ) { if( eObjectType == OBJECTTYPE_DATA_CURVE_EQUATION ) xObjectProperties = aCurveList[nIndex]->getEquationProperties(); @@ -1281,7 +1282,7 @@ rtl::Reference< DataSeries > ObjectIdentifier::getDataSeriesForCID( if( xDataSeriesContainer.is() ) { const std::vector< rtl::Reference< DataSeries > > & aDataSeriesSeq( xDataSeriesContainer->getDataSeries2() ); - if( nSeriesIndex >= 0 && nSeriesIndex < static_cast<sal_Int32>(aDataSeriesSeq.size()) ) + if( nSeriesIndex >= 0 && o3tl::make_unsigned(nSeriesIndex) < aDataSeriesSeq.size() ) xSeries = aDataSeriesSeq[nSeriesIndex]; } diff --git a/chart2/source/tools/RegressionCurveHelper.cxx b/chart2/source/tools/RegressionCurveHelper.cxx index 24be670b659c..6124007fceb8 100644 --- a/chart2/source/tools/RegressionCurveHelper.cxx +++ b/chart2/source/tools/RegressionCurveHelper.cxx @@ -40,6 +40,7 @@ #include <com/sun/star/chart2/XRegressionCurveContainer.hpp> #include <com/sun/star/chart2/XDataSeries.hpp> #include <com/sun/star/chart2/data/XDataSource.hpp> +#include <o3tl/safeint.hxx> #include <tools/diagnose_ex.h> #include <comphelper/property.hxx> @@ -668,7 +669,7 @@ rtl::Reference< RegressionCurveModel > RegressionCurveHelper::getRegressionCurve try { const std::vector< rtl::Reference< RegressionCurveModel > > aCurves(xCurveContainer->getRegressionCurves2()); - if(0 <= aIndex && aIndex < static_cast<sal_Int32>(aCurves.size())) + if(0 <= aIndex && o3tl::make_unsigned(aIndex) < aCurves.size()) { if(!isMeanValueLine(aCurves[aIndex])) return aCurves[aIndex]; diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx index 95a86fe377c2..b14ea4e18878 100644 --- a/chart2/source/view/axes/VCartesianAxis.cxx +++ b/chart2/source/view/axes/VCartesianAxis.cxx @@ -29,6 +29,7 @@ #include "Tickmarks_Equidistant.hxx" #include <ExplicitCategoriesProvider.hxx> #include <com/sun/star/chart2/AxisType.hpp> +#include <o3tl/safeint.hxx> #include <rtl/math.hxx> #include <tools/diagnose_ex.h> #include <tools/color.hxx> @@ -662,7 +663,7 @@ void VCartesianAxis::createAllTickInfos( TickInfoArraysType& rAllTickInfos ) TickIter* VCartesianAxis::createLabelTickIterator( sal_Int32 nTextLevel ) { - if( nTextLevel>=0 && nTextLevel < static_cast< sal_Int32 >(m_aAllTickInfos.size()) ) + if( nTextLevel>=0 && o3tl::make_unsigned(nTextLevel) < m_aAllTickInfos.size() ) return new PureTickIter( m_aAllTickInfos[nTextLevel] ); return nullptr; } diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx index d7f862ae5cec..9cb2e06ba761 100644 --- a/chart2/source/view/charttypes/AreaChart.cxx +++ b/chart2/source/view/charttypes/AreaChart.cxx @@ -38,6 +38,7 @@ #include <com/sun/star/chart/MissingValueTreatment.hpp> #include <sal/log.hxx> +#include <o3tl/safeint.hxx> #include <osl/diagnose.h> #include <com/sun/star/beans/XPropertySet.hpp> @@ -700,7 +701,7 @@ void AreaChart::createShapes() { std::vector<std::vector<css::drawing::Position3D>>& rPolygon = pSeries->m_aPolyPolygonShape3D; sal_Int32& rIndex = pSeries->m_nPolygonIndex; - if( 0<= rIndex && rIndex < static_cast<sal_Int32>(rPolygon.size()) ) + if( 0<= rIndex && o3tl::make_unsigned(rIndex) < rPolygon.size() ) { if( !rPolygon[ rIndex ].empty() ) rIndex++; //start a new polygon for the next point if the current poly is not empty diff --git a/chart2/source/view/charttypes/NetChart.cxx b/chart2/source/view/charttypes/NetChart.cxx index 647ea083f583..5b8f1db34be5 100644 --- a/chart2/source/view/charttypes/NetChart.cxx +++ b/chart2/source/view/charttypes/NetChart.cxx @@ -33,6 +33,7 @@ #include <com/sun/star/chart/DataLabelPlacement.hpp> #include <com/sun/star/chart/MissingValueTreatment.hpp> +#include <o3tl/safeint.hxx> #include <osl/diagnose.h> #include <officecfg/Office/Compatibility.hxx> @@ -440,7 +441,7 @@ void NetChart::createShapes() { std::vector<std::vector<css::drawing::Position3D>>& rPolygon = pSeries->m_aPolyPolygonShape3D; sal_Int32& rIndex = pSeries->m_nPolygonIndex; - if( 0<= rIndex && rIndex < static_cast<sal_Int32>(rPolygon.size()) ) + if( 0<= rIndex && o3tl::make_unsigned(rIndex) < rPolygon.size() ) { if( !rPolygon[ rIndex ].empty() ) rIndex++; //start a new polygon for the next point if the current poly is not empty diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index eaa7f0743f03..0b2ad886f68f 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -66,6 +66,7 @@ #include <com/sun/star/chart2/XDataPointCustomLabelField.hpp> #include <com/sun/star/container/XChild.hpp> #include <com/sun/star/chart2/RelativePosition.hpp> +#include <o3tl/safeint.hxx> #include <tools/color.hxx> #include <tools/UnitConversion.hxx> #include <rtl/ustrbuf.hxx> @@ -193,7 +194,7 @@ void VSeriesPlotter::addSeries( std::unique_ptr<VDataSeries> pSeries, sal_Int32 pSeries->setXValuesIfNone( m_pExplicitCategoriesProvider->getOriginalCategories() ); } - if(zSlot<0 || zSlot>=static_cast<sal_Int32>(m_aZSlots.size())) + if(zSlot<0 || o3tl::make_unsigned(zSlot)>=m_aZSlots.size()) { //new z slot std::vector< VDataSeriesGroup > aZSlot; @@ -205,7 +206,7 @@ void VSeriesPlotter::addSeries( std::unique_ptr<VDataSeries> pSeries, sal_Int32 //existing zslot std::vector< VDataSeriesGroup >& rXSlots = m_aZSlots[zSlot]; - if(xSlot<0 || xSlot>=static_cast<sal_Int32>(rXSlots.size())) + if(xSlot<0 || o3tl::make_unsigned(xSlot)>=rXSlots.size()) { //append the series to already existing x series rXSlots.emplace_back( std::move(pSeries) ); |