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

Side by Side Diff: webrtc/examples/peerconnection/server/main.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 2011 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2011 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 parser.SetUsageMessage(usage); 54 parser.SetUsageMessage(usage);
55 parser.SetFlag("port", "8888"); 55 parser.SetFlag("port", "8888");
56 parser.SetFlag("help", "false"); 56 parser.SetFlag("help", "false");
57 parser.ProcessFlags(); 57 parser.ProcessFlags();
58 58
59 if (parser.GetFlag("help") == "true") { 59 if (parser.GetFlag("help") == "true") {
60 parser.PrintUsageMessage(); 60 parser.PrintUsageMessage();
61 return 0; 61 return 0;
62 } 62 }
63 63
64 int port = strtol((parser.GetFlag("port")).c_str(), NULL, 10); 64 int port = strtol((parser.GetFlag("port")).c_str(), nullptr, 10);
65 65
66 // Abort if the user specifies a port that is outside the allowed 66 // Abort if the user specifies a port that is outside the allowed
67 // range [1, 65535]. 67 // range [1, 65535].
68 if ((port < 1) || (port > 65535)) { 68 if ((port < 1) || (port > 65535)) {
69 printf("Error: %i is not a valid port.\n", port); 69 printf("Error: %i is not a valid port.\n", port);
70 return -1; 70 return -1;
71 } 71 }
72 72
73 ListeningSocket listener; 73 ListeningSocket listener;
74 if (!listener.Create()) { 74 if (!listener.Create()) {
(...skipping 13 matching lines...) Expand all
88 while (!quit) { 88 while (!quit) {
89 fd_set socket_set; 89 fd_set socket_set;
90 FD_ZERO(&socket_set); 90 FD_ZERO(&socket_set);
91 if (listener.valid()) 91 if (listener.valid())
92 FD_SET(listener.socket(), &socket_set); 92 FD_SET(listener.socket(), &socket_set);
93 93
94 for (SocketArray::iterator i = sockets.begin(); i != sockets.end(); ++i) 94 for (SocketArray::iterator i = sockets.begin(); i != sockets.end(); ++i)
95 FD_SET((*i)->socket(), &socket_set); 95 FD_SET((*i)->socket(), &socket_set);
96 96
97 struct timeval timeout = { 10, 0 }; 97 struct timeval timeout = { 10, 0 };
98 if (select(FD_SETSIZE, &socket_set, NULL, NULL, &timeout) == SOCKET_ERROR) { 98 if (select(FD_SETSIZE, &socket_set, nullptr, nullptr, &timeout) ==
99 SOCKET_ERROR) {
99 printf("select failed\n"); 100 printf("select failed\n");
100 break; 101 break;
101 } 102 }
102 103
103 for (SocketArray::iterator i = sockets.begin(); i != sockets.end(); ++i) { 104 for (SocketArray::iterator i = sockets.begin(); i != sockets.end(); ++i) {
104 DataSocket* s = *i; 105 DataSocket* s = *i;
105 bool socket_done = true; 106 bool socket_done = true;
106 if (FD_ISSET(s->socket(), &socket_set)) { 107 if (FD_ISSET(s->socket(), &socket_set)) {
107 if (s->OnDataAvailable(&socket_done) && s->request_received()) { 108 if (s->OnDataAvailable(&socket_done) && s->request_received()) {
108 ChannelMember* member = clients.Lookup(s); 109 ChannelMember* member = clients.Lookup(s);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 } 172 }
172 } 173 }
173 } 174 }
174 175
175 for (SocketArray::iterator i = sockets.begin(); i != sockets.end(); ++i) 176 for (SocketArray::iterator i = sockets.begin(); i != sockets.end(); ++i)
176 delete (*i); 177 delete (*i);
177 sockets.clear(); 178 sockets.clear();
178 179
179 return 0; 180 return 0;
180 } 181 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698