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

Unified Diff: sdk/lib/io/file_impl.dart

Issue 1651023003: Fix EOF detection when reading an entire file (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 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: sdk/lib/io/file_impl.dart
diff --git a/sdk/lib/io/file_impl.dart b/sdk/lib/io/file_impl.dart
index 6b0dc96789ae8626baf5c27948ad74ed8834ea7d..5dd559c1835ee022d6afac71a9409a7a1ed414d3 100644
--- a/sdk/lib/io/file_impl.dart
+++ b/sdk/lib/io/file_impl.dart
@@ -446,8 +446,8 @@ class _File extends FileSystemEntity implements File {
var completer = new Completer();
void read() {
file.read(_BLOCK_SIZE).then((data) {
- if (data.length > 0) builder.add(data);
- if (data.length == _BLOCK_SIZE) {
+ if (data.length > 0) {
+ builder.add(data);
read();
} else {
completer.complete(builder.takeBytes());
@@ -480,7 +480,7 @@ class _File extends FileSystemEntity implements File {
do {
data = opened.readSync(_BLOCK_SIZE);
if (data.length > 0) builder.add(data);
- } while (data.length == _BLOCK_SIZE);
+ } while (data.length > 0);
data = builder.takeBytes();
} else {
data = opened.readSync(length);
« 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