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

Side by Side Diff: runtime/bin/socket_linux.cc

Issue 17341008: Update mac and android Socket::LookupAddress. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « runtime/bin/socket_android.cc ('k') | runtime/bin/socket_macos.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(TARGET_OS_LINUX) 6 #if defined(TARGET_OS_LINUX)
7 7
8 #include <errno.h> // NOLINT 8 #include <errno.h> // NOLINT
9 #include <stdio.h> // NOLINT 9 #include <stdio.h> // NOLINT
10 #include <stdlib.h> // NOLINT 10 #include <stdlib.h> // NOLINT
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 ASSERT(*os_error == NULL); 201 ASSERT(*os_error == NULL);
202 *os_error = new OSError(status, 202 *os_error = new OSError(status,
203 gai_strerror(status), 203 gai_strerror(status),
204 OSError::kGetAddressInfo); 204 OSError::kGetAddressInfo);
205 return NULL; 205 return NULL;
206 } 206 }
207 intptr_t count = 0; 207 intptr_t count = 0;
208 for (struct addrinfo* c = info; c != NULL; c = c->ai_next) { 208 for (struct addrinfo* c = info; c != NULL; c = c->ai_next) {
209 if (c->ai_family == AF_INET || c->ai_family == AF_INET6) count++; 209 if (c->ai_family == AF_INET || c->ai_family == AF_INET6) count++;
210 } 210 }
211 int i = 0; 211 intptr_t i = 0;
212 AddressList<SocketAddress>* addresses = new AddressList<SocketAddress>(count); 212 AddressList<SocketAddress>* addresses = new AddressList<SocketAddress>(count);
213 for (struct addrinfo* c = info; c != NULL; c = c->ai_next) { 213 for (struct addrinfo* c = info; c != NULL; c = c->ai_next) {
214 if (c->ai_family == AF_INET || c->ai_family == AF_INET6) { 214 if (c->ai_family == AF_INET || c->ai_family == AF_INET6) {
215 addresses->SetAt(i, new SocketAddress(c->ai_addr)); 215 addresses->SetAt(i, new SocketAddress(c->ai_addr));
216 i++; 216 i++;
217 } 217 }
218 } 218 }
219 freeaddrinfo(info); 219 freeaddrinfo(info);
220 return addresses; 220 return addresses;
221 } 221 }
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 SOL_TCP, 366 SOL_TCP,
367 TCP_NODELAY, 367 TCP_NODELAY,
368 reinterpret_cast<char *>(&on), 368 reinterpret_cast<char *>(&on),
369 sizeof(on))) == 0; 369 sizeof(on))) == 0;
370 } 370 }
371 371
372 } // namespace bin 372 } // namespace bin
373 } // namespace dart 373 } // namespace dart
374 374
375 #endif // defined(TARGET_OS_LINUX) 375 #endif // defined(TARGET_OS_LINUX)
OLDNEW
« no previous file with comments | « runtime/bin/socket_android.cc ('k') | runtime/bin/socket_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698