mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-02 20:58:15 +00:00
Just make the io.Reader etc aliases
This commit is contained in:
@@ -221,7 +221,7 @@ writer_to_stream :: proc(b: ^Writer) -> (s: io.Stream) {
|
|||||||
|
|
||||||
// writer_to_stream converts a Writer into an io.Stream
|
// writer_to_stream converts a Writer into an io.Stream
|
||||||
writer_to_writer :: proc(b: ^Writer) -> (s: io.Writer) {
|
writer_to_writer :: proc(b: ^Writer) -> (s: io.Writer) {
|
||||||
return {writer_to_stream(b)}
|
return writer_to_stream(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ read_slice_from_stream :: #force_inline proc(z: ^Context_Stream_Input, size: int
|
|||||||
// TODO: REMOVE ALL USE OF context.temp_allocator here
|
// TODO: REMOVE ALL USE OF context.temp_allocator here
|
||||||
// the is literally no need for it
|
// the is literally no need for it
|
||||||
b := make([]u8, size, context.temp_allocator)
|
b := make([]u8, size, context.temp_allocator)
|
||||||
_, e := io.read({z.input}, b[:])
|
_, e := io.read(z.input, b[:])
|
||||||
if e == .None {
|
if e == .None {
|
||||||
return b, .None
|
return b, .None
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ hash_stream_224 :: proc(s: io.Stream) -> ([DIGEST_SIZE_224]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
@@ -149,7 +149,7 @@ hash_stream_256 :: proc(s: io.Stream) -> ([DIGEST_SIZE_256]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
@@ -228,7 +228,7 @@ hash_stream_384 :: proc(s: io.Stream) -> ([DIGEST_SIZE_384]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
@@ -307,7 +307,7 @@ hash_stream_512 :: proc(s: io.Stream) -> ([DIGEST_SIZE_512]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ hash_stream :: proc(s: io.Stream) -> ([DIGEST_SIZE]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
_blake2.update(&ctx, buf[:read])
|
_blake2.update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ hash_stream :: proc(s: io.Stream) -> ([DIGEST_SIZE]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
_blake2.update(&ctx, buf[:read])
|
_blake2.update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ hash_stream :: proc(s: io.Stream) -> ([DIGEST_SIZE]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ hash_stream_224 :: proc(s: io.Stream) -> ([DIGEST_SIZE_224]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
@@ -149,7 +149,7 @@ hash_stream_256 :: proc(s: io.Stream) -> ([DIGEST_SIZE_256]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
@@ -228,7 +228,7 @@ hash_stream_384 :: proc(s: io.Stream) -> ([DIGEST_SIZE_384]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
@@ -307,7 +307,7 @@ hash_stream_512 :: proc(s: io.Stream) -> ([DIGEST_SIZE_512]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ hash_stream_128_3 :: proc(s: io.Stream) -> ([DIGEST_SIZE_128]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
ctx.str_len = u32(len(buf[:read]))
|
ctx.str_len = u32(len(buf[:read]))
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
@@ -164,7 +164,7 @@ hash_stream_128_4 :: proc(s: io.Stream) -> ([DIGEST_SIZE_128]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
ctx.str_len = u32(len(buf[:read]))
|
ctx.str_len = u32(len(buf[:read]))
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
@@ -249,7 +249,7 @@ hash_stream_128_5 :: proc(s: io.Stream) -> ([DIGEST_SIZE_128]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
ctx.str_len = u32(len(buf[:read]))
|
ctx.str_len = u32(len(buf[:read]))
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
@@ -334,7 +334,7 @@ hash_stream_160_3 :: proc(s: io.Stream) -> ([DIGEST_SIZE_160]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
ctx.str_len = u32(len(buf[:read]))
|
ctx.str_len = u32(len(buf[:read]))
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
@@ -419,7 +419,7 @@ hash_stream_160_4 :: proc(s: io.Stream) -> ([DIGEST_SIZE_160]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
ctx.str_len = u32(len(buf[:read]))
|
ctx.str_len = u32(len(buf[:read]))
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
@@ -504,7 +504,7 @@ hash_stream_160_5 :: proc(s: io.Stream) -> ([DIGEST_SIZE_160]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
ctx.str_len = u32(len(buf[:read]))
|
ctx.str_len = u32(len(buf[:read]))
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
@@ -589,7 +589,7 @@ hash_stream_192_3 :: proc(s: io.Stream) -> ([DIGEST_SIZE_192]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
ctx.str_len = u32(len(buf[:read]))
|
ctx.str_len = u32(len(buf[:read]))
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
@@ -674,7 +674,7 @@ hash_stream_192_4 :: proc(s: io.Stream) -> ([DIGEST_SIZE_192]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
ctx.str_len = u32(len(buf[:read]))
|
ctx.str_len = u32(len(buf[:read]))
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
@@ -759,7 +759,7 @@ hash_stream_192_5 :: proc(s: io.Stream) -> ([DIGEST_SIZE_192]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
ctx.str_len = u32(len(buf[:read]))
|
ctx.str_len = u32(len(buf[:read]))
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
@@ -844,7 +844,7 @@ hash_stream_224_3 :: proc(s: io.Stream) -> ([DIGEST_SIZE_224]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
ctx.str_len = u32(len(buf[:read]))
|
ctx.str_len = u32(len(buf[:read]))
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
@@ -929,7 +929,7 @@ hash_stream_224_4 :: proc(s: io.Stream) -> ([DIGEST_SIZE_224]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
ctx.str_len = u32(len(buf[:read]))
|
ctx.str_len = u32(len(buf[:read]))
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
@@ -1014,7 +1014,7 @@ hash_stream_224_5 :: proc(s: io.Stream) -> ([DIGEST_SIZE_224]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
ctx.str_len = u32(len(buf[:read]))
|
ctx.str_len = u32(len(buf[:read]))
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
@@ -1099,7 +1099,7 @@ hash_stream_256_3 :: proc(s: io.Stream) -> ([DIGEST_SIZE_256]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
ctx.str_len = u32(len(buf[:read]))
|
ctx.str_len = u32(len(buf[:read]))
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
@@ -1184,7 +1184,7 @@ hash_stream_256_4 :: proc(s: io.Stream) -> ([DIGEST_SIZE_256]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
ctx.str_len = u32(len(buf[:read]))
|
ctx.str_len = u32(len(buf[:read]))
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
@@ -1270,7 +1270,7 @@ hash_stream_256_5 :: proc(s: io.Stream) -> ([DIGEST_SIZE_256]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
ctx.str_len = u32(len(buf[:read]))
|
ctx.str_len = u32(len(buf[:read]))
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ hash_stream_224 :: proc(s: io.Stream) -> ([DIGEST_SIZE_224]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
@@ -149,7 +149,7 @@ hash_stream_256 :: proc(s: io.Stream) -> ([DIGEST_SIZE_256]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
@@ -228,7 +228,7 @@ hash_stream_384 :: proc(s: io.Stream) -> ([DIGEST_SIZE_384]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
@@ -307,7 +307,7 @@ hash_stream_512 :: proc(s: io.Stream) -> ([DIGEST_SIZE_512]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ hash_stream_224 :: proc(s: io.Stream) -> ([DIGEST_SIZE_224]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
_sha3.update(&ctx, buf[:read])
|
_sha3.update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
@@ -159,7 +159,7 @@ hash_stream_256 :: proc(s: io.Stream) -> ([DIGEST_SIZE_256]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
_sha3.update(&ctx, buf[:read])
|
_sha3.update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
@@ -241,7 +241,7 @@ hash_stream_384 :: proc(s: io.Stream) -> ([DIGEST_SIZE_384]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
_sha3.update(&ctx, buf[:read])
|
_sha3.update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
@@ -323,7 +323,7 @@ hash_stream_512 :: proc(s: io.Stream) -> ([DIGEST_SIZE_512]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
_sha3.update(&ctx, buf[:read])
|
_sha3.update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ hash_stream :: proc(s: io.Stream) -> ([DIGEST_SIZE]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ hash_stream :: proc(s: io.Stream) -> ([DIGEST_SIZE]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ hash_stream :: proc(s: io.Stream) -> ([DIGEST_SIZE]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ hash_stream_128 :: proc(s: io.Stream) -> ([DIGEST_SIZE_128]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
@@ -145,7 +145,7 @@ hash_stream_160 :: proc(s: io.Stream) -> ([DIGEST_SIZE_160]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
@@ -221,7 +221,7 @@ hash_stream_256 :: proc(s: io.Stream) -> ([DIGEST_SIZE_256]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
@@ -297,7 +297,7 @@ hash_stream_320 :: proc(s: io.Stream) -> ([DIGEST_SIZE_320]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ hash_stream :: proc(s: io.Stream) -> ([DIGEST_SIZE]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ hash_stream_224 :: proc(s: io.Stream) -> ([DIGEST_SIZE_224]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
@@ -153,7 +153,7 @@ hash_stream_256 :: proc(s: io.Stream) -> ([DIGEST_SIZE_256]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
@@ -232,7 +232,7 @@ hash_stream_384 :: proc(s: io.Stream) -> ([DIGEST_SIZE_384]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
@@ -311,7 +311,7 @@ hash_stream_512 :: proc(s: io.Stream) -> ([DIGEST_SIZE_512]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ hash_stream_224 :: proc(s: io.Stream) -> ([DIGEST_SIZE_224]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
_sha3.update(&ctx, buf[:read])
|
_sha3.update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
@@ -152,7 +152,7 @@ hash_stream_256 :: proc(s: io.Stream) -> ([DIGEST_SIZE_256]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
_sha3.update(&ctx, buf[:read])
|
_sha3.update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
@@ -231,7 +231,7 @@ hash_stream_384 :: proc(s: io.Stream) -> ([DIGEST_SIZE_384]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
_sha3.update(&ctx, buf[:read])
|
_sha3.update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
@@ -310,7 +310,7 @@ hash_stream_512 :: proc(s: io.Stream) -> ([DIGEST_SIZE_512]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
_sha3.update(&ctx, buf[:read])
|
_sha3.update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ hash_stream_128 :: proc(s: io.Stream) -> ([DIGEST_SIZE_128]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
_sha3.update(&ctx, buf[:read])
|
_sha3.update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
@@ -155,7 +155,7 @@ hash_stream_256 :: proc(s: io.Stream) -> ([DIGEST_SIZE_256]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
_sha3.update(&ctx, buf[:read])
|
_sha3.update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ hash_stream :: proc(s: io.Stream) -> ([DIGEST_SIZE]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ hash_stream_256 :: proc(s: io.Stream) -> ([DIGEST_SIZE_256]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
@@ -146,7 +146,7 @@ hash_stream_512 :: proc(s: io.Stream) -> ([DIGEST_SIZE_512]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ hash_stream_128 :: proc(s: io.Stream) -> ([DIGEST_SIZE_128]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
_tiger.update(&ctx, buf[:read])
|
_tiger.update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
@@ -150,7 +150,7 @@ hash_stream_160 :: proc(s: io.Stream) -> ([DIGEST_SIZE_160]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
_tiger.update(&ctx, buf[:read])
|
_tiger.update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
@@ -229,7 +229,7 @@ hash_stream_192 :: proc(s: io.Stream) -> ([DIGEST_SIZE_192]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
_tiger.update(&ctx, buf[:read])
|
_tiger.update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ hash_stream_128 :: proc(s: io.Stream) -> ([DIGEST_SIZE_128]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
_tiger.update(&ctx, buf[:read])
|
_tiger.update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
@@ -150,7 +150,7 @@ hash_stream_160 :: proc(s: io.Stream) -> ([DIGEST_SIZE_160]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
_tiger.update(&ctx, buf[:read])
|
_tiger.update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
@@ -229,7 +229,7 @@ hash_stream_192 :: proc(s: io.Stream) -> ([DIGEST_SIZE_192]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
_tiger.update(&ctx, buf[:read])
|
_tiger.update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ hash_stream :: proc(s: io.Stream) -> ([DIGEST_SIZE]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
read := 1
|
read := 1
|
||||||
for read > 0 {
|
for read > 0 {
|
||||||
read, _ = io.read({s}, buf)
|
read, _ = io.read(s, buf)
|
||||||
if read > 0 {
|
if read > 0 {
|
||||||
update(&ctx, buf[:read])
|
update(&ctx, buf[:read])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ fprint :: proc(fd: os.Handle, args: ..any, sep := " ") -> int {
|
|||||||
b: bufio.Writer
|
b: bufio.Writer
|
||||||
defer bufio.writer_flush(&b)
|
defer bufio.writer_flush(&b)
|
||||||
|
|
||||||
bufio.writer_init_with_buf(&b, {os.stream_from_handle(fd)}, buf[:])
|
bufio.writer_init_with_buf(&b, os.stream_from_handle(fd), buf[:])
|
||||||
w := bufio.writer_to_writer(&b)
|
w := bufio.writer_to_writer(&b)
|
||||||
return wprint(w=w, args=args, sep=sep)
|
return wprint(w=w, args=args, sep=sep)
|
||||||
}
|
}
|
||||||
@@ -23,7 +23,7 @@ fprintln :: proc(fd: os.Handle, args: ..any, sep := " ") -> int {
|
|||||||
b: bufio.Writer
|
b: bufio.Writer
|
||||||
defer bufio.writer_flush(&b)
|
defer bufio.writer_flush(&b)
|
||||||
|
|
||||||
bufio.writer_init_with_buf(&b, {os.stream_from_handle(fd)}, buf[:])
|
bufio.writer_init_with_buf(&b, os.stream_from_handle(fd), buf[:])
|
||||||
|
|
||||||
w := bufio.writer_to_writer(&b)
|
w := bufio.writer_to_writer(&b)
|
||||||
return wprintln(w=w, args=args, sep=sep)
|
return wprintln(w=w, args=args, sep=sep)
|
||||||
@@ -34,7 +34,7 @@ fprintf :: proc(fd: os.Handle, fmt: string, args: ..any) -> int {
|
|||||||
b: bufio.Writer
|
b: bufio.Writer
|
||||||
defer bufio.writer_flush(&b)
|
defer bufio.writer_flush(&b)
|
||||||
|
|
||||||
bufio.writer_init_with_buf(&b, {os.stream_from_handle(fd)}, buf[:])
|
bufio.writer_init_with_buf(&b, os.stream_from_handle(fd), buf[:])
|
||||||
|
|
||||||
w := bufio.writer_to_writer(&b)
|
w := bufio.writer_to_writer(&b)
|
||||||
return wprintf(w, fmt, ..args)
|
return wprintf(w, fmt, ..args)
|
||||||
@@ -44,7 +44,7 @@ fprint_type :: proc(fd: os.Handle, info: ^runtime.Type_Info) -> (n: int, err: io
|
|||||||
b: bufio.Writer
|
b: bufio.Writer
|
||||||
defer bufio.writer_flush(&b)
|
defer bufio.writer_flush(&b)
|
||||||
|
|
||||||
bufio.writer_init_with_buf(&b, {os.stream_from_handle(fd)}, buf[:])
|
bufio.writer_init_with_buf(&b, os.stream_from_handle(fd), buf[:])
|
||||||
|
|
||||||
w := bufio.writer_to_writer(&b)
|
w := bufio.writer_to_writer(&b)
|
||||||
return wprint_type(w, info)
|
return wprint_type(w, info)
|
||||||
@@ -54,7 +54,7 @@ fprint_typeid :: proc(fd: os.Handle, id: typeid) -> (n: int, err: io.Error) {
|
|||||||
b: bufio.Writer
|
b: bufio.Writer
|
||||||
defer bufio.writer_flush(&b)
|
defer bufio.writer_flush(&b)
|
||||||
|
|
||||||
bufio.writer_init_with_buf(&b, {os.stream_from_handle(fd)}, buf[:])
|
bufio.writer_init_with_buf(&b, os.stream_from_handle(fd), buf[:])
|
||||||
|
|
||||||
w := bufio.writer_to_writer(&b)
|
w := bufio.writer_to_writer(&b)
|
||||||
return wprint_typeid(w, id)
|
return wprint_typeid(w, id)
|
||||||
|
|||||||
+15
-15
@@ -1,80 +1,80 @@
|
|||||||
package io
|
package io
|
||||||
|
|
||||||
to_reader :: proc(s: Stream) -> (r: Reader, ok: bool = true) #optional_ok {
|
to_reader :: proc(s: Stream) -> (r: Reader, ok: bool = true) #optional_ok {
|
||||||
r.stream = s
|
r = s
|
||||||
ok = .Read in query(s)
|
ok = .Read in query(s)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
to_writer :: proc(s: Stream) -> (w: Writer, ok: bool = true) #optional_ok {
|
to_writer :: proc(s: Stream) -> (w: Writer, ok: bool = true) #optional_ok {
|
||||||
w.stream = s
|
w = s
|
||||||
ok = .Write in query(s)
|
ok = .Write in query(s)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
to_closer :: proc(s: Stream) -> (c: Closer, ok: bool = true) #optional_ok {
|
to_closer :: proc(s: Stream) -> (c: Closer, ok: bool = true) #optional_ok {
|
||||||
c.stream = s
|
c = s
|
||||||
ok = .Close in query(s)
|
ok = .Close in query(s)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
to_flusher :: proc(s: Stream) -> (f: Flusher, ok: bool = true) #optional_ok {
|
to_flusher :: proc(s: Stream) -> (f: Flusher, ok: bool = true) #optional_ok {
|
||||||
f.stream = s
|
f = s
|
||||||
ok = .Flush in query(s)
|
ok = .Flush in query(s)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
to_seeker :: proc(s: Stream) -> (seeker: Seeker, ok: bool = true) #optional_ok {
|
to_seeker :: proc(s: Stream) -> (seeker: Seeker, ok: bool = true) #optional_ok {
|
||||||
seeker.stream = s
|
seeker = s
|
||||||
ok = .Seek in query(s)
|
ok = .Seek in query(s)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
to_read_writer :: proc(s: Stream) -> (r: Read_Writer, ok: bool = true) #optional_ok {
|
to_read_writer :: proc(s: Stream) -> (r: Read_Writer, ok: bool = true) #optional_ok {
|
||||||
r.stream = s
|
r = s
|
||||||
ok = query(s) >= {.Read, .Write}
|
ok = query(s) >= {.Read, .Write}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
to_read_closer :: proc(s: Stream) -> (r: Read_Closer, ok: bool = true) #optional_ok {
|
to_read_closer :: proc(s: Stream) -> (r: Read_Closer, ok: bool = true) #optional_ok {
|
||||||
r.stream = s
|
r = s
|
||||||
ok = query(s) >= {.Read, .Close}
|
ok = query(s) >= {.Read, .Close}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
to_read_write_closer :: proc(s: Stream) -> (r: Read_Write_Closer, ok: bool = true) #optional_ok {
|
to_read_write_closer :: proc(s: Stream) -> (r: Read_Write_Closer, ok: bool = true) #optional_ok {
|
||||||
r.stream = s
|
r = s
|
||||||
ok = query(s) >= {.Read, .Write, .Close}
|
ok = query(s) >= {.Read, .Write, .Close}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
to_read_write_seeker :: proc(s: Stream) -> (r: Read_Write_Seeker, ok: bool = true) #optional_ok {
|
to_read_write_seeker :: proc(s: Stream) -> (r: Read_Write_Seeker, ok: bool = true) #optional_ok {
|
||||||
r.stream = s
|
r = s
|
||||||
ok = query(s) >= {.Read, .Write, .Seek}
|
ok = query(s) >= {.Read, .Write, .Seek}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
to_write_flusher :: proc(s: Stream) -> (w: Write_Flusher, ok: bool = true) #optional_ok {
|
to_write_flusher :: proc(s: Stream) -> (w: Write_Flusher, ok: bool = true) #optional_ok {
|
||||||
w.stream = s
|
w = s
|
||||||
ok = query(s) >= {.Write, .Flush}
|
ok = query(s) >= {.Write, .Flush}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
to_write_flush_closer :: proc(s: Stream) -> (w: Write_Flush_Closer, ok: bool = true) #optional_ok {
|
to_write_flush_closer :: proc(s: Stream) -> (w: Write_Flush_Closer, ok: bool = true) #optional_ok {
|
||||||
w.stream = s
|
w = s
|
||||||
ok = query(s) >= {.Write, .Flush, .Close}
|
ok = query(s) >= {.Write, .Flush, .Close}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
to_reader_at :: proc(s: Stream) -> (r: Reader_At, ok: bool = true) #optional_ok {
|
to_reader_at :: proc(s: Stream) -> (r: Reader_At, ok: bool = true) #optional_ok {
|
||||||
r.stream = s
|
r = s
|
||||||
ok = query(s) >= {.Read_At}
|
ok = query(s) >= {.Read_At}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
to_writer_at :: proc(s: Stream) -> (w: Writer_At, ok: bool = true) #optional_ok {
|
to_writer_at :: proc(s: Stream) -> (w: Writer_At, ok: bool = true) #optional_ok {
|
||||||
w.stream = s
|
w = s
|
||||||
ok = query(s) >= {.Write_At}
|
ok = query(s) >= {.Write_At}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
to_write_closer :: proc(s: Stream) -> (w: Write_Closer, ok: bool = true) #optional_ok {
|
to_write_closer :: proc(s: Stream) -> (w: Write_Closer, ok: bool = true) #optional_ok {
|
||||||
w.stream = s
|
w = s
|
||||||
ok = query(s) >= {.Write, .Close}
|
ok = query(s) >= {.Write, .Close}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
to_write_seeker :: proc(s: Stream) -> (w: Write_Seeker, ok: bool = true) #optional_ok {
|
to_write_seeker :: proc(s: Stream) -> (w: Write_Seeker, ok: bool = true) #optional_ok {
|
||||||
w.stream = s
|
w = s
|
||||||
ok = query(s) >= {.Write, .Seek}
|
ok = query(s) >= {.Write, .Seek}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
+26
-31
@@ -75,29 +75,29 @@ Stream :: struct {
|
|||||||
data: rawptr,
|
data: rawptr,
|
||||||
}
|
}
|
||||||
|
|
||||||
Reader :: struct {using stream: Stream}
|
Reader :: Stream
|
||||||
Writer :: struct {using stream: Stream}
|
Writer :: Stream
|
||||||
Closer :: struct {using stream: Stream}
|
Closer :: Stream
|
||||||
Flusher :: struct {using stream: Stream}
|
Flusher :: Stream
|
||||||
Seeker :: struct {using stream: Stream}
|
Seeker :: Stream
|
||||||
|
|
||||||
Read_Writer :: struct {using stream: Stream}
|
Read_Writer :: Stream
|
||||||
Read_Closer :: struct {using stream: Stream}
|
Read_Closer :: Stream
|
||||||
Read_Write_Closer :: struct {using stream: Stream}
|
Read_Write_Closer :: Stream
|
||||||
Read_Write_Seeker :: struct {using stream: Stream}
|
Read_Write_Seeker :: Stream
|
||||||
|
|
||||||
Write_Closer :: struct {using stream: Stream}
|
Write_Closer :: Stream
|
||||||
Write_Seeker :: struct {using stream: Stream}
|
Write_Seeker :: Stream
|
||||||
Write_Flusher :: struct {using stream: Stream}
|
Write_Flusher :: Stream
|
||||||
Write_Flush_Closer :: struct {using stream: Stream}
|
Write_Flush_Closer :: Stream
|
||||||
|
|
||||||
Reader_At :: struct {using stream: Stream}
|
Reader_At :: Stream
|
||||||
Writer_At :: struct {using stream: Stream}
|
Writer_At :: Stream
|
||||||
|
|
||||||
|
|
||||||
destroy :: proc(s: Stream) -> (err: Error) {
|
destroy :: proc(s: Stream) -> (err: Error) {
|
||||||
_ = flush({s})
|
_ = flush(s)
|
||||||
_ = close({s})
|
_ = close(s)
|
||||||
if s.procedure != nil {
|
if s.procedure != nil {
|
||||||
_, err = s.procedure(s.data, .Destroy, nil, 0, nil)
|
_, err = s.procedure(s.data, .Destroy, nil, 0, nil)
|
||||||
} else {
|
} else {
|
||||||
@@ -192,11 +192,10 @@ size :: proc(s: Stream) -> (n: i64, err: Error) {
|
|||||||
if s.procedure != nil {
|
if s.procedure != nil {
|
||||||
n, err = s.procedure(s.data, .Size, nil, 0, nil)
|
n, err = s.procedure(s.data, .Size, nil, 0, nil)
|
||||||
if err == .Empty {
|
if err == .Empty {
|
||||||
seeker := Seeker{s}
|
|
||||||
n = 0
|
n = 0
|
||||||
curr := seek(seeker, 0, .Current) or_return
|
curr := seek(s, 0, .Current) or_return
|
||||||
end := seek(seeker, 0, .End) or_return
|
end := seek(s, 0, .End) or_return
|
||||||
seek(seeker, curr, .Start) or_return
|
seek(s, curr, .Start) or_return
|
||||||
n = end
|
n = end
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -220,11 +219,9 @@ read_at :: proc(r: Reader_At, p: []byte, offset: i64, n_read: ^int = nil) -> (n:
|
|||||||
if err != .Empty {
|
if err != .Empty {
|
||||||
n = int(n64)
|
n = int(n64)
|
||||||
} else {
|
} else {
|
||||||
seeker := Seeker{r}
|
curr := seek(r, offset, .Current) or_return
|
||||||
reader := Reader{r}
|
n, err = read(r, p)
|
||||||
curr := seek(seeker, offset, .Current) or_return
|
_, err1 := seek(r, curr, .Start)
|
||||||
n, err = read(reader, p)
|
|
||||||
_, err1 := seek(seeker, curr, .Start)
|
|
||||||
if err1 != nil && err == nil {
|
if err1 != nil && err == nil {
|
||||||
err = err1
|
err = err1
|
||||||
}
|
}
|
||||||
@@ -248,11 +245,9 @@ write_at :: proc(w: Writer_At, p: []byte, offset: i64, n_written: ^int = nil) ->
|
|||||||
if err != .Empty {
|
if err != .Empty {
|
||||||
n = int(n64)
|
n = int(n64)
|
||||||
} else {
|
} else {
|
||||||
seeker := Seeker{w}
|
curr := seek(w, offset, .Current) or_return
|
||||||
writer := Writer{w}
|
n, err = write(w, p)
|
||||||
curr := seek(seeker, offset, .Current) or_return
|
_, err1 := seek(w, curr, .Start)
|
||||||
n, err = write(writer, p)
|
|
||||||
_, err1 := seek(seeker, curr, .Start)
|
|
||||||
if err1 != nil && err == nil {
|
if err1 != nil && err == nil {
|
||||||
err = err1
|
err = err1
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -69,7 +69,7 @@ hash_stream :: proc(s: io.Stream) -> ([DIGEST_SIZE]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
i := 1
|
i := 1
|
||||||
for i > 0 {
|
for i > 0 {
|
||||||
i, _ = io.read({s}, buf)
|
i, _ = io.read(s, buf)
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -69,7 +69,7 @@ hash_stream :: proc(s: io.Stream) -> ([DIGEST_SIZE]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
i := 1
|
i := 1
|
||||||
for i > 0 {
|
for i > 0 {
|
||||||
i, _ = io.read({s}, buf)
|
i, _ = io.read(s, buf)
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -69,7 +69,7 @@ hash_stream_512 :: proc(s: io.Stream) -> ([DIGEST_SIZE_512]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
i := 1
|
i := 1
|
||||||
for i > 0 {
|
for i > 0 {
|
||||||
i, _ = io.read({s}, buf)
|
i, _ = io.read(s, buf)
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -69,7 +69,7 @@ hash_stream :: proc(s: io.Stream) -> ([DIGEST_SIZE]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
i := 1
|
i := 1
|
||||||
for i > 0 {
|
for i > 0 {
|
||||||
i, _ = io.read({s}, buf)
|
i, _ = io.read(s, buf)
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -69,7 +69,7 @@ hash_stream :: proc(s: io.Stream) -> ([DIGEST_SIZE]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
i := 1
|
i := 1
|
||||||
for i > 0 {
|
for i > 0 {
|
||||||
i, _ = io.read({s}, buf)
|
i, _ = io.read(s, buf)
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -69,7 +69,7 @@ hash_stream_160 :: proc(s: io.Stream) -> ([DIGEST_SIZE_160]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
i := 1
|
i := 1
|
||||||
for i > 0 {
|
for i > 0 {
|
||||||
i, _ = io.read({s}, buf)
|
i, _ = io.read(s, buf)
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -69,7 +69,7 @@ hash_stream :: proc(s: io.Stream) -> ([DIGEST_SIZE]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
i := 1
|
i := 1
|
||||||
for i > 0 {
|
for i > 0 {
|
||||||
i, _ = io.read({s}, buf)
|
i, _ = io.read(s, buf)
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+4
-4
@@ -72,7 +72,7 @@ hash_stream_224 :: proc(s: io.Stream) -> ([DIGEST_SIZE_224]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
i := 1
|
i := 1
|
||||||
for i > 0 {
|
for i > 0 {
|
||||||
i, _ = io.read({s}, buf)
|
i, _ = io.read(s, buf)
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
||||||
}
|
}
|
||||||
@@ -151,7 +151,7 @@ hash_stream_256 :: proc(s: io.Stream) -> ([DIGEST_SIZE_256]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
i := 1
|
i := 1
|
||||||
for i > 0 {
|
for i > 0 {
|
||||||
i, _ = io.read({s}, buf)
|
i, _ = io.read(s, buf)
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
||||||
}
|
}
|
||||||
@@ -230,7 +230,7 @@ hash_stream_384 :: proc(s: io.Stream) -> ([DIGEST_SIZE_384]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
i := 1
|
i := 1
|
||||||
for i > 0 {
|
for i > 0 {
|
||||||
i, _ = io.read({s}, buf)
|
i, _ = io.read(s, buf)
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
||||||
}
|
}
|
||||||
@@ -309,7 +309,7 @@ hash_stream_512 :: proc(s: io.Stream) -> ([DIGEST_SIZE_512]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
i := 1
|
i := 1
|
||||||
for i > 0 {
|
for i > 0 {
|
||||||
i, _ = io.read({s}, buf)
|
i, _ = io.read(s, buf)
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+4
-4
@@ -72,7 +72,7 @@ hash_stream_224 :: proc(s: io.Stream) -> ([DIGEST_SIZE_224]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
i := 1
|
i := 1
|
||||||
for i > 0 {
|
for i > 0 {
|
||||||
i, _ = io.read({s}, buf)
|
i, _ = io.read(s, buf)
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
||||||
}
|
}
|
||||||
@@ -151,7 +151,7 @@ hash_stream_256 :: proc(s: io.Stream) -> ([DIGEST_SIZE_256]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
i := 1
|
i := 1
|
||||||
for i > 0 {
|
for i > 0 {
|
||||||
i, _ = io.read({s}, buf)
|
i, _ = io.read(s, buf)
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
||||||
}
|
}
|
||||||
@@ -230,7 +230,7 @@ hash_stream_384 :: proc(s: io.Stream) -> ([DIGEST_SIZE_384]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
i := 1
|
i := 1
|
||||||
for i > 0 {
|
for i > 0 {
|
||||||
i, _ = io.read({s}, buf)
|
i, _ = io.read(s, buf)
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
||||||
}
|
}
|
||||||
@@ -309,7 +309,7 @@ hash_stream_512 :: proc(s: io.Stream) -> ([DIGEST_SIZE_512]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
i := 1
|
i := 1
|
||||||
for i > 0 {
|
for i > 0 {
|
||||||
i, _ = io.read({s}, buf)
|
i, _ = io.read(s, buf)
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+2
-2
@@ -70,7 +70,7 @@ hash_stream_128 :: proc(s: io.Stream) -> ([DIGEST_SIZE_128]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
i := 1
|
i := 1
|
||||||
for i > 0 {
|
for i > 0 {
|
||||||
i, _ = io.read({s}, buf)
|
i, _ = io.read(s, buf)
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
||||||
}
|
}
|
||||||
@@ -149,7 +149,7 @@ hash_stream_256 :: proc(s: io.Stream) -> ([DIGEST_SIZE_256]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
i := 1
|
i := 1
|
||||||
for i > 0 {
|
for i > 0 {
|
||||||
i, _ = io.read({s}, buf)
|
i, _ = io.read(s, buf)
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+3
-3
@@ -72,7 +72,7 @@ hash_stream_256 :: proc(s: io.Stream) -> ([DIGEST_SIZE_256]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
i := 1
|
i := 1
|
||||||
for i > 0 {
|
for i > 0 {
|
||||||
i, _ = io.read({s}, buf)
|
i, _ = io.read(s, buf)
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
||||||
}
|
}
|
||||||
@@ -151,7 +151,7 @@ hash_stream_512 :: proc(s: io.Stream) -> ([DIGEST_SIZE_512]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
i := 1
|
i := 1
|
||||||
for i > 0 {
|
for i > 0 {
|
||||||
i, _ = io.read({s}, buf)
|
i, _ = io.read(s, buf)
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
||||||
}
|
}
|
||||||
@@ -230,7 +230,7 @@ hash_stream_slice :: proc(s: io.Stream, bit_size: int, allocator := context.allo
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
i := 1
|
i := 1
|
||||||
for i > 0 {
|
for i > 0 {
|
||||||
i, _ = io.read({s}, buf)
|
i, _ = io.read(s, buf)
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -69,7 +69,7 @@ hash_stream :: proc(s: io.Stream) -> ([DIGEST_SIZE]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
i := 1
|
i := 1
|
||||||
for i > 0 {
|
for i > 0 {
|
||||||
i, _ = io.read({s}, buf)
|
i, _ = io.read(s, buf)
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+2
-2
@@ -70,7 +70,7 @@ hash_stream_256 :: proc(s: io.Stream) -> ([DIGEST_SIZE_256]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
i := 1
|
i := 1
|
||||||
for i > 0 {
|
for i > 0 {
|
||||||
i, _ = io.read({s}, buf)
|
i, _ = io.read(s, buf)
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
||||||
}
|
}
|
||||||
@@ -149,7 +149,7 @@ hash_stream_512 :: proc(s: io.Stream) -> ([DIGEST_SIZE_512]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
i := 1
|
i := 1
|
||||||
for i > 0 {
|
for i > 0 {
|
||||||
i, _ = io.read({s}, buf)
|
i, _ = io.read(s, buf)
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+3
-3
@@ -71,7 +71,7 @@ hash_stream_128 :: proc(s: io.Stream) -> ([DIGEST_SIZE_128]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
i := 1
|
i := 1
|
||||||
for i > 0 {
|
for i > 0 {
|
||||||
i, _ = io.read({s}, buf)
|
i, _ = io.read(s, buf)
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
||||||
}
|
}
|
||||||
@@ -150,7 +150,7 @@ hash_stream_160 :: proc(s: io.Stream) -> ([DIGEST_SIZE_160]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
i := 1
|
i := 1
|
||||||
for i > 0 {
|
for i > 0 {
|
||||||
i, _ = io.read({s}, buf)
|
i, _ = io.read(s, buf)
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
||||||
}
|
}
|
||||||
@@ -229,7 +229,7 @@ hash_stream_192 :: proc(s: io.Stream) -> ([DIGEST_SIZE_192]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
i := 1
|
i := 1
|
||||||
for i > 0 {
|
for i > 0 {
|
||||||
i, _ = io.read({s}, buf)
|
i, _ = io.read(s, buf)
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -69,7 +69,7 @@ hash_stream :: proc(s: io.Stream) -> ([DIGEST_SIZE]byte, bool) {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
i := 1
|
i := 1
|
||||||
for i > 0 {
|
for i > 0 {
|
||||||
i, _ = io.read({s}, buf)
|
i, _ = io.read(s, buf)
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
botan.hash_update(ctx, len(buf) == 0 ? nil : &buf[0], uint(i))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user