diff options
author | Michael Stahl <mstahl@redhat.com> | 2014-04-24 12:57:26 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2014-04-24 13:01:26 +0200 |
commit | c1158fbc1c8abb0842fb8eb307724ef42ac6e8e2 (patch) | |
tree | 4d0bcf101b80516520b55a20884e89882c1a83a9 /include/com/sun | |
parent | 2e8aad6d45c53d554ccaf26de998ede708cfc289 (diff) |
Sequence::operator[]: silence -Werror=strict-overflow warnings
GCC 4.8.2 warns when index is a subtraction expression; the real
problems in that case will be found by the "index >= 0" check.
Change-Id: I4c3f0bdb7996e433b1693eb7dcbafb9610b5dbcf
Diffstat (limited to 'include/com/sun')
-rw-r--r-- | include/com/sun/star/uno/Sequence.hxx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/include/com/sun/star/uno/Sequence.hxx b/include/com/sun/star/uno/Sequence.hxx index 748fdcb18445..88fba66aa45b 100644 --- a/include/com/sun/star/uno/Sequence.hxx +++ b/include/com/sun/star/uno/Sequence.hxx @@ -156,7 +156,8 @@ template<class E> E const * Sequence<E>::end() const template< class E > inline E & Sequence< E >::operator [] ( sal_Int32 nIndex ) { - assert( nIndex >= 0 && nIndex < getLength() ); + // silence spurious -Werror=strict-overflow warnings from GCC 4.8.2 + assert(nIndex >= 0 && static_cast<sal_uInt32>(nIndex) < getLength()); return getArray()[ nIndex ]; } @@ -164,7 +165,8 @@ template< class E > inline const E & Sequence< E >::operator [] ( sal_Int32 nIndex ) const SAL_THROW(()) { - assert( nIndex >= 0 && nIndex < getLength() ); + // silence spurious -Werror=strict-overflow warnings from GCC 4.8.2 + assert(nIndex >= 0 && static_cast<sal_uInt32>(nIndex) < getLength()); return reinterpret_cast< const E * >( _pSequence->elements )[ nIndex ]; } |