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

net: fix unsafe warnings

This commit is contained in:
Delyan Angelov 2021-04-23 15:18:09 +03:00
parent 2f29e7903c
commit 1b46f9aa02

View File

@ -43,7 +43,8 @@ pub fn (mut c TcpConn) write_ptr(b &byte, len int) ?int {
unsafe { b.vstring_with_len(len) }) unsafe { b.vstring_with_len(len) })
} }
$if trace_tcp_data_write ? { $if trace_tcp_data_write ? {
eprintln('>>> TcpConn.write_ptr | data.len: ${len:6} | data: ' + b.vstring_with_len(len)) eprintln('>>> TcpConn.write_ptr | data.len: ${len:6} | data: ' +
unsafe { b.vstring_with_len(len) })
} }
unsafe { unsafe {
mut ptr_base := &byte(b) mut ptr_base := &byte(b)
@ -94,7 +95,7 @@ pub fn (mut c TcpConn) read_ptr(buf_ptr &byte, len int) ?int {
if res > 0 { if res > 0 {
$if trace_tcp_data_read ? { $if trace_tcp_data_read ? {
eprintln('<<< TcpConn.read_ptr | 1 data.len: ${res:6} | data: ' + eprintln('<<< TcpConn.read_ptr | 1 data.len: ${res:6} | data: ' +
buf_ptr.vstring_with_len(res)) unsafe { buf_ptr.vstring_with_len(res) })
} }
return res return res
} }
@ -108,7 +109,7 @@ pub fn (mut c TcpConn) read_ptr(buf_ptr &byte, len int) ?int {
$if trace_tcp_data_read ? { $if trace_tcp_data_read ? {
if res > 0 { if res > 0 {
eprintln('<<< TcpConn.read_ptr | 2 data.len: ${res:6} | data: ' + eprintln('<<< TcpConn.read_ptr | 2 data.len: ${res:6} | data: ' +
buf_ptr.vstring_with_len(res)) unsafe { buf_ptr.vstring_with_len(res) })
} }
} }
return socket_error(res) return socket_error(res)