Added -Wzero-as-null-pointer-constant, replaced NULL --> UAVCAN_NULLPTR. All changes are automatic, no manual edits to the library code.

This commit is contained in:
Pavel Kirienko
2016-07-29 15:39:24 +03:00
parent b6fa34fed5
commit 38a241a90a
69 changed files with 306 additions and 274 deletions
@@ -86,7 +86,7 @@ class UAVCAN_EXPORT GenericPublisher : public GenericPublisherBase
{
struct ZeroTransferBuffer : public StaticTransferBufferImpl
{
ZeroTransferBuffer() : StaticTransferBufferImpl(NULL, 0) { }
ZeroTransferBuffer() : StaticTransferBufferImpl(UAVCAN_NULLPTR, 0) { }
};
typedef typename Select<DataStruct::MaxBitLen == 0,
@@ -138,7 +138,7 @@ public:
int publish(const DataStruct& message, TransferType transfer_type, NodeID dst_node_id,
MonotonicTime blocking_deadline = MonotonicTime())
{
return genericPublish(message, transfer_type, dst_node_id, NULL, blocking_deadline);
return genericPublish(message, transfer_type, dst_node_id, UAVCAN_NULLPTR, blocking_deadline);
}
int publish(const DataStruct& message, TransferType transfer_type, NodeID dst_node_id, TransferID tid,
@@ -38,7 +38,7 @@ class UAVCAN_EXPORT ReceivedDataStructure : public DataType_
template <typename Ret, Ret(IncomingTransfer::*Fun) () const>
Ret safeget() const
{
if (_transfer_ == NULL)
if (_transfer_ == UAVCAN_NULLPTR)
{
return Ret();
}
@@ -47,13 +47,13 @@ class UAVCAN_EXPORT ReceivedDataStructure : public DataType_
protected:
ReceivedDataStructure()
: _transfer_(NULL)
: _transfer_(UAVCAN_NULLPTR)
{ }
ReceivedDataStructure(const IncomingTransfer* arg_transfer)
: _transfer_(arg_transfer)
{
UAVCAN_ASSERT(arg_transfer != NULL);
UAVCAN_ASSERT(arg_transfer != UAVCAN_NULLPTR);
}
public:
@@ -230,7 +230,7 @@ int GenericSubscriber<DataSpec, DataStruct, TransferListenerType>::checkInit()
GlobalDataTypeRegistry::instance().freeze();
const DataTypeDescriptor* const descr =
GlobalDataTypeRegistry::instance().find(DataTypeKind(DataSpec::DataTypeKind), DataSpec::getDataTypeFullName());
if (descr == NULL)
if (descr == UAVCAN_NULLPTR)
{
UAVCAN_TRACE("GenericSubscriber", "Type [%s] is not registered", DataSpec::getDataTypeFullName());
return -ErrUnknownDataType;
@@ -49,13 +49,13 @@ class UAVCAN_EXPORT GlobalDataTypeRegistry : Noncopyable
{
const DataTypeID id;
explicit EntryInsertionComparator(const Entry* dtd)
: id((dtd == NULL) ? DataTypeID() : dtd->descriptor.getID())
: id((dtd == UAVCAN_NULLPTR) ? DataTypeID() : dtd->descriptor.getID())
{
UAVCAN_ASSERT(dtd != NULL);
UAVCAN_ASSERT(dtd != UAVCAN_NULLPTR);
}
bool operator()(const Entry* entry) const
{
UAVCAN_ASSERT(entry != NULL);
UAVCAN_ASSERT(entry != UAVCAN_NULLPTR);
return entry->descriptor.getID() > id;
}
};
@@ -169,7 +169,7 @@ protected:
ServiceClientBase(INode& node)
: DeadlineHandler(node.getScheduler())
, data_type_descriptor_(NULL)
, data_type_descriptor_(UAVCAN_NULLPTR)
, request_timeout_(getDefaultRequestTimeout())
{ }
@@ -420,8 +420,8 @@ bool ServiceClient<DataType_, Callback_>::shouldAcceptFrame(const RxFrame& frame
{
UAVCAN_ASSERT(frame.getTransferType() == TransferTypeServiceResponse); // Other types filtered out by dispatcher
return NULL != call_registry_.find(CallStateMatchingPredicate(ServiceCallID(frame.getSrcNodeID(),
frame.getTransferID())));
return UAVCAN_NULLPTR != call_registry_.find(CallStateMatchingPredicate(ServiceCallID(frame.getSrcNodeID(),
frame.getTransferID())));
}
@@ -474,8 +474,8 @@ int ServiceClient<DataType_, Callback_>::addCallState(ServiceCallID call_id)
}
}
if (NULL == call_registry_.template emplace<INode&, ServiceClientBase&, ServiceCallID>(SubscriberType::getNode(),
*this, call_id))
if (UAVCAN_NULLPTR == call_registry_.template emplace<INode&, ServiceClientBase&,
ServiceCallID>(SubscriberType::getNode(), *this, call_id))
{
SubscriberType::stop();
return -ErrMemory;
@@ -527,7 +527,7 @@ int ServiceClient<DataType_, Callback_>::call(NodeID server_node_id, const Reque
* TODO move to init(), but this requires to somewhat refactor GenericSubscriber<> (remove TransferForwarder)
*/
TransferListenerWithFilter* const tl = SubscriberType::getTransferListener();
if (tl == NULL)
if (tl == UAVCAN_NULLPTR)
{
UAVCAN_ASSERT(0); // Must have been created
cancelCall(out_call_id);
@@ -570,14 +570,14 @@ void ServiceClient<DataType_, Callback_>::cancelAllCalls()
template <typename DataType_, typename Callback_>
bool ServiceClient<DataType_, Callback_>::hasPendingCallToServer(NodeID server_node_id) const
{
return NULL != call_registry_.find(ServerSearchPredicate(server_node_id));
return UAVCAN_NULLPTR != call_registry_.find(ServerSearchPredicate(server_node_id));
}
template <typename DataType_, typename Callback_>
ServiceCallID ServiceClient<DataType_, Callback_>::getCallIDByIndex(unsigned index) const
{
const CallState* const id = call_registry_.getByIndex(index);
return (id == NULL) ? ServiceCallID() : id->getCallID();
return (id == UAVCAN_NULLPTR) ? ServiceCallID() : id->getCallID();
}
}