Index: webrtc/base/win32socketserver.cc |
diff --git a/webrtc/base/win32socketserver.cc b/webrtc/base/win32socketserver.cc |
index adf360b5ff17f3e42531257d4be7c062f83cf331..3ee88dbaf585e4c0f1efb61932d7f75cfda31538 100644 |
--- a/webrtc/base/win32socketserver.cc |
+++ b/webrtc/base/win32socketserver.cc |
@@ -165,7 +165,7 @@ class Win32Socket::EventSink : public Win32Window { |
}; |
void Win32Socket::EventSink::Dispose() { |
- parent_ = NULL; |
+ parent_ = nullptr; |
if (::IsWindow(handle())) { |
::DestroyWindow(handle()); |
} else { |
@@ -227,9 +227,14 @@ void Win32Socket::EventSink::OnNcDestroy() { |
///////////////////////////////////////////////////////////////////////////// |
Win32Socket::Win32Socket() |
- : socket_(INVALID_SOCKET), error_(0), state_(CS_CLOSED), connect_time_(0), |
- closing_(false), close_error_(0), sink_(NULL), dns_(NULL) { |
-} |
+ : socket_(INVALID_SOCKET), |
+ error_(0), |
+ state_(CS_CLOSED), |
+ connect_time_(0), |
+ closing_(false), |
+ close_error_(0), |
+ sink_(nullptr), |
+ dns_(nullptr) {} |
Win32Socket::~Win32Socket() { |
Close(); |
@@ -238,7 +243,7 @@ Win32Socket::~Win32Socket() { |
bool Win32Socket::CreateT(int family, int type) { |
Close(); |
int proto = (SOCK_DGRAM == type) ? IPPROTO_UDP : IPPROTO_TCP; |
- socket_ = ::WSASocket(family, type, proto, NULL, NULL, 0); |
+ socket_ = ::WSASocket(family, type, proto, nullptr, 0, 0); |
if (socket_ == INVALID_SOCKET) { |
UpdateLastError(); |
return false; |
@@ -487,14 +492,14 @@ Win32Socket* Win32Socket::Accept(SocketAddress* out_addr) { |
SOCKET s = ::accept(socket_, reinterpret_cast<sockaddr*>(&saddr), &addr_len); |
UpdateLastError(); |
if (s == INVALID_SOCKET) |
- return NULL; |
+ return nullptr; |
if (out_addr) |
SocketAddressFromSockAddrStorage(saddr, out_addr); |
Win32Socket* socket = new Win32Socket; |
if (0 == socket->Attach(s)) |
return socket; |
delete socket; |
- return NULL; |
+ return nullptr; |
} |
int Win32Socket::Close() { |
@@ -509,11 +514,11 @@ int Win32Socket::Close() { |
if (dns_) { |
WSACancelAsyncRequest(dns_->handle); |
delete dns_; |
- dns_ = NULL; |
+ dns_ = nullptr; |
} |
if (sink_) { |
sink_->Dispose(); |
- sink_ = NULL; |
+ sink_ = nullptr; |
} |
addr_.Clear(); |
state_ = CS_CLOSED; |
@@ -552,17 +557,17 @@ int Win32Socket::EstimateMTU(uint16_t* mtu) { |
} |
void Win32Socket::CreateSink() { |
- RTC_DCHECK(NULL == sink_); |
+ RTC_DCHECK(nullptr == sink_); |
// Create window |
sink_ = new EventSink(this); |
- sink_->Create(NULL, L"EventSink", 0, 0, 0, 0, 10, 10); |
+ sink_->Create(nullptr, L"EventSink", 0, 0, 0, 0, 10, 10); |
} |
bool Win32Socket::SetAsync(int events) { |
- if (NULL == sink_) { |
+ if (nullptr == sink_) { |
CreateSink(); |
- RTC_DCHECK(NULL != sink_); |
+ RTC_DCHECK(nullptr != sink_); |
} |
// start the async select |
@@ -709,7 +714,7 @@ void Win32Socket::OnDnsNotify(HANDLE task, int error) { |
SignalCloseEvent(this, error_); |
} else { |
delete dns_; |
- dns_ = NULL; |
+ dns_ = nullptr; |
} |
} |
@@ -725,16 +730,16 @@ Win32SocketServer::Win32SocketServer(MessageQueue* message_queue) |
: message_queue_(message_queue), |
wnd_(this), |
posted_(false), |
- hdlg_(NULL) { |
+ hdlg_(nullptr) { |
if (s_wm_wakeup_id == 0) |
s_wm_wakeup_id = RegisterWindowMessage(L"WM_WAKEUP"); |
- if (!wnd_.Create(NULL, kWindowName, 0, 0, 0, 0, 0, 0)) { |
+ if (!wnd_.Create(nullptr, kWindowName, 0, 0, 0, 0, 0, 0)) { |
LOG_GLE(LS_ERROR) << "Failed to create message window."; |
} |
} |
Win32SocketServer::~Win32SocketServer() { |
- if (wnd_.handle() != NULL) { |
+ if (wnd_.handle() != nullptr) { |
KillTimer(wnd_.handle(), 1); |
wnd_.Destroy(); |
} |
@@ -758,7 +763,7 @@ AsyncSocket* Win32SocketServer::CreateAsyncSocket(int family, int type) { |
return socket; |
} |
delete socket; |
- return NULL; |
+ return nullptr; |
} |
void Win32SocketServer::SetMessageQueue(MessageQueue* queue) { |
@@ -773,12 +778,12 @@ bool Win32SocketServer::Wait(int cms, bool process_io) { |
uint32_t start = Time(); |
do { |
MSG msg; |
- SetTimer(wnd_.handle(), 0, cms, NULL); |
+ SetTimer(wnd_.handle(), 0, cms, nullptr); |
// Get the next available message. If we have a modeless dialog, give |
// give the message to IsDialogMessage, which will return true if it |
// was a message for the dialog that it handled internally. |
// Otherwise, dispatch as usual via Translate/DispatchMessage. |
- b = GetMessage(&msg, NULL, 0, 0); |
+ b = GetMessage(&msg, nullptr, 0, 0); |
if (b == -1) { |
LOG_GLE(LS_ERROR) << "GetMessage failed."; |
return false; |
@@ -794,7 +799,7 @@ bool Win32SocketServer::Wait(int cms, bool process_io) { |
// Sit and wait forever for a WakeUp. This is the Thread::Send case. |
RTC_DCHECK(cms == -1); |
MSG msg; |
- b = GetMessage(&msg, NULL, s_wm_wakeup_id, s_wm_wakeup_id); |
+ b = GetMessage(&msg, nullptr, s_wm_wakeup_id, s_wm_wakeup_id); |
{ |
CritScope scope(&cs_); |
posted_ = false; |
@@ -844,7 +849,7 @@ void Win32SocketServer::Pump() { |
if (delay == -1) { |
KillTimer(wnd_.handle(), 1); |
} else { |
- SetTimer(wnd_.handle(), 1, delay, NULL); |
+ SetTimer(wnd_.handle(), 1, delay, nullptr); |
} |
} |