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

all: byte => u8

This commit is contained in:
Alexander Medvednikov
2022-04-15 14:45:52 +03:00
parent 7f3b91e688
commit 014c3c97f0
38 changed files with 201 additions and 201 deletions

View File

@ -22,7 +22,7 @@ pub fn fd_write(fd int, s string) {
return
}
remaining = remaining - written
sp = unsafe { sp + written }
sp = unsafe { voidptr(sp + written)}
}
}

View File

@ -281,7 +281,7 @@ pub fn (mut f File) write_full_buffer(buffer voidptr, buffer_len usize) ? {
if !f.is_opened {
return error_file_not_opened()
}
mut ptr := &byte(buffer)
mut ptr := &u8(buffer)
mut remaining_bytes := i64(buffer_len)
for remaining_bytes > 0 {
unsafe {
@ -390,12 +390,12 @@ pub fn (f &File) read_bytes_into_newline(mut buf []byte) ?int {
}
}
newline {
buf[buf_ptr] = byte(c)
buf[buf_ptr] = u8(c)
nbytes++
return nbytes
}
else {
buf[buf_ptr] = byte(c)
buf[buf_ptr] = u8(c)
buf_ptr++
nbytes++
}

View File

@ -230,7 +230,7 @@ pub fn cp(src string, dst string) ? {
}
// TODO use defer{} to close files in case of error or return.
// Currently there is a C-Error when building.
mut buf := [1024]byte{}
mut buf := [1024]u8{}
mut count := 0
for {
count = C.read(fp_from, &buf[0], sizeof(buf))

View File

@ -242,7 +242,7 @@ pub fn loginname() string {
return ''
}
fn init_os_args(argc int, argv &&byte) []string {
fn init_os_args(argc int, argv &&u8) []string {
mut args_ := []string{len: argc}
for i in 0 .. argc {
args_[i] = unsafe { tos_clone(argv[i]) }
@ -267,7 +267,7 @@ pub fn ls(path string) ?[]string {
break
}
unsafe {
bptr := &byte(&ent.d_name[0])
bptr := &u8(&ent.d_name[0])
if bptr[0] == 0 || (bptr[0] == `.` && bptr[1] == 0)
|| (bptr[0] == `.` && bptr[1] == `.` && bptr[2] == 0) {
continue
@ -348,7 +348,7 @@ pub fn execute(cmd string) Result {
defer {
unsafe { res.free() }
}
buf := [4096]byte{}
buf := [4096]u8{}
unsafe {
pbuf := &buf[0]
for {
@ -381,7 +381,7 @@ pub fn (mut c Command) start() ? {
[manualfree]
pub fn (mut c Command) read_line() string {
buf := [4096]byte{}
buf := [4096]u8{}
mut res := strings.new_builder(1024)
defer {
unsafe { res.free() }
@ -462,7 +462,7 @@ pub fn debugger_present() bool {
return false
}
fn C.mkstemp(stemplate &byte) int
fn C.mkstemp(stemplate &u8) int
// `is_writable_folder` - `folder` exists and is writable to the process
[manualfree]