mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 23:58:50 +00:00
Fix io typos
This commit is contained in:
+17
-3
@@ -150,7 +150,7 @@ close :: proc(s: Closer) -> Error {
|
|||||||
return .None;
|
return .None;
|
||||||
}
|
}
|
||||||
|
|
||||||
flush :: proc(s: Flusher, p: []byte) -> Error {
|
flush :: proc(s: Flusher) -> Error {
|
||||||
if s.stream_vtable != nil && s.impl_flush != nil {
|
if s.stream_vtable != nil && s.impl_flush != nil {
|
||||||
return s->impl_flush();
|
return s->impl_flush();
|
||||||
}
|
}
|
||||||
@@ -158,7 +158,7 @@ flush :: proc(s: Flusher, p: []byte) -> Error {
|
|||||||
return .None;
|
return .None;
|
||||||
}
|
}
|
||||||
|
|
||||||
size :: proc(s: Stream, p: []byte) -> i64 {
|
size :: proc(s: Stream) -> i64 {
|
||||||
if s.stream_vtable == nil {
|
if s.stream_vtable == nil {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -267,7 +267,21 @@ read_byte :: proc(r: Byte_Reader) -> (byte, Error) {
|
|||||||
return b[0], err;
|
return b[0], err;
|
||||||
}
|
}
|
||||||
|
|
||||||
write_byte :: proc(w: Byte_Writer, c: byte) -> Error {
|
write_byte :: proc{
|
||||||
|
write_byte_to_byte_writer,
|
||||||
|
write_byte_to_writer,
|
||||||
|
};
|
||||||
|
|
||||||
|
write_byte_to_byte_writer :: proc(w: Byte_Writer, c: byte) -> Error {
|
||||||
|
return _write_byte(auto_cast w, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
write_byte_to_writer :: proc(w: Writer, c: byte) -> Error {
|
||||||
|
return _write_byte(auto_cast w, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
@(private)
|
||||||
|
_write_byte :: proc(w: Byte_Writer, c: byte) -> Error {
|
||||||
if w.stream_vtable == nil {
|
if w.stream_vtable == nil {
|
||||||
return .Empty;
|
return .Empty;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,18 @@
|
|||||||
package io
|
package io
|
||||||
|
|
||||||
import "core:runtime"
|
import "core:runtime"
|
||||||
|
import "core:strconv"
|
||||||
|
|
||||||
|
write_u64 :: proc(w: Writer, i: u64, base: int = 10) -> (n: int, err: Error) {
|
||||||
|
buf: [32]byte;
|
||||||
|
s := strconv.append_bits(buf[:], u64(i), base, false, 64, strconv.digits, nil);
|
||||||
|
return write_string(w, s);
|
||||||
|
}
|
||||||
|
write_i64 :: proc(w: Writer, i: i64, base: int = 10) -> (n: int, err: Error) {
|
||||||
|
buf: [32]byte;
|
||||||
|
s := strconv.append_bits(buf[:], u64(i), base, true, 64, strconv.digits, nil);
|
||||||
|
return write_string(w, s);
|
||||||
|
}
|
||||||
|
|
||||||
@(private)
|
@(private)
|
||||||
Tee_Reader :: struct {
|
Tee_Reader :: struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user