diff options
author | Daniel Boelzle <dbo@openoffice.org> | 2000-09-25 13:48:13 +0000 |
---|---|---|
committer | Daniel Boelzle <dbo@openoffice.org> | 2000-09-25 13:48:13 +0000 |
commit | 349a1365a1618ab94d12ca7f4438ca4b84f5ef35 (patch) | |
tree | 63d4a05769ad0bf558f4d4cfeb91738954a44e12 /cppu | |
parent | f938c9220b6da25d4b38414a8e0aac3c57d00c8d (diff) |
added assertions for illegal index
Diffstat (limited to 'cppu')
-rw-r--r-- | cppu/inc/com/sun/star/uno/Sequence.h | 10 | ||||
-rw-r--r-- | cppu/inc/com/sun/star/uno/Sequence.hxx | 21 |
2 files changed, 23 insertions, 8 deletions
diff --git a/cppu/inc/com/sun/star/uno/Sequence.h b/cppu/inc/com/sun/star/uno/Sequence.h index f87e78122e74..099960cbb264 100644 --- a/cppu/inc/com/sun/star/uno/Sequence.h +++ b/cppu/inc/com/sun/star/uno/Sequence.h @@ -2,9 +2,9 @@ * * $RCSfile: Sequence.h,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 15:25:51 $ + * last change: $Author: dbo $ $Date: 2000-09-25 14:48:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -207,8 +207,7 @@ public: @param nIndex index @return non-const C++ reference to element */ - inline E & SAL_CALL operator [] ( sal_Int32 nIndex ) - { return getArray()[ nIndex ]; } + inline E & SAL_CALL operator [] ( sal_Int32 nIndex ); /** Const index operator: Obtains a reference to element indexed at given position.<br> The implementation does <b>not</b> check for array bounds!<br> @@ -216,8 +215,7 @@ public: @param nIndex index @return const C++ reference to element */ - inline const E & SAL_CALL operator [] ( sal_Int32 nIndex ) const - { return getConstArray()[ nIndex ]; } + inline const E & SAL_CALL operator [] ( sal_Int32 nIndex ) const; /** Equality operator: Compares two sequences. diff --git a/cppu/inc/com/sun/star/uno/Sequence.hxx b/cppu/inc/com/sun/star/uno/Sequence.hxx index 7b9e3065571e..a940a2f8bb16 100644 --- a/cppu/inc/com/sun/star/uno/Sequence.hxx +++ b/cppu/inc/com/sun/star/uno/Sequence.hxx @@ -2,9 +2,9 @@ * * $RCSfile: Sequence.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 15:25:51 $ + * last change: $Author: dbo $ $Date: 2000-09-25 14:48:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -65,6 +65,9 @@ #include <cppu/macros.hxx> #endif +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif #ifndef _OSL_INTERLCK_H_ #include <osl/interlck.h> #endif @@ -162,6 +165,20 @@ inline E * Sequence< E >::getArray() } //__________________________________________________________________________________________________ template< class E > +inline E & Sequence< E >::operator [] ( sal_Int32 nIndex ) +{ + OSL_ENSURE( nIndex < getLength(), "### illegal index of sequence!" ); + return getArray()[ nIndex ]; +} +//__________________________________________________________________________________________________ +template< class E > +inline const E & Sequence< E >::operator [] ( sal_Int32 nIndex ) const +{ + OSL_ENSURE( nIndex < getLength(), "### illegal index of sequence!" ); + return getConstArray()[ nIndex ]; +} +//__________________________________________________________________________________________________ +template< class E > inline void Sequence< E >::realloc( sal_Int32 nSize ) { const Type & rType = ::getCppuType( this ); |