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

Unified Diff: runtime/bin/file.cc

Issue 11345025: Use the encoding parameter for writeString on RandomAccessFile objects. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/file.h ('k') | runtime/bin/file_patch.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/file.cc
diff --git a/runtime/bin/file.cc b/runtime/bin/file.cc
index d74dced66a7bb38807512e3aa05a8b50c8d4eca7..3bd7256e5248bea7e899031c3821b0894009f2a4 100644
--- a/runtime/bin/file.cc
+++ b/runtime/bin/file.cc
@@ -158,27 +158,6 @@ void FUNCTION_NAME(File_WriteByte)(Dart_NativeArguments args) {
}
-void FUNCTION_NAME(File_WriteString)(Dart_NativeArguments args) {
- Dart_EnterScope();
- intptr_t value =
- DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0));
- File* file = reinterpret_cast<File*>(value);
- ASSERT(file != NULL);
- const char* str =
- DartUtils::GetStringValue(Dart_GetNativeArgument(args, 1));
- int bytes_written = file->Write(reinterpret_cast<const void*>(str),
- strlen(str));
- if (bytes_written >= 0) {
- Dart_SetReturnValue(args, Dart_NewInteger(bytes_written));
- } else {
- Dart_Handle err = DartUtils::NewDartOSError();
- if (Dart_IsError(err)) Dart_PropagateError(err);
- Dart_SetReturnValue(args, err);
- }
- Dart_ExitScope();
-}
-
-
void FUNCTION_NAME(File_ReadList)(Dart_NativeArguments args) {
Dart_EnterScope();
intptr_t value =
@@ -861,25 +840,6 @@ static CObject* FileWriteListRequest(const CObjectArray& request) {
}
-static CObject* FileWriteStringRequest(const CObjectArray& request) {
- if (request.Length() == 3 &&
- request[1]->IsIntptr() &&
- request[2]->IsString()) {
- File* file = CObjectToFilePointer(request[1]);
- ASSERT(file != NULL);
- if (!file->IsClosed()) {
- CObjectString str(request[2]);
- const void* buffer = reinterpret_cast<const void*>(str.CString());
- int64_t bytes_written = file->Write(buffer, str.Length());
- return new CObjectInt64(CObject::NewInt64(bytes_written));
- } else {
- return CObject::FileClosedError();
- }
- }
- return CObject::IllegalArgumentError();
-}
-
-
void FileService(Dart_Port dest_port_id,
Dart_Port reply_port_id,
Dart_CObject* message) {
@@ -943,9 +903,6 @@ void FileService(Dart_Port dest_port_id,
case File::kWriteListRequest:
response = FileWriteListRequest(request);
break;
- case File::kWriteStringRequest:
- response = FileWriteStringRequest(request);
- break;
default:
UNREACHABLE();
}
« no previous file with comments | « runtime/bin/file.h ('k') | runtime/bin/file_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698