diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2011-11-28 21:11:28 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2011-11-28 22:05:46 +0100 |
commit | ebdbd2b578c970694597dc163125842e9073bf6c (patch) | |
tree | 3a5e3dace480276cf6417cfe81f528d88f5f3365 /binaryurp/source | |
parent | 06a075ca72a5f7c206701433345a7a5542f838f7 (diff) |
Adapted to new assertion/logging mechanisms.
Diffstat (limited to 'binaryurp/source')
-rw-r--r-- | binaryurp/source/binaryany.cxx | 9 | ||||
-rw-r--r-- | binaryurp/source/bridge.cxx | 101 | ||||
-rw-r--r-- | binaryurp/source/bridgefactory.cxx | 6 | ||||
-rw-r--r-- | binaryurp/source/cache.hxx | 6 | ||||
-rw-r--r-- | binaryurp/source/lessoperators.cxx | 4 | ||||
-rw-r--r-- | binaryurp/source/marshal.cxx | 22 | ||||
-rw-r--r-- | binaryurp/source/proxy.cxx | 25 | ||||
-rw-r--r-- | binaryurp/source/reader.cxx | 36 | ||||
-rw-r--r-- | binaryurp/source/unmarshal.cxx | 13 |
9 files changed, 113 insertions, 109 deletions
diff --git a/binaryurp/source/binaryany.cxx b/binaryurp/source/binaryany.cxx index c8c8a4c63a3f..0c510f65a775 100644 --- a/binaryurp/source/binaryany.cxx +++ b/binaryurp/source/binaryany.cxx @@ -28,7 +28,8 @@ #include "sal/config.h" -#include "osl/diagnose.h" +#include <cassert> + #include "typelib/typeclass.h" #include "typelib/typedescription.hxx" #include "uno/any2.h" @@ -50,12 +51,12 @@ BinaryAny::BinaryAny() throw () { BinaryAny::BinaryAny(css::uno::TypeDescription const & type, void * value) throw () { - OSL_ASSERT(type.is()); + assert(type.is()); uno_any_construct(&data_, value, type.get(), 0); } BinaryAny::BinaryAny(uno_Any const & raw) throw () { - OSL_ASSERT(raw.pType != 0); + assert(raw.pType != 0); data_.pType = raw.pType; typelib_typedescriptionreference_acquire(data_.pType); data_.pData = raw.pData == &raw.pReserved ? &data_.pReserved : raw.pData; @@ -88,7 +89,7 @@ css::uno::TypeDescription BinaryAny::getType() const throw () { void * BinaryAny::getValue(css::uno::TypeDescription const & type) const throw () { - OSL_ASSERT( + assert( type.is() && (type.get()->eTypeClass == typelib_TypeClass_ANY || type.equals(css::uno::TypeDescription(data_.pType)))); diff --git a/binaryurp/source/bridge.cxx b/binaryurp/source/bridge.cxx index b4fced38d78d..4852961ef2c0 100644 --- a/binaryurp/source/bridge.cxx +++ b/binaryurp/source/bridge.cxx @@ -29,6 +29,7 @@ #include "sal/config.h" #include <algorithm> +#include <cassert> #include <cstddef> #include <limits> #include <memory> @@ -50,16 +51,16 @@ #include "com/sun/star/uno/XInterface.hpp" #include "cppuhelper/exc_hlp.hxx" #include "cppuhelper/weak.hxx" -#include "osl/diagnose.h" #include "osl/mutex.hxx" #include "osl/thread.hxx" #include "rtl/byteseq.hxx" +#include "rtl/oustringostreaminserter.hxx" #include "rtl/random.h" #include "rtl/ref.hxx" -#include "rtl/textenc.h" #include "rtl/ustrbuf.hxx" #include "rtl/ustring.h" #include "rtl/ustring.hxx" +#include "sal/log.hxx" #include "sal/types.h" #include "typelib/typeclass.h" #include "typelib/typedescription.h" @@ -92,14 +93,20 @@ sal_Int32 random() { return n; } +rtl::OUString toString(css::uno::TypeDescription const & type) { + typelib_TypeDescription * d = type.get(); + assert(d != 0 && d->pTypeName != 0); + return rtl::OUString(d->pTypeName); +} + extern "C" void SAL_CALL freeProxyCallback(uno_ExtEnvironment *, void * pProxy) { - OSL_ASSERT(pProxy != 0); + assert(pProxy != 0); static_cast< Proxy * >(pProxy)->do_free(); } void joinThread(osl::Thread * thread) { - OSL_ASSERT(thread != 0); + assert(thread != 0); if (thread->getIdentifier() != osl::Thread::getCurrentIdentifier()) { thread->join(); } @@ -210,7 +217,7 @@ Bridge::Bridge( normalCall_(false), activeCalls_(0), terminated_(false), mode_(MODE_REQUESTED) { - OSL_ASSERT(factory.is() && connection.is()); + assert(factory.is() && connection.is()); if (!binaryUno_.is()) { throw css::uno::RuntimeException( rtl::OUString( @@ -227,9 +234,9 @@ Bridge::Bridge( } void Bridge::start() { - OSL_ASSERT(threadPool_ == 0 && !writer_.is() && !reader_.is()); + assert(threadPool_ == 0 && !writer_.is() && !reader_.is()); threadPool_ = uno_threadpool_create(); - OSL_ASSERT(threadPool_ != 0); + assert(threadPool_ != 0); writer_.set(new Writer(this)); writer_->create(); reader_.set(new Reader(this)); @@ -253,15 +260,13 @@ void Bridge::terminate() { try { connection_->close(); } catch (css::io::IOException & e) { - OSL_TRACE( - OSL_LOG_PREFIX "caught IO exception '%s'", - rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr()); + SAL_INFO("binaryurp", "caught IO exception '" << e.Message << '\''); } - OSL_ASSERT(w.is()); + assert(w.is()); w->stop(); joinThread(r.get()); joinThread(w.get()); - OSL_ASSERT(threadPool_ != 0); + assert(threadPool_ != 0); uno_threadpool_dispose(threadPool_); Stubs s; { @@ -270,6 +275,10 @@ void Bridge::terminate() { } for (Stubs::iterator i(s.begin()); i != s.end(); ++i) { for (Stub::iterator j(i->second.begin()); j != i->second.end(); ++j) { + SAL_INFO( + "binaryurp", + "stub '" << i->first << "', '" << toString(j->first) + << "' still mapped at Bridge::terminate"); binaryUno_.get()->pExtEnv->revokeInterface( binaryUno_.get()->pExtEnv, j->second.object.get()); } @@ -281,10 +290,8 @@ void Bridge::terminate() { css::lang::EventObject( static_cast< cppu::OWeakObject * >(this))); } catch (css::uno::RuntimeException & e) { - OSL_TRACE( - OSL_LOG_PREFIX "caught runtime exception '%s'", - rtl::OUStringToOString( - e.Message, RTL_TEXTENCODING_UTF8).getStr()); + SAL_WARN( + "binaryurp", "caught runtime exception '" << e.Message << '\''); } } } @@ -317,7 +324,7 @@ BinaryAny Bridge::mapCppToBinaryAny(css::uno::Any const & cppAny) { } uno_ThreadPool Bridge::getThreadPool() const { - OSL_ASSERT(threadPool_ != 0); + assert(threadPool_ != 0); return threadPool_; } @@ -330,14 +337,14 @@ rtl::Reference< Writer > Bridge::getWriter() { "Binary URP bridge already disposed")), static_cast< cppu::OWeakObject * >(this)); } - OSL_ASSERT(writer_.is()); + assert(writer_.is()); return writer_; } css::uno::UnoInterfaceReference Bridge::registerIncomingInterface( rtl::OUString const & oid, css::uno::TypeDescription const & type) { - OSL_ASSERT(type.is()); + assert(type.is()); if (oid.getLength() == 0) { return css::uno::UnoInterfaceReference(); } @@ -353,8 +360,7 @@ css::uno::UnoInterfaceReference Bridge::registerIncomingInterface( obj.set(new Proxy(this, oid, type), SAL_NO_ACQUIRE); { osl::MutexGuard g(mutex_); - OSL_ASSERT( - proxies_ < std::numeric_limits< std::size_t >::max()); + assert(proxies_ < std::numeric_limits< std::size_t >::max()); ++proxies_; } binaryUno_.get()->pExtEnv->registerProxyInterface( @@ -372,7 +378,7 @@ rtl::OUString Bridge::registerOutgoingInterface( css::uno::UnoInterfaceReference const & object, css::uno::TypeDescription const & type) { - OSL_ASSERT(type.is()); + assert(type.is()); if (!object.is()) { return rtl::OUString(); } @@ -393,7 +399,7 @@ rtl::OUString Bridge::registerOutgoingInterface( i = stubs_.insert(Stubs::value_type(oid, Stub())).first; std::swap(i->second, newStub); j = i->second.find(type); - OSL_ASSERT(j != i->second.end()); + assert(j != i->second.end()); } j->second.object = object; j->second.references = 1; @@ -404,7 +410,7 @@ rtl::OUString Bridge::registerOutgoingInterface( reinterpret_cast< typelib_InterfaceTypeDescription * >( type.get())); } else { - OSL_ASSERT(stub != &newStub); + assert(stub != &newStub); if (j->second.references == SAL_MAX_UINT32) { throw css::uno::RuntimeException( rtl::OUString( @@ -421,7 +427,7 @@ rtl::OUString Bridge::registerOutgoingInterface( css::uno::UnoInterfaceReference Bridge::findStub( rtl::OUString const & oid, css::uno::TypeDescription const & type) { - OSL_ASSERT(oid.getLength() != 0 && type.is()); + assert(oid.getLength() != 0 && type.is()); osl::MutexGuard g(mutex_); Stubs::iterator i(stubs_.find(oid)); if (i != stubs_.end()) { @@ -443,7 +449,7 @@ css::uno::UnoInterfaceReference Bridge::findStub( void Bridge::releaseStub( rtl::OUString const & oid, css::uno::TypeDescription const & type) { - OSL_ASSERT(oid.getLength() != 0 && type.is()); + assert(oid.getLength() != 0 && type.is()); css::uno::UnoInterfaceReference obj; bool unused; { @@ -462,7 +468,7 @@ void Bridge::releaseStub( RTL_CONSTASCII_USTRINGPARAM("URP: release unknown stub")), css::uno::Reference< css::uno::XInterface >()); } - OSL_ASSERT(j->second.references > 0); + assert(j->second.references > 0); --j->second.references; if (j->second.references == 0) { obj = j->second.object; @@ -488,7 +494,7 @@ void Bridge::resurrectProxy(Proxy & proxy) { proxy.getOid().pData, reinterpret_cast< typelib_InterfaceTypeDescription * >( proxy.getType().get())); - OSL_ASSERT(p == &proxy); + assert(p == &proxy); } void Bridge::revokeProxy(Proxy & proxy) { @@ -500,16 +506,15 @@ void Bridge::freeProxy(Proxy & proxy) { try { makeReleaseCall(proxy.getOid(), proxy.getType()); } catch (css::uno::RuntimeException & e) { - OSL_TRACE( - OSL_LOG_PREFIX "caught runtime exception '%s'", - rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr()); + SAL_WARN( + "binaryurp", "caught runtime exception '" << e.Message << '\''); } catch (std::exception & e) { - OSL_TRACE(OSL_LOG_PREFIX "caught C++ exception '%s'", e.what()); + SAL_WARN("binaryurp", "caught C++ exception '" << e.what() << '\''); } bool unused; { osl::MutexGuard g(mutex_); - OSL_ASSERT(proxies_ > 0); + assert(proxies_ > 0); --proxies_; unused = becameUnused(); } @@ -518,7 +523,7 @@ void Bridge::freeProxy(Proxy & proxy) { void Bridge::incrementCalls(bool normalCall) throw () { osl::MutexGuard g(mutex_); - OSL_ASSERT(calls_ < std::numeric_limits< std::size_t >::max()); + assert(calls_ < std::numeric_limits< std::size_t >::max()); ++calls_; normalCall_ |= normalCall; } @@ -527,7 +532,7 @@ void Bridge::decrementCalls() { bool unused; { osl::MutexGuard g(mutex_); - OSL_ASSERT(calls_ > 0); + assert(calls_ > 0); --calls_; unused = becameUnused(); } @@ -536,7 +541,7 @@ void Bridge::decrementCalls() { void Bridge::incrementActiveCalls() throw () { osl::MutexGuard g(mutex_); - OSL_ASSERT( + assert( activeCalls_ <= calls_ && activeCalls_ < std::numeric_limits< std::size_t >::max()); ++activeCalls_; @@ -545,7 +550,7 @@ void Bridge::incrementActiveCalls() throw () { void Bridge::decrementActiveCalls() throw () { osl::MutexGuard g(mutex_); - OSL_ASSERT(activeCalls_ <= calls_ && activeCalls_ > 0); + assert(activeCalls_ <= calls_ && activeCalls_ > 0); --activeCalls_; if (activeCalls_ == 0) { passive_.set(); @@ -590,7 +595,7 @@ bool Bridge::makeCall( } void Bridge::sendRequestChangeRequest() { - OSL_ASSERT(mode_ == MODE_REQUESTED); + assert(mode_ == MODE_REQUESTED); random_ = random(); std::vector< BinaryAny > a; a.push_back( @@ -622,7 +627,7 @@ void Bridge::handleRequestChangeReply( mode_ = MODE_WAIT; break; default: - OSL_ASSERT(false); // this cannot happen + assert(false); // this cannot happen break; } if (n != exp) { @@ -644,7 +649,7 @@ void Bridge::handleRequestChangeReply( sendCommitChangeRequest(); break; default: - OSL_ASSERT(false); // this cannot happen + assert(false); // this cannot happen break; } } @@ -661,7 +666,7 @@ void Bridge::handleCommitChangeReply( if (ccMode) { setCurrentContextMode(); } - OSL_ASSERT(mode_ == MODE_REQUESTED || mode_ == MODE_REPLY_1); + assert(mode_ == MODE_REQUESTED || mode_ == MODE_REPLY_1); mode_ = MODE_NORMAL; getWriter()->unblock(); decrementCalls(); @@ -670,7 +675,7 @@ void Bridge::handleCommitChangeReply( void Bridge::handleRequestChangeRequest( rtl::ByteSequence const & tid, std::vector< BinaryAny > const & inArguments) { - OSL_ASSERT(inArguments.size() == 1); + assert(inArguments.size() == 1); switch (mode_) { case MODE_REQUESTED: { @@ -726,9 +731,11 @@ void Bridge::handleCommitChangeRequest( bool ccMode = false; bool exc = false; BinaryAny ret; - OSL_ASSERT(inArguments.size() == 1); + assert(inArguments.size() == 1); css::uno::Sequence< css::bridge::ProtocolProperty > s; - OSL_VERIFY(mapBinaryToCppAny(inArguments[0]) >>= s); + bool ok = (mapBinaryToCppAny(inArguments[0]) >>= s); + assert(ok); + (void) ok; // avoid warnings for (sal_Int32 i = 0; i != s.getLength(); ++i) { if (s[i].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("CurrentContext"))) @@ -874,7 +881,7 @@ void Bridge::addEventListener( css::uno::Reference< css::lang::XEventListener > const & xListener) throw (css::uno::RuntimeException) { - OSL_ASSERT(xListener.is()); + assert(xListener.is()); { osl::MutexGuard g(mutex_); if (!terminated_) { @@ -899,7 +906,7 @@ void Bridge::removeEventListener( } void Bridge::sendCommitChangeRequest() { - OSL_ASSERT(mode_ == MODE_REQUESTED || mode_ == MODE_REPLY_1); + assert(mode_ == MODE_REQUESTED || mode_ == MODE_REPLY_1); css::uno::Sequence< css::bridge::ProtocolProperty > s(1); s[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CurrentContext")); std::vector< BinaryAny > a; @@ -910,7 +917,7 @@ void Bridge::sendCommitChangeRequest() { void Bridge::sendProtPropRequest( OutgoingRequest::Kind kind, std::vector< BinaryAny > const & inArguments) { - OSL_ASSERT( + assert( kind == OutgoingRequest::KIND_REQUEST_CHANGE || kind == OutgoingRequest::KIND_COMMIT_CHANGE); incrementCalls(false); diff --git a/binaryurp/source/bridgefactory.cxx b/binaryurp/source/bridgefactory.cxx index 9421371c5149..5c9105585916 100644 --- a/binaryurp/source/bridgefactory.cxx +++ b/binaryurp/source/bridgefactory.cxx @@ -29,6 +29,7 @@ #include "sal/config.h" #include <algorithm> +#include <cassert> #include "com/sun/star/connection/XConnection.hpp" #include "com/sun/star/uno/Exception.hpp" @@ -38,7 +39,6 @@ #include "com/sun/star/uno/XInterface.hpp" #include "cppuhelper/factory.hxx" #include "cppuhelper/implementationentry.hxx" -#include "osl/diagnose.h" #include "rtl/ref.hxx" #include "sal/types.h" #include "uno/lbnames.h" @@ -77,7 +77,7 @@ BridgeFactory::static_getSupportedServiceNames() { void BridgeFactory::removeBridge( css::uno::Reference< css::bridge::XBridge > const & bridge) { - OSL_ASSERT(bridge.is()); + assert(bridge.is()); rtl::OUString n(bridge->getName()); osl::MutexGuard g(*this); if (n.getLength() == 0) { @@ -98,7 +98,7 @@ BridgeFactory::BridgeFactory( css::uno::Reference< css::uno::XComponentContext > const & context): BridgeFactoryBase(*static_cast< osl::Mutex * >(this)), context_(context) { - OSL_ASSERT(context.is()); + assert(context.is()); } BridgeFactory::~BridgeFactory() {} diff --git a/binaryurp/source/cache.hxx b/binaryurp/source/cache.hxx index 8a4a4b5789d6..6108d325e680 100644 --- a/binaryurp/source/cache.hxx +++ b/binaryurp/source/cache.hxx @@ -31,11 +31,11 @@ #include "sal/config.h" +#include <cassert> #include <cstddef> #include <map> #include "boost/noncopyable.hpp" -#include "osl/diagnose.h" #include "sal/types.h" namespace binaryurp { @@ -51,11 +51,11 @@ public: explicit Cache(std::size_t size): size_(size), first_(map_.end()), last_(map_.end()) { - OSL_ASSERT(size < cache::ignore); + assert(size < cache::ignore); } sal_uInt16 add(T const & content, bool * found) { - OSL_ASSERT(found != 0); + assert(found != 0); typename Map::iterator i(map_.find(content)); *found = i != map_.end(); if (i == map_.end()) { diff --git a/binaryurp/source/lessoperators.cxx b/binaryurp/source/lessoperators.cxx index 316b9d1230e1..38270fa9ccb9 100644 --- a/binaryurp/source/lessoperators.cxx +++ b/binaryurp/source/lessoperators.cxx @@ -29,8 +29,8 @@ #include "sal/config.h" #include <algorithm> +#include <cassert> -#include "osl/diagnose.h" #include "rtl/byteseq.hxx" #include "rtl/ustring.hxx" #include "sal/types.h" @@ -42,7 +42,7 @@ namespace com { namespace sun { namespace star { namespace uno { bool operator <(TypeDescription const & left, TypeDescription const & right) { - OSL_ASSERT(left.is() && right.is()); + assert(left.is() && right.is()); typelib_TypeClass tc1 = left.get()->eTypeClass; typelib_TypeClass tc2 = right.get()->eTypeClass; return tc1 < tc2 || diff --git a/binaryurp/source/marshal.cxx b/binaryurp/source/marshal.cxx index e679ee1dd86e..1bdcba3d153e 100644 --- a/binaryurp/source/marshal.cxx +++ b/binaryurp/source/marshal.cxx @@ -28,6 +28,7 @@ #include "sal/config.h" +#include <cassert> #include <vector> #include "boost/noncopyable.hpp" @@ -36,7 +37,6 @@ #include "com/sun/star/uno/Sequence.hxx" #include "com/sun/star/uno/XInterface.hpp" #include "cppu/unotype.hxx" -#include "osl/diagnose.h" #include "rtl/byteseq.hxx" #include "rtl/string.hxx" #include "rtl/textcvt.h" @@ -84,7 +84,7 @@ void writeCompressed(std::vector< unsigned char > * buffer, sal_uInt32 value) { void writeString( std::vector< unsigned char > * buffer, rtl::OUString const & value) { - OSL_ASSERT(buffer != 0); + assert(buffer != 0); rtl::OString v; if (!value.convertToString( &v, RTL_TEXTENCODING_UTF8, @@ -106,13 +106,13 @@ void writeString( Marshal::Marshal(rtl::Reference< Bridge > const & bridge, WriterState & state): bridge_(bridge), state_(state) { - OSL_ASSERT(bridge.is()); + assert(bridge.is()); } Marshal::~Marshal() {} void Marshal::write8(std::vector< unsigned char > * buffer, sal_uInt8 value) { - OSL_ASSERT(buffer != 0); + assert(buffer != 0); buffer->push_back(value); } @@ -132,7 +132,7 @@ void Marshal::writeValue( std::vector< unsigned char > * buffer, css::uno::TypeDescription const & type, BinaryAny const & value) { - OSL_ASSERT( + assert( type.is() && (type.get()->eTypeClass == typelib_TypeClass_ANY || value.getType().equals(type))); @@ -144,7 +144,7 @@ void Marshal::writeType( css::uno::TypeDescription const & value) { value.makeComplete(); - OSL_ASSERT(value.is()); + assert(value.is()); typelib_TypeClass tc = value.get()->eTypeClass; if (tc <= typelib_TypeClass_ANY) { write8(buffer, static_cast< sal_uInt8 >(tc)); @@ -202,13 +202,13 @@ void Marshal::writeValue( std::vector< unsigned char > * buffer, css::uno::TypeDescription const & type, void const * value) { - OSL_ASSERT(buffer != 0 && type.is()); + assert(buffer != 0 && type.is()); type.makeComplete(); switch (type.get()->eTypeClass) { case typelib_TypeClass_VOID: break; case typelib_TypeClass_BOOLEAN: - OSL_ASSERT(*static_cast< sal_uInt8 const * >(value) <= 1); + assert(*static_cast< sal_uInt8 const * >(value) <= 1); // fall through case typelib_TypeClass_BYTE: write8(buffer, *static_cast< sal_uInt8 const * >(value)); @@ -257,7 +257,7 @@ void Marshal::writeValue( reinterpret_cast< typelib_IndirectTypeDescription * >( type.get())-> pType); - OSL_ASSERT(ctd.is()); + assert(ctd.is()); if (ctd.get()->eTypeClass == typelib_TypeClass_BYTE) { buffer->insert( buffer->end(), p->elements, p->elements + p->nElements); @@ -281,7 +281,7 @@ void Marshal::writeValue( type)); break; default: - OSL_ASSERT(false); // this cannot happen + assert(false); // this cannot happen break; } } @@ -290,7 +290,7 @@ void Marshal::writeMemberValues( std::vector< unsigned char > * buffer, css::uno::TypeDescription const & type, void const * aggregateValue) { - OSL_ASSERT( + assert( type.is() && (type.get()->eTypeClass == typelib_TypeClass_STRUCT || type.get()->eTypeClass == typelib_TypeClass_EXCEPTION) && diff --git a/binaryurp/source/proxy.cxx b/binaryurp/source/proxy.cxx index 3d97e19e0530..75cca80f55c1 100644 --- a/binaryurp/source/proxy.cxx +++ b/binaryurp/source/proxy.cxx @@ -28,11 +28,11 @@ #include "sal/config.h" +#include <cassert> #include <exception> #include <vector> #include "cppuhelper/exc_hlp.hxx" -#include "osl/diagnose.h" #include "rtl/ref.hxx" #include "rtl/ustring.hxx" #include "sal/types.h" @@ -53,12 +53,12 @@ namespace { namespace css = com::sun::star; extern "C" void SAL_CALL proxy_acquireInterface(uno_Interface * pInterface) { - OSL_ASSERT(pInterface != 0); + assert(pInterface != 0); static_cast< Proxy * >(pInterface)->do_acquire(); } extern "C" void SAL_CALL proxy_releaseInterface(uno_Interface * pInterface) { - OSL_ASSERT(pInterface != 0); + assert(pInterface != 0); static_cast< Proxy * >(pInterface)->do_release(); } @@ -66,7 +66,7 @@ extern "C" void SAL_CALL proxy_dispatchInterface( uno_Interface * pUnoI, typelib_TypeDescription const * pMemberType, void * pReturn, void ** pArgs, uno_Any ** ppException) { - OSL_ASSERT(pUnoI != 0); + assert(pUnoI != 0); static_cast< Proxy * >(pUnoI)->do_dispatch( pMemberType, pReturn, pArgs, ppException); } @@ -78,7 +78,7 @@ Proxy::Proxy( css::uno::TypeDescription const & type): bridge_(bridge), oid_(oid), type_(type), references_(1) { - OSL_ASSERT(bridge.is()); + assert(bridge.is()); acquire = &proxy_acquireInterface; release = &proxy_releaseInterface; pDispatcher = &proxy_dispatchInterface; @@ -139,7 +139,7 @@ bool Proxy::isProxy( rtl::Reference< Bridge > const & bridge, css::uno::UnoInterfaceReference const & object, rtl::OUString * oid) { - OSL_ASSERT(object.is()); + assert(object.is()); return object.m_pUnoI->acquire == &proxy_acquireInterface && static_cast< Proxy * >(object.m_pUnoI)->isProxy(bridge, oid); } @@ -151,7 +151,7 @@ void Proxy::do_dispatch_throw( void ** arguments, uno_Any ** exception) const { //TODO: Optimize queryInterface: - OSL_ASSERT(member != 0); + assert(member != 0); bool setter = false; std::vector< BinaryAny > inArgs; switch (member->eTypeClass) { @@ -184,7 +184,7 @@ void Proxy::do_dispatch_throw( break; } default: - OSL_ASSERT(false); // this cannot happen + assert(false); // this cannot happen break; } BinaryAny ret; @@ -195,8 +195,7 @@ void Proxy::do_dispatch_throw( const_cast< typelib_TypeDescription * >(member)), setter, inArgs, &ret, &outArgs)) { - OSL_ASSERT( - ret.getType().get()->eTypeClass == typelib_TypeClass_EXCEPTION); + assert(ret.getType().get()->eTypeClass == typelib_TypeClass_EXCEPTION); uno_any_construct( *exception, ret.getValue(ret.getType()), ret.getType().get(), 0); } else { @@ -235,11 +234,11 @@ void Proxy::do_dispatch_throw( } } } - OSL_ASSERT(i == outArgs.end()); + assert(i == outArgs.end()); break; } default: - OSL_ASSERT(false); // this cannot happen + assert(false); // this cannot happen break; } *exception = 0; @@ -249,7 +248,7 @@ void Proxy::do_dispatch_throw( bool Proxy::isProxy( rtl::Reference< Bridge > const & bridge, rtl::OUString * oid) const { - OSL_ASSERT(oid != 0); + assert(oid != 0); if (bridge == bridge_) { *oid = oid_; return true; diff --git a/binaryurp/source/reader.cxx b/binaryurp/source/reader.cxx index b304dbee4942..c151e985a629 100644 --- a/binaryurp/source/reader.cxx +++ b/binaryurp/source/reader.cxx @@ -28,6 +28,7 @@ #include "sal/config.h" +#include <cassert> #include <exception> #include <memory> #include <vector> @@ -43,12 +44,11 @@ #include "com/sun/star/uno/XCurrentContext.hpp" #include "com/sun/star/uno/XInterface.hpp" #include "cppu/unotype.hxx" -#include "osl/diagnose.h" #include "rtl/byteseq.h" -#include "rtl/string.h" -#include "rtl/textenc.h" +#include "rtl/oustringostreaminserter.hxx" #include "rtl/ustring.h" #include "rtl/ustring.hxx" +#include "sal/log.hxx" #include "sal/types.h" #include "typelib/typeclass.h" #include "typelib/typedescription.h" @@ -76,7 +76,7 @@ css::uno::Sequence< sal_Int8 > read( css::uno::Reference< css::connection::XConnection > const & connection, sal_uInt32 size, bool eofOk) { - OSL_ASSERT(connection.is()); + assert(connection.is()); if (size > SAL_MAX_INT32) { throw css::uno::RuntimeException( rtl::OUString( @@ -96,12 +96,12 @@ css::uno::Sequence< sal_Int8 > read( "binaryurp::Reader: premature end of input")), css::uno::Reference< css::uno::XInterface >()); } - OSL_ASSERT(buf.getLength() == static_cast< sal_Int32 >(size)); + assert(buf.getLength() == static_cast< sal_Int32 >(size)); return buf; } extern "C" void SAL_CALL request(void * pThreadSpecificData) { - OSL_ASSERT(pThreadSpecificData != 0); + assert(pThreadSpecificData != 0); boost::scoped_ptr< IncomingRequest >( static_cast< IncomingRequest * >(pThreadSpecificData))-> execute(); @@ -110,7 +110,7 @@ extern "C" void SAL_CALL request(void * pThreadSpecificData) { } Reader::Reader(rtl::Reference< Bridge > const & bridge): bridge_(bridge) { - OSL_ASSERT(bridge.is()); + assert(bridge.is()); acquire(); } @@ -146,11 +146,9 @@ void Reader::run() { block.done(); } } catch (css::uno::Exception & e) { - OSL_TRACE( - OSL_LOG_PREFIX "caught UNO exception '%s'", - rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr()); + SAL_WARN("binaryurp", "caught UNO exception '" << e.Message << '\''); } catch (std::exception & e) { - OSL_TRACE(OSL_LOG_PREFIX "caught C++ exception '%s'", e.what()); + SAL_WARN("binaryurp", "caught C++ exception '" << e.what() << '\''); } bridge_->terminate(); } @@ -259,7 +257,7 @@ void Reader::readMessage(Unmarshal & unmarshal) { sal_Int32 memberId = itd->pMapFunctionIndexToMemberIndex[functionId]; css::uno::TypeDescription memberTd(itd->ppAllMembers[memberId]); memberTd.makeComplete(); - OSL_ASSERT(memberTd.is()); + assert(memberTd.is()); bool protProps = bridge_->isProtocolPropertiesRequest(oid, type); bool ccMode = !protProps && functionId != SPECIAL_FUNCTION_ID_RELEASE && bridge_->isCurrentContextMode(); @@ -323,7 +321,7 @@ void Reader::readMessage(Unmarshal & unmarshal) { break; } default: - OSL_ASSERT(false); // this cannot happen + assert(false); // this cannot happen break; } bridge_->incrementCalls( @@ -350,7 +348,7 @@ void Reader::readMessage(Unmarshal & unmarshal) { case SPECIAL_FUNCTION_ID_QUERY_INTERFACE: obj = bridge_->findStub(oid, type); if (!obj.is()) { - OSL_ASSERT( + assert( inArgs.size() == 1 && inArgs[0].getType().equals( css::uno::TypeDescription( @@ -457,7 +455,7 @@ void Reader::readReplyMessage(Unmarshal & unmarshal, sal_uInt8 flags1) { break; } default: - OSL_ASSERT(false); // this cannot happen + assert(false); // this cannot happen break; } bool ok = false; @@ -511,7 +509,7 @@ void Reader::readReplyMessage(Unmarshal & unmarshal, sal_uInt8 flags1) { break; } default: - OSL_ASSERT(false); // this cannot happen + assert(false); // this cannot happen break; } } @@ -529,15 +527,15 @@ void Reader::readReplyMessage(Unmarshal & unmarshal, sal_uInt8 flags1) { break; } case OutgoingRequest::KIND_REQUEST_CHANGE: - OSL_ASSERT(outArgs.empty()); + assert(outArgs.empty()); bridge_->handleRequestChangeReply(exc, ret); break; case OutgoingRequest::KIND_COMMIT_CHANGE: - OSL_ASSERT(outArgs.empty()); + assert(outArgs.empty()); bridge_->handleCommitChangeReply(exc, ret); break; default: - OSL_ASSERT(false); // this cannot happen + assert(false); // this cannot happen break; } } diff --git a/binaryurp/source/unmarshal.cxx b/binaryurp/source/unmarshal.cxx index 490954eac841..df91fa8bf294 100644 --- a/binaryurp/source/unmarshal.cxx +++ b/binaryurp/source/unmarshal.cxx @@ -28,6 +28,7 @@ #include "sal/config.h" +#include <cassert> #include <cstdlib> #include <new> #include <vector> @@ -39,7 +40,6 @@ #include "com/sun/star/uno/Sequence.hxx" #include "com/sun/star/uno/XInterface.hpp" #include "cppu/unotype.hxx" -#include "osl/diagnose.h" #include "rtl/byteseq.hxx" #include "rtl/ref.hxx" #include "rtl/textcvt.h" @@ -78,7 +78,7 @@ std::vector< BinaryAny >::iterator copyMemberValues( css::uno::TypeDescription const & type, std::vector< BinaryAny >::iterator const & it, void * buffer) throw () { - OSL_ASSERT( + assert( type.is() && (type.get()->eTypeClass == typelib_TypeClass_STRUCT || type.get()->eTypeClass == typelib_TypeClass_EXCEPTION) && @@ -292,7 +292,7 @@ rtl::ByteSequence Unmarshal::readTid() { } BinaryAny Unmarshal::readValue(css::uno::TypeDescription const & type) { - OSL_ASSERT(type.is()); + assert(type.is()); switch (type.get()->eTypeClass) { default: std::abort(); // this cannot happen @@ -486,8 +486,7 @@ rtl::OUString Unmarshal::readString() { } BinaryAny Unmarshal::readSequence(css::uno::TypeDescription const & type) { - OSL_ASSERT( - type.is() && type.get()->eTypeClass == typelib_TypeClass_SEQUENCE); + assert(type.is() && type.get()->eTypeClass == typelib_TypeClass_SEQUENCE); sal_uInt32 n = readCompressed(); if (n > SAL_MAX_INT32) { throw css::uno::RuntimeException( @@ -515,7 +514,7 @@ BinaryAny Unmarshal::readSequence(css::uno::TypeDescription const & type) { for (sal_uInt32 i = 0; i != n; ++i) { as.push_back(readValue(ctd)); } - OSL_ASSERT(ctd.get()->nSize >= 0); + assert(ctd.get()->nSize >= 0); sal_uInt64 size = static_cast< sal_uInt64 >(n) * static_cast< sal_uInt64 >(ctd.get()->nSize); // sal_uInt32 * sal_Int32 -> sal_uInt64 cannot overflow @@ -542,7 +541,7 @@ BinaryAny Unmarshal::readSequence(css::uno::TypeDescription const & type) { void Unmarshal::readMemberValues( css::uno::TypeDescription const & type, std::vector< BinaryAny > * values) { - OSL_ASSERT( + assert( type.is() && (type.get()->eTypeClass == typelib_TypeClass_STRUCT || type.get()->eTypeClass == typelib_TypeClass_EXCEPTION) && |