Skip to content

Commit

Permalink
style suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-cooper committed Apr 1, 2015
1 parent 962073a commit 4493008
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions std/stdio.d
Expand Up @@ -742,13 +742,15 @@ $(D rawRead) always reads in binary mode on Windows.
scope(exit) __fhnd_info[fd] = info;
}
}
immutable fread_result =
immutable freadResult =
fread(buffer.ptr, T.sizeof, buffer.length, _p.handle);
immutable fread_success = (fread_result == buffer.length);
if (fread_success)
return buffer;
errnoEnforce(!error);
return buffer[0 .. fread_result];
assert (freadResult <= buffer.length); // fread return guarantee
if (freadResult != buffer.length) // error or eof
{
errnoEnforce(!error);
return buffer[0 .. freadResult];
}
return buffer;
}

unittest
Expand Down

0 comments on commit 4493008

Please sign in to comment.