From 99ef7846544ea4548fb607df37aa0429d68c2ebe Mon Sep 17 00:00:00 2001 From: Chris Sherlock Date: Sun, 7 May 2017 08:35:34 +1000 Subject: tdf#43157: convert stoc from OSL_ASSERT to assert Change-Id: I7d1b2748a4f4afd873ee4d65d153c76b249507dd --- stoc/source/corereflection/crefl.cxx | 2 +- stoc/source/corereflection/criface.cxx | 6 +++--- stoc/source/implementationregistration/implreg.cxx | 2 +- stoc/source/implementationregistration/mergekeys.cxx | 2 +- stoc/source/invocation_adapterfactory/iafactory.cxx | 14 +++++++------- stoc/source/javavm/javavm.cxx | 8 ++++---- stoc/source/proxy_factory/proxyfac.cxx | 16 ++++++++-------- stoc/source/security/access_controller.cxx | 12 ++++++------ stoc/source/security/file_policy.cxx | 2 +- stoc/source/servicemanager/servicemanager.cxx | 6 +++--- stoc/source/uriproc/UriReference.cxx | 10 +++++----- .../UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx | 2 +- stoc/source/uriproc/VndSunStarPkgUrlReferenceFactory.cxx | 4 ++-- 13 files changed, 43 insertions(+), 43 deletions(-) (limited to 'stoc') diff --git a/stoc/source/corereflection/crefl.cxx b/stoc/source/corereflection/crefl.cxx index 434776be2abf..203128099d2c 100644 --- a/stoc/source/corereflection/crefl.cxx +++ b/stoc/source/corereflection/crefl.cxx @@ -242,7 +242,7 @@ Any IdlReflectionServiceImpl::getByHierarchicalName( const OUString & rName ) if (aRet.getValueTypeClass() == TypeClass_INTERFACE) { // type retrieved from tdmgr - OSL_ASSERT( (*o3tl::forceAccess>(aRet))->queryInterface( + assert( (*o3tl::forceAccess>(aRet))->queryInterface( cppu::UnoType::get()).hasValue() ); css::uno::Reference< css::reflection::XConstantTypeDescription > diff --git a/stoc/source/corereflection/criface.cxx b/stoc/source/corereflection/criface.cxx index d5a3a2192d60..7428221c97cb 100644 --- a/stoc/source/corereflection/criface.cxx +++ b/stoc/source/corereflection/criface.cxx @@ -139,7 +139,7 @@ Reference< XIdlClass > IdlAttributeFieldImpl::getDeclaringClass() { OUString aName(getAttributeTypeDescr()->aBase.aBase.pTypeName); sal_Int32 i = aName.indexOf(':'); - OSL_ASSERT(i >= 0); + assert(i >= 0); _xDeclClass = getReflection()->forName(aName.copy(0, i)); } } @@ -412,7 +412,7 @@ Reference< XIdlClass > IdlInterfaceMethodImpl::getDeclaringClass() { OUString aName(getMethodTypeDescr()->aBase.aBase.pTypeName); sal_Int32 i = aName.indexOf(':'); - OSL_ASSERT(i >= 0); + assert(i >= 0); _xDeclClass = getReflection()->forName(aName.copy(0, i)); } } @@ -755,7 +755,7 @@ Sequence< Reference< XIdlClass > > InterfaceIdlClassImpl::getSuperclasses() for (sal_Int32 i = 0; i < pType->nBaseTypes; ++i) { _xSuperClasses[i] = getReflection()->forType( &pType->ppBaseTypes[i]->aBase); - OSL_ASSERT(_xSuperClasses[i].is()); + assert(_xSuperClasses[i].is()); } } return Sequence< Reference< XIdlClass > >(_xSuperClasses); diff --git a/stoc/source/implementationregistration/implreg.cxx b/stoc/source/implementationregistration/implreg.cxx index d32de8ff99d6..2ecd6743ae74 100644 --- a/stoc/source/implementationregistration/implreg.cxx +++ b/stoc/source/implementationregistration/implreg.cxx @@ -1721,7 +1721,7 @@ Reference< XSimpleRegistry > ImplementationRegistration::createTemporarySimpleRe rSMgr->createInstanceWithContext( spool().com_sun_star_registry_SimpleRegistry, xCtx ), UNO_QUERY); - OSL_ASSERT( xReg.is() ); + assert( xReg.is() ); return xReg; } diff --git a/stoc/source/implementationregistration/mergekeys.cxx b/stoc/source/implementationregistration/mergekeys.cxx index df24ca697ec2..cffd43171bc7 100644 --- a/stoc/source/implementationregistration/mergekeys.cxx +++ b/stoc/source/implementationregistration/mergekeys.cxx @@ -89,7 +89,7 @@ static void mergeKeys( xDest->setStringListValue( xSource->getStringListValue() ); break; default: - OSL_ASSERT(false); + assert(false); break; } diff --git a/stoc/source/invocation_adapterfactory/iafactory.cxx b/stoc/source/invocation_adapterfactory/iafactory.cxx index b7b3620a5d61..d15e2951cf7c 100644 --- a/stoc/source/invocation_adapterfactory/iafactory.cxx +++ b/stoc/source/invocation_adapterfactory/iafactory.cxx @@ -191,10 +191,10 @@ inline void AdapterImpl::release() { t_ptr_map::iterator iFind( m_pFactory->m_receiver2adapters.find( m_key ) ); - OSL_ASSERT( m_pFactory->m_receiver2adapters.end() != iFind ); + assert( m_pFactory->m_receiver2adapters.end() != iFind ); t_ptr_set & adapter_set = iFind->second; if (adapter_set.erase( this ) != 1) { - OSL_ASSERT( false ); + assert( false ); } if (adapter_set.empty()) { @@ -260,7 +260,7 @@ bool AdapterImpl::coerce_assign( if (p_exc) // exception occurred { - OSL_ASSERT( + assert( p_exc->pType->eTypeClass == typelib_TypeClass_EXCEPTION ); if (typelib_typedescriptionreference_isAssignableFrom( cppu::UnoType::get().getTypeLibType(), p_exc->pType )) @@ -648,7 +648,7 @@ AdapterImpl::AdapterImpl( pInterface->m_pTypeDescr = nullptr; pTypes[nPos].getDescription( reinterpret_cast(&pInterface->m_pTypeDescr) ); - OSL_ASSERT( pInterface->m_pTypeDescr ); + assert( pInterface->m_pTypeDescr ); if (! pInterface->m_pTypeDescr) { for ( sal_Int32 n = 0; n < nPos; ++n ) @@ -665,7 +665,7 @@ AdapterImpl::AdapterImpl( // map receiver m_pReceiver = static_cast(m_pFactory->m_aCpp2Uno.mapInterface( xReceiver.get(), cppu::UnoType::get() )); - OSL_ASSERT( nullptr != m_pReceiver ); + assert( nullptr != m_pReceiver ); if (! m_pReceiver) { throw RuntimeException( "cannot map receiver!" ); @@ -699,7 +699,7 @@ FactoryImpl::FactoryImpl( Reference< XComponentContext > const & xContext ) UNO_QUERY_THROW ); m_pConverter = static_cast(m_aCpp2Uno.mapInterface( xConverter.get(), cppu::UnoType::get() )); - OSL_ASSERT( nullptr != m_pConverter ); + assert( nullptr != m_pConverter ); // some type info: // sequence< any > @@ -851,7 +851,7 @@ Reference< XInterface > FactoryImpl::createAdapter( m_aUno2Cpp.mapInterface( reinterpret_cast(&xRet), pUnoI, cppu::UnoType::get() ); that->release(); - OSL_ASSERT( xRet.is() ); + assert( xRet.is() ); if (! xRet.is()) { throw RuntimeException( "mapping UNO to C++ failed!" ); diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx index a4e9efe66e59..a46e9c858ac4 100644 --- a/stoc/source/javavm/javavm.cxx +++ b/stoc/source/javavm/javavm.cxx @@ -573,7 +573,7 @@ public: ~DetachCurrentThread() { if (m_jvm->DetachCurrentThread() != 0) { - OSL_ASSERT(false); + assert(false); } } @@ -823,7 +823,7 @@ JavaVirtualMachine::getJavaVM(css::uno::Sequence< sal_Int8 > const & rProcessId) case JFW_E_RUNNING_JVM: { //This service should make sure that we do not start java twice. - OSL_ASSERT(false); + assert(false); break; } case JFW_E_NEED_RESTART: @@ -884,12 +884,12 @@ JavaVirtualMachine::getJavaVM(css::uno::Sequence< sal_Int8 > const & rProcessId) } return css::uno::makeAny(reinterpret_cast< sal_IntPtr >(m_pJavaVm)); case RETURN_VIRTUALMACHINE: - OSL_ASSERT(sizeof (sal_Int64) >= sizeof (jvmaccess::VirtualMachine *)); + assert(sizeof (sal_Int64) >= sizeof (jvmaccess::VirtualMachine *)); return css::uno::makeAny( reinterpret_cast< sal_Int64 >( m_xUnoVirtualMachine->getVirtualMachine().get())); case RETURN_UNOVIRTUALMACHINE: - OSL_ASSERT(sizeof (sal_Int64) >= sizeof (jvmaccess::VirtualMachine *)); + assert(sizeof (sal_Int64) >= sizeof (jvmaccess::VirtualMachine *)); return css::uno::makeAny( reinterpret_cast< sal_Int64 >(m_xUnoVirtualMachine.get())); } diff --git a/stoc/source/proxy_factory/proxyfac.cxx b/stoc/source/proxy_factory/proxyfac.cxx index ea3c7479c21d..da3eb0b65c67 100644 --- a/stoc/source/proxy_factory/proxyfac.cxx +++ b/stoc/source/proxy_factory/proxyfac.cxx @@ -152,7 +152,7 @@ UnoInterfaceReference FactoryImpl::binuno_queryInterface( m_uno2cpp.get() ); uno_any_destruct( exc, nullptr ); ::cppu::throwException( cpp_exc ); - OSL_ASSERT( false ); // way of no return + assert( false ); // way of no return return UnoInterfaceReference(); // for dummy } } @@ -197,7 +197,7 @@ static void SAL_CALL binuno_proxy_free( (void) pEnv; // avoid warning about unused parameter binuno_Proxy * proxy = static_cast< binuno_Proxy * >( static_cast< uno_Interface * >( pProxy ) ); - OSL_ASSERT( proxy->m_root->m_factory->m_uno_env.get()->pExtEnv == pEnv ); + assert( proxy->m_root->m_factory->m_uno_env.get()->pExtEnv == pEnv ); delete proxy; } @@ -210,13 +210,13 @@ static void SAL_CALL binuno_proxy_acquire( uno_Interface * pUnoI ) // rebirth of zombie uno_ExtEnvironment * uno_env = that->m_root->m_factory->m_uno_env.get()->pExtEnv; - OSL_ASSERT( uno_env != nullptr ); + assert( uno_env != nullptr ); (*uno_env->registerProxyInterface)( uno_env, reinterpret_cast< void ** >( &pUnoI ), binuno_proxy_free, that->m_oid.pData, reinterpret_cast< typelib_InterfaceTypeDescription * >( that->m_typeDescr.get() ) ); - OSL_ASSERT( that == static_cast< binuno_Proxy * >( pUnoI ) ); + assert( that == static_cast< binuno_Proxy * >( pUnoI ) ); } } @@ -228,7 +228,7 @@ static void SAL_CALL binuno_proxy_release( uno_Interface * pUnoI ) { uno_ExtEnvironment * uno_env = that->m_root->m_factory->m_uno_env.get()->pExtEnv; - OSL_ASSERT( uno_env != nullptr ); + assert( uno_env != nullptr ); (*uno_env->revokeInterface)( uno_env, pUnoI ); } } @@ -319,14 +319,14 @@ Any ProxyRoot::queryAggregation( Type const & rType ) { Reference< XInterface > xProxy; uno_ExtEnvironment * cpp_env = m_factory->m_cpp_env.get()->pExtEnv; - OSL_ASSERT( cpp_env != nullptr ); + assert( cpp_env != nullptr ); // mind a new delegator, calculate current root: Reference< XInterface > xRoot( static_cast< OWeakObject * >(this), UNO_QUERY_THROW ); OUString oid; (*cpp_env->getObjectIdentifier)( cpp_env, &oid.pData, xRoot.get() ); - OSL_ASSERT( !oid.isEmpty() ); + assert( !oid.isEmpty() ); (*cpp_env->getRegisteredInterface)( cpp_env, reinterpret_cast< void ** >( &xProxy ), @@ -353,7 +353,7 @@ Any ProxyRoot::queryAggregation( Type const & rType ) SAL_NO_ACQUIRE ); uno_ExtEnvironment * uno_env = m_factory->m_uno_env.get()->pExtEnv; - OSL_ASSERT( uno_env != nullptr ); + assert( uno_env != nullptr ); (*uno_env->registerProxyInterface)( uno_env, reinterpret_cast< void ** >( &proxy.m_pUnoI ), binuno_proxy_free, oid.pData, diff --git a/stoc/source/security/access_controller.cxx b/stoc/source/security/access_controller.cxx index 6772d2ba2a8a..4d173df5df02 100644 --- a/stoc/source/security/access_controller.cxx +++ b/stoc/source/security/access_controller.cxx @@ -494,7 +494,7 @@ void AccessController::checkAndClearPostPoned() // check postponed permissions std::unique_ptr< t_rec_vec > rec( static_cast< t_rec_vec * >( m_rec.getData() ) ); m_rec.setData( nullptr ); // takeover ownership - OSL_ASSERT( rec.get() ); + assert( rec.get() ); if (rec.get()) { t_rec_vec const & vec = *rec.get(); @@ -502,20 +502,20 @@ void AccessController::checkAndClearPostPoned() { case SINGLE_USER: { - OSL_ASSERT( m_singleUser_init ); + assert( m_singleUser_init ); for (const auto & p : vec) { - OSL_ASSERT( m_singleUserId.equals( p.first ) ); + assert( m_singleUserId.equals( p.first ) ); m_singleUserPermissions.checkPermission( p.second ); } break; } case SINGLE_DEFAULT_USER: { - OSL_ASSERT( m_defaultPerm_init ); + assert( m_defaultPerm_init ); for (const auto & p : vec) { - OSL_ASSERT( p.first.isEmpty() ); // default-user + assert( p.first.isEmpty() ); // default-user m_defaultPermissions.checkPermission( p.second ); } break; @@ -530,7 +530,7 @@ void AccessController::checkAndClearPostPoned() MutexGuard guard( m_mutex ); pPermissions = m_user2permissions.lookup( p.first ); } - OSL_ASSERT( pPermissions ); + assert( pPermissions ); if (pPermissions) { pPermissions->checkPermission( p.second ); diff --git a/stoc/source/security/file_policy.cxx b/stoc/source/security/file_policy.cxx index 31bdcdbcc7c1..948260fb119f 100644 --- a/stoc/source/security/file_policy.cxx +++ b/stoc/source/security/file_policy.cxx @@ -351,7 +351,7 @@ PolicyReader::PolicyReader( OUString const & fileName, AccessControl & ac ) PolicyReader::~PolicyReader() { if ( ::osl_closeFile( m_file ) != osl_File_E_None ) { - OSL_ASSERT( false ); + assert(false); } } diff --git a/stoc/source/servicemanager/servicemanager.cxx b/stoc/source/servicemanager/servicemanager.cxx index eb5685a29b76..d580e1461052 100644 --- a/stoc/source/servicemanager/servicemanager.cxx +++ b/stoc/source/servicemanager/servicemanager.cxx @@ -671,7 +671,7 @@ void OServiceManager::disposing() m_xContext.clear(); // not only the Event should hold the object - OSL_ASSERT( m_refCount != 1 ); + assert( m_refCount != 1 ); } // XPropertySet @@ -806,7 +806,7 @@ Reference< XInterface > OServiceManager::createInstanceWithContext( check_undisposed(); #if OSL_DEBUG_LEVEL > 0 Reference< beans::XPropertySet > xProps( xContext->getServiceManager(), UNO_QUERY ); - OSL_ASSERT( xProps.is() ); + assert( xProps.is() ); if (xProps.is()) { Reference< XComponentContext > xDefContext; @@ -860,7 +860,7 @@ Reference< XInterface > OServiceManager::createInstanceWithArgumentsAndContext( check_undisposed(); #if OSL_DEBUG_LEVEL > 0 Reference< beans::XPropertySet > xProps( xContext->getServiceManager(), UNO_QUERY ); - OSL_ASSERT( xProps.is() ); + assert( xProps.is() ); if (xProps.is()) { Reference< XComponentContext > xDefContext; diff --git a/stoc/source/uriproc/UriReference.cxx b/stoc/source/uriproc/UriReference.cxx index 2baa1f3b9b20..20f4c4ffb6b9 100644 --- a/stoc/source/uriproc/UriReference.cxx +++ b/stoc/source/uriproc/UriReference.cxx @@ -42,11 +42,11 @@ UriReference::UriReference( m_hasQuery(bHasQuery), m_hasFragment(false) { - OSL_ASSERT(!scheme.isEmpty() || bIsHierarchical); - OSL_ASSERT(!bHasAuthority || bIsHierarchical); - OSL_ASSERT(authority.isEmpty() || bHasAuthority); - OSL_ASSERT(!bHasQuery || bIsHierarchical); - OSL_ASSERT(query.isEmpty() || bHasQuery); + assert(!scheme.isEmpty() || bIsHierarchical); + assert(!bHasAuthority || bIsHierarchical); + assert(authority.isEmpty() || bHasAuthority); + assert(!bHasQuery || bIsHierarchical); + assert(query.isEmpty() || bHasQuery); } UriReference::~UriReference() {} diff --git a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx index d246f07c9221..231c31816df1 100644 --- a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx +++ b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx @@ -130,7 +130,7 @@ private: OUString UrlReference::expand( css::uno::Reference< css::util::XMacroExpander > const & expander) { - OSL_ASSERT(expander.is()); + assert(expander.is()); return expander->expandMacros( ::rtl::Uri::decode( getPath(), ::rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8)); diff --git a/stoc/source/uriproc/VndSunStarPkgUrlReferenceFactory.cxx b/stoc/source/uriproc/VndSunStarPkgUrlReferenceFactory.cxx index dc7fbf0015ff..757bbf719533 100644 --- a/stoc/source/uriproc/VndSunStarPkgUrlReferenceFactory.cxx +++ b/stoc/source/uriproc/VndSunStarPkgUrlReferenceFactory.cxx @@ -91,7 +91,7 @@ css::uno::Reference< css::uri::XUriReference > Factory::createVndSunStarPkgUrlReference( css::uno::Reference< css::uri::XUriReference > const & authority) { - OSL_ASSERT(authority.is()); + assert(authority.is()); if (authority->isAbsolute() && !authority->hasFragment()) { OUStringBuffer buf; buf.append("vnd.sun.star.pkg://"); @@ -102,7 +102,7 @@ Factory::createVndSunStarPkgUrlReference( css::uno::Reference< css::uri::XUriReference > uriRef( css::uri::UriReferenceFactory::create(m_context)->parse( buf.makeStringAndClear())); - OSL_ASSERT(uriRef.is()); + assert(uriRef.is()); return uriRef; } else { return css::uno::Reference< css::uri::XUriReference >(); -- cgit