mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
all: replace []byte with []u8
This commit is contained in:
@@ -182,11 +182,11 @@ pub fn parse_request(mut reader io.BufferedReader) ?Request {
|
||||
mut request := parse_request_head(mut reader) ?
|
||||
|
||||
// body
|
||||
mut body := []byte{}
|
||||
mut body := []u8{}
|
||||
if length := request.header.get(.content_length) {
|
||||
n := length.int()
|
||||
if n > 0 {
|
||||
body = []byte{len: n}
|
||||
body = []u8{len: n}
|
||||
mut count := 0
|
||||
for count < body.len {
|
||||
count += reader.read(mut body[count..]) or { break }
|
||||
|
||||
@@ -8,7 +8,7 @@ mut:
|
||||
place int
|
||||
}
|
||||
|
||||
fn (mut s StringReader) read(mut buf []byte) ?int {
|
||||
fn (mut s StringReader) read(mut buf []u8) ?int {
|
||||
if s.place >= s.text.len {
|
||||
return none
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@ fn (mut resp Response) free() {
|
||||
}
|
||||
|
||||
// Formats resp to bytes suitable for HTTP response transmission
|
||||
pub fn (resp Response) bytes() []byte {
|
||||
// TODO: build []byte directly; this uses two allocations
|
||||
pub fn (resp Response) bytes() []u8 {
|
||||
// TODO: build []u8 directly; this uses two allocations
|
||||
return resp.bytestr().bytes()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user