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

all: update repo to use the new error handling syntax (#8950)

This commit is contained in:
spaceface
2021-02-28 21:20:21 +01:00
committed by GitHub
parent b9a381f101
commit d63b7bc35a
135 changed files with 487 additions and 468 deletions

View File

@@ -109,14 +109,14 @@ fn (mut d Digest) checksum() []byte {
mut tmp := []byte{len: (64)}
tmp[0] = 0x80
if int(len) % 64 < 56 {
d.write(tmp[..56 - int(len) % 64]) or { panic(err) }
d.write(tmp[..56 - int(len) % 64]) or { panic(err.msg) }
} else {
d.write(tmp[..64 + 56 - int(len) % 64]) or { panic(err) }
d.write(tmp[..64 + 56 - int(len) % 64]) or { panic(err.msg) }
}
// Length in bits.
len <<= 3
binary.big_endian_put_u64(mut tmp, len)
d.write(tmp[..8]) or { panic(err) }
d.write(tmp[..8]) or { panic(err.msg) }
mut digest := []byte{len: (size)}
binary.big_endian_put_u32(mut digest, d.h[0])
binary.big_endian_put_u32(mut digest[4..], d.h[1])
@@ -129,7 +129,7 @@ fn (mut d Digest) checksum() []byte {
// sum returns the SHA-1 checksum of the bytes passed in `data`.
pub fn sum(data []byte) []byte {
mut d := new()
d.write(data) or { panic(err) }
d.write(data) or { panic(err.msg) }
return d.checksum()
}