diff options
Diffstat (limited to 'sd/source/ui')
-rw-r--r-- | sd/source/ui/app/sdxfer.cxx | 3 | ||||
-rw-r--r-- | sd/source/ui/slideshow/slideshowimpl.cxx | 3 | ||||
-rw-r--r-- | sd/source/ui/slidesorter/model/SlideSorterModel.cxx | 3 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unocpres.cxx | 5 |
4 files changed, 9 insertions, 5 deletions
diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx index 14e63798aec9..67016fd194e1 100644 --- a/sd/source/ui/app/sdxfer.cxx +++ b/sd/source/ui/app/sdxfer.cxx @@ -35,6 +35,7 @@ #include <editeng/outlobj.hxx> #include <sot/storage.hxx> #include <editeng/editobj.hxx> +#include <o3tl/safeint.hxx> #include <svx/svdobjkind.hxx> #include <svx/svdouno.hxx> #include <svx/ImageMapInfo.hxx> @@ -725,7 +726,7 @@ sal_Int32 SdTransferable::GetUserDataCount() const std::shared_ptr<SdTransferable::UserData> SdTransferable::GetUserData (const sal_Int32 nIndex) const { - if (nIndex>=0 && nIndex<sal_Int32(maUserData.size())) + if (nIndex>=0 && o3tl::make_unsigned(nIndex)<maUserData.size()) return maUserData[nIndex]; else return std::shared_ptr<UserData>(); diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index b896fbb4ebbf..3215a550b7c1 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -78,6 +78,7 @@ #include <comphelper/processfactory.hxx> #include <comphelper/propertyvalue.hxx> #include <rtl/ref.hxx> +#include <o3tl/safeint.hxx> #include <o3tl/string_view.hxx> #include <avmedia/mediawindow.hxx> #include <svtools/colrdlg.hxx> @@ -166,7 +167,7 @@ private: bool getSlideAPI( sal_Int32 nSlideNumber, Reference< XDrawPage >& xSlide, Reference< XAnimationNode >& xAnimNode ); sal_Int32 findSlideIndex( sal_Int32 nSlideNumber ) const; - bool isValidIndex( sal_Int32 nIndex ) const { return (nIndex >= 0) && (nIndex < static_cast<sal_Int32>(maSlideNumbers.size())); } + bool isValidIndex( sal_Int32 nIndex ) const { return (nIndex >= 0) && (o3tl::make_unsigned(nIndex) < maSlideNumbers.size()); } bool isValidSlideNumber( sal_Int32 nSlideNumber ) const { return (nSlideNumber >= 0) && (nSlideNumber < mnSlideCount); } private: diff --git a/sd/source/ui/slidesorter/model/SlideSorterModel.cxx b/sd/source/ui/slidesorter/model/SlideSorterModel.cxx index 365c9127944d..4d3e7965690b 100644 --- a/sd/source/ui/slidesorter/model/SlideSorterModel.cxx +++ b/sd/source/ui/slidesorter/model/SlideSorterModel.cxx @@ -41,6 +41,7 @@ #include <sdpage.hxx> #include <FrameView.hxx> +#include <o3tl/safeint.hxx> #include <tools/diagnose_ex.h> using namespace ::com::sun::star; @@ -616,7 +617,7 @@ bool SlideSorterModel::DeleteSlide (const SdPage* pPage) bool bMarkedSelected(false); - if(nIndex >= 0 && nIndex < static_cast<sal_Int32>(maPageDescriptors.size())) + if(nIndex >= 0 && o3tl::make_unsigned(nIndex) < maPageDescriptors.size()) { if (maPageDescriptors[nIndex]) if (maPageDescriptors[nIndex]->GetPage() != pPage) diff --git a/sd/source/ui/unoidl/unocpres.cxx b/sd/source/ui/unoidl/unocpres.cxx index e5c9eb16e021..cc57b1e7941a 100644 --- a/sd/source/ui/unoidl/unocpres.cxx +++ b/sd/source/ui/unoidl/unocpres.cxx @@ -21,6 +21,7 @@ #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> +#include <o3tl/safeint.hxx> #include <vcl/svapp.hxx> #include <svx/svdpage.hxx> #include <cppuhelper/supportsservice.hxx> @@ -84,7 +85,7 @@ void SAL_CALL SdXCustomPresentation::insertByIndex( sal_Int32 Index, const uno:: if( bDisposing ) throw lang::DisposedException(); - if( Index < 0 || Index > static_cast<sal_Int32>( mpSdCustomShow ? mpSdCustomShow->PagesVector().size() : 0 ) ) + if( Index < 0 || o3tl::make_unsigned(Index) > ( mpSdCustomShow ? mpSdCustomShow->PagesVector().size() : 0 ) ) throw lang::IndexOutOfBoundsException(); uno::Reference< drawing::XDrawPage > xPage; @@ -182,7 +183,7 @@ uno::Any SAL_CALL SdXCustomPresentation::getByIndex( sal_Int32 Index ) if( bDisposing ) throw lang::DisposedException(); - if (Index < 0 || !mpSdCustomShow || Index >= static_cast<sal_Int32>(mpSdCustomShow->PagesVector().size())) + if (Index < 0 || !mpSdCustomShow || o3tl::make_unsigned(Index) >= mpSdCustomShow->PagesVector().size()) throw lang::IndexOutOfBoundsException(); uno::Any aAny; |