diff options
Diffstat (limited to 'chart2/source/controller')
5 files changed, 15 insertions, 11 deletions
diff --git a/chart2/source/controller/accessibility/AccessibleBase.cxx b/chart2/source/controller/accessibility/AccessibleBase.cxx index 26657d429bd1..840f578aa17a 100644 --- a/chart2/source/controller/accessibility/AccessibleBase.cxx +++ b/chart2/source/controller/accessibility/AccessibleBase.cxx @@ -42,6 +42,7 @@ #include <vcl/window.hxx> #include <vcl/settings.hxx> #include <o3tl/functional.hxx> +#include <o3tl/safeint.hxx> #include <tools/diagnose_ex.h> #include <unotools/accessiblestatesethelper.hxx> @@ -503,7 +504,7 @@ Reference< XAccessible > AccessibleBase::ImplGetAccessibleChildById( sal_Int32 i MutexGuard aGuard( m_aMutex); if( ! m_bMayHaveChildren || i < 0 || - static_cast< ChildListVectorType::size_type >( i ) >= m_aChildList.size() ) + o3tl::make_unsigned( i ) >= m_aChildList.size() ) { OUString aBuf = "Index " + OUString::number( i ) + " is invalid for range [ 0, " + OUString::number( m_aChildList.size() - 1 ) + diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx index cbfb03b50031..465496f62979 100644 --- a/chart2/source/controller/dialogs/DataBrowser.cxx +++ b/chart2/source/controller/dialogs/DataBrowser.cxx @@ -36,6 +36,7 @@ #include <vcl/svapp.hxx> #include <vcl/virdev.hxx> #include <rtl/math.hxx> +#include <o3tl/safeint.hxx> #include <osl/diagnose.h> #include <toolkit/helper/vclunohelper.hxx> @@ -570,7 +571,7 @@ bool DataBrowser::MayMoveLeftColumns() const { sal_Int32 nColIndex(0); if( lcl_SeriesHeaderHasFocus( m_aSeriesHeaders, &nColIndex )) - return (static_cast< sal_uInt32 >( nColIndex ) <= (m_aSeriesHeaders.size() - 1)) && (static_cast< sal_uInt32 >( nColIndex ) != 0); + return (o3tl::make_unsigned( nColIndex ) <= (m_aSeriesHeaders.size() - 1)) && (static_cast< sal_uInt32 >( nColIndex ) != 0); } sal_Int32 nColIdx = lcl_getColumnInDataOrHeader( GetCurColumnId(), m_aSeriesHeaders ); @@ -587,7 +588,7 @@ bool DataBrowser::MayMoveRightColumns() const { sal_Int32 nColIndex(0); if( lcl_SeriesHeaderHasFocus( m_aSeriesHeaders, &nColIndex )) - return (static_cast< sal_uInt32 >( nColIndex ) < (m_aSeriesHeaders.size() - 1)); + return (o3tl::make_unsigned( nColIndex ) < (m_aSeriesHeaders.size() - 1)); } sal_Int32 nColIdx = lcl_getColumnInDataOrHeader( GetCurColumnId(), m_aSeriesHeaders ); diff --git a/chart2/source/controller/dialogs/DataBrowserModel.cxx b/chart2/source/controller/dialogs/DataBrowserModel.cxx index 272693f1d7c6..e353899eb81e 100644 --- a/chart2/source/controller/dialogs/DataBrowserModel.cxx +++ b/chart2/source/controller/dialogs/DataBrowserModel.cxx @@ -41,6 +41,7 @@ #include <com/sun/star/chart2/data/XNumericalDataSequence.hpp> #include <com/sun/star/chart2/data/XTextualDataSequence.hpp> #include <com/sun/star/util/XModifiable.hpp> +#include <o3tl/safeint.hxx> #include <tools/diagnose_ex.h> #include <comphelper/property.hxx> @@ -291,7 +292,7 @@ void DataBrowserModel::insertDataSeries( sal_Int32 nAfterColumnIndex ) Reference<chart2::XDiagram> xDiagram = ChartModelHelper::findDiagram(m_xChartDocument); Reference<chart2::XChartType> xChartType; Reference<chart2::XDataSeries> xSeries; - if (static_cast<size_t>(nAfterColumnIndex) < m_aColumns.size()) + if (o3tl::make_unsigned(nAfterColumnIndex) < m_aColumns.size()) // Get the data series at specific column position (if available). xSeries.set( m_aColumns[nAfterColumnIndex].m_xDataSeries ); @@ -436,7 +437,7 @@ void DataBrowserModel::removeComplexCategoryLevel( sal_Int32 nAtColumnIndex ) void DataBrowserModel::removeDataSeriesOrComplexCategoryLevel( sal_Int32 nAtColumnIndex ) { OSL_ASSERT(m_apDialogModel); - if (nAtColumnIndex < 0 || static_cast<size_t>(nAtColumnIndex) >= m_aColumns.size()) + if (nAtColumnIndex < 0 || o3tl::make_unsigned(nAtColumnIndex) >= m_aColumns.size()) // Out of bound. return; @@ -505,7 +506,7 @@ void DataBrowserModel::removeDataSeriesOrComplexCategoryLevel( sal_Int32 nAtColu void DataBrowserModel::swapDataSeries( sal_Int32 nFirstColumnIndex ) { OSL_ASSERT(m_apDialogModel); - if( static_cast< tDataColumnVector::size_type >( nFirstColumnIndex ) < m_aColumns.size() - 1 ) + if( o3tl::make_unsigned( nFirstColumnIndex ) < m_aColumns.size() - 1 ) { Reference< chart2::XDataSeries > xSeries( m_aColumns[nFirstColumnIndex].m_xDataSeries ); if( xSeries.is()) @@ -728,7 +729,7 @@ sal_Int32 DataBrowserModel::getMaxRowCount() const OUString DataBrowserModel::getRoleOfColumn( sal_Int32 nColumnIndex ) const { if( nColumnIndex != -1 && - static_cast< sal_uInt32 >( nColumnIndex ) < m_aColumns.size()) + o3tl::make_unsigned( nColumnIndex ) < m_aColumns.size()) return m_aColumns[ nColumnIndex ].m_aUIRoleName; return OUString(); } @@ -738,7 +739,7 @@ bool DataBrowserModel::isCategoriesColumn( sal_Int32 nColumnIndex ) const if (nColumnIndex < 0) return false; - if (static_cast<size_t>(nColumnIndex) >= m_aColumns.size()) + if (o3tl::make_unsigned(nColumnIndex) >= m_aColumns.size()) return false; // A column is a category when it doesn't have an associated data series. diff --git a/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx b/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx index 7113eba8857b..9259ce921819 100644 --- a/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx +++ b/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx @@ -24,7 +24,7 @@ #include <DrawViewWrapper.hxx> #include <com/sun/star/drawing/Direction3D.hpp> - +#include <o3tl/safeint.hxx> #include <svx/xtable.hxx> #include <svl/itempool.hxx> #include <svtools/ctrltool.hxx> @@ -141,7 +141,7 @@ Graphic ViewElementListProvider::GetSymbolGraphic( sal_Int32 nStandardSymbol, co return Graphic(); if(nStandardSymbol<0) nStandardSymbol*=-1; - if( static_cast<size_t>(nStandardSymbol) >= pSymbolList->GetObjCount() ) + if( o3tl::make_unsigned(nStandardSymbol) >= pSymbolList->GetObjCount() ) nStandardSymbol %= pSymbolList->GetObjCount(); SdrObject* pObj = pSymbolList->GetObj(nStandardSymbol); diff --git a/chart2/source/controller/main/ElementSelector.cxx b/chart2/source/controller/main/ElementSelector.cxx index 8ff8f2039abe..4cc61cc1d1b0 100644 --- a/chart2/source/controller/main/ElementSelector.cxx +++ b/chart2/source/controller/main/ElementSelector.cxx @@ -27,6 +27,7 @@ #include <ObjectIdentifier.hxx> #include <cppuhelper/supportsservice.hxx> +#include <o3tl/safeint.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <vcl/svapp.hxx> @@ -182,7 +183,7 @@ void SelectorListBox::Select() if ( !IsTravelSelect() ) { const sal_Int32 nPos = GetSelectedEntryPos(); - if( static_cast<size_t>(nPos) < m_aEntries.size() ) + if( o3tl::make_unsigned(nPos) < m_aEntries.size() ) { ObjectIdentifier aOID = m_aEntries[nPos].OID; Reference< view::XSelectionSupplier > xSelectionSupplier( m_xChartController.get(), uno::UNO_QUERY ); |