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

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

Issue 1800863002: Cleanup in //runtime/bin (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Windows fixes Created 4 years, 9 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
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 #include "bin/file.h" 5 #include "bin/file.h"
6 6
7 #include "bin/builtin.h" 7 #include "bin/builtin.h"
8 #include "bin/dartutils.h" 8 #include "bin/dartutils.h"
9 #include "bin/embedded_dart_io.h" 9 #include "bin/embedded_dart_io.h"
10 #include "bin/io_buffer.h" 10 #include "bin/io_buffer.h"
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 if (path != NULL) { 558 if (path != NULL) {
559 Dart_SetReturnValue(args, DartUtils::NewString(path)); 559 Dart_SetReturnValue(args, DartUtils::NewString(path));
560 } else { 560 } else {
561 Dart_SetReturnValue(args, DartUtils::NewDartOSError()); 561 Dart_SetReturnValue(args, DartUtils::NewDartOSError());
562 } 562 }
563 } 563 }
564 564
565 565
566 void FUNCTION_NAME(File_OpenStdio)(Dart_NativeArguments args) { 566 void FUNCTION_NAME(File_OpenStdio)(Dart_NativeArguments args) {
567 int64_t fd = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0)); 567 int64_t fd = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0));
568 ASSERT(fd == STDIN_FILENO || fd == STDOUT_FILENO || fd == STDERR_FILENO); 568 ASSERT((fd == STDIN_FILENO) ||
569 (fd == STDOUT_FILENO) ||
570 (fd == STDERR_FILENO));
569 File* file = File::OpenStdio(static_cast<int>(fd)); 571 File* file = File::OpenStdio(static_cast<int>(fd));
570 Dart_SetReturnValue(args, Dart_NewInteger(reinterpret_cast<intptr_t>(file))); 572 Dart_SetReturnValue(args, Dart_NewInteger(reinterpret_cast<intptr_t>(file)));
571 } 573 }
572 574
573 575
574 void FUNCTION_NAME(File_GetStdioHandleType)(Dart_NativeArguments args) { 576 void FUNCTION_NAME(File_GetStdioHandleType)(Dart_NativeArguments args) {
575 int64_t fd = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0)); 577 int64_t fd = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0));
576 ASSERT(fd == STDIN_FILENO || fd == STDOUT_FILENO || fd == STDERR_FILENO); 578 ASSERT((fd == STDIN_FILENO) ||
579 (fd == STDOUT_FILENO) ||
580 (fd == STDERR_FILENO));
577 File::StdioHandleType type = File::GetStdioHandleType(static_cast<int>(fd)); 581 File::StdioHandleType type = File::GetStdioHandleType(static_cast<int>(fd));
578 Dart_SetReturnValue(args, Dart_NewInteger(type)); 582 Dart_SetReturnValue(args, Dart_NewInteger(type));
579 } 583 }
580 584
581 585
582 void FUNCTION_NAME(File_GetType)(Dart_NativeArguments args) { 586 void FUNCTION_NAME(File_GetType)(Dart_NativeArguments args) {
583 if (Dart_IsString(Dart_GetNativeArgument(args, 0)) && 587 if (Dart_IsString(Dart_GetNativeArgument(args, 0)) &&
584 Dart_IsBoolean(Dart_GetNativeArgument(args, 1))) { 588 Dart_IsBoolean(Dart_GetNativeArgument(args, 1))) {
585 const char* str = 589 const char* str =
586 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); 590 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0));
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 } 1243 }
1240 } else { 1244 } else {
1241 return CObject::FileClosedError(); 1245 return CObject::FileClosedError();
1242 } 1246 }
1243 } 1247 }
1244 return CObject::IllegalArgumentError(); 1248 return CObject::IllegalArgumentError();
1245 } 1249 }
1246 1250
1247 } // namespace bin 1251 } // namespace bin
1248 } // namespace dart 1252 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698