diff options
| author | daurnimator <quae@daurnimator.com> | 2020-01-31 20:46:09 +1100 |
|---|---|---|
| committer | daurnimator <quae@daurnimator.com> | 2020-01-31 22:33:55 +1100 |
| commit | b9f720365c0ad20420ead337c1746b8f0a5da649 (patch) | |
| tree | 313773cea791fc1fe509fdad218254b218300585 /lib/std/event | |
| parent | 7cf0b02ab44481c7961393cb095993adb29d85f3 (diff) | |
| download | zig-b9f720365c0ad20420ead337c1746b8f0a5da649.tar.gz zig-b9f720365c0ad20420ead337c1746b8f0a5da649.zip | |
Turn win32 errors into a non-exhaustive enum
Diffstat (limited to 'lib/std/event')
| -rw-r--r-- | lib/std/event/fs.zig | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/std/event/fs.zig b/lib/std/event/fs.zig index ce88ac4dc4..7581d2a1fb 100644 --- a/lib/std/event/fs.zig +++ b/lib/std/event/fs.zig @@ -160,12 +160,12 @@ pub fn pwriteWindows(fd: fd_t, data: []const u8, offset: u64) os.WindowsWriteErr var bytes_transferred: windows.DWORD = undefined; if (windows.kernel32.GetOverlappedResult(fd, &resume_node.base.overlapped, &bytes_transferred, windows.FALSE) == 0) { switch (windows.kernel32.GetLastError()) { - windows.ERROR.IO_PENDING => unreachable, - windows.ERROR.INVALID_USER_BUFFER => return error.SystemResources, - windows.ERROR.NOT_ENOUGH_MEMORY => return error.SystemResources, - windows.ERROR.OPERATION_ABORTED => return error.OperationAborted, - windows.ERROR.NOT_ENOUGH_QUOTA => return error.SystemResources, - windows.ERROR.BROKEN_PIPE => return error.BrokenPipe, + .IO_PENDING => unreachable, + .INVALID_USER_BUFFER => return error.SystemResources, + .NOT_ENOUGH_MEMORY => return error.SystemResources, + .OPERATION_ABORTED => return error.OperationAborted, + .NOT_ENOUGH_QUOTA => return error.SystemResources, + .BROKEN_PIPE => return error.BrokenPipe, else => |err| return windows.unexpectedError(err), } } @@ -320,10 +320,10 @@ pub fn preadWindows(fd: fd_t, data: []u8, offset: u64) !usize { var bytes_transferred: windows.DWORD = undefined; if (windows.kernel32.GetOverlappedResult(fd, &resume_node.base.overlapped, &bytes_transferred, windows.FALSE) == 0) { switch (windows.kernel32.GetLastError()) { - windows.ERROR.IO_PENDING => unreachable, - windows.ERROR.OPERATION_ABORTED => return error.OperationAborted, - windows.ERROR.BROKEN_PIPE => return error.BrokenPipe, - windows.ERROR.HANDLE_EOF => return @as(usize, bytes_transferred), + .IO_PENDING => unreachable, + .OPERATION_ABORTED => return error.OperationAborted, + .BROKEN_PIPE => return error.BrokenPipe, + .HANDLE_EOF => return @as(usize, bytes_transferred), else => |err| return windows.unexpectedError(err), } } |
