From c1158fbc1c8abb0842fb8eb307724ef42ac6e8e2 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Thu, 24 Apr 2014 12:57:26 +0200 Subject: 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 --- include/com/sun/star/uno/Sequence.hxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'include/com') 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 E const * Sequence::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(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(nIndex) < getLength()); return reinterpret_cast< const E * >( _pSequence->elements )[ nIndex ]; } -- cgit