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

Unified Diff: runtime/bin/file_impl.dart

Issue 9264001: - Fix the return type of File.openSync. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 11 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/file_impl.dart
===================================================================
--- runtime/bin/file_impl.dart (revision 3421)
+++ runtime/bin/file_impl.dart (working copy)
@@ -221,7 +221,7 @@
port.toSendPort());
return;
}
- var result = _FileUtils.writeList(_id, _buffer, _offset, _bytes);
+ var result = _FileUtils._writeList(_id, _buffer, _offset, _bytes);
_replyPort.send(result, port.toSendPort());
}
@@ -420,7 +420,23 @@
static int readList(int id, List<int> buffer, int offset, int bytes)
native "File_ReadList";
static int writeByte(int id, int value) native "File_WriteByte";
- static int writeList(int id, List<int> buffer, int offset, int bytes)
+ static int _writeList(int id, List<int> buffer, int offset, int bytes) {
Mads Ager (google) 2012/01/19 07:13:27 You can't get to this member in any case from the
Ivan Posva 2012/01/20 21:55:06 The thing is that if somebody decides to make File
+ ObjectArray out_buffer;
+ int out_offset = offset;
+ if (buffer is ObjectArray) {
+ out_buffer = buffer;
+ } else {
+ out_buffer = new ObjectArray(bytes);
+ out_offset = 0;
+ int j = offset;
+ for (int i = 0; i < bytes; i++) {
+ out_buffer[i] = buffer[j];
+ j++;
+ }
+ }
+ return __writeList(id, out_buffer, out_offset, bytes);
+ }
+ static int __writeList(int id, List<int> buffer, int offset, int bytes)
native "File_WriteList";
static int writeString(int id, String string) native "File_WriteString";
static int position(int id) native "File_Position";
@@ -574,7 +590,7 @@
_scheduler.enqueue(operation, handleOpenResult);
}
- void openSync([FileMode mode = FileMode.READ]) {
+ RandomAccessFile openSync([FileMode mode = FileMode.READ]) {
if (_asyncUsed) {
throw new FileIOException(
"Mixed use of synchronous and asynchronous API");
@@ -847,7 +863,7 @@
if (index != 0) {
throw new IndexOutOfRangeException(index);
}
- int result = _FileUtils.writeList(_id, buffer, offset, bytes);
+ int result = _FileUtils._writeList(_id, buffer, offset, bytes);
if (result == -1) {
throw new FileIOException("writeList failed");
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698