mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-27 19:09:47 +03:00
std.Io.Threaded: stop checking bytes read with END_OF_FILE
This commit is contained in:
@@ -8816,9 +8816,10 @@ fn fileReadStreamingPosix(file: File, data: []const []u8) File.ReadStreamingErro
|
||||
fn fileReadStreamingWindows(file: File, data: []const []u8) File.ReadStreamingError!usize {
|
||||
var io_status_block: windows.IO_STATUS_BLOCK = .{
|
||||
.u = .{ .Status = .PENDING },
|
||||
.Information = 0,
|
||||
.Information = undefined,
|
||||
};
|
||||
try ntReadFile(file.handle, data, &noopApc, null, &io_status_block);
|
||||
|
||||
while (@atomicLoad(windows.NTSTATUS, &io_status_block.u.Status, .acquire) == .PENDING) {
|
||||
// Once we get here we must not return from the function until the
|
||||
// operation completes, thereby releasing reference to io_status_block.
|
||||
@@ -8842,10 +8843,7 @@ fn ntReadFileResult(io_status_block: *const windows.IO_STATUS_BLOCK) !usize {
|
||||
.PENDING => unreachable,
|
||||
.CANCELLED => unreachable,
|
||||
.SUCCESS => return io_status_block.Information,
|
||||
.END_OF_FILE, .PIPE_BROKEN => {
|
||||
if (io_status_block.Information == 0) return error.EndOfStream;
|
||||
return io_status_block.Information;
|
||||
},
|
||||
.END_OF_FILE, .PIPE_BROKEN => return error.EndOfStream,
|
||||
.INVALID_DEVICE_REQUEST => return error.IsDir,
|
||||
.LOCK_NOT_GRANTED => return error.LockViolation,
|
||||
.ACCESS_DENIED => return error.AccessDenied,
|
||||
|
||||
Reference in New Issue
Block a user