From e26e0c3f72cd72d898b692d93ae5ee79fb65ad71 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Sat, 26 Dec 2020 14:57:51 +0200 Subject: [PATCH] os: restore some of the deprecated os.File methods --- vlib/os/file.c.v | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/vlib/os/file.c.v b/vlib/os/file.c.v index 5691ac644e..7aae4235bd 100644 --- a/vlib/os/file.c.v +++ b/vlib/os/file.c.v @@ -85,15 +85,11 @@ pub fn (mut f File) write_to(pos int, buf []byte) ?int { return res } -[deprecated] pub fn (mut f File) write_bytes(data voidptr, size int) int { - eprintln('warning `File.write_bytes()` has been deprecated, use `File.write` instead') return C.fwrite(data, 1, size, f.cfile) } -[deprecated] pub fn (mut f File) write_bytes_at(data voidptr, size int, pos int) int { - eprintln('warning `File.write_bytes_at()` has been deprecated, use `File.write_at` instead') C.fseek(f.cfile, pos, C.SEEK_SET) res := C.fwrite(data, 1, size, f.cfile) C.fseek(f.cfile, 0, C.SEEK_END) @@ -102,16 +98,12 @@ pub fn (mut f File) write_bytes_at(data voidptr, size int, pos int) int { // **************************** Read ops *************************** // read_bytes reads bytes from the beginning of the file -[deprecated] pub fn (f &File) read_bytes(size int) []byte { - eprintln('warning `File.read_bytes()` has been deprecated, use `File.read` instead') return f.read_bytes_at(size, 0) } // read_bytes_at reads bytes at the given position in the file -[deprecated] pub fn (f &File) read_bytes_at(size int, pos int) []byte { - eprintln('warning `File.read_bytes_at()` has been deprecated, use `File.read_at` instead') mut arr := []byte{len: size} nreadbytes := f.read_bytes_into(pos, mut arr) or { // return err @@ -120,12 +112,10 @@ pub fn (f &File) read_bytes_at(size int, pos int) []byte { return arr[0..nreadbytes] } -// read_bytes_from fills `buf` with bytes at the given position in the file. +// read_bytes_into fills `buf` with bytes at the given position in the file. // `buf` must have length greater than zero. // Returns number of bytes read or an error. -[deprecated] pub fn (f &File) read_bytes_into(pos int, mut buf []byte) ?int { - eprintln('warning `File.read_bytes_into()` has been deprecated, use `File.read_from_into` instead') if buf.len == 0 { panic(@FN + ': `buf.len` == 0') }