mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: warn when fixed-size ArrayInit doesn't have trailing {}
. (#6137)
This commit is contained in:
@ -186,7 +186,7 @@ pub fn (s Socket) accept() ?Socket {
|
||||
}
|
||||
|
||||
pub fn (s Socket) peer_ip() ?string {
|
||||
buf := [44]byte
|
||||
buf := [44]byte{}
|
||||
peeraddr := C.sockaddr_in{}
|
||||
speeraddr := sizeof(peeraddr)
|
||||
ok := C.getpeername(s.sockfd, &C.sockaddr(&peeraddr), &speeraddr)
|
||||
@ -327,7 +327,7 @@ pub fn (s Socket) write(str string) ?int {
|
||||
|
||||
// read_line - retrieves a line from the socket s (i.e. a string ended with \n)
|
||||
pub fn (s Socket) read_line() string {
|
||||
mut buf := [max_read]byte // where C.recv will store the network data
|
||||
mut buf := [max_read]byte{} // where C.recv will store the network data
|
||||
mut res := '' // The final result, including the ending \n.
|
||||
for {
|
||||
mut line := '' // The current line. Can be a partial without \n in it.
|
||||
@ -373,7 +373,7 @@ pub fn (s Socket) read_line() string {
|
||||
|
||||
// TODO
|
||||
pub fn (s Socket) read_all() string {
|
||||
mut buf := [max_read]byte // where C.recv will store the network data
|
||||
mut buf := [max_read]byte{} // where C.recv will store the network data
|
||||
mut res := '' // The final result, including the ending \n.
|
||||
for {
|
||||
n := C.recv(s.sockfd, buf, max_read - 1, 0)
|
||||
|
Reference in New Issue
Block a user