Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1809)

Unified Diff: webrtc/base/virtualsocketserver.cc

Issue 2718663005: Replace NULL with nullptr or null in webrtc/base/. (Closed)
Patch Set: Fixing Windows and formatting issues. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/base/virtualsocketserver.h ('k') | webrtc/base/weak_ptr.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/virtualsocketserver.cc
diff --git a/webrtc/base/virtualsocketserver.cc b/webrtc/base/virtualsocketserver.cc
index d9c7eebbc6dc69d52a343dc36889787bb70ee235..57f218e91ba609f11612dbcad4c1f0949a6770db 100644
--- a/webrtc/base/virtualsocketserver.cc
+++ b/webrtc/base/virtualsocketserver.cc
@@ -64,7 +64,7 @@ class Packet : public MessageData {
public:
Packet(const char* data, size_t size, const SocketAddress& from)
: size_(size), consumed_(0), from_(from) {
- RTC_DCHECK(NULL != data);
+ RTC_DCHECK(nullptr != data);
data_ = new char[size_];
memcpy(data_, data, size_);
}
@@ -103,7 +103,7 @@ VirtualSocket::VirtualSocket(VirtualSocketServer* server,
async_(async),
state_(CS_CLOSED),
error_(0),
- listen_queue_(NULL),
+ listen_queue_(nullptr),
network_size_(0),
recv_buffer_size_(0),
bound_(false),
@@ -184,7 +184,7 @@ int VirtualSocket::Close() {
listen_queue_->pop_front();
}
delete listen_queue_;
- listen_queue_ = NULL;
+ listen_queue_ = nullptr;
}
// Disconnect stream sockets
if (CS_CONNECTED == state_) {
@@ -210,7 +210,7 @@ int VirtualSocket::Close() {
server_->msg_queue_->Clear(this, MSG_ID_CONNECT, &msgs);
}
for (MessageList::iterator it = msgs.begin(); it != msgs.end(); ++it) {
- RTC_DCHECK(NULL != it->pdata);
+ RTC_DCHECK(nullptr != it->pdata);
MessageAddress* data = static_cast<MessageAddress*>(it->pdata);
// Lookup remote side.
@@ -308,7 +308,7 @@ int VirtualSocket::RecvFrom(void* pv,
recv_buffer_size_ -= data_read;
if (was_full) {
VirtualSocket* sender = server_->LookupBinding(remote_addr_);
- RTC_DCHECK(NULL != sender);
+ RTC_DCHECK(nullptr != sender);
server_->SendTcp(sender);
}
}
@@ -323,16 +323,16 @@ int VirtualSocket::Listen(int backlog) {
error_ = EINVAL;
return -1;
}
- RTC_DCHECK(NULL == listen_queue_);
+ RTC_DCHECK(nullptr == listen_queue_);
listen_queue_ = new ListenQueue;
state_ = CS_CONNECTING;
return 0;
}
VirtualSocket* VirtualSocket::Accept(SocketAddress* paddr) {
- if (NULL == listen_queue_) {
+ if (nullptr == listen_queue_) {
error_ = EINVAL;
- return NULL;
+ return nullptr;
}
while (!listen_queue_->empty()) {
VirtualSocket* socket = new VirtualSocket(server_, AF_INET, type_, async_);
@@ -355,7 +355,7 @@ VirtualSocket* VirtualSocket::Accept(SocketAddress* paddr) {
return socket;
}
error_ = EWOULDBLOCK;
- return NULL;
+ return nullptr;
}
int VirtualSocket::GetError() const {
@@ -393,7 +393,7 @@ int VirtualSocket::EstimateMTU(uint16_t* mtu) {
void VirtualSocket::OnMessage(Message* pmsg) {
if (pmsg->message_id == MSG_ID_PACKET) {
- RTC_DCHECK(NULL != pmsg->pdata);
+ RTC_DCHECK(nullptr != pmsg->pdata);
Packet* packet = static_cast<Packet*>(pmsg->pdata);
recv_buffer_.push_back(packet);
@@ -402,9 +402,9 @@ void VirtualSocket::OnMessage(Message* pmsg) {
SignalReadEvent(this);
}
} else if (pmsg->message_id == MSG_ID_CONNECT) {
- RTC_DCHECK(NULL != pmsg->pdata);
+ RTC_DCHECK(nullptr != pmsg->pdata);
MessageAddress* data = static_cast<MessageAddress*>(pmsg->pdata);
- if (listen_queue_ != NULL) {
+ if (listen_queue_ != nullptr) {
listen_queue_->push_back(data->addr);
if (async_) {
SignalReadEvent(this);
@@ -525,7 +525,7 @@ void VirtualSocket::OnSocketServerReadyToSend() {
VirtualSocketServer::VirtualSocketServer(SocketServer* ss)
: server_(ss),
server_owned_(false),
- msg_queue_(NULL),
+ msg_queue_(nullptr),
stop_on_idle_(false),
next_ipv4_(kInitialNextIPv4),
next_ipv6_(kInitialNextIPv6),
@@ -670,7 +670,7 @@ bool VirtualSocketServer::CloseTcpConnections(
int VirtualSocketServer::Bind(VirtualSocket* socket,
const SocketAddress& addr) {
- RTC_DCHECK(NULL != socket);
+ RTC_DCHECK(nullptr != socket);
// Address must be completely specified at this point
RTC_DCHECK(!IPIsUnspec(addr.ipaddr()));
RTC_DCHECK(addr.port() != 0);
@@ -683,7 +683,7 @@ int VirtualSocketServer::Bind(VirtualSocket* socket,
}
int VirtualSocketServer::Bind(VirtualSocket* socket, SocketAddress* addr) {
- RTC_DCHECK(NULL != socket);
+ RTC_DCHECK(nullptr != socket);
if (!IPIsUnspec(addr->ipaddr())) {
addr->SetIP(addr->ipaddr().Normalized());
@@ -757,7 +757,7 @@ VirtualSocket* VirtualSocketServer::LookupConnection(
remote.port());
SocketAddressPair address_pair(local_normalized, remote_normalized);
ConnectionMap::iterator it = connections_->find(address_pair);
- return (connections_->end() != it) ? it->second : NULL;
+ return (connections_->end() != it) ? it->second : nullptr;
}
void VirtualSocketServer::RemoveConnection(const SocketAddress& local,
@@ -784,7 +784,7 @@ int VirtualSocketServer::Connect(VirtualSocket* socket,
<< socket->GetLocalAddress() << " and " << remote_addr;
return -1;
}
- if (remote != NULL) {
+ if (remote != nullptr) {
SocketAddress addr = socket->GetLocalAddress();
msg_queue_->PostDelayed(RTC_FROM_HERE, delay, remote, MSG_ID_CONNECT,
new MessageAddress(addr));
« no previous file with comments | « webrtc/base/virtualsocketserver.h ('k') | webrtc/base/weak_ptr.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698