mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-22 05:34:59 -07:00
fix(os2): check for 0 bytes read and return EOF
This commit is contained in:
@@ -121,6 +121,9 @@ _read :: proc(f: ^File, p: []byte) -> (i64, Error) {
|
||||
if n < 0 {
|
||||
return -1, _get_platform_error(n)
|
||||
}
|
||||
if n == 0 {
|
||||
return 0, .EOF
|
||||
}
|
||||
return i64(n), nil
|
||||
}
|
||||
|
||||
@@ -135,6 +138,9 @@ _read_at :: proc(f: ^File, p: []byte, offset: i64) -> (n: i64, err: Error) {
|
||||
if m < 0 {
|
||||
return -1, _get_platform_error(m)
|
||||
}
|
||||
if m == 0 {
|
||||
return 0, .EOF
|
||||
}
|
||||
n += i64(m)
|
||||
b = b[m:]
|
||||
offset += i64(m)
|
||||
|
||||
Reference in New Issue
Block a user