ci: other mut vlib test fixes

pull/6494/head
Delyan Angelov 2020-09-27 11:18:55 +03:00
parent aa889b0edc
commit 03258db26d
4 changed files with 9 additions and 7 deletions

View File

@ -105,7 +105,8 @@ pub fn (mut x AesCbc) decrypt_blocks(mut dst []byte, src []byte) {
// Loop over all but the first block.
for start > 0 {
x.b.decrypt(mut (*dst).slice(start, end), mut src.slice(start, end))
mut src_chunk := src.slice(start, end)
x.b.decrypt(mut (*dst).slice(start, end), mut src_chunk)
cipher.xor_bytes(mut (*dst).slice(start, end), (*dst).slice(start, end), src.slice(prev, start))
end = start
@ -114,7 +115,8 @@ pub fn (mut x AesCbc) decrypt_blocks(mut dst []byte, src []byte) {
}
// The first block is special because it uses the saved iv.
x.b.decrypt(mut (*dst).slice(start, end), mut src.slice(start, end))
mut src_chunk := src.slice(start, end)
x.b.decrypt(mut (*dst).slice(start, end), mut src_chunk)
cipher.xor_bytes(mut (*dst).slice(start, end), (*dst).slice(start, end), x.iv)

View File

@ -15,7 +15,7 @@ fn test_crypto_rc4() {
mut src := 'toencrypt'.bytes()
// src & dst same, encrypt in place
c.xor_key_stream(mut src, src) // encrypt data
c.xor_key_stream(mut src, mut src) // encrypt data
c.reset()

View File

@ -165,7 +165,7 @@ fn test_write_and_read_bytes() {
assert rbytes == payload
// check that trying to read data from EOF doesn't error and returns 0
mut a := []byte{len: 5}
nread := file_read.read_bytes_into(5, a) or {
nread := file_read.read_bytes_into(5, mut a) or {
eprintln(err)
int(-1)
}

View File

@ -18,7 +18,7 @@ fn do_rec(ch chan int, resch chan i64, n int) {
mut sum := i64(0)
for _ in 0 .. n {
mut r := 0
for ch.try_pop(mut r) != .success {}
for ch.try_pop(r) != .success {}
sum += r
}
println(sum)
@ -34,11 +34,11 @@ fn do_send(ch chan int, start, end int) {
fn test_channel_polling() {
ch := chan int{cap: buflen}
resch := chan i64{}
for i in 0 .. nrec {
for _ in 0 .. nrec {
go do_rec(ch, resch, objs_per_thread)
}
mut n := nobj
for i in 0 .. nsend {
for _ in 0 .. nsend {
end := n
n -= objs_per_thread
go do_send(ch, n, end)