diff --git a/vlib/builtin/linux_bare/memory_managment.v b/vlib/builtin/linux_bare/memory_managment.v index 8f8c3d829c4658..33d78d093b983e 100644 --- a/vlib/builtin/linux_bare/memory_managment.v +++ b/vlib/builtin/linux_bare/memory_managment.v @@ -2,7 +2,7 @@ module builtin import dlmalloc -fn mm_alloc(size u64) (&byte, Errno) { +fn mm_alloc(size u64) (&u8, Errno) { // BEGIN CONSTS // the constants need to be here, since the initialization of other constants, // which happen before these ones would, require malloc diff --git a/vlib/builtin/linux_bare/old/linuxsys_bare.v b/vlib/builtin/linux_bare/old/linuxsys_bare.v index de9b2b68932b50..8f78e0fabae15b 100644 --- a/vlib/builtin/linux_bare/old/linuxsys_bare.v +++ b/vlib/builtin/linux_bare/old/linuxsys_bare.v @@ -337,16 +337,16 @@ fn split_int_errno(rc_in u64) (i64, Errno) { } // 0 sys_read unsigned int fd char *buf size_t count -pub fn sys_read(fd i64, buf &byte, count u64) (i64, Errno) { +pub fn sys_read(fd i64, buf &u8, count u64) (i64, Errno) { return split_int_errno(sys_call3(0, u64(fd), u64(buf), count)) } // 1 sys_write unsigned int fd, const char *buf, size_t count -pub fn sys_write(fd i64, buf &byte, count u64) (i64, Errno) { +pub fn sys_write(fd i64, buf &u8, count u64) (i64, Errno) { return split_int_errno(sys_call3(1, u64(fd), u64(buf), count)) } -pub fn sys_open(filename &byte, flags i64, mode int) (i64, Errno) { +pub fn sys_open(filename &u8, flags i64, mode int) (i64, Errno) { // 2 sys_open const char *filename int flags int mode return split_int_errno(sys_call3(2, u64(filename), u64(flags), u64(mode))) } @@ -357,7 +357,7 @@ pub fn sys_close(fd i64) Errno { } // 9 sys_mmap unsigned long addr unsigned long len unsigned long prot unsigned long flags unsigned long fd unsigned long off -pub fn sys_mmap(addr &byte, len u64, prot Mm_prot, flags Map_flags, fildes u64, off u64) (&byte, Errno) { +pub fn sys_mmap(addr &u8, len u64, prot Mm_prot, flags Map_flags, fildes u64, off u64) (&u8, Errno) { rc := sys_call6(9, u64(addr), len, u64(prot), u64(flags), fildes, off) a, e := split_int_errno(rc) return &u8(a), e diff --git a/vlib/builtin/linux_bare/old/mm_bare.v b/vlib/builtin/linux_bare/old/mm_bare.v index 2acfb395622aa6..02032c2fe6fbcb 100644 --- a/vlib/builtin/linux_bare/old/mm_bare.v +++ b/vlib/builtin/linux_bare/old/mm_bare.v @@ -11,7 +11,7 @@ pub fn mm_pages(size u64) u32 { return u32(pages) } -pub fn mm_alloc(size u64) (&byte, Errno) { +pub fn mm_alloc(size u64) (&u8, Errno) { pages := mm_pages(size) n_bytes := u64(pages * u32(Linux_mem.page_size)) @@ -24,7 +24,7 @@ pub fn mm_alloc(size u64) (&byte, Errno) { return &u8(0), e } -pub fn mm_free(addr &byte) Errno { +pub fn mm_free(addr &u8) Errno { ap := &int(addr - 4) size := u64(*ap) * u64(Linux_mem.page_size) @@ -41,7 +41,7 @@ pub fn mem_copy(dest0 voidptr, src0 voidptr, n isize) voidptr { } @[unsafe] -pub fn malloc(n isize) &byte { +pub fn malloc(n isize) &u8 { if n < 0 { panic('malloc(<0)') } diff --git a/vlib/builtin/linux_bare/old/string_bare.v b/vlib/builtin/linux_bare/old/string_bare.v index da4e117b6db1b5..36053c8a5b8457 100644 --- a/vlib/builtin/linux_bare/old/string_bare.v +++ b/vlib/builtin/linux_bare/old/string_bare.v @@ -2,17 +2,17 @@ module builtin pub struct string { pub: - str &byte + str &u8 len int } -pub fn strlen(s &byte) int { +pub fn strlen(s &u8) int { mut i := 0 for ; s[i] != 0; i++ {} return i } -pub fn tos(s &byte, len int) string { +pub fn tos(s &u8, len int) string { if s == 0 { panic('tos(): nil string') } @@ -49,7 +49,7 @@ pub fn tos_clone(s byteptr) string { // Same as `tos`, but calculates the length. Called by `string(bytes)` casts. // Used only internally. -pub fn tos2(s &byte) string { +pub fn tos2(s &u8) string { if s == 0 { panic('tos2: nil string') } @@ -85,7 +85,7 @@ pub fn string_ne(s1 string, s2 string) bool { return !string_eq(s1, s2) } -pub fn i64_tos(buf &byte, len int, n0 i64, base int) string { +pub fn i64_tos(buf &u8, len int, n0 i64, base int) string { if base < 2 { panic('base must be >= 2') } diff --git a/vlib/builtin/map.c.v b/vlib/builtin/map.c.v index 86742e21906831..765eff0e54434b 100644 --- a/vlib/builtin/map.c.v +++ b/vlib/builtin/map.c.v @@ -1,6 +1,6 @@ module builtin -fn C.wyhash(&byte, u64, u64, &u64) u64 +fn C.wyhash(&u8, u64, u64, &u64) u64 fn C.wyhash64(u64, u64) u64 diff --git a/vlib/builtin/wasm_bare/libc_impl.c.v b/vlib/builtin/wasm_bare/libc_impl.c.v index c0a2f465f374eb..b4f69da108401c 100644 --- a/vlib/builtin/wasm_bare/libc_impl.c.v +++ b/vlib/builtin/wasm_bare/libc_impl.c.v @@ -105,11 +105,11 @@ fn memcmp(a &C.void, b &C.void, n usize) int { return 0 } -fn vsprintf(str &char, format &char, ap &byte) int { +fn vsprintf(str &char, format &char, ap &u8) int { panic('vsprintf(): string interpolation is not supported in `-freestanding`') } -fn vsnprintf(str &char, size usize, format &char, ap &byte) int { +fn vsnprintf(str &char, size usize, format &char, ap &u8) int { panic('vsnprintf(): string interpolation is not supported in `-freestanding`') } @@ -119,17 +119,17 @@ enum Errno { } // not really needed -fn bare_read(buf &byte, count u64) (i64, Errno) { +fn bare_read(buf &u8, count u64) (i64, Errno) { return 0, Errno.eerror } -pub fn bare_print(buf &byte, len u64) { +pub fn bare_print(buf &u8, len u64) { } -fn bare_eprint(buf &byte, len u64) { +fn bare_eprint(buf &u8, len u64) { } -pub fn write(_fd i64, _buf &byte, _count u64) i64 { +pub fn write(_fd i64, _buf &u8, _count u64) i64 { return -1 } diff --git a/vlib/crypto/rand/rand_freebsd.c.v b/vlib/crypto/rand/rand_freebsd.c.v index 889ab55d299804..8a225cce443c61 100644 --- a/vlib/crypto/rand/rand_freebsd.c.v +++ b/vlib/crypto/rand/rand_freebsd.c.v @@ -6,7 +6,7 @@ module rand #include -fn C.arc4random_buf(p &byte, n usize) +fn C.arc4random_buf(p &u8, n usize) // read returns an array of `bytes_needed` random bytes read from the OS. pub fn read(bytes_needed int) ![]u8 { diff --git a/vlib/crypto/rand/rand_openbsd.c.v b/vlib/crypto/rand/rand_openbsd.c.v index 889ab55d299804..8a225cce443c61 100644 --- a/vlib/crypto/rand/rand_openbsd.c.v +++ b/vlib/crypto/rand/rand_openbsd.c.v @@ -6,7 +6,7 @@ module rand #include -fn C.arc4random_buf(p &byte, n usize) +fn C.arc4random_buf(p &u8, n usize) // read returns an array of `bytes_needed` random bytes read from the OS. pub fn read(bytes_needed int) ![]u8 { diff --git a/vlib/crypto/rand/rand_solaris.c.v b/vlib/crypto/rand/rand_solaris.c.v index 5aa0ead344a25c..2146c989517dad 100644 --- a/vlib/crypto/rand/rand_solaris.c.v +++ b/vlib/crypto/rand/rand_solaris.c.v @@ -6,7 +6,7 @@ module rand #include -fn C.getrandom(p &byte, n usize, flags u32) int +fn C.getrandom(p &u8, n usize, flags u32) int const ( read_batch_size = 256 diff --git a/vlib/encoding/base32/base32.v b/vlib/encoding/base32/base32.v index a33edb34fdeff9..51f9140d1f7624 100644 --- a/vlib/encoding/base32/base32.v +++ b/vlib/encoding/base32/base32.v @@ -351,7 +351,7 @@ fn (enc &Encoding) decode_(src_ []u8, mut dst []u8) !(int, bool) { // strip_newlines removes newline characters and returns the number // of non-newline characters copied to dst. -// fn strip_newlines(mut dst []u8, src []byte) int { +// fn strip_newlines(mut dst []u8, src []u8) int { // mut offset := 0 // for b in src { // if b in [`\r`, `\n`] { diff --git a/vlib/math/math_test.v b/vlib/math/math_test.v index 4e17e2ea99d8a7..fb65421989ed81 100644 --- a/vlib/math/math_test.v +++ b/vlib/math/math_test.v @@ -1148,7 +1148,6 @@ fn test_maxof_minof() { assert maxof[i32]() == 2147483647 assert maxof[i64]() == 9223372036854775807 assert maxof[u8]() == 255 - assert maxof[byte]() == 255 assert maxof[u16]() == 65535 assert maxof[u32]() == 4294967295 assert maxof[u64]() == 18446744073709551615 @@ -1161,7 +1160,6 @@ fn test_maxof_minof() { assert minof[i32]() == -2147483648 assert minof[i64]() == -9223372036854775807 - 1 assert minof[u8]() == 0 - assert minof[byte]() == 0 assert minof[u16]() == 0 assert minof[u32]() == 0 assert minof[u64]() == 0 diff --git a/vlib/stbi/stbi.c.v b/vlib/stbi/stbi.c.v index e260bdbb177063..dd205696c8699a 100644 --- a/vlib/stbi/stbi.c.v +++ b/vlib/stbi/stbi.c.v @@ -188,7 +188,7 @@ fn C.stbi_write_bmp(filename &char, w int, h int, comp int, buffer &u8) int fn C.stbi_write_tga(filename &char, w int, h int, comp int, buffer &u8) int fn C.stbi_write_jpg(filename &char, w int, h int, comp int, buffer &u8, quality int) int -// fn C.stbi_write_hdr(filename &char, w int, h int, comp int, buffer &byte) int // buffer &byte => buffer &f32 +// fn C.stbi_write_hdr(filename &char, w int, h int, comp int, buffer &u8) int // buffer &u8 => buffer &f32 // stbi_write_png write on path a PNG file // row_stride_in_bytes is usually equal to: w * comp @@ -222,7 +222,7 @@ pub fn stbi_write_jpg(path string, w int, h int, comp int, buf &u8, quality int) } /* -pub fn stbi_write_hdr(path string, w int, h int, comp int, buf &byte) ! { +pub fn stbi_write_hdr(path string, w int, h int, comp int, buf &u8) ! { if 0 == C.stbi_write_hdr(&char(path.str), w , h , comp , buf){ return error('stbi_image failed to write hdr file to "$path"') } diff --git a/vlib/v/checker/assign.v b/vlib/v/checker/assign.v index 41919a403d3828..e7628f08a53318 100644 --- a/vlib/v/checker/assign.v +++ b/vlib/v/checker/assign.v @@ -537,7 +537,7 @@ or use an explicit `unsafe{ a[..] }`, if you do not want a copy of the slice.', } if node.op == .assign { // `mut arr := [u8(1),2,3]` - // `arr = [byte(4),5,6]` + // `arr = [u8(4),5,6]` left_info := left_sym.info as ast.Array left_elem_type := c.table.unaliased_type(left_info.elem_type) if left_type_unwrapped.nr_muls() == right_type_unwrapped.nr_muls() diff --git a/vlib/v/tests/aliased_array_method_call_test.v b/vlib/v/tests/aliased_array_method_call_test.v index 322ff306d5b7b1..91f26d6f57682e 100644 --- a/vlib/v/tests/aliased_array_method_call_test.v +++ b/vlib/v/tests/aliased_array_method_call_test.v @@ -1,10 +1,10 @@ -fn get_bytes_array() []byte { - return [byte(97), 98, 99] +fn get_bytes_array() []u8 { + return [u8(97), 98, 99] } fn test_element_aliased_array_method_call() { assert get_bytes_array().bytestr() == 'abc' - arr := [byte(97), 98, 99] + arr := [u8(97), 98, 99] assert arr.bytestr() == 'abc' } diff --git a/vlib/v/tests/assign_array_of_aliases_test.v b/vlib/v/tests/assign_array_of_aliases_test.v index 3375b6fa590744..7b6730fbfff635 100644 --- a/vlib/v/tests/assign_array_of_aliases_test.v +++ b/vlib/v/tests/assign_array_of_aliases_test.v @@ -1,6 +1,6 @@ fn test_assign_array_of_aliases() { mut arr := [u8(1), 2, 3] - arr = [byte(4), 5, 6] + arr = [u8(4), 5, 6] println(arr) assert arr.len == 3 diff --git a/vlib/v/tests/check_init_value_for_arrays_of_option_test.v b/vlib/v/tests/check_init_value_for_arrays_of_option_test.v index 18534917ead61f..7704864166d7fc 100644 --- a/vlib/v/tests/check_init_value_for_arrays_of_option_test.v +++ b/vlib/v/tests/check_init_value_for_arrays_of_option_test.v @@ -32,7 +32,6 @@ fn test_primitives() { check_init_value_for_arrays_of_option[i64]() check_init_value_for_arrays_of_option[u8]() - check_init_value_for_arrays_of_option[byte]() check_init_value_for_arrays_of_option[u16]() check_init_value_for_arrays_of_option[u32]() check_init_value_for_arrays_of_option[u64]() diff --git a/vlib/v/tests/const_from_bytes_test.v b/vlib/v/tests/const_from_bytes_test.v index 70fcb07afcf598..8d7a90438f476b 100644 --- a/vlib/v/tests/const_from_bytes_test.v +++ b/vlib/v/tests/const_from_bytes_test.v @@ -1,7 +1,7 @@ -type UUID = [16]byte +type UUID = [16]u8 -const codec_test_uuid = UUID([byte(0x6b), 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, - 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8]!) +const codec_test_uuid = UUID([u8(0x6b), 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, + 0xc0, 0x4f, 0xd4, 0x30, 0xc8]!) fn test_const_from_bytes() { println(codec_test_uuid) diff --git a/vlib/v/tests/fn_call_mut_array_of_aliases_args_test.v b/vlib/v/tests/fn_call_mut_array_of_aliases_args_test.v index 348934aae083a4..1ba82a798b3470 100644 --- a/vlib/v/tests/fn_call_mut_array_of_aliases_args_test.v +++ b/vlib/v/tests/fn_call_mut_array_of_aliases_args_test.v @@ -1,8 +1,8 @@ -fn f1(mut b []byte) string { +fn f1(mut b []u8) string { return '${b}' } -fn f2(b []byte) string { +fn f2(b []u8) string { return '${b}' } diff --git a/vlib/v/tests/fn_with_array_of_aliases_argument_test.v b/vlib/v/tests/fn_with_array_of_aliases_argument_test.v index 8a6479724872cc..f08fb2ffbc2984 100644 --- a/vlib/v/tests/fn_with_array_of_aliases_argument_test.v +++ b/vlib/v/tests/fn_with_array_of_aliases_argument_test.v @@ -11,7 +11,7 @@ fn (f Foo) show_array_of_u8(data []u8) string { } fn test_fn_with_array_of_aliases_argument() { - a := [byte(1), 2, 3] + a := [u8(1), 2, 3] s1 := show_array_of_u8(a) println(s1) diff --git a/vlib/v/tests/typeof_simple_types_test.v b/vlib/v/tests/typeof_simple_types_test.v index 67cb93fc48c1a6..850e09bfffcad4 100644 --- a/vlib/v/tests/typeof_simple_types_test.v +++ b/vlib/v/tests/typeof_simple_types_test.v @@ -27,7 +27,6 @@ fn test_typeof_for_builtin_int_types() { assert typeof(u32(1)).name == 'u32' assert typeof(u64(1)).name == 'u64' // - assert typeof(byte(1)).name == 'byte' assert typeof(char(1)).name == 'char' } diff --git a/vlib/x/json2/encoder.v b/vlib/x/json2/encoder.v index a32f1dde0c6a16..48363bcf6c27f9 100644 --- a/vlib/x/json2/encoder.v +++ b/vlib/x/json2/encoder.v @@ -429,8 +429,6 @@ fn (e &Encoder) encode_array[U](val []U, level int, mut wr io.Writer) ! { e.encode_any(i64(val[i]), level + 1, mut wr)! } $else $if U is u8 { e.encode_any(u8(val[i]), level + 1, mut wr)! - } $else $if U is byte { - e.encode_any(u8(val[i]), level + 1, mut wr)! } $else $if U is u16 { e.encode_any(u16(val[i]), level + 1, mut wr)! } $else $if U is u32 { diff --git a/vlib/x/json2/json_module_compatibility_test/json_test.v b/vlib/x/json2/json_module_compatibility_test/json_test.v index 57c3f60ace6b62..e9c00920cfd5d3 100644 --- a/vlib/x/json2/json_module_compatibility_test/json_test.v +++ b/vlib/x/json2/json_module_compatibility_test/json_test.v @@ -176,11 +176,11 @@ fn test_encode_alias_struct() { } struct StByteArray { - ba []byte + ba []u8 } fn test_byte_array() { - assert json.encode(StByteArray{ ba: [byte(1), 2, 3, 4, 5] }) == '{"ba":[1,2,3,4,5]}' + assert json.encode(StByteArray{ ba: [u8(1), 2, 3, 4, 5] }) == '{"ba":[1,2,3,4,5]}' } struct Bar {