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

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

Issue 12316036: Merge IO v2 branch to bleeding edge (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased to r18818 Created 7 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 | Annotate | Revision Log
« no previous file with comments | « runtime/bin/file.cc ('k') | runtime/bin/process.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) 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 10 matching lines...) Expand all
21 return info.dwNumberOfProcessors; 21 return info.dwNumberOfProcessors;
22 } 22 }
23 23
24 24
25 const char* Platform::OperatingSystem() { 25 const char* Platform::OperatingSystem() {
26 return "windows"; 26 return "windows";
27 } 27 }
28 28
29 29
30 bool Platform::LocalHostname(char *buffer, intptr_t buffer_length) { 30 bool Platform::LocalHostname(char *buffer, intptr_t buffer_length) {
31 static bool socket_initialized = false; 31 if (!Socket::Initialize()) return false;
32 if (!socket_initialized) {
33 // Initialize Socket for gethostname.
34 if (!Socket::Initialize()) return false;
35 socket_initialized = true;
36 }
37 return gethostname(buffer, buffer_length) == 0; 32 return gethostname(buffer, buffer_length) == 0;
38 } 33 }
39 34
40 35
41 char** Platform::Environment(intptr_t* count) { 36 char** Platform::Environment(intptr_t* count) {
42 wchar_t* strings = GetEnvironmentStringsW(); 37 wchar_t* strings = GetEnvironmentStringsW();
43 if (strings == NULL) return NULL; 38 if (strings == NULL) return NULL;
44 wchar_t* tmp = strings; 39 wchar_t* tmp = strings;
45 intptr_t i = 0; 40 intptr_t i = 0;
46 while (*tmp != '\0') { 41 while (*tmp != '\0') {
(...skipping 11 matching lines...) Expand all
58 return result; 53 return result;
59 } 54 }
60 55
61 56
62 void Platform::FreeEnvironment(char** env, int count) { 57 void Platform::FreeEnvironment(char** env, int count) {
63 for (int i = 0; i < count; i++) free(env[i]); 58 for (int i = 0; i < count; i++) free(env[i]);
64 delete[] env; 59 delete[] env;
65 } 60 }
66 61
67 #endif // defined(TARGET_OS_WINDOWS) 62 #endif // defined(TARGET_OS_WINDOWS)
OLDNEW
« no previous file with comments | « runtime/bin/file.cc ('k') | runtime/bin/process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698