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

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

Issue 2439173002: [windows] Make most file_win.cc functions use malloc for string conversions. (Closed)
Patch Set: Fix typo Created 4 years, 2 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
« no previous file with comments | « runtime/bin/file_win.cc ('k') | runtime/bin/utils_win.h » ('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 #if !defined(DART_IO_DISABLED) 5 #if !defined(DART_IO_DISABLED)
6 6
7 #include "platform/globals.h" 7 #include "platform/globals.h"
8 #if defined(TARGET_OS_WINDOWS) 8 #if defined(TARGET_OS_WINDOWS)
9 9
10 #include "bin/socket.h" 10 #include "bin/socket.h"
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 SetLastError(error_code); 363 SetLastError(error_code);
364 *os_error = new OSError(); 364 *os_error = new OSError();
365 return false; 365 return false;
366 } 366 }
367 return true; 367 return true;
368 } 368 }
369 369
370 370
371 bool Socket::ParseAddress(int type, const char* address, RawAddr* addr) { 371 bool Socket::ParseAddress(int type, const char* address, RawAddr* addr) {
372 int result; 372 int result;
373 const wchar_t* system_address = StringUtilsWin::Utf8ToWide(address); 373 Utf8ToWideScope system_address(address);
374 if (type == SocketAddress::TYPE_IPV4) { 374 if (type == SocketAddress::TYPE_IPV4) {
375 result = InetPton(AF_INET, system_address, &addr->in.sin_addr); 375 result = InetPton(AF_INET, system_address.wide(), &addr->in.sin_addr);
376 } else { 376 } else {
377 ASSERT(type == SocketAddress::TYPE_IPV6); 377 ASSERT(type == SocketAddress::TYPE_IPV6);
378 result = InetPton(AF_INET6, system_address, &addr->in6.sin6_addr); 378 result = InetPton(AF_INET6, system_address.wide(), &addr->in6.sin6_addr);
379 } 379 }
380 return result == 1; 380 return result == 1;
381 } 381 }
382 382
383 383
384 intptr_t Socket::CreateBindDatagram(const RawAddr& addr, bool reuseAddress) { 384 intptr_t Socket::CreateBindDatagram(const RawAddr& addr, bool reuseAddress) {
385 SOCKET s = socket(addr.ss.ss_family, SOCK_DGRAM, IPPROTO_UDP); 385 SOCKET s = socket(addr.ss.ss_family, SOCK_DGRAM, IPPROTO_UDP);
386 if (s == INVALID_SOCKET) { 386 if (s == INVALID_SOCKET) {
387 return -1; 387 return -1;
388 } 388 }
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 reinterpret_cast<char *>(&mreq), 720 reinterpret_cast<char *>(&mreq),
721 sizeof(mreq)) == 0; 721 sizeof(mreq)) == 0;
722 } 722 }
723 723
724 } // namespace bin 724 } // namespace bin
725 } // namespace dart 725 } // namespace dart
726 726
727 #endif // defined(TARGET_OS_WINDOWS) 727 #endif // defined(TARGET_OS_WINDOWS)
728 728
729 #endif // !defined(DART_IO_DISABLED) 729 #endif // !defined(DART_IO_DISABLED)
OLDNEW
« no previous file with comments | « runtime/bin/file_win.cc ('k') | runtime/bin/utils_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698