mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-04 06:38:47 +00:00
Make io.Section_Reader set base too
This should fix seeking from `.Start`, getting the `size`, and `read_at`. Also make the API consistent with the other `*_init` procs in `util.odin` by returning the `io.Reader`.
This commit is contained in:
+3
-2
@@ -376,11 +376,12 @@ Section_Reader :: struct {
|
|||||||
limit: i64,
|
limit: i64,
|
||||||
}
|
}
|
||||||
|
|
||||||
section_reader_init :: proc(s: ^Section_Reader, r: Reader_At, off: i64, n: i64) {
|
section_reader_init :: proc(s: ^Section_Reader, r: Reader_At, off: i64, n: i64) -> Reader {
|
||||||
s.r = r
|
s.r = r
|
||||||
|
s.base = off
|
||||||
s.off = off
|
s.off = off
|
||||||
s.limit = off + n
|
s.limit = off + n
|
||||||
return
|
return section_reader_to_stream(s)
|
||||||
}
|
}
|
||||||
section_reader_to_stream :: proc(s: ^Section_Reader) -> (out: Stream) {
|
section_reader_to_stream :: proc(s: ^Section_Reader) -> (out: Stream) {
|
||||||
out.data = s
|
out.data = s
|
||||||
|
|||||||
Reference in New Issue
Block a user