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

@@ -25,19 +25,17 @@ pub fn new_ofb(b Block, iv []byte) Ofb {
if iv.len != block_size {
panic('cipher.new_ofb: IV length must be equal block size')
}
x := Ofb{
mut x := Ofb{
b: b
out: []byte{len: b.block_size}
next: []byte{len: b.block_size}
out_used: block_size
}
copy(x.next, iv)
copy(mut x.next, iv)
return x
}
pub fn (x &Ofb) xor_key_stream(mut dst_ []byte, src_ []byte) {
pub fn (mut x Ofb) xor_key_stream(mut dst_ []byte, src_ []byte) {
unsafe {
mut dst := *dst_
mut src := src_
@@ -55,7 +53,7 @@ pub fn (x &Ofb) xor_key_stream(mut dst_ []byte, src_ []byte) {
x.out_used = 0
}
copy(x.next, x.out)
copy(mut x.next, x.out)
n := xor_bytes(mut dst, src, x.out)
dst = dst[n..]