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

Unified Diff: webrtc/voice_engine/test/channel_transport/udp_socket_manager_posix.cc

Issue 2685783014: Replace NULL with nullptr in all C++ files. (Closed)
Patch Set: Fixing android. 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
Index: webrtc/voice_engine/test/channel_transport/udp_socket_manager_posix.cc
diff --git a/webrtc/voice_engine/test/channel_transport/udp_socket_manager_posix.cc b/webrtc/voice_engine/test/channel_transport/udp_socket_manager_posix.cc
index 6447e8bec1ff154015c699bf15acd0b01751a013..622b5186c9f5f0aae5aa0bcc92f76951c3eedcbf 100644
--- a/webrtc/voice_engine/test/channel_transport/udp_socket_manager_posix.cc
+++ b/webrtc/voice_engine/test/channel_transport/udp_socket_manager_posix.cc
@@ -196,21 +196,18 @@ UdpSocketManagerPosixImpl::UdpSocketManagerPosixImpl()
UdpSocketManagerPosixImpl::~UdpSocketManagerPosixImpl()
{
- if (_critSectList != NULL)
- {
- UpdateSocketMap();
-
- _critSectList->Enter();
- for (std::map<SOCKET, UdpSocketPosix*>::iterator it =
- _socketMap.begin();
- it != _socketMap.end();
- ++it) {
- delete it->second;
- }
- _socketMap.clear();
- _critSectList->Leave();
+ if (_critSectList != nullptr) {
+ UpdateSocketMap();
+
+ _critSectList->Enter();
+ for (std::map<SOCKET, UdpSocketPosix*>::iterator it = _socketMap.begin();
+ it != _socketMap.end(); ++it) {
+ delete it->second;
+ }
+ _socketMap.clear();
+ _critSectList->Leave();
- delete _critSectList;
+ delete _critSectList;
}
WEBRTC_TRACE(kTraceMemory, kTraceTransport, -1,
@@ -259,13 +256,12 @@ bool UdpSocketManagerPosixImpl::Process()
int num = 0;
if (doSelect)
{
- num = select(maxFd+1, &_readFds, NULL, NULL, &timeout);
+ num = select(maxFd + 1, &_readFds, nullptr, nullptr, &timeout);
- if (num == SOCKET_ERROR)
- {
- // Timeout = 10 ms.
- SleepMs(10);
- return true;
+ if (num == SOCKET_ERROR) {
+ // Timeout = 10 ms.
+ SleepMs(10);
+ return true;
}
}else
{
@@ -343,21 +339,20 @@ void UdpSocketManagerPosixImpl::UpdateSocketMap()
_critSectList->Enter();
for (FdList::iterator iter = _removeList.begin();
iter != _removeList.end(); ++iter) {
- UdpSocketPosix* deleteSocket = NULL;
- SOCKET removeFD = *iter;
-
- // If the socket is in the add list it hasn't been added to the socket
- // map yet. Just remove the socket from the add list.
- for (SocketList::iterator iter = _addList.begin();
- iter != _addList.end(); ++iter) {
- UdpSocketPosix* addSocket = static_cast<UdpSocketPosix*>(*iter);
- SOCKET addFD = addSocket->GetFd();
- if(removeFD == addFD)
- {
- deleteSocket = addSocket;
- _addList.erase(iter);
- break;
- }
+ UdpSocketPosix* deleteSocket = nullptr;
+ SOCKET removeFD = *iter;
+
+ // If the socket is in the add list it hasn't been added to the socket
+ // map yet. Just remove the socket from the add list.
+ for (SocketList::iterator iter = _addList.begin(); iter != _addList.end();
+ ++iter) {
+ UdpSocketPosix* addSocket = static_cast<UdpSocketPosix*>(*iter);
+ SOCKET addFD = addSocket->GetFd();
+ if (removeFD == addFD) {
+ deleteSocket = addSocket;
+ _addList.erase(iter);
+ break;
+ }
}
// Find and remove socket from _socketMap.

Powered by Google App Engine
This is Rietveld 408576698