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

Side by Side Diff: webrtc/voice_engine/test/channel_transport/udp_socket_wrapper.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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 19 matching lines...) Expand all
30 bool UdpSocketWrapper::_initiated = false; 30 bool UdpSocketWrapper::_initiated = false;
31 31
32 // Temporary Android hack. The value 1024 is taken from 32 // Temporary Android hack. The value 1024 is taken from
33 // <ndk>/build/platforms/android-1.5/arch-arm/usr/include/linux/posix_types.h 33 // <ndk>/build/platforms/android-1.5/arch-arm/usr/include/linux/posix_types.h
34 // TODO (tomasl): can we remove this now? 34 // TODO (tomasl): can we remove this now?
35 #ifndef FD_SETSIZE 35 #ifndef FD_SETSIZE
36 #define FD_SETSIZE 1024 36 #define FD_SETSIZE 1024
37 #endif 37 #endif
38 38
39 UdpSocketWrapper::UdpSocketWrapper() 39 UdpSocketWrapper::UdpSocketWrapper()
40 : _wantsIncoming(false), 40 : _wantsIncoming(false), _deleteEvent(nullptr) {}
41 _deleteEvent(NULL)
42 {
43 }
44 41
45 UdpSocketWrapper::~UdpSocketWrapper() 42 UdpSocketWrapper::~UdpSocketWrapper()
46 { 43 {
47 if(_deleteEvent) 44 if(_deleteEvent)
48 { 45 {
49 _deleteEvent->Set(); 46 _deleteEvent->Set();
50 _deleteEvent = NULL; 47 _deleteEvent = nullptr;
51 } 48 }
52 } 49 }
53 50
54 void UdpSocketWrapper::SetEventToNull() 51 void UdpSocketWrapper::SetEventToNull()
55 { 52 {
56 if (_deleteEvent) 53 if (_deleteEvent)
57 { 54 {
58 _deleteEvent = NULL; 55 _deleteEvent = nullptr;
59 } 56 }
60 } 57 }
61 58
62 UdpSocketWrapper* UdpSocketWrapper::CreateSocket(const int32_t id, 59 UdpSocketWrapper* UdpSocketWrapper::CreateSocket(const int32_t id,
63 UdpSocketManager* mgr, 60 UdpSocketManager* mgr,
64 CallbackObj obj, 61 CallbackObj obj,
65 IncomingSocketCallback cb, 62 IncomingSocketCallback cb,
66 bool ipV6Enable, 63 bool ipV6Enable,
67 bool disableGQOS) 64 bool disableGQOS)
68 65
(...skipping 11 matching lines...) Expand all
80 int32_t err = WSAStartup( wVersionRequested, &wsaData); 77 int32_t err = WSAStartup( wVersionRequested, &wsaData);
81 if (err != 0) 78 if (err != 0)
82 { 79 {
83 WEBRTC_TRACE( 80 WEBRTC_TRACE(
84 kTraceError, 81 kTraceError,
85 kTraceTransport, 82 kTraceTransport,
86 id, 83 id,
87 "UdpSocketWrapper::CreateSocket failed to initialize sockets\ 84 "UdpSocketWrapper::CreateSocket failed to initialize sockets\
88 WSAStartup error:%d", 85 WSAStartup error:%d",
89 err); 86 err);
90 return NULL; 87 return nullptr;
91 } 88 }
92 89
93 _initiated = true; 90 _initiated = true;
94 } 91 }
95 92
96 s = new UdpSocket2Windows(id, mgr, ipV6Enable, disableGQOS); 93 s = new UdpSocket2Windows(id, mgr, ipV6Enable, disableGQOS);
97 94
98 #else 95 #else
99 if (!_initiated) 96 if (!_initiated)
100 { 97 {
101 _initiated = true; 98 _initiated = true;
102 } 99 }
103 s = new UdpSocketPosix(id, mgr, ipV6Enable); 100 s = new UdpSocketPosix(id, mgr, ipV6Enable);
104 if (s) 101 if (s)
105 { 102 {
106 UdpSocketPosix* sl = static_cast<UdpSocketPosix*>(s); 103 UdpSocketPosix* sl = static_cast<UdpSocketPosix*>(s);
107 if (sl->GetFd() != INVALID_SOCKET && sl->GetFd() < FD_SETSIZE) 104 if (sl->GetFd() != INVALID_SOCKET && sl->GetFd() < FD_SETSIZE)
108 { 105 {
109 // ok 106 // ok
110 } else 107 } else
111 { 108 {
112 WEBRTC_TRACE( 109 WEBRTC_TRACE(
113 kTraceError, 110 kTraceError,
114 kTraceTransport, 111 kTraceTransport,
115 id, 112 id,
116 "UdpSocketWrapper::CreateSocket failed to initialize socket"); 113 "UdpSocketWrapper::CreateSocket failed to initialize socket");
117 delete s; 114 delete s;
118 s = NULL; 115 s = nullptr;
119 } 116 }
120 } 117 }
121 #endif 118 #endif
122 if (s) 119 if (s)
123 { 120 {
124 s->_deleteEvent = NULL; 121 s->_deleteEvent = nullptr;
125 if (!s->SetCallback(obj, cb)) 122 if (!s->SetCallback(obj, cb)) {
126 { 123 WEBRTC_TRACE(kTraceError, kTraceTransport, id,
127 WEBRTC_TRACE( 124 "UdpSocketWrapper::CreateSocket failed to ser callback");
128 kTraceError, 125 return (nullptr);
129 kTraceTransport,
130 id,
131 "UdpSocketWrapper::CreateSocket failed to ser callback");
132 return(NULL);
133 } 126 }
134 } 127 }
135 return s; 128 return s;
136 } 129 }
137 130
138 bool UdpSocketWrapper::StartReceiving() 131 bool UdpSocketWrapper::StartReceiving()
139 { 132 {
140 _wantsIncoming = true; 133 _wantsIncoming = true;
141 return true; 134 return true;
142 } 135 }
143 136
144 bool UdpSocketWrapper::StartReceiving(const uint32_t /*receiveBuffers*/) { 137 bool UdpSocketWrapper::StartReceiving(const uint32_t /*receiveBuffers*/) {
145 return StartReceiving(); 138 return StartReceiving();
146 } 139 }
147 140
148 bool UdpSocketWrapper::StopReceiving() 141 bool UdpSocketWrapper::StopReceiving()
149 { 142 {
150 _wantsIncoming = false; 143 _wantsIncoming = false;
151 return true; 144 return true;
152 } 145 }
153 146
154 int32_t UdpSocketWrapper::SetPCP(const int32_t /*pcp*/) { return -1; } 147 int32_t UdpSocketWrapper::SetPCP(const int32_t /*pcp*/) { return -1; }
155 148
156 uint32_t UdpSocketWrapper::ReceiveBuffers() { return 0; } 149 uint32_t UdpSocketWrapper::ReceiveBuffers() { return 0; }
157 150
158 } // namespace test 151 } // namespace test
159 } // namespace webrtc 152 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698