Browse Source

src: use static_cast for void-to-T casts

Code cleanup, replace a few uses of reinterpret_cast<T*>(void_ptr) with
static_cast<T*>(void_ptr).
v0.11.5-release
Ben Noordhuis 12 years ago
parent
commit
5383e75885
  1. 3
      src/cares_wrap.cc
  2. 2
      src/node_file.cc
  3. 4
      src/pipe_wrap.cc
  4. 4
      src/tcp_wrap.cc
  5. 6
      src/udp_wrap.cc

3
src/cares_wrap.cc

@ -770,8 +770,7 @@ static void QueryWithFamily(const FunctionCallbackInfo<Value>& args) {
void AfterGetAddrInfo(uv_getaddrinfo_t* req, int status, struct addrinfo* res) {
HandleScope scope(node_isolate);
GetAddrInfoReqWrap* req_wrap =
reinterpret_cast<GetAddrInfoReqWrap*>(req->data);
GetAddrInfoReqWrap* req_wrap = static_cast<GetAddrInfoReqWrap*>(req->data);
Local<Value> argv[] = {
Integer::New(status, node_isolate),

2
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<FSReqWrap*>(req->data);
FSReqWrap* req_wrap = static_cast<FSReqWrap*>(req->data);
assert(&req_wrap->req_ == req);
// check if data needs to be cleaned

4
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<ConnectWrap*>(req->data);
PipeWrap* wrap = reinterpret_cast<PipeWrap*>(req->handle->data);
ConnectWrap* req_wrap = static_cast<ConnectWrap*>(req->data);
PipeWrap* wrap = static_cast<PipeWrap*>(req->handle->data);
HandleScope scope(node_isolate);

4
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<ConnectWrap*>(req->data);
TCPWrap* wrap = reinterpret_cast<TCPWrap*>(req->handle->data);
ConnectWrap* req_wrap = static_cast<ConnectWrap*>(req->data);
TCPWrap* wrap = static_cast<TCPWrap*>(req->handle->data);
HandleScope scope(node_isolate);

6
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<SendWrap*>(req->data);
UDPWrap* wrap = reinterpret_cast<UDPWrap*>(req->handle->data);
SendWrap* req_wrap = static_cast<SendWrap*>(req->data);
UDPWrap* wrap = static_cast<UDPWrap*>(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<UDPWrap*>(handle->data);
UDPWrap* wrap = static_cast<UDPWrap*>(handle->data);
HandleScope scope(node_isolate);
Local<Object> wrap_obj = wrap->object();

Loading…
Cancel
Save