diff --git a/core/io/util.odin b/core/io/util.odin index c1d8d2808..c6ad8f525 100644 --- a/core/io/util.odin +++ b/core/io/util.odin @@ -8,7 +8,7 @@ read_ptr :: proc(r: Reader, p: rawptr, byte_size: int, n_read: ^int = nil) -> (n return read(r, ([^]byte)(p)[:byte_size], n_read) } -read_slice :: proc(r: Reader, p: rawptr, byte_size: int, n_read: ^int = nil) -> (n: int, err: Error) { +read_slice :: proc(r: Reader, slice: $S/[]$T, n_read: ^int = nil) -> (n: int, err: Error) { size := len(slice)*size_of(T) return read_ptr(w, raw_data(slice), size, n_read) } diff --git a/core/os/file_util.odin b/core/os/file_util.odin index 235362e04..854977b01 100644 --- a/core/os/file_util.odin +++ b/core/os/file_util.odin @@ -114,19 +114,19 @@ read_ptr :: proc(f: ^File, data: rawptr, len: int) -> (n: int, err: Error) { /* `write_slice` is a utility procedure that writes the bytes points at `slice`. - It is equivalent to: `write(f, ([^]byte)(raw_data(slice))[:len(slice)*size_of(slice[0]))])` + It is equivalent to: `write(f, ([^]byte)(raw_data(slice))[:len(slice)*size_of(slice[0])])` */ write_slice :: proc(f: ^File, slice: $S/[]$T) -> (n: int, err: Error) { - return write(f, ([^]byte)(raw_data(slice))[:len(slice)*size_of(slice[0]))]) + return write(f, ([^]byte)(raw_data(slice))[:len(slice)*size_of(slice[0])]) } /* `read_slice` is a utility procedure that writes the bytes points at `slice`. - It is equivalent to: `read(f, ([^]byte)(raw_data(slice))[:len(slice)*size_of(slice[0]))])` + It is equivalent to: `read(f, ([^]byte)(raw_data(slice))[:len(slice)*size_of(slice[0])])` */ read_slice :: proc(f: ^File, slice: $S/[]$T) -> (n: int, err: Error) { - return read(f, ([^]byte)(raw_data(slice))[:len(slice)*size_of(slice[0]))]) + return read(f, ([^]byte)(raw_data(slice))[:len(slice)*size_of(slice[0])]) }