From 6488e5f1207eb3f72e00cd1e2ada2e443c891373 Mon Sep 17 00:00:00 2001 From: Thomas Arnhold Date: Sat, 12 Mar 2011 11:49:53 +0100 Subject: Move OSL_ENSURE(false,...) to OSL_FAIL(...) --- bridges/source/remote/urp/urp_reader.cxx | 3 +-- cppu/source/typelib/typelib.cxx | 8 ++++---- cppuhelper/source/implbase.cxx | 8 ++++---- cppuhelper/source/propshlp.cxx | 2 +- cppuhelper/source/weak.cxx | 4 ++-- jvmaccess/source/virtualmachine.cxx | 4 ++-- jvmfwk/plugins/sunmajor/pluginlib/util.cxx | 2 +- remotebridges/source/factory/bridgefactory.cxx | 2 +- sal/qa/osl/socket/sockethelper.cxx | 2 +- stoc/source/javavm/javavm.cxx | 11 +++++------ 10 files changed, 22 insertions(+), 24 deletions(-) diff --git a/bridges/source/remote/urp/urp_reader.cxx b/bridges/source/remote/urp/urp_reader.cxx index 761168d7f516..c4cd06caebc1 100644 --- a/bridges/source/remote/urp/urp_reader.cxx +++ b/bridges/source/remote/urp/urp_reader.cxx @@ -565,8 +565,7 @@ void OReaderThread::run() TYPELIB_DANGER_RELEASE( pType ); if ( !ok ) { - OSL_ENSURE( - false, + OSL_FAIL( ("urp_bridge: error while unpacking current" " context") ); disposeEnvironment(); diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx index f84350f27691..5b8caa298690 100644 --- a/cppu/source/typelib/typelib.cxx +++ b/cppu/source/typelib/typelib.cxx @@ -1309,7 +1309,7 @@ extern "C" void SAL_CALL typelib_typedescription_newInterfaceMethod( sal_Int32 nOffset = rtl_ustr_lastIndexOfChar_WithLength( pTypeName->buffer, pTypeName->length, ':'); if (nOffset <= 0 || pTypeName->buffer[nOffset - 1] != ':') { - OSL_ENSURE(false, "Bad interface method type name"); + OSL_FAIL("Bad interface method type name"); return; } rtl::OUString aInterfaceTypeName(pTypeName->buffer, nOffset - 1); @@ -1322,7 +1322,7 @@ extern "C" void SAL_CALL typelib_typedescription_newInterfaceMethod( || !complete( reinterpret_cast< typelib_TypeDescription ** >(&pInterface), false)) { - OSL_ENSURE(false, "No interface corresponding to interface method"); + OSL_FAIL("No interface corresponding to interface method"); return; } @@ -1402,7 +1402,7 @@ extern "C" void SAL_CALL typelib_typedescription_newExtendedInterfaceAttribute( sal_Int32 nOffset = rtl_ustr_lastIndexOfChar_WithLength( pTypeName->buffer, pTypeName->length, ':'); if (nOffset <= 0 || pTypeName->buffer[nOffset - 1] != ':') { - OSL_ENSURE(false, "Bad interface attribute type name"); + OSL_FAIL("Bad interface attribute type name"); return; } rtl::OUString aInterfaceTypeName(pTypeName->buffer, nOffset - 1); @@ -1415,7 +1415,7 @@ extern "C" void SAL_CALL typelib_typedescription_newExtendedInterfaceAttribute( || !complete( reinterpret_cast< typelib_TypeDescription ** >(&pInterface), false)) { - OSL_ENSURE(false, "No interface corresponding to interface attribute"); + OSL_FAIL("No interface corresponding to interface attribute"); return; } diff --git a/cppuhelper/source/implbase.cxx b/cppuhelper/source/implbase.cxx index 60f153194bef..3f0e238762f6 100644 --- a/cppuhelper/source/implbase.cxx +++ b/cppuhelper/source/implbase.cxx @@ -254,8 +254,8 @@ void WeakComponentImplHelperBase::release() dispose(); } catch (RuntimeException const& exc) { // don't break throw () - OSL_ENSURE( - false, OUStringToOString( + OSL_FAIL( + OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US ).getStr() ); static_cast(exc); } @@ -390,8 +390,8 @@ void WeakAggComponentImplHelperBase::release() dispose(); } catch (RuntimeException const& exc) { // don't break throw () - OSL_ENSURE( - false, OUStringToOString( + OSL_FAIL( + OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US ).getStr() ); static_cast(exc); } diff --git a/cppuhelper/source/propshlp.cxx b/cppuhelper/source/propshlp.cxx index 9abc35dd3632..0cc3e14f2133 100644 --- a/cppuhelper/source/propshlp.cxx +++ b/cppuhelper/source/propshlp.cxx @@ -1016,7 +1016,7 @@ void OPropertyArrayHelper::init( sal_Bool bSorted ) SAL_THROW( () ) { #ifndef OS2 // YD disabled, too many troubles with debug builds! if (bSorted) { - OSL_ENSURE( false, "Property array is not sorted" ); + OSL_FAIL( "Property array is not sorted" ); } #endif // not sorted diff --git a/cppuhelper/source/weak.cxx b/cppuhelper/source/weak.cxx index 1dd76d26758e..11b99fc45076 100644 --- a/cppuhelper/source/weak.cxx +++ b/cppuhelper/source/weak.cxx @@ -226,8 +226,8 @@ void OWeakObject::disposeWeakConnectionPoint() p->dispose(); } catch (RuntimeException const& exc) { - OSL_ENSURE( - false, OUStringToOString( + OSL_FAIL( + OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US ).getStr() ); static_cast(exc); } diff --git a/jvmaccess/source/virtualmachine.cxx b/jvmaccess/source/virtualmachine.cxx index 9597eed2e8aa..a257f55224cd 100644 --- a/jvmaccess/source/virtualmachine.cxx +++ b/jvmaccess/source/virtualmachine.cxx @@ -100,7 +100,7 @@ JNIEnv * VirtualMachine::attachThread(bool * pAttached) const JNIEnv * pEnv; jint n = m_pVm->GetEnv(reinterpret_cast< void ** >(&pEnv), m_nVersion); if (n != JNI_OK && n != JNI_EDETACHED) { - OSL_ENSURE(false, "JNI: GetEnv failed"); + OSL_FAIL("JNI: GetEnv failed"); } if (pEnv == 0) { @@ -119,7 +119,7 @@ void VirtualMachine::detachThread() const { #ifdef SOLAR_JAVA if (m_pVm->DetachCurrentThread() != JNI_OK) { - OSL_ENSURE(false, "JNI: DetachCurrentThread failed"); + OSL_FAIL("JNI: DetachCurrentThread failed"); } #endif } diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx index b34d486a4b2e..f3f64a806d5c 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx @@ -203,7 +203,7 @@ inline FileHandleGuard::~FileHandleGuard() SAL_THROW(()) { if (osl_closeFile(m_rHandle) != osl_File_E_None) { - OSL_ENSURE(false, "unexpected situation"); + OSL_FAIL("unexpected situation"); } } } diff --git a/remotebridges/source/factory/bridgefactory.cxx b/remotebridges/source/factory/bridgefactory.cxx index b6ef55d18a1c..fc5e2246d2ec 100644 --- a/remotebridges/source/factory/bridgefactory.cxx +++ b/remotebridges/source/factory/bridgefactory.cxx @@ -230,7 +230,7 @@ namespace remotebridges_factory } catch (rtl::MalformedUriException &) { - OSL_ENSURE(false, "MalformedUriException"); + OSL_FAIL("MalformedUriException"); } ServiceHashMap::iterator ii = m_mapProtocolToService.find( sProtocolName ); if( ii != m_mapProtocolToService.end() ) diff --git a/sal/qa/osl/socket/sockethelper.cxx b/sal/qa/osl/socket/sockethelper.cxx index c6ee81e2a363..35d650a42830 100644 --- a/sal/qa/osl/socket/sockethelper.cxx +++ b/sal/qa/osl/socket/sockethelper.cxx @@ -107,7 +107,7 @@ void printUString( const ::rtl::OUString & str, const char* msg) #else char hostname[255]; if (gethostname(hostname, 255) != 0) { - OSL_ENSURE( false, "#Error: gethostname failed." ); + OSL_FAIL( "#Error: gethostname failed." ); } struct hostent *hptr; diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx index 6b97a619b34a..0b9ad60dd358 100644 --- a/stoc/source/javavm/javavm.cxx +++ b/stoc/source/javavm/javavm.cxx @@ -643,7 +643,7 @@ extern "C" sal_Bool SAL_CALL component_writeInfo(void * pServiceManager, } catch (css::uno::Exception &) { - OSL_ENSURE(false, "com.sun.star.uno.Exception caught"); + OSL_FAIL("com.sun.star.uno.Exception caught"); } } return false; @@ -1421,7 +1421,7 @@ JavaVirtualMachine::~JavaVirtualMachine() } catch (css::uno::Exception &) { - OSL_ENSURE(false, "com.sun.star.uno.Exception caught"); + OSL_FAIL("com.sun.star.uno.Exception caught"); } if (m_xJavaConfiguration.is()) // We should never get here, but just in case... @@ -1431,7 +1431,7 @@ JavaVirtualMachine::~JavaVirtualMachine() } catch (css::uno::Exception &) { - OSL_ENSURE(false, "com.sun.star.uno.Exception caught"); + OSL_FAIL("com.sun.star.uno.Exception caught"); } } @@ -1658,12 +1658,11 @@ void JavaVirtualMachine::setINetSettingsInVM(bool set_reset) } catch (css::uno::RuntimeException &) { - OSL_ENSURE(false, "RuntimeException"); + OSL_FAIL("RuntimeException"); } catch (jvmaccess::VirtualMachine::AttachGuard::CreationException &) { - OSL_ENSURE(false, - "jvmaccess::VirtualMachine::AttachGuard::CreationException"); + OSL_FAIL("jvmaccess::VirtualMachine::AttachGuard::CreationException"); } } -- cgit v1.2.3