mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-25 08:57:55 +00:00
improve some Negative_Read/Negative_Write logic
Returns the actual error if one is set, instead of swallowing it for the less descriptive negative error. Also fixes a out-of-bounds slice error in `bufio.writer_write` because it wasn't checking the returned `m`.
This commit is contained in:
@@ -359,7 +359,7 @@ buffer_read_from :: proc(b: ^Buffer, r: io.Reader) -> (n: i64, err: io.Error) #n
|
||||
resize(&b.buf, i)
|
||||
m, e := io.read(r, b.buf[i:cap(b.buf)])
|
||||
if m < 0 {
|
||||
err = .Negative_Read
|
||||
err = e if e != nil else .Negative_Read
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user