Skip to content

Commit

Permalink
Fix EOF detection when reading an entire file
Browse files Browse the repository at this point in the history
Closes #25596

BUG= #25596
R=kustermann@google.com

Review URL: https://codereview.chromium.org/1651023003 .
  • Loading branch information
sgjesse authored and whesse committed Feb 9, 2016
1 parent 5fb724f commit afaadba
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sdk/lib/io/file_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit afaadba

Please sign in to comment.