diff options
Diffstat (limited to 'sal/inc/rtl/ustring.hxx')
-rw-r--r-- | sal/inc/rtl/ustring.hxx | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/sal/inc/rtl/ustring.hxx b/sal/inc/rtl/ustring.hxx index edf7c9747962..ef13dd1da387 100644 --- a/sal/inc/rtl/ustring.hxx +++ b/sal/inc/rtl/ustring.hxx @@ -29,12 +29,15 @@ #ifndef _RTL_USTRING_HXX_ #define _RTL_USTRING_HXX_ -#ifdef __cplusplus +#include "sal/config.h" + +#include <cassert> #include "osl/diagnose.h" #include <rtl/ustring.h> #include <rtl/string.hxx> #include <rtl/memory.h> +#include "sal/log.h" #if defined EXCEPTIONS_OFF #include <stdlib.h> @@ -184,13 +187,13 @@ public: { pData = 0; rtl_string2UString( &pData, value, length, encoding, convertFlags ); + if (pData == 0) { #if defined EXCEPTIONS_OFF - OSL_ASSERT(pData != NULL); + SAL_WARN("sal", "std::bad_alloc but EXCEPTIONS_OFF"); #else - if (pData == 0) { throw std::bad_alloc(); - } #endif + } } /** Create a new string from an array of Unicode code points. @@ -967,7 +970,7 @@ public: */ OUString copy( sal_Int32 beginIndex ) const SAL_THROW(()) { - OSL_ASSERT(beginIndex >= 0 && beginIndex <= getLength()); + assert(beginIndex >= 0 && beginIndex <= getLength()); if ( beginIndex == 0 ) return *this; else @@ -991,7 +994,7 @@ public: */ OUString copy( sal_Int32 beginIndex, sal_Int32 count ) const SAL_THROW(()) { - OSL_ASSERT(beginIndex >= 0 && beginIndex <= getLength() && count >= 0); + assert(beginIndex >= 0 && beginIndex <= getLength() && count >= 0); if ( (beginIndex == 0) && (count == getLength()) ) return *this; else @@ -1243,13 +1246,13 @@ public: { rtl_uString * pNew = 0; rtl_uString_intern( &pNew, pData ); + if (pNew == 0) { #if defined EXCEPTIONS_OFF - OSL_ASSERT(pNew != NULL); + SAL_WARN("sal", "std::bad_alloc but EXCEPTIONS_OFF"); #else - if (pNew == 0) { throw std::bad_alloc(); - } #endif + } return OUString( pNew, (DO_NOT_ACQUIRE *)0 ); } @@ -1286,13 +1289,13 @@ public: rtl_uString * pNew = 0; rtl_uString_internConvert( &pNew, value, length, encoding, convertFlags, pInfo ); + if (pNew == 0) { #if defined EXCEPTIONS_OFF - OSL_ASSERT(pNew != NULL); + SAL_WARN("sal", "std::bad_alloc but EXCEPTIONS_OFF"); #else - if (pNew == 0) { throw std::bad_alloc(); - } #endif + } return OUString( pNew, (DO_NOT_ACQUIRE *)0 ); } @@ -1576,8 +1579,6 @@ inline OString OUStringToOString( const OUString & rUnicode, } /* Namespace */ -#endif /* __cplusplus */ - #endif /* _RTL_USTRING_HXX */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |