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

os: tag some File methods that take voidptr as unsafe - write_bytes, write_bytes_at (#8985)

This commit is contained in:
Nick Treleaven
2021-02-27 08:11:17 +00:00
committed by GitHub
parent 0b3f209965
commit aed348fb80
4 changed files with 5 additions and 3 deletions

View File

@@ -79,10 +79,12 @@ pub fn (mut f File) write_to(pos int, buf []byte) ?int {
return res
}
[unsafe]
pub fn (mut f File) write_bytes(data voidptr, size int) int {
return int(C.fwrite(data, 1, size, f.cfile))
}
[unsafe]
pub fn (mut f File) write_bytes_at(data voidptr, size int, pos int) int {
C.fseek(f.cfile, pos, C.SEEK_SET)
res := int(C.fwrite(data, 1, size, f.cfile))