| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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_WINDOWS) | 6 #if defined(TARGET_OS_WINDOWS) |
| 7 | 7 |
| 8 #include "bin/platform.h" | 8 #include "bin/platform.h" |
| 9 #include "bin/log.h" | 9 #include "bin/log.h" |
| 10 #include "bin/socket.h" | 10 #include "bin/socket.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 GetSystemInfo(&info); | 25 GetSystemInfo(&info); |
| 26 return info.dwNumberOfProcessors; | 26 return info.dwNumberOfProcessors; |
| 27 } | 27 } |
| 28 | 28 |
| 29 | 29 |
| 30 const char* Platform::OperatingSystem() { | 30 const char* Platform::OperatingSystem() { |
| 31 return "windows"; | 31 return "windows"; |
| 32 } | 32 } |
| 33 | 33 |
| 34 | 34 |
| 35 const char* Platform::LibraryExtension() { | |
| 36 return "dll"; | |
| 37 } | |
| 38 | |
| 39 | |
| 40 bool Platform::LocalHostname(char *buffer, intptr_t buffer_length) { | 35 bool Platform::LocalHostname(char *buffer, intptr_t buffer_length) { |
| 41 #if defined(PLATFORM_DISABLE_SOCKET) | |
| 42 return false; | |
| 43 #else | |
| 44 if (!Socket::Initialize()) return false; | 36 if (!Socket::Initialize()) return false; |
| 45 return gethostname(buffer, buffer_length) == 0; | 37 return gethostname(buffer, buffer_length) == 0; |
| 46 #endif | |
| 47 } | 38 } |
| 48 | 39 |
| 49 | 40 |
| 50 char** Platform::Environment(intptr_t* count) { | 41 char** Platform::Environment(intptr_t* count) { |
| 51 wchar_t* strings = GetEnvironmentStringsW(); | 42 wchar_t* strings = GetEnvironmentStringsW(); |
| 52 if (strings == NULL) return NULL; | 43 if (strings == NULL) return NULL; |
| 53 wchar_t* tmp = strings; | 44 wchar_t* tmp = strings; |
| 54 intptr_t i = 0; | 45 intptr_t i = 0; |
| 55 while (*tmp != '\0') { | 46 while (*tmp != '\0') { |
| 56 // Skip environment strings starting with "=". | 47 // Skip environment strings starting with "=". |
| (...skipping 20 matching lines...) Expand all Loading... |
| 77 for (intptr_t i = 0; i < count; i++) { | 68 for (intptr_t i = 0; i < count; i++) { |
| 78 free(env[i]); | 69 free(env[i]); |
| 79 } | 70 } |
| 80 delete[] env; | 71 delete[] env; |
| 81 } | 72 } |
| 82 | 73 |
| 83 } // namespace bin | 74 } // namespace bin |
| 84 } // namespace dart | 75 } // namespace dart |
| 85 | 76 |
| 86 #endif // defined(TARGET_OS_WINDOWS) | 77 #endif // defined(TARGET_OS_WINDOWS) |
| OLD | NEW |