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

parser: deprecate size_t (#11443)

This commit is contained in:
Enzo
2021-09-08 12:09:32 +02:00
committed by GitHub
parent 892971024e
commit e3b65092d6
31 changed files with 160 additions and 152 deletions

View File

@@ -13,7 +13,7 @@ struct C.dirent {
fn C.readdir(voidptr) &C.dirent
fn C.readlink(pathname &char, buf &char, bufsiz size_t) int
fn C.readlink(pathname &char, buf &char, bufsiz usize) int
fn C.getline(voidptr, voidptr, voidptr) int
@@ -531,7 +531,7 @@ pub fn get_raw_line() string {
return buf.vstring_with_len(offset)
}
} $else {
max := size_t(0)
max := usize(0)
buf := &char(0)
nr_chars := unsafe { C.getline(&buf, &max, C.stdin) }
return unsafe { tos(&byte(buf), if nr_chars < 0 { 0 } else { nr_chars }) }
@@ -567,7 +567,7 @@ pub fn get_raw_stdin() []byte {
}
}
} $else {
max := size_t(0)
max := usize(0)
buf := &char(0)
nr_chars := unsafe { C.getline(&buf, &max, C.stdin) }
return array{
@@ -996,7 +996,7 @@ pub fn is_atty(fd int) int {
// write_file_array writes the data in `buffer` to a file in `path`.
pub fn write_file_array(path string, buffer array) ? {
mut f := create(path) ?
unsafe { f.write_full_buffer(buffer.data, size_t(buffer.len * buffer.element_size)) ? }
unsafe { f.write_full_buffer(buffer.data, usize(buffer.len * buffer.element_size)) ? }
f.close()
}