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:
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user