forked from vieter-v/vieter
fix: replace byte with u8
BREAKING: the V compiler removed the byte type alias in favor of u8.main
parent
20707f6af1
commit
7722d5a7e4
|
@ -28,8 +28,8 @@ fn send(req &string) ?http.Response {
|
||||||
s.wait_for_write() ?
|
s.wait_for_write() ?
|
||||||
|
|
||||||
mut c := 0
|
mut c := 0
|
||||||
mut buf := []byte{len: docker.buf_len}
|
mut buf := []u8{len: docker.buf_len}
|
||||||
mut res := []byte{}
|
mut res := []u8{}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
c = s.read(mut buf) or { return error('Failed to read data from socket ${docker.socket}.') }
|
c = s.read(mut buf) or { return error('Failed to read data from socket ${docker.socket}.') }
|
||||||
|
@ -52,7 +52,7 @@ fn send(req &string) ?http.Response {
|
||||||
|
|
||||||
// We loop until we've encountered the end of the chunked response
|
// We loop until we've encountered the end of the chunked response
|
||||||
// A chunked HTTP response always ends with '0\r\n\r\n'.
|
// A chunked HTTP response always ends with '0\r\n\r\n'.
|
||||||
for res.len < 5 || res#[-5..] != [byte(`0`), `\r`, `\n`, `\r`, `\n`] {
|
for res.len < 5 || res#[-5..] != [u8(`0`), `\r`, `\n`, `\r`, `\n`] {
|
||||||
// Wait for the server to respond
|
// Wait for the server to respond
|
||||||
s.wait_for_write() ?
|
s.wait_for_write() ?
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ fn archive_add_entry(archive &C.archive, entry &C.archive_entry, file_path &stri
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write the file to the archive
|
// Write the file to the archive
|
||||||
buf := [8192]byte{}
|
buf := [8192]u8{}
|
||||||
mut len := C.read(fd, &buf, sizeof(buf))
|
mut len := C.read(fd, &buf, sizeof(buf))
|
||||||
|
|
||||||
for len > 0 {
|
for len > 0 {
|
||||||
|
|
|
@ -30,7 +30,7 @@ pub fn reader_to_file(mut reader io.BufferedReader, length int, path string) ? {
|
||||||
file.close()
|
file.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
mut buf := []byte{len: util.reader_buf_size}
|
mut buf := []u8{len: util.reader_buf_size}
|
||||||
mut bytes_left := length
|
mut bytes_left := length
|
||||||
|
|
||||||
// Repeat as long as the stream still has data
|
// Repeat as long as the stream still has data
|
||||||
|
@ -60,7 +60,7 @@ pub fn hash_file(path &string) ?(string, string) {
|
||||||
mut sha256sum := sha256.new()
|
mut sha256sum := sha256.new()
|
||||||
|
|
||||||
buf_size := int(1_000_000)
|
buf_size := int(1_000_000)
|
||||||
mut buf := []byte{len: buf_size}
|
mut buf := []u8{len: buf_size}
|
||||||
mut bytes_left := os.file_size(path)
|
mut bytes_left := os.file_size(path)
|
||||||
|
|
||||||
for bytes_left > 0 {
|
for bytes_left > 0 {
|
||||||
|
|
|
@ -285,7 +285,7 @@ pub fn (mut ctx Context) file(f_path string) Result {
|
||||||
resp.set_status(ctx.status)
|
resp.set_status(ctx.status)
|
||||||
send_string(mut ctx.conn, resp.bytestr()) or { return Result{} }
|
send_string(mut ctx.conn, resp.bytestr()) or { return Result{} }
|
||||||
|
|
||||||
mut buf := []byte{len: 1_000_000}
|
mut buf := []u8{len: 1_000_000}
|
||||||
mut bytes_left := file_size
|
mut bytes_left := file_size
|
||||||
|
|
||||||
// Repeat as long as the stream still has data
|
// Repeat as long as the stream still has data
|
||||||
|
|
Loading…
Reference in New Issue