[Libreoffice-commits] .: cppu/inc cppu/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Jan 15 02:26:20 PST 2013


 cppu/inc/com/sun/star/uno/Sequence.hxx |   14 ++++++--------
 cppu/source/uno/sequence.cxx           |    4 ++++
 2 files changed, 10 insertions(+), 8 deletions(-)

New commits:
commit d55155cad0926f61b5745260196b93e95471d06a
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jan 15 11:24:46 2013 +0100

    Include <cassert>
    
    Also, move assert into uno_type_sequence_construct so that all its callers
    benefit.
    
    Also, change some OSL_ENSURE to assert.
    
    Change-Id: Idd0a03c4aa6eed1db453db84602c01ff16f0d72c

diff --git a/cppu/inc/com/sun/star/uno/Sequence.hxx b/cppu/inc/com/sun/star/uno/Sequence.hxx
index 3a006a6..a23fd3b 100644
--- a/cppu/inc/com/sun/star/uno/Sequence.hxx
+++ b/cppu/inc/com/sun/star/uno/Sequence.hxx
@@ -19,7 +19,10 @@
 #ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
 #define _COM_SUN_STAR_UNO_SEQUENCE_HXX_
 
-#include "osl/diagnose.h"
+#include "sal/config.h"
+
+#include <cassert>
+
 #include "osl/interlck.h"
 #include "com/sun/star/uno/Sequence.h"
 #include "typelib/typedescription.h"
@@ -89,7 +92,6 @@ inline Sequence< E >::Sequence( const E * pElements, sal_Int32 len )
 template< class E >
 inline Sequence< E >::Sequence( sal_Int32 len )
 {
-    assert( len >= 0 );
     const Type & rType = ::cppu::getTypeFavourUnsigned( this );
 #if ! defined EXCEPTIONS_OFF
     sal_Bool success =
@@ -167,9 +169,7 @@ inline E * Sequence< E >::getArray()
 template< class E >
 inline E & Sequence< E >::operator [] ( sal_Int32 nIndex )
 {
-    OSL_ENSURE(
-        nIndex >= 0 && nIndex < getLength(),
-        "### illegal index of sequence!" );
+    assert( nIndex >= 0 && nIndex < getLength() );
     return getArray()[ nIndex ];
 }
 
@@ -178,9 +178,7 @@ template< class E >
 inline const E & Sequence< E >::operator [] ( sal_Int32 nIndex ) const
     SAL_THROW(())
 {
-    OSL_ENSURE(
-        nIndex >= 0 && nIndex < getLength(),
-        "### illegal index of sequence!" );
+    assert( nIndex >= 0 && nIndex < getLength() );
     return reinterpret_cast< const E * >( _pSequence->elements )[ nIndex ];
 }
 
diff --git a/cppu/source/uno/sequence.cxx b/cppu/source/uno/sequence.cxx
index d9e28fb..d570461 100644
--- a/cppu/source/uno/sequence.cxx
+++ b/cppu/source/uno/sequence.cxx
@@ -17,6 +17,9 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include "sal/config.h"
+
+#include <cassert>
 #include <string.h>
 
 #include <rtl/alloc.h>
@@ -771,6 +774,7 @@ sal_Bool SAL_CALL uno_type_sequence_construct(
     uno_AcquireFunc acquire )
     SAL_THROW_EXTERN_C()
 {
+    assert( len >= 0 );
     bool ret;
     if (len)
     {


More information about the Libreoffice-commits mailing list