Browse Source

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`.
Feoramund 1 năm trước cách đây
mục cha
commit
d66486c17e
1 tập tin đã thay đổi với 3 bổ sung2 xóa
  1. 3 2
      core/io/util.odin

+ 3 - 2
core/io/util.odin

@@ -376,11 +376,12 @@ Section_Reader :: struct {
 	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.base = off
 	s.off = off
 	s.limit = off + n
-	return
+	return section_reader_to_stream(s)
 }
 section_reader_to_stream :: proc(s: ^Section_Reader) -> (out: Stream) {
 	out.data = s