1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

ci: fix v -cc gcc -cstrict examples/pico/pico.v

This commit is contained in:
Delyan Angelov
2021-10-01 13:49:38 +03:00
parent 6f7c3a7cdf
commit 41de0c3c6a
5 changed files with 28 additions and 22 deletions

View File

@@ -29,7 +29,7 @@ fn C.phr_parse_headers(buf &char, len usize, headers &C.phr_header, num_headers
fn C.phr_parse_request_path(buf_start &char, len usize, method PPchar, method_len &usize, path PPchar, path_len &usize) int
fn C.phr_parse_request_path_pipeline(buf_start &char, len usize, method PPchar, method_len &usize, path PPchar, path_len &usize) int
fn C.get_date() &byte
fn C.get_date() &char
// static inline int u64toa(char* buf, uint64_t value) {
fn C.u64toa(buffer &char, value u64) int

View File

@@ -18,8 +18,9 @@ pub fn (mut r Request) parse_request(s string, max_headers int) int {
minor_version := 0
num_headers := usize(max_headers)
pret := C.phr_parse_request(s.str, s.len, PPchar(&r.method.str), &method_len, PPchar(&r.path.str),
&path_len, &minor_version, &r.headers[0], &num_headers, r.prev_len)
pret := C.phr_parse_request(&char(s.str), s.len, voidptr(&r.method.str), &method_len,
voidptr(&r.path.str), &path_len, &minor_version, &r.headers[0], &num_headers,
r.prev_len)
if pret > 0 {
unsafe {
r.method = tos(r.method.str, int(method_len))
@@ -37,8 +38,8 @@ pub fn (mut r Request) parse_request_path(s string) int {
method_len := usize(0)
path_len := usize(0)
pret := C.phr_parse_request_path(s.str, s.len, PPchar(&r.method.str), &method_len,
PPchar(&r.path.str), &path_len)
pret := C.phr_parse_request_path(&char(s.str), s.len, voidptr(&r.method.str), &method_len,
voidptr(&r.path.str), &path_len)
if pret > 0 {
unsafe {
r.method = tos(r.method.str, int(method_len))
@@ -53,8 +54,8 @@ pub fn (mut r Request) parse_request_path_pipeline(s string) int {
method_len := usize(0)
path_len := usize(0)
pret := C.phr_parse_request_path_pipeline(s.str, s.len, PPchar(&r.method.str), &method_len,
PPchar(&r.path.str), &path_len)
pret := C.phr_parse_request_path_pipeline(&char(s.str), s.len, voidptr(&r.method.str),
&method_len, voidptr(&r.path.str), &path_len)
if pret > 0 {
unsafe {
r.method = tos(r.method.str, int(method_len))

View File

@@ -78,7 +78,7 @@ pub fn (mut r Response) json() &Response {
pub fn (mut r Response) body(body string) {
r.write_string('Content-Length: ')
unsafe {
r.buf += C.u64toa(r.buf, body.len)
r.buf += C.u64toa(&char(r.buf), body.len)
}
r.write_string('\r\n\r\n')
r.write_string(body)
@@ -106,7 +106,7 @@ pub fn (mut r Response) raw(response string) {
[inline]
pub fn (mut r Response) end() int {
n := int(r.buf) - int(r.buf_start)
n := int(i64(r.buf) - i64(r.buf_start))
if C.write(r.fd, r.buf_start, n) != n {
return -1
}