diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2004-04-14 10:48:22 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2004-04-14 10:48:22 +0000 |
commit | 8a8295f7b663a3ffd76600623c07fdf882f8d353 (patch) | |
tree | b905209c6247b10c8870f02debc33d292946d8c7 /sal/inc/rtl/byteseq.hxx | |
parent | 8a83bcaa5772752f4c1ca89014a8bf6d12cca784 (diff) |
INTEGRATION: CWS unopkg1 (1.3.232); FILE MERGED
2004/03/12 13:25:56 dbo 1.3.232.1: #i22343# throwing ::std::bad_alloc in case of memory exhaustion
Diffstat (limited to 'sal/inc/rtl/byteseq.hxx')
-rw-r--r-- | sal/inc/rtl/byteseq.hxx | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/sal/inc/rtl/byteseq.hxx b/sal/inc/rtl/byteseq.hxx index cd8e6b55f146..0db8ddd76665 100644 --- a/sal/inc/rtl/byteseq.hxx +++ b/sal/inc/rtl/byteseq.hxx @@ -2,9 +2,9 @@ * * $RCSfile: byteseq.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: jbu $ $Date: 2001-10-09 07:19:27 $ + * last change: $Author: hr $ $Date: 2004-04-14 11:48:22 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -74,6 +74,10 @@ #include <rtl/memory.h> #endif +#if ! defined EXCEPTIONS_OFF +#include <new> +#endif + namespace rtl { @@ -97,16 +101,24 @@ inline ByteSequence::ByteSequence( sal_Sequence *pSequence) SAL_THROW( () ) ::rtl_byte_sequence_acquire( pSequence ); } //__________________________________________________________________________________________________ -inline ByteSequence::ByteSequence( const sal_Int8 * pElements, sal_Int32 len ) SAL_THROW( () ) +inline ByteSequence::ByteSequence( const sal_Int8 * pElements, sal_Int32 len ) : _pSequence( 0 ) { ::rtl_byte_sequence_constructFromArray( &_pSequence, pElements, len ); +#if ! defined EXCEPTIONS_OFF + if (_pSequence == 0) + throw ::std::bad_alloc(); +#endif } //__________________________________________________________________________________________________ -inline ByteSequence::ByteSequence( sal_Int32 len, enum __ByteSequence_NoDefault value ) SAL_THROW( () ) +inline ByteSequence::ByteSequence( sal_Int32 len, enum __ByteSequence_NoDefault value ) : _pSequence( 0 ) { ::rtl_byte_sequence_constructNoDefault( &_pSequence, len ); +#if ! defined EXCEPTIONS_OFF + if (_pSequence == 0) + throw ::std::bad_alloc(); +#endif } //__________________________________________________________________________________________________ inline ByteSequence::ByteSequence( sal_Sequence *pSequence, enum __ByteSequence_NoAcquire value ) SAL_THROW( () ) @@ -114,10 +126,14 @@ inline ByteSequence::ByteSequence( sal_Sequence *pSequence, enum __ByteSequence_ { } //__________________________________________________________________________________________________ -inline ByteSequence::ByteSequence( sal_Int32 len ) SAL_THROW( () ) +inline ByteSequence::ByteSequence( sal_Int32 len ) : _pSequence( 0 ) { ::rtl_byte_sequence_construct( &_pSequence, len ); +#if ! defined EXCEPTIONS_OFF + if (_pSequence == 0) + throw ::std::bad_alloc(); +#endif } //__________________________________________________________________________________________________ inline ByteSequence::~ByteSequence() SAL_THROW( () ) @@ -136,18 +152,26 @@ inline sal_Bool ByteSequence::operator == ( const ByteSequence & rSeq ) const SA return ::rtl_byte_sequence_equals( _pSequence, rSeq._pSequence ); } //__________________________________________________________________________________________________ -inline sal_Int8 * ByteSequence::getArray() SAL_THROW( () ) +inline sal_Int8 * ByteSequence::getArray() { ::rtl_byte_sequence_reference2One( &_pSequence ); +#if ! defined EXCEPTIONS_OFF + if (_pSequence == 0) + throw ::std::bad_alloc(); +#endif return (sal_Int8 *)_pSequence->elements; } //__________________________________________________________________________________________________ -inline void ByteSequence::realloc( sal_Int32 nSize ) SAL_THROW( () ) +inline void ByteSequence::realloc( sal_Int32 nSize ) { ::rtl_byte_sequence_realloc( &_pSequence, nSize ); +#if ! defined EXCEPTIONS_OFF + if (_pSequence == 0) + throw ::std::bad_alloc(); +#endif } //__________________________________________________________________________________________________ -inline sal_Int8 & ByteSequence::operator [] ( sal_Int32 nIndex ) SAL_THROW( () ) +inline sal_Int8 & ByteSequence::operator [] ( sal_Int32 nIndex ) { return getArray()[ nIndex ]; } |