mirror of
https://github.com/odin-lang/Odin.git
synced 2026-06-04 01:34:39 +00:00
Correct EOF value
This commit is contained in:
@@ -173,7 +173,7 @@ read :: proc(fd: Handle, data: []byte) -> (total_read: int, err: Error) {
|
||||
// Successful read can mean two things, including EOF, see:
|
||||
// https://learn.microsoft.com/en-us/windows/win32/fileio/testing-for-the-end-of-a-file
|
||||
if bytes_read == 0 {
|
||||
return 0, ERROR_HANDLE_EOF
|
||||
return 0, .EOF
|
||||
} else {
|
||||
return int(bytes_read), nil
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ ERROR_INVALID_HANDLE :: _Platform_Error(6)
|
||||
ERROR_NOT_ENOUGH_MEMORY :: _Platform_Error(8)
|
||||
ERROR_NO_MORE_FILES :: _Platform_Error(18)
|
||||
ERROR_HANDLE_EOF :: _Platform_Error(38)
|
||||
ERROR_EOF :: ERROR_HANDLE_EOF
|
||||
ERROR_EOF :: General_Error.EOF
|
||||
ERROR_NETNAME_DELETED :: _Platform_Error(64)
|
||||
ERROR_FILE_EXISTS :: _Platform_Error(80)
|
||||
ERROR_INVALID_PARAMETER :: _Platform_Error(87)
|
||||
|
||||
@@ -60,11 +60,6 @@ _file_stream_proc :: proc(stream_data: rawptr, mode: io.Stream_Mode, p: []byte,
|
||||
}
|
||||
|
||||
if err == nil && os_err != nil {
|
||||
when ODIN_OS == .Windows {
|
||||
if os_err == ERROR_HANDLE_EOF {
|
||||
return n, .EOF
|
||||
}
|
||||
}
|
||||
err = error_to_io_error(os_err)
|
||||
}
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user