OLD | NEW |
---|---|
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(HOST_OS_WINDOWS) | 8 #if defined(HOST_OS_WINDOWS) |
9 | 9 |
10 #include "bin/socket_base.h" | 10 #include "bin/socket_base.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
160 int SocketBase::GetType(intptr_t fd) { | 160 int SocketBase::GetType(intptr_t fd) { |
161 Handle* handle = reinterpret_cast<Handle*>(fd); | 161 Handle* handle = reinterpret_cast<Handle*>(fd); |
162 switch (GetFileType(handle->handle())) { | 162 switch (GetFileType(handle->handle())) { |
163 case FILE_TYPE_CHAR: | 163 case FILE_TYPE_CHAR: |
164 return File::kTerminal; | 164 return File::kTerminal; |
165 case FILE_TYPE_PIPE: | 165 case FILE_TYPE_PIPE: |
166 return File::kPipe; | 166 return File::kPipe; |
167 case FILE_TYPE_DISK: | 167 case FILE_TYPE_DISK: |
168 return File::kFile; | 168 return File::kFile; |
169 default: | 169 default: |
170 return GetLastError == NO_ERROR ? File::kOther : -1; | 170 return GetLastError == MX_OK ? File::kOther : -1; |
zra
2017/06/09 19:24:25
ditto
| |
171 } | 171 } |
172 } | 172 } |
173 | 173 |
174 | 174 |
175 intptr_t SocketBase::GetStdioHandle(intptr_t num) { | 175 intptr_t SocketBase::GetStdioHandle(intptr_t num) { |
176 if (num != 0) { | 176 if (num != 0) { |
177 return -1; | 177 return -1; |
178 } | 178 } |
179 HANDLE handle = GetStdHandle(STD_INPUT_HANDLE); | 179 HANDLE handle = GetStdHandle(STD_INPUT_HANDLE); |
180 if (handle == INVALID_HANDLE_VALUE) { | 180 if (handle == INVALID_HANDLE_VALUE) { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
281 // Query the size needed. | 281 // Query the size needed. |
282 int status = GetAdaptersAddresses(SocketAddress::FromType(type), flags, NULL, | 282 int status = GetAdaptersAddresses(SocketAddress::FromType(type), flags, NULL, |
283 NULL, &size); | 283 NULL, &size); |
284 IP_ADAPTER_ADDRESSES* addrs = NULL; | 284 IP_ADAPTER_ADDRESSES* addrs = NULL; |
285 if (status == ERROR_BUFFER_OVERFLOW) { | 285 if (status == ERROR_BUFFER_OVERFLOW) { |
286 addrs = reinterpret_cast<IP_ADAPTER_ADDRESSES*>(malloc(size)); | 286 addrs = reinterpret_cast<IP_ADAPTER_ADDRESSES*>(malloc(size)); |
287 // Get the addresses now we have the right buffer. | 287 // Get the addresses now we have the right buffer. |
288 status = GetAdaptersAddresses(SocketAddress::FromType(type), flags, NULL, | 288 status = GetAdaptersAddresses(SocketAddress::FromType(type), flags, NULL, |
289 addrs, &size); | 289 addrs, &size); |
290 } | 290 } |
291 if (status != NO_ERROR) { | 291 if (status != MX_OK) { |
292 ASSERT(*os_error == NULL); | 292 ASSERT(*os_error == NULL); |
293 DWORD error_code = WSAGetLastError(); | 293 DWORD error_code = WSAGetLastError(); |
294 SetLastError(error_code); | 294 SetLastError(error_code); |
295 *os_error = new OSError(); | 295 *os_error = new OSError(); |
296 return NULL; | 296 return NULL; |
297 } | 297 } |
298 intptr_t count = 0; | 298 intptr_t count = 0; |
299 for (IP_ADAPTER_ADDRESSES* a = addrs; a != NULL; a = a->Next) { | 299 for (IP_ADAPTER_ADDRESSES* a = addrs; a != NULL; a = a->Next) { |
300 for (IP_ADAPTER_UNICAST_ADDRESS* u = a->FirstUnicastAddress; u != NULL; | 300 for (IP_ADAPTER_UNICAST_ADDRESS* u = a->FirstUnicastAddress; u != NULL; |
301 u = u->Next) { | 301 u = u->Next) { |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
452 return setsockopt(handle->socket(), proto, MCAST_LEAVE_GROUP, | 452 return setsockopt(handle->socket(), proto, MCAST_LEAVE_GROUP, |
453 reinterpret_cast<char*>(&mreq), sizeof(mreq)) == 0; | 453 reinterpret_cast<char*>(&mreq), sizeof(mreq)) == 0; |
454 } | 454 } |
455 | 455 |
456 } // namespace bin | 456 } // namespace bin |
457 } // namespace dart | 457 } // namespace dart |
458 | 458 |
459 #endif // defined(HOST_OS_WINDOWS) | 459 #endif // defined(HOST_OS_WINDOWS) |
460 | 460 |
461 #endif // !defined(DART_IO_DISABLED) | 461 #endif // !defined(DART_IO_DISABLED) |
OLD | NEW |