From 5383e7588520dfcbb4372235ffa87d88101e1507 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Sat, 3 Aug 2013 22:50:15 +0200 Subject: [PATCH] src: use static_cast for void-to-T casts Code cleanup, replace a few uses of reinterpret_cast(void_ptr) with static_cast(void_ptr). --- src/cares_wrap.cc | 3 +-- src/node_file.cc | 2 +- src/pipe_wrap.cc | 4 ++-- src/tcp_wrap.cc | 4 ++-- src/udp_wrap.cc | 6 +++--- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index 6cb55a5e0f..d782ad6b48 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -770,8 +770,7 @@ static void QueryWithFamily(const FunctionCallbackInfo& args) { void AfterGetAddrInfo(uv_getaddrinfo_t* req, int status, struct addrinfo* res) { HandleScope scope(node_isolate); - GetAddrInfoReqWrap* req_wrap = - reinterpret_cast(req->data); + GetAddrInfoReqWrap* req_wrap = static_cast(req->data); Local argv[] = { Integer::New(status, node_isolate), diff --git a/src/node_file.cc b/src/node_file.cc index 15f64275c1..9aa944b693 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -98,7 +98,7 @@ static inline int IsInt64(double x) { static void After(uv_fs_t *req) { HandleScope scope(node_isolate); - FSReqWrap* req_wrap = reinterpret_cast(req->data); + FSReqWrap* req_wrap = static_cast(req->data); assert(&req_wrap->req_ == req); // check if data needs to be cleaned diff --git a/src/pipe_wrap.cc b/src/pipe_wrap.cc index 850f458245..53c8da92dc 100644 --- a/src/pipe_wrap.cc +++ b/src/pipe_wrap.cc @@ -221,8 +221,8 @@ void PipeWrap::OnConnection(uv_stream_t* handle, int status) { // TODO(bnoordhuis) Maybe share this with TCPWrap? void PipeWrap::AfterConnect(uv_connect_t* req, int status) { - ConnectWrap* req_wrap = reinterpret_cast(req->data); - PipeWrap* wrap = reinterpret_cast(req->handle->data); + ConnectWrap* req_wrap = static_cast(req->data); + PipeWrap* wrap = static_cast(req->handle->data); HandleScope scope(node_isolate); diff --git a/src/tcp_wrap.cc b/src/tcp_wrap.cc index b4e3e0b78f..ad852dee00 100644 --- a/src/tcp_wrap.cc +++ b/src/tcp_wrap.cc @@ -335,8 +335,8 @@ void TCPWrap::OnConnection(uv_stream_t* handle, int status) { void TCPWrap::AfterConnect(uv_connect_t* req, int status) { - ConnectWrap* req_wrap = reinterpret_cast(req->data); - TCPWrap* wrap = reinterpret_cast(req->handle->data); + ConnectWrap* req_wrap = static_cast(req->data); + TCPWrap* wrap = static_cast(req->handle->data); HandleScope scope(node_isolate); diff --git a/src/udp_wrap.cc b/src/udp_wrap.cc index 0f97dd654c..7a2334e12b 100644 --- a/src/udp_wrap.cc +++ b/src/udp_wrap.cc @@ -334,8 +334,8 @@ void UDPWrap::OnSend(uv_udp_send_t* req, int status) { assert(req != NULL); - SendWrap* req_wrap = reinterpret_cast(req->data); - UDPWrap* wrap = reinterpret_cast(req->handle->data); + SendWrap* req_wrap = static_cast(req->data); + UDPWrap* wrap = static_cast(req->handle->data); assert(req_wrap->persistent().IsEmpty() == false); assert(wrap->persistent().IsEmpty() == false); @@ -368,7 +368,7 @@ void UDPWrap::OnRecv(uv_udp_t* handle, return; } - UDPWrap* wrap = reinterpret_cast(handle->data); + UDPWrap* wrap = static_cast(handle->data); HandleScope scope(node_isolate); Local wrap_obj = wrap->object();