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

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

Issue 2698813002: [dart:io][windows] Make unicode characters display correctly. (Closed)
Patch Set: Make tests pass Created 3 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
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 #if !defined(DART_IO_DISABLED) 5 #if !defined(DART_IO_DISABLED)
6 6
7 #include "bin/file.h" 7 #include "bin/file.h"
8 8
9 #include "bin/builtin.h" 9 #include "bin/builtin.h"
10 #include "bin/dartutils.h" 10 #include "bin/dartutils.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 intptr_t file_pointer = 69 intptr_t file_pointer =
70 DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 1)); 70 DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 1));
71 File* file = reinterpret_cast<File*>(file_pointer); 71 File* file = reinterpret_cast<File*>(file_pointer);
72 Dart_WeakPersistentHandle handle = Dart_NewWeakPersistentHandle( 72 Dart_WeakPersistentHandle handle = Dart_NewWeakPersistentHandle(
73 dart_this, reinterpret_cast<void*>(file), sizeof(*file), ReleaseFile); 73 dart_this, reinterpret_cast<void*>(file), sizeof(*file), ReleaseFile);
74 file->SetWeakHandle(handle); 74 file->SetWeakHandle(handle);
75 SetFile(dart_this, file_pointer); 75 SetFile(dart_this, file_pointer);
76 } 76 }
77 77
78 78
79 void FUNCTION_NAME(File_SetTranslation)(Dart_NativeArguments args) {
80 File* file = GetFile(args);
81 ASSERT(file != NULL);
82 intptr_t translation =
83 DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 1));
siva 2017/02/22 00:58:45 Dart_GetNativeIntegerArgument might work here, jus
zra 2017/02/22 05:07:15 Done.
84 if ((translation != File::kText) && (translation != File::kBinary)) {
85 Dart_ThrowException(DartUtils::NewDartArgumentError(
86 "The argument must be a FileTranslation mode"));
87 }
88 file->SetTranslation(static_cast<File::DartFileTranslation>(translation));
89 }
90
91
79 void FUNCTION_NAME(File_Open)(Dart_NativeArguments args) { 92 void FUNCTION_NAME(File_Open)(Dart_NativeArguments args) {
80 const char* filename = 93 const char* filename =
81 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); 94 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0));
82 int64_t mode = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 1)); 95 int64_t mode = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 1));
83 File::DartFileOpenMode dart_file_mode = 96 File::DartFileOpenMode dart_file_mode =
84 static_cast<File::DartFileOpenMode>(mode); 97 static_cast<File::DartFileOpenMode>(mode);
85 File::FileOpenMode file_mode = File::DartModeToFileMode(dart_file_mode); 98 File::FileOpenMode file_mode = File::DartModeToFileMode(dart_file_mode);
86 // Check that the file exists before opening it only for 99 // Check that the file exists before opening it only for
87 // reading. This is to prevent the opening of directories as 100 // reading. This is to prevent the opening of directories as
88 // files. Directories can be opened for reading using the posix 101 // files. Directories can be opened for reading using the posix
(...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after
1285 return CObject::IllegalArgumentError(); 1298 return CObject::IllegalArgumentError();
1286 } 1299 }
1287 } 1300 }
1288 return CObject::IllegalArgumentError(); 1301 return CObject::IllegalArgumentError();
1289 } 1302 }
1290 1303
1291 } // namespace bin 1304 } // namespace bin
1292 } // namespace dart 1305 } // namespace dart
1293 1306
1294 #endif // !defined(DART_IO_DISABLED) 1307 #endif // !defined(DART_IO_DISABLED)
OLDNEW
« no previous file with comments | « runtime/bin/file.h ('k') | runtime/bin/file_android.cc » ('j') | runtime/bin/file_android.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698