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

vlib: add mut for the first parameter of builtin.copy, arrays.copy and crypto (#13702)

This commit is contained in:
Nick Treleaven
2022-03-09 18:26:00 +00:00
committed by GitHub
parent 4c33003f86
commit 7231a3f135
31 changed files with 84 additions and 88 deletions

View File

@ -47,7 +47,7 @@ pub fn (mut r BufferedReader) read(mut buf []byte) ?int {
return none
}
}
read := copy(buf, r.buf[r.offset..r.len])
read := copy(mut buf, r.buf[r.offset..r.len])
if read == 0 {
return none
}

View File

@ -19,7 +19,7 @@ fn (mut s StringReader) read(mut buf []byte) ?int {
}
mut howmany := imin(buf.len, s.text.len - s.place)
xxx := s.text[s.place..s.place + howmany].bytes()
read := copy(buf, xxx)
read := copy(mut buf, xxx)
s.place += read
return read
}

View File

@ -16,7 +16,7 @@ fn (mut b Buf) read(mut buf []byte) ?int {
if !(b.i < b.bytes.len) {
return none
}
n := copy(buf, b.bytes[b.i..])
n := copy(mut buf, b.bytes[b.i..])
b.i += n
return n
}

View File

@ -11,7 +11,7 @@ fn (mut b Buf) read(mut buf []byte) ?int {
if !(b.i < b.bytes.len) {
return none
}
n := copy(buf, b.bytes[b.i..])
n := copy(mut buf, b.bytes[b.i..])
b.i += n
return n
}
@ -48,7 +48,7 @@ fn (mut s StringReader) read(mut buf []byte) ?int {
if s.place >= s.text.len {
return none
}
read := copy(buf, s.text[s.place..].bytes())
read := copy(mut buf, s.text[s.place..].bytes())
s.place += read
return read
}