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

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

Issue 1228053002: Change stdout/stderr to binary mode on Windows (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Really use the _O_ version Created 5 years, 5 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 | « no previous file | tests/standalone/io/stdio_nonblocking_test.dart » ('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/file.h" 8 #include "bin/file.h"
9 9
10 #include <fcntl.h> // NOLINT 10 #include <fcntl.h> // NOLINT
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 switch (fd) { 189 switch (fd) {
190 case 1: 190 case 1:
191 fd = _fileno(stdout); 191 fd = _fileno(stdout);
192 break; 192 break;
193 case 2: 193 case 2:
194 fd = _fileno(stderr); 194 fd = _fileno(stderr);
195 break; 195 break;
196 default: 196 default:
197 UNREACHABLE(); 197 UNREACHABLE();
198 } 198 }
199 _setmode(fd, _O_BINARY);
199 return new File(new FileHandle(fd)); 200 return new File(new FileHandle(fd));
200 } 201 }
201 202
202 203
203 bool File::Exists(const char* name) { 204 bool File::Exists(const char* name) {
204 struct __stat64 st; 205 struct __stat64 st;
205 const wchar_t* system_name = StringUtilsWin::Utf8ToWide(name); 206 const wchar_t* system_name = StringUtilsWin::Utf8ToWide(name);
206 bool stat_status = _wstat64(system_name, &st); 207 bool stat_status = _wstat64(system_name, &st);
207 free(const_cast<wchar_t*>(system_name)); 208 free(const_cast<wchar_t*>(system_name));
208 if (stat_status == 0) { 209 if (stat_status == 0) {
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 return kIdentical; 692 return kIdentical;
692 } else { 693 } else {
693 return kDifferent; 694 return kDifferent;
694 } 695 }
695 } 696 }
696 697
697 } // namespace bin 698 } // namespace bin
698 } // namespace dart 699 } // namespace dart
699 700
700 #endif // defined(TARGET_OS_WINDOWS) 701 #endif // defined(TARGET_OS_WINDOWS)
OLDNEW
« no previous file with comments | « no previous file | tests/standalone/io/stdio_nonblocking_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698