You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bc...@apache.org on 2019/04/24 01:10:04 UTC
[trafficserver] branch master updated: Change to C++ style pointer
casting
This is an automated email from the ASF dual-hosted git repository.
bcall pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new ed6058c Change to C++ style pointer casting
ed6058c is described below
commit ed6058cf1cc7b90c0c3a4ee4ff02ca59f660c0d0
Author: Masakazu Kitajo <ma...@apache.org>
AuthorDate: Tue Apr 23 16:31:00 2019 +0800
Change to C++ style pointer casting
---
iocore/net/P_UDPConnection.h | 24 ++++++++++++------------
iocore/net/P_UDPNet.h | 4 ++--
iocore/net/P_UDPPacket.h | 16 ++++++++--------
3 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/iocore/net/P_UDPConnection.h b/iocore/net/P_UDPConnection.h
index 443df0e..ef69b31 100644
--- a/iocore/net/P_UDPConnection.h
+++ b/iocore/net/P_UDPConnection.h
@@ -79,13 +79,13 @@ UDPConnectionInternal::~UDPConnectionInternal()
TS_INLINE SOCKET
UDPConnection::getFd()
{
- return ((UDPConnectionInternal *)this)->fd;
+ return static_cast<UDPConnectionInternal *>(this)->fd;
}
TS_INLINE void
UDPConnection::setBinding(struct sockaddr const *s)
{
- UDPConnectionInternal *p = (UDPConnectionInternal *)this;
+ UDPConnectionInternal *p = static_cast<UDPConnectionInternal *>(this);
ats_ip_copy(&p->binding, s);
p->binding_valid = 1;
}
@@ -93,7 +93,7 @@ UDPConnection::setBinding(struct sockaddr const *s)
TS_INLINE void
UDPConnection::setBinding(IpAddr const &ip, in_port_t port)
{
- UDPConnectionInternal *p = (UDPConnectionInternal *)this;
+ UDPConnectionInternal *p = static_cast<UDPConnectionInternal *>(this);
IpEndpoint addr;
addr.assign(ip, htons(port));
ats_ip_copy(&p->binding, addr);
@@ -103,7 +103,7 @@ UDPConnection::setBinding(IpAddr const &ip, in_port_t port)
TS_INLINE int
UDPConnection::getBinding(struct sockaddr *s)
{
- UDPConnectionInternal *p = (UDPConnectionInternal *)this;
+ UDPConnectionInternal *p = static_cast<UDPConnectionInternal *>(this);
ats_ip_copy(s, &p->binding);
return p->binding_valid;
}
@@ -111,13 +111,13 @@ UDPConnection::getBinding(struct sockaddr *s)
TS_INLINE void
UDPConnection::destroy()
{
- ((UDPConnectionInternal *)this)->tobedestroyed = 1;
+ static_cast<UDPConnectionInternal *>(this)->tobedestroyed = 1;
}
TS_INLINE int
UDPConnection::shouldDestroy()
{
- return ((UDPConnectionInternal *)this)->tobedestroyed;
+ return static_cast<UDPConnectionInternal *>(this)->tobedestroyed;
}
TS_INLINE void
@@ -129,13 +129,13 @@ UDPConnection::AddRef()
TS_INLINE int
UDPConnection::GetRefCount()
{
- return ((UDPConnectionInternal *)this)->refcount;
+ return static_cast<UDPConnectionInternal *>(this)->refcount;
}
TS_INLINE int
UDPConnection::GetSendGenerationNumber()
{
- return ((UDPConnectionInternal *)this)->sendGenerationNum;
+ return static_cast<UDPConnectionInternal *>(this)->sendGenerationNum;
}
TS_INLINE int
@@ -147,7 +147,7 @@ UDPConnection::getPortNum()
TS_INLINE int64_t
UDPConnection::cancel()
{
- UDPConnectionInternal *p = (UDPConnectionInternal *)this;
+ UDPConnectionInternal *p = static_cast<UDPConnectionInternal *>(this);
p->sendGenerationNum++;
p->lastPktStartTime = p->lastSentPktStartTime;
@@ -157,7 +157,7 @@ UDPConnection::cancel()
TS_INLINE void
UDPConnection::SetLastSentPktTSSeqNum(int64_t sentSeqNum)
{
- ((UDPConnectionInternal *)this)->lastSentPktTSSeqNum = sentSeqNum;
+ static_cast<UDPConnectionInternal *>(this)->lastSentPktTSSeqNum = sentSeqNum;
}
TS_INLINE void
@@ -165,6 +165,6 @@ UDPConnection::setContinuation(Continuation *c)
{
// it is not safe to switch among continuations that don't share locks
ink_assert(mutex.get() == nullptr || c->mutex == mutex);
- mutex = c->mutex;
- ((UDPConnectionInternal *)this)->continuation = c;
+ mutex = c->mutex;
+ static_cast<UDPConnectionInternal *>(this)->continuation = c;
}
diff --git a/iocore/net/P_UDPNet.h b/iocore/net/P_UDPNet.h
index 5340178..99ca615 100644
--- a/iocore/net/P_UDPNet.h
+++ b/iocore/net/P_UDPNet.h
@@ -336,11 +336,11 @@ struct PollCont;
static inline PollCont *
get_UDPPollCont(EThread *t)
{
- return (PollCont *)ETHREAD_GET_PTR(t, udpNetInternal.pollCont_offset);
+ return static_cast<PollCont *>(ETHREAD_GET_PTR(t, udpNetInternal.pollCont_offset));
}
static inline UDPNetHandler *
get_UDPNetHandler(EThread *t)
{
- return (UDPNetHandler *)ETHREAD_GET_PTR(t, udpNetInternal.udpNetHandler_offset);
+ return static_cast<UDPNetHandler *>(ETHREAD_GET_PTR(t, udpNetInternal.udpNetHandler_offset));
}
diff --git a/iocore/net/P_UDPPacket.h b/iocore/net/P_UDPPacket.h
index 80426ca..21fbfe7 100644
--- a/iocore/net/P_UDPPacket.h
+++ b/iocore/net/P_UDPPacket.h
@@ -86,7 +86,7 @@ UDPPacketInternal::free()
TS_INLINE void
UDPPacket::append_block(IOBufferBlock *block)
{
- UDPPacketInternal *p = (UDPPacketInternal *)this;
+ UDPPacketInternal *p = static_cast<UDPPacketInternal *>(this);
if (block) {
if (p->chain) { // append to end
@@ -104,7 +104,7 @@ UDPPacket::append_block(IOBufferBlock *block)
TS_INLINE int64_t
UDPPacket::getPktLength() const
{
- UDPPacketInternal *p = (UDPPacketInternal *)this;
+ UDPPacketInternal *p = const_cast<UDPPacketInternal *>(static_cast<const UDPPacketInternal *>(this));
IOBufferBlock *b;
p->pktLength = 0;
@@ -119,13 +119,13 @@ UDPPacket::getPktLength() const
TS_INLINE void
UDPPacket::free()
{
- ((UDPPacketInternal *)this)->free();
+ static_cast<UDPPacketInternal *>(this)->free();
}
TS_INLINE void
UDPPacket::setContinuation(Continuation *c)
{
- ((UDPPacketInternal *)this)->cont = c;
+ static_cast<UDPPacketInternal *>(this)->cont = c;
}
TS_INLINE void
@@ -138,7 +138,7 @@ UDPPacket::setConnection(UDPConnection *c)
assert will prevent that. The "if" clause enables correct
handling of the connection ref. counts in such a scenario. */
- UDPConnectionInternal *&conn = ((UDPPacketInternal *)this)->conn;
+ UDPConnectionInternal *&conn = static_cast<UDPPacketInternal *>(this)->conn;
if (conn) {
if (conn == c)
@@ -146,7 +146,7 @@ UDPPacket::setConnection(UDPConnection *c)
conn->Release();
conn = nullptr;
}
- conn = (UDPConnectionInternal *)c;
+ conn = static_cast<UDPConnectionInternal *>(c);
conn->AddRef();
}
@@ -154,13 +154,13 @@ TS_INLINE IOBufferBlock *
UDPPacket::getIOBlockChain()
{
ink_assert(dynamic_cast<UDPPacketInternal *>(this) != nullptr);
- return ((UDPPacketInternal *)this)->chain.get();
+ return static_cast<UDPPacketInternal *>(this)->chain.get();
}
TS_INLINE UDPConnection *
UDPPacket::getConnection()
{
- return ((UDPPacketInternal *)this)->conn;
+ return static_cast<UDPPacketInternal *>(this)->conn;
}
TS_INLINE UDPPacket *