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

@@ -14,7 +14,7 @@ fn main() {
mut checksum := u64(0)
mut start_pos := 0
mut bgenerating := benchmark.start()
mut bytepile := []byte{}
mut bytepile := []u8{}
for _ in 0 .. sample_size * max_str_len {
bytepile << u8(rand.int_in_range(40, 125) or { 40 })
}

View File

@@ -2209,7 +2209,7 @@ fn (t Tree) array_node_int(nodes []int) &Node {
return arr
}
fn (t Tree) array_node_u8(nodes []byte) &Node {
fn (t Tree) array_node_u8(nodes []u8) &Node {
mut arr := new_array()
for node in nodes {
arr.add_item(t.number_node(node))

View File

@@ -46,7 +46,7 @@ fn (context Context) footer() string {
return ')\n'
}
fn (context Context) file2v(bname string, fbytes []byte, bn_max int) string {
fn (context Context) file2v(bname string, fbytes []u8, bn_max int) string {
mut sb := strings.new_builder(1000)
bn_diff_len := bn_max - bname.len
sb.write_string('\t${bname}_len' + ' '.repeat(bn_diff_len - 4) + ' = $fbytes.len\n')
@@ -73,7 +73,7 @@ fn (context Context) file2v(bname string, fbytes []byte, bn_max int) string {
return sb.str()
}
fn (context Context) bname_and_bytes(file string) ?(string, []byte) {
fn (context Context) bname_and_bytes(file string) ?(string, []u8) {
fname := os.file_name(file)
fname_escaped := fname.replace_each(['.', '_', '-', '_'])
byte_name := '$context.prefix$fname_escaped'.to_lower()
@@ -120,7 +120,7 @@ fn main() {
if context.write_file != '' && os.file_ext(context.write_file) !in ['.vv', '.v'] {
context.write_file += '.v'
}
mut file_byte_map := map[string][]byte{}
mut file_byte_map := map[string][]u8{}
for file in real_files {
bname, fbytes := context.bname_and_bytes(file) or {
eprintln(err.msg())