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:
@ -39,20 +39,18 @@ fn new_cfb(b Block, iv []byte, decrypt bool) Cfb {
|
||||
if iv.len != block_size {
|
||||
panic('cipher.new_cfb: IV length must be equal block size')
|
||||
}
|
||||
x := Cfb{
|
||||
mut x := Cfb{
|
||||
b: b
|
||||
out: []byte{len: b.block_size}
|
||||
next: []byte{len: b.block_size}
|
||||
out_used: block_size
|
||||
decrypt: decrypt
|
||||
}
|
||||
|
||||
copy(x.next, iv)
|
||||
|
||||
copy(mut x.next, iv)
|
||||
return x
|
||||
}
|
||||
|
||||
pub fn (x &Cfb) xor_key_stream(mut dst_ []byte, src_ []byte) {
|
||||
pub fn (mut x Cfb) xor_key_stream(mut dst_ []byte, src_ []byte) {
|
||||
unsafe {
|
||||
mut dst := *dst_
|
||||
mut src := src_
|
||||
@ -71,12 +69,12 @@ pub fn (x &Cfb) xor_key_stream(mut dst_ []byte, src_ []byte) {
|
||||
}
|
||||
|
||||
if x.decrypt {
|
||||
copy(x.next[x.out_used..], src)
|
||||
copy(mut x.next[x.out_used..], src)
|
||||
}
|
||||
|
||||
n := xor_bytes(mut dst, src, x.out[x.out_used..])
|
||||
if !x.decrypt {
|
||||
copy(x.next[x.out_used..], dst)
|
||||
copy(mut x.next[x.out_used..], dst)
|
||||
}
|
||||
dst = dst[n..]
|
||||
src = src[n..]
|
||||
|
Reference in New Issue
Block a user