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

array: make left/right/slice private

This commit is contained in:
Alexander Medvednikov
2019-11-30 12:37:34 +03:00
parent b38283dcf1
commit 7e4799334f
5 changed files with 12 additions and 12 deletions

View File

@ -80,7 +80,7 @@ pub fn (f File) read_bytes_at(size, pos int) []byte {
C.fseek(f.cfile, pos, C.SEEK_SET)
nreadbytes := C.fread(arr.data, 1, size, f.cfile)
C.fseek(f.cfile, 0, C.SEEK_SET)
return arr.slice(0, nreadbytes)
return arr[0..nreadbytes]
}
pub fn read_bytes(path string) ?[]byte {
@ -95,7 +95,7 @@ pub fn read_bytes(path string) ?[]byte {
mut res := [`0`].repeat(fsize)
nreadbytes := C.fread(res.data, fsize, 1, fp)
C.fclose(fp)
return res.slice(0, nreadbytes )
return res[0..nreadbytes]
}
// read_file reads the file in `path` and returns the contents.