summaryrefslogtreecommitdiff
path: root/binaryurp
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-11-10 10:10:57 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-11-10 10:31:17 +0100
commite68121b3c1d973d149adad4d8e1bcbe042107506 (patch)
treebeade9fd10b68520b6a782d536e4bbb1526dba96 /binaryurp
parent08e49fa3377d8c4e7e5df7a32233fcd9763ee936 (diff)
loplugin:nullptr (automatic rewrite)
Change-Id: Ic3516d9069cbe935f5b82aec0afac3facdc814a5
Diffstat (limited to 'binaryurp')
-rw-r--r--binaryurp/source/binaryany.cxx12
-rw-r--r--binaryurp/source/bridge.cxx26
-rw-r--r--binaryurp/source/bridgefactory.cxx4
-rw-r--r--binaryurp/source/cache.hxx2
-rw-r--r--binaryurp/source/currentcontext.cxx4
-rw-r--r--binaryurp/source/incomingrequest.cxx16
-rw-r--r--binaryurp/source/marshal.cxx10
-rw-r--r--binaryurp/source/proxy.cxx24
-rw-r--r--binaryurp/source/reader.cxx6
-rw-r--r--binaryurp/source/unmarshal.cxx18
-rw-r--r--binaryurp/source/writer.cxx4
11 files changed, 63 insertions, 63 deletions
diff --git a/binaryurp/source/binaryany.cxx b/binaryurp/source/binaryany.cxx
index d1b345a355b4..a1994178c8d0 100644
--- a/binaryurp/source/binaryany.cxx
+++ b/binaryurp/source/binaryany.cxx
@@ -30,18 +30,18 @@
namespace binaryurp {
BinaryAny::BinaryAny() throw () {
- uno_any_construct(&data_, 0, 0, 0);
+ uno_any_construct(&data_, nullptr, nullptr, nullptr);
}
BinaryAny::BinaryAny(css::uno::TypeDescription const & type, void * value)
throw ()
{
assert(type.is());
- uno_any_construct(&data_, value, type.get(), 0);
+ uno_any_construct(&data_, value, type.get(), nullptr);
}
BinaryAny::BinaryAny(uno_Any const & raw) throw () {
- assert(raw.pType != 0);
+ assert(raw.pType != nullptr);
data_.pType = raw.pType;
typelib_typedescriptionreference_acquire(data_.pType);
data_.pData = raw.pData == &raw.pReserved ? &data_.pReserved : raw.pData;
@@ -49,16 +49,16 @@ BinaryAny::BinaryAny(uno_Any const & raw) throw () {
}
BinaryAny::BinaryAny(BinaryAny const & other) throw () {
- uno_type_any_construct(&data_, other.data_.pData, other.data_.pType, 0);
+ uno_type_any_construct(&data_, other.data_.pData, other.data_.pType, nullptr);
}
BinaryAny::~BinaryAny() throw () {
- uno_any_destruct(&data_, 0);
+ uno_any_destruct(&data_, nullptr);
}
BinaryAny & BinaryAny::operator =(BinaryAny const & other) throw () {
if (&other != this) {
- uno_type_any_assign(&data_, other.data_.pData, other.data_.pType, 0, 0);
+ uno_type_any_assign(&data_, other.data_.pData, other.data_.pType, nullptr, nullptr);
}
return *this;
}
diff --git a/binaryurp/source/bridge.cxx b/binaryurp/source/bridge.cxx
index 6641143b8f80..a2d68e73c1a0 100644
--- a/binaryurp/source/bridge.cxx
+++ b/binaryurp/source/bridge.cxx
@@ -82,19 +82,19 @@ sal_Int32 random() {
OUString toString(css::uno::TypeDescription const & type) {
typelib_TypeDescription * d = type.get();
- assert(d != 0 && d->pTypeName != 0);
+ assert(d != nullptr && d->pTypeName != nullptr);
return OUString(d->pTypeName);
}
extern "C" void SAL_CALL freeProxyCallback(
SAL_UNUSED_PARAMETER uno_ExtEnvironment *, void * pProxy)
{
- assert(pProxy != 0);
+ assert(pProxy != nullptr);
static_cast< Proxy * >(pProxy)->do_free();
}
bool isThread(salhelper::Thread * thread) {
- assert(thread != 0);
+ assert(thread != nullptr);
return osl::Thread::getCurrentIdentifier() == thread->getIdentifier();
}
@@ -115,7 +115,7 @@ private:
};
AttachThread::AttachThread(uno_ThreadPool threadPool): threadPool_(threadPool) {
- sal_Sequence * s = 0;
+ sal_Sequence * s = nullptr;
uno_getIdOfCurrentThread(&s);
tid_ = rtl::ByteSequence(s, rtl::BYTESEQ_NOACQUIRE);
uno_threadpool_attach(threadPool_);
@@ -190,7 +190,7 @@ Bridge::Bridge(
css::uno::Reference< css::bridge::XProtocolProperties > >::get()),
protPropRequest_("com.sun.star.bridge.XProtocolProperties::requestChange"),
protPropCommit_("com.sun.star.bridge.XProtocolProperties::commitChange"),
- state_(STATE_INITIAL), threadPool_(0), currentContextMode_(false),
+ state_(STATE_INITIAL), threadPool_(nullptr), currentContextMode_(false),
proxies_(0), calls_(0), normalCall_(false), activeCalls_(0),
mode_(MODE_REQUESTED)
{
@@ -210,10 +210,10 @@ void Bridge::start() {
{
osl::MutexGuard g(mutex_);
assert(
- state_ == STATE_INITIAL && threadPool_ == 0 && !writer_.is() &&
+ state_ == STATE_INITIAL && threadPool_ == nullptr && !writer_.is() &&
!reader_.is());
threadPool_ = uno_threadpool_create();
- assert(threadPool_ != 0);
+ assert(threadPool_ != nullptr);
reader_ = r;
writer_ = w;
state_ = STATE_STARTED;
@@ -252,7 +252,7 @@ void Bridge::terminate(bool final) {
{
osl::MutexGuard g2(mutex_);
tp = threadPool_;
- threadPool_ = 0;
+ threadPool_ = nullptr;
if (reader_.is()) {
if (!isThread(reader_.get())) {
r = reader_;
@@ -273,7 +273,7 @@ void Bridge::terminate(bool final) {
} else if (w.is()) {
w->join();
}
- if (tp != 0) {
+ if (tp != nullptr) {
uno_threadpool_destroy(tp);
}
}
@@ -306,7 +306,7 @@ void Bridge::terminate(bool final) {
if (joinW) {
w->join();
}
- assert(tp != 0);
+ assert(tp != nullptr);
uno_threadpool_dispose(tp);
Stubs s;
{
@@ -343,7 +343,7 @@ void Bridge::terminate(bool final) {
{
osl::MutexGuard g(mutex_);
if (final) {
- threadPool_ = 0;
+ threadPool_ = nullptr;
}
}
terminated_.set();
@@ -366,7 +366,7 @@ BinaryAny Bridge::mapCppToBinaryAny(css::uno::Any const & cppAny) {
uno_ThreadPool Bridge::getThreadPool() {
osl::MutexGuard g(mutex_);
checkDisposed();
- assert(threadPool_ != 0);
+ assert(threadPool_ != nullptr);
return threadPool_;
}
@@ -608,7 +608,7 @@ bool Bridge::makeCall(
decrementActiveCalls();
decrementCalls();
}
- if (resp.get() == 0) {
+ if (resp.get() == nullptr) {
throw css::lang::DisposedException(
"Binary URP bridge disposed during call",
static_cast< cppu::OWeakObject * >(this));
diff --git a/binaryurp/source/bridgefactory.cxx b/binaryurp/source/bridgefactory.cxx
index 8f079f077848..3328d35593ef 100644
--- a/binaryurp/source/bridgefactory.cxx
+++ b/binaryurp/source/bridgefactory.cxx
@@ -211,8 +211,8 @@ static cppu::ImplementationEntry const services[] = {
{ &binaryurp::BridgeFactory::static_create,
&binaryurp::BridgeFactory::static_getImplementationName,
&binaryurp::BridgeFactory::static_getSupportedServiceNames,
- &cppu::createOneInstanceComponentFactory, 0, 0 },
- { 0, 0, 0, 0, 0, 0 }
+ &cppu::createOneInstanceComponentFactory, nullptr, 0 },
+ { nullptr, nullptr, nullptr, nullptr, nullptr, 0 }
};
}
diff --git a/binaryurp/source/cache.hxx b/binaryurp/source/cache.hxx
index 9df738f03ba2..9bd87898c528 100644
--- a/binaryurp/source/cache.hxx
+++ b/binaryurp/source/cache.hxx
@@ -48,7 +48,7 @@ public:
}
IdxType add( const T& rContent, bool* pbFound) {
- assert( pbFound != NULL);
+ assert( pbFound != nullptr);
if( !size_) {
*pbFound = false;
return cache::ignore;
diff --git a/binaryurp/source/currentcontext.cxx b/binaryurp/source/currentcontext.cxx
index 81d46672dbd2..52718e15fab6 100644
--- a/binaryurp/source/currentcontext.cxx
+++ b/binaryurp/source/currentcontext.cxx
@@ -38,7 +38,7 @@ css::uno::UnoInterfaceReference get() {
css::uno::UnoInterfaceReference cc;
if (!uno_getCurrentContext(
reinterpret_cast< void ** >(&cc.m_pUnoI),
- OUString(UNO_LB_UNO).pData, 0))
+ OUString(UNO_LB_UNO).pData, nullptr))
{
throw css::uno::RuntimeException("uno_getCurrentContext failed");
}
@@ -49,7 +49,7 @@ void set(css::uno::UnoInterfaceReference const & value) {
css::uno::UnoInterfaceReference cc(value);
if (!uno_setCurrentContext(
cc.m_pUnoI,
- OUString(UNO_LB_UNO).pData, 0))
+ OUString(UNO_LB_UNO).pData, nullptr))
{
throw css::uno::RuntimeException("uno_setCurrentContext failed");
}
diff --git a/binaryurp/source/incomingrequest.cxx b/binaryurp/source/incomingrequest.cxx
index e9c70583e316..009e473c64b4 100644
--- a/binaryurp/source/incomingrequest.cxx
+++ b/binaryurp/source/incomingrequest.cxx
@@ -123,10 +123,10 @@ bool IncomingRequest::execute_throw(
BinaryAny * returnValue, std::vector< BinaryAny > * outArguments) const
{
OSL_ASSERT(
- returnValue != 0 &&
+ returnValue != nullptr &&
returnValue->getType().equals(
css::uno::TypeDescription(cppu::UnoType<void>::get())) &&
- outArguments != 0 && outArguments->empty());
+ outArguments != nullptr && outArguments->empty());
bool isExc = false;
switch (functionId_) {
case SPECIAL_FUNCTION_ID_RESERVED:
@@ -237,19 +237,19 @@ bool IncomingRequest::execute_throw(
uno_Any exc;
uno_Any * pexc = &exc;
(*object_.get()->pDispatcher)(
- object_.get(), member_.get(), retBuf.empty() ? 0 : &retBuf[0],
- args.empty() ? 0 : &args[0], &pexc);
- isExc = pexc != 0;
+ object_.get(), member_.get(), retBuf.empty() ? nullptr : &retBuf[0],
+ args.empty() ? nullptr : &args[0], &pexc);
+ isExc = pexc != nullptr;
if (isExc) {
*returnValue = BinaryAny(
css::uno::TypeDescription(
cppu::UnoType< css::uno::Any >::get()),
&exc);
- uno_any_destruct(&exc, 0);
+ uno_any_destruct(&exc, nullptr);
} else {
if (!retBuf.empty()) {
*returnValue = BinaryAny(retType, &retBuf[0]);
- uno_destructData(&retBuf[0], retType.get(), 0);
+ uno_destructData(&retBuf[0], retType.get(), nullptr);
}
if (!outArguments->empty()) {
OSL_ASSERT(
@@ -271,7 +271,7 @@ bool IncomingRequest::execute_throw(
}
if (!mtd->pParams[k].bIn) {
uno_type_destructData(
- &(*j++)[0], mtd->pParams[k].pTypeRef, 0);
+ &(*j++)[0], mtd->pParams[k].pTypeRef, nullptr);
}
}
OSL_ASSERT(i == outArguments->end());
diff --git a/binaryurp/source/marshal.cxx b/binaryurp/source/marshal.cxx
index 5904557cc1e8..a45d1c639d0c 100644
--- a/binaryurp/source/marshal.cxx
+++ b/binaryurp/source/marshal.cxx
@@ -72,7 +72,7 @@ void writeCompressed(std::vector< unsigned char > * buffer, sal_uInt32 value) {
void writeString(
std::vector< unsigned char > * buffer, OUString const & value)
{
- assert(buffer != 0);
+ assert(buffer != nullptr);
OString v;
if (!value.convertToString(
&v, RTL_TEXTENCODING_UTF8,
@@ -97,7 +97,7 @@ Marshal::Marshal(rtl::Reference< Bridge > const & bridge, WriterState & state):
Marshal::~Marshal() {}
void Marshal::write8(std::vector< unsigned char > * buffer, sal_uInt8 value) {
- assert(buffer != 0);
+ assert(buffer != nullptr);
buffer->push_back(value);
}
@@ -187,7 +187,7 @@ void Marshal::writeValue(
std::vector< unsigned char > * buffer,
css::uno::TypeDescription const & type, void const * value)
{
- assert(buffer != 0 && type.is());
+ assert(buffer != nullptr && type.is());
type.makeComplete();
switch (type.get()->eTypeClass) {
case typelib_TypeClass_VOID:
@@ -279,11 +279,11 @@ void Marshal::writeMemberValues(
type.is() &&
(type.get()->eTypeClass == typelib_TypeClass_STRUCT ||
type.get()->eTypeClass == typelib_TypeClass_EXCEPTION) &&
- aggregateValue != 0);
+ aggregateValue != nullptr);
type.makeComplete();
typelib_CompoundTypeDescription * ctd =
reinterpret_cast< typelib_CompoundTypeDescription * >(type.get());
- if (ctd->pBaseTypeDescription != 0) {
+ if (ctd->pBaseTypeDescription != nullptr) {
writeMemberValues(
buffer,
css::uno::TypeDescription(&ctd->pBaseTypeDescription->aBase),
diff --git a/binaryurp/source/proxy.cxx b/binaryurp/source/proxy.cxx
index e3dc96199eee..9368cd2d2f3d 100644
--- a/binaryurp/source/proxy.cxx
+++ b/binaryurp/source/proxy.cxx
@@ -42,12 +42,12 @@ namespace binaryurp {
namespace {
extern "C" void SAL_CALL proxy_acquireInterface(uno_Interface * pInterface) {
- assert(pInterface != 0);
+ assert(pInterface != nullptr);
static_cast< Proxy * >(pInterface)->do_acquire();
}
extern "C" void SAL_CALL proxy_releaseInterface(uno_Interface * pInterface) {
- assert(pInterface != 0);
+ assert(pInterface != nullptr);
static_cast< Proxy * >(pInterface)->do_release();
}
@@ -55,7 +55,7 @@ extern "C" void SAL_CALL proxy_dispatchInterface(
uno_Interface * pUnoI, typelib_TypeDescription const * pMemberType,
void * pReturn, void ** pArgs, uno_Any ** ppException)
{
- assert(pUnoI != 0);
+ assert(pUnoI != nullptr);
static_cast< Proxy * >(pUnoI)->do_dispatch(
pMemberType, pReturn, pArgs, ppException);
}
@@ -132,12 +132,12 @@ void Proxy::do_dispatch_throw(
void ** arguments, uno_Any ** exception) const
{
//TODO: Optimize queryInterface:
- assert(member != 0);
+ assert(member != nullptr);
bool bSetter = false;
std::vector< BinaryAny > inArgs;
switch (member->eTypeClass) {
case typelib_TypeClass_INTERFACE_ATTRIBUTE:
- bSetter = returnValue == 0;
+ bSetter = returnValue == nullptr;
if (bSetter) {
inArgs.push_back(
BinaryAny(
@@ -178,7 +178,7 @@ void Proxy::do_dispatch_throw(
{
assert(ret.getType().get()->eTypeClass == typelib_TypeClass_EXCEPTION);
uno_any_construct(
- *exception, ret.getValue(ret.getType()), ret.getType().get(), 0);
+ *exception, ret.getValue(ret.getType()), ret.getType().get(), nullptr);
} else {
switch (member->eTypeClass) {
case typelib_TypeClass_INTERFACE_ATTRIBUTE:
@@ -188,7 +188,7 @@ void Proxy::do_dispatch_throw(
typelib_InterfaceAttributeTypeDescription const * >(
member)->
pAttributeTypeRef);
- uno_copyData(returnValue, ret.getValue(t), t.get(), 0);
+ uno_copyData(returnValue, ret.getValue(t), t.get(), nullptr);
}
break;
case typelib_TypeClass_INTERFACE_METHOD:
@@ -199,7 +199,7 @@ void Proxy::do_dispatch_throw(
member);
css::uno::TypeDescription t(mtd->pReturnTypeRef);
if (t.get()->eTypeClass != typelib_TypeClass_VOID) {
- uno_copyData(returnValue, ret.getValue(t), t.get(), 0);
+ uno_copyData(returnValue, ret.getValue(t), t.get(), nullptr);
}
std::vector< BinaryAny >::iterator i(outArgs.begin());
for (sal_Int32 j = 0; j != mtd->nParams; ++j) {
@@ -208,10 +208,10 @@ void Proxy::do_dispatch_throw(
if (mtd->pParams[j].bIn) {
(void) uno_assignData(
arguments[j], pt.get(), i++->getValue(pt),
- pt.get(), 0, 0, 0);
+ pt.get(), nullptr, nullptr, nullptr);
} else {
uno_copyData(
- arguments[j], i++->getValue(pt), pt.get(), 0);
+ arguments[j], i++->getValue(pt), pt.get(), nullptr);
}
}
}
@@ -222,14 +222,14 @@ void Proxy::do_dispatch_throw(
assert(false); // this cannot happen
break;
}
- *exception = 0;
+ *exception = nullptr;
}
}
bool Proxy::isProxy(
rtl::Reference< Bridge > const & bridge, OUString * oid) const
{
- assert(oid != 0);
+ assert(oid != nullptr);
if (bridge == bridge_) {
*oid = oid_;
return true;
diff --git a/binaryurp/source/reader.cxx b/binaryurp/source/reader.cxx
index eed96ae9f431..6a5f6905e3e7 100644
--- a/binaryurp/source/reader.cxx
+++ b/binaryurp/source/reader.cxx
@@ -79,7 +79,7 @@ css::uno::Sequence< sal_Int8 > read(
}
extern "C" void SAL_CALL request(void * pThreadSpecificData) {
- assert(pThreadSpecificData != 0);
+ assert(pThreadSpecificData != nullptr);
std::unique_ptr< IncomingRequest >(
static_cast< IncomingRequest * >(pThreadSpecificData))->
execute();
@@ -359,7 +359,7 @@ void Reader::readReplyMessage(Unmarshal & unmarshal, sal_uInt8 flags1) {
ret.getType().get()))
{
sal_Int32 n = 0;
- typelib_TypeDescriptionReference ** p = 0;
+ typelib_TypeDescriptionReference ** p = nullptr;
switch (req.member.get()->eTypeClass) {
case typelib_TypeClass_INTERFACE_ATTRIBUTE:
{
@@ -443,7 +443,7 @@ void Reader::readReplyMessage(Unmarshal & unmarshal, sal_uInt8 flags1) {
std::unique_ptr< IncomingReply > resp(
new IncomingReply(exc, ret, outArgs));
uno_threadpool_putJob(
- bridge_->getThreadPool(), tid.getHandle(), resp.get(), 0,
+ bridge_->getThreadPool(), tid.getHandle(), resp.get(), nullptr,
false);
resp.release();
break;
diff --git a/binaryurp/source/unmarshal.cxx b/binaryurp/source/unmarshal.cxx
index 43ddfa87db23..3f1f5fc42032 100644
--- a/binaryurp/source/unmarshal.cxx
+++ b/binaryurp/source/unmarshal.cxx
@@ -56,7 +56,7 @@ namespace {
void * allocate(sal_Size size) {
void * p = rtl_allocateMemory(size);
- if (p == 0) {
+ if (p == nullptr) {
throw std::bad_alloc();
}
return p;
@@ -70,12 +70,12 @@ std::vector< BinaryAny >::iterator copyMemberValues(
type.is() &&
(type.get()->eTypeClass == typelib_TypeClass_STRUCT ||
type.get()->eTypeClass == typelib_TypeClass_EXCEPTION) &&
- buffer != 0);
+ buffer != nullptr);
type.makeComplete();
std::vector< BinaryAny >::iterator i(it);
typelib_CompoundTypeDescription * ctd =
reinterpret_cast< typelib_CompoundTypeDescription * >(type.get());
- if (ctd->pBaseTypeDescription != 0) {
+ if (ctd->pBaseTypeDescription != nullptr) {
i = copyMemberValues(
css::uno::TypeDescription(&ctd->pBaseTypeDescription->aBase), i,
buffer);
@@ -84,7 +84,7 @@ std::vector< BinaryAny >::iterator copyMemberValues(
uno_type_copyData(
static_cast< char * >(buffer) + ctd->pMemberOffsets[j],
i++->getValue(css::uno::TypeDescription(ctd->ppTypeRefs[j])),
- ctd->ppTypeRefs[j], 0);
+ ctd->ppTypeRefs[j], nullptr);
}
return i;
}
@@ -345,7 +345,7 @@ BinaryAny Unmarshal::readValue(css::uno::TypeDescription const & type) {
raw.pType = reinterpret_cast< typelib_TypeDescriptionReference * >(
type.get());
raw.pData = buf;
- raw.pReserved = 0;
+ raw.pReserved = nullptr;
return BinaryAny(raw);
}
case typelib_TypeClass_INTERFACE:
@@ -427,7 +427,7 @@ BinaryAny Unmarshal::readSequence(css::uno::TypeDescription const & type) {
"binaryurp::Unmarshal: sequence size too large");
}
if (n == 0) {
- return BinaryAny(type, 0);
+ return BinaryAny(type, nullptr);
}
css::uno::TypeDescription ctd(
reinterpret_cast< typelib_IndirectTypeDescription * >(
@@ -461,7 +461,7 @@ BinaryAny Unmarshal::readSequence(css::uno::TypeDescription const & type) {
for (sal_uInt32 i = 0; i != n; ++i) {
uno_copyData(
static_cast< sal_Sequence * >(buf)->elements + i * ctd.get()->nSize,
- as[i].getValue(ctd), ctd.get(), 0);
+ as[i].getValue(ctd), ctd.get(), nullptr);
}
return BinaryAny(type, &buf);
}
@@ -473,11 +473,11 @@ void Unmarshal::readMemberValues(
type.is() &&
(type.get()->eTypeClass == typelib_TypeClass_STRUCT ||
type.get()->eTypeClass == typelib_TypeClass_EXCEPTION) &&
- values != 0);
+ values != nullptr);
type.makeComplete();
typelib_CompoundTypeDescription * ctd =
reinterpret_cast< typelib_CompoundTypeDescription * >(type.get());
- if (ctd->pBaseTypeDescription != 0) {
+ if (ctd->pBaseTypeDescription != nullptr) {
readMemberValues(
css::uno::TypeDescription(&ctd->pBaseTypeDescription->aBase),
values);
diff --git a/binaryurp/source/writer.cxx b/binaryurp/source/writer.cxx
index 3813dbc7187d..7558f8296024 100644
--- a/binaryurp/source/writer.cxx
+++ b/binaryurp/source/writer.cxx
@@ -204,7 +204,7 @@ void Writer::sendRequest(
typelib_InterfaceAttributeTypeDescription * atd =
reinterpret_cast< typelib_InterfaceAttributeTypeDescription * >(
member.get());
- OSL_ASSERT(atd->pInterface != 0);
+ OSL_ASSERT(atd->pInterface != nullptr);
if (!t.is()) {
t = css::uno::TypeDescription(&atd->pInterface->aBase);
}
@@ -221,7 +221,7 @@ void Writer::sendRequest(
typelib_InterfaceMethodTypeDescription * mtd =
reinterpret_cast< typelib_InterfaceMethodTypeDescription * >(
member.get());
- assert(mtd->pInterface != 0);
+ assert(mtd->pInterface != nullptr);
if (!t.is()) {
t = css::uno::TypeDescription(&mtd->pInterface->aBase);
}