From 1b46f9aa02e8195646a9447ae5d3d536b2b2eda9 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Fri, 23 Apr 2021 15:18:09 +0300 Subject: [PATCH] net: fix unsafe warnings --- vlib/net/tcp.v | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/vlib/net/tcp.v b/vlib/net/tcp.v index 0a49511d13..92bfee34ee 100644 --- a/vlib/net/tcp.v +++ b/vlib/net/tcp.v @@ -43,7 +43,8 @@ pub fn (mut c TcpConn) write_ptr(b &byte, len int) ?int { unsafe { b.vstring_with_len(len) }) } $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 { 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 trace_tcp_data_read ? { 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 } @@ -108,7 +109,7 @@ pub fn (mut c TcpConn) read_ptr(buf_ptr &byte, len int) ?int { $if trace_tcp_data_read ? { if res > 0 { 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)