diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2012-03-30 16:53:45 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2012-03-30 17:34:17 +0200 |
commit | d537da41d7b51783f98e0629917dc3831b053795 (patch) | |
tree | 7fcd80dcc47bf1489c8e3c5c9a5c713c0ceaeb2d /sal | |
parent | 8bc439333a970895b0f1dd5f353ac9f8c9031c56 (diff) |
no bad_alloc throwing in string literal O(U)String functions
String literals should be reasonably short, and if memory is so low
that they trigger allocation failure, something else would would
trip over very soon anyway.
Diffstat (limited to 'sal')
-rw-r--r-- | sal/inc/rtl/ustring.hxx | 23 | ||||
-rw-r--r-- | sal/rtl/source/strtmpl.cxx | 2 |
2 files changed, 1 insertions, 24 deletions
diff --git a/sal/inc/rtl/ustring.hxx b/sal/inc/rtl/ustring.hxx index ad6fad22713e..a5528894e0d4 100644 --- a/sal/inc/rtl/ustring.hxx +++ b/sal/inc/rtl/ustring.hxx @@ -192,7 +192,6 @@ public: @param literal the 8-bit ASCII string literal - @exception std::bad_alloc is thrown if an out-of-memory condition occurs @since LibreOffice 3.6 */ #ifdef HAVE_SFINAE_ANONYMOUS_BROKEN @@ -203,13 +202,6 @@ public: { pData = 0; rtl_uString_newFromLiteral( &pData, literal, N - 1 ); - if (pData == 0) { -#if defined EXCEPTIONS_OFF - SAL_WARN("sal", "std::bad_alloc but EXCEPTIONS_OFF"); -#else - throw std::bad_alloc(); -#endif - } #ifdef RTL_STRING_UNITTEST rtl_string_unittest_const_literal = true; #endif @@ -237,13 +229,6 @@ public: { pData = 0; rtl_uString_newFromLiteral( &pData, literal, internal::ConstCharArrayDetector< T, void >::size - 1 ); - if (pData == 0) { -#if defined EXCEPTIONS_OFF - SAL_WARN("sal", "std::bad_alloc but EXCEPTIONS_OFF"); -#else - throw std::bad_alloc(); -#endif - } #ifdef RTL_STRING_UNITTEST rtl_string_unittest_const_literal = true; #endif @@ -379,20 +364,12 @@ public: @param literal the 8-bit ASCII string literal - @exception std::bad_alloc is thrown if an out-of-memory condition occurs @since LibreOffice 3.6 */ template< typename T > typename internal::ConstCharArrayDetector< T, OUString& >::Type operator=( T& literal ) { rtl_uString_newFromLiteral( &pData, literal, internal::ConstCharArrayDetector< T, void >::size - 1 ); - if (pData == 0) { -#if defined EXCEPTIONS_OFF - SAL_WARN("sal", "std::bad_alloc but EXCEPTIONS_OFF"); -#else - throw std::bad_alloc(); -#endif - } return *this; } diff --git a/sal/rtl/source/strtmpl.cxx b/sal/rtl/source/strtmpl.cxx index 026d6473b6d1..8e1de8bdab0f 100644 --- a/sal/rtl/source/strtmpl.cxx +++ b/sal/rtl/source/strtmpl.cxx @@ -1218,7 +1218,7 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newFromLiteral)( IMPL_RTL_STRINGDATA** ppThis IMPL_RTL_STRINGNAME( release )( *ppThis ); *ppThis = IMPL_RTL_STRINGNAME( ImplAlloc )( nLen ); - OSL_ASSERT(*ppThis != NULL); + assert( *ppThis != NULL ); if ( (*ppThis) ) { IMPL_RTL_STRCODE* pBuffer = (*ppThis)->buffer; |