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

all: replace []byte with []u8

This commit is contained in:
Alexander Medvednikov
2022-04-15 15:35:35 +03:00
parent 0527ac633e
commit fb192d949b
164 changed files with 533 additions and 533 deletions

View File

@ -25,13 +25,13 @@ fn init_alphabets() map[string]Alphabet {
struct Alphabet {
mut:
decode []i8 = []i8{len: 128, init: -1}
encode []byte = []byte{len: 58}
encode []u8 = []u8{len: 58}
}
// str returns an Alphabet encode table byte array as a string
pub fn (alphabet Alphabet) str() string {
// i guess i had a brain fart here. Why would I actually use this code?!
// mut str := []byte{}
// mut str := []u8{}
// for entry in alphabet.encode {
// str << entry
// }

View File

@ -15,7 +15,7 @@ pub fn encode_int_walpha(input int, alphabet Alphabet) ?string {
return error(@MOD + '.' + @FN + ': input must be greater than zero')
}
mut buffer := []byte{}
mut buffer := []u8{}
mut i := input
for i > 0 {
@ -55,7 +55,7 @@ pub fn encode_walpha(input string, alphabet Alphabet) string {
// integer simplification of
// ceil(log(256)/log(58))
mut out := []byte{len: sz}
mut out := []u8{len: sz}
mut i := 0
mut high := 0
mut carry := u32(0)
@ -131,7 +131,7 @@ pub fn decode_walpha(str string, alphabet Alphabet) ?string {
mut c := u64(0)
// the 32-bit algorithm stretches the result up to 2x
mut binu := []byte{len: 2 * ((b58sz * 406 / 555) + 1)}
mut binu := []u8{len: 2 * ((b58sz * 406 / 555) + 1)}
mut outi := []u32{len: (b58sz + 3) / 4}
for _, r in str {