authorgravatar for ed.dean515@gmail.comEdward Dean <ed.dean515@gmail.com> 2021-04-04 10:34:34+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-04-04 17:04:46-07:00
log83a2665772578f6262afc858613023738a7d25ef
tree73fa61dcd465d7d4f61f50881d2241f398a4f665
parent7302b096bd6e4274080eab051f6f3e1ab49213b9

Fixed error types for GetSeekPosError


2 files changed, 5 insertions(+), 6 deletions(-)

lib/std/fs/file.zig+4-4
...@@ -223,15 +223,15 @@ pub const File = struct {...@@ -223,15 +223,15 @@ pub const File = struct {
223 return os.lseek_SET(self.handle, offset);223 return os.lseek_SET(self.handle, offset);
224 }224 }
225225
226 pub const GetPosError = os.SeekError || os.FStatError;226 pub const GetSeekPosError = os.SeekError || os.FStatError;
227227
228 /// TODO: integrate with async I/O228 /// TODO: integrate with async I/O
229 pub fn getPos(self: File) GetPosError!u64 {229 pub fn getPos(self: File) GetSeekPosError!u64 {
230 return os.lseek_CUR_get(self.handle);230 return os.lseek_CUR_get(self.handle);
231 }231 }
232232
233 /// TODO: integrate with async I/O233 /// TODO: integrate with async I/O
234 pub fn getEndPos(self: File) GetPosError!u64 {234 pub fn getEndPos(self: File) GetSeekPosError!u64 {
235 if (builtin.os.tag == .windows) {235 if (builtin.os.tag == .windows) {
236 return windows.GetFileSizeEx(self.handle);236 return windows.GetFileSizeEx(self.handle);
237 }237 }
...@@ -819,7 +819,7 @@ pub const File = struct {...@@ -819,7 +819,7 @@ pub const File = struct {
819 pub const SeekableStream = io.SeekableStream(819 pub const SeekableStream = io.SeekableStream(
820 File,820 File,
821 SeekError,821 SeekError,
822 GetPosError,822 GetSeekPosError,
823 seekTo,823 seekTo,
824 seekBy,824 seekBy,
825 getPos,825 getPos,
lib/std/io/stream_source.zig+1-2
...@@ -5,7 +5,6 @@...@@ -5,7 +5,6 @@
5// and substantial portions of the software.5// and substantial portions of the software.
6const std = @import("../std.zig");6const std = @import("../std.zig");
7const io = std.io;7const io = std.io;
8const testing = std.testing;
98
10/// Provides `io.Reader`, `io.Writer`, and `io.SeekableStream` for in-memory buffers as9/// Provides `io.Reader`, `io.Writer`, and `io.SeekableStream` for in-memory buffers as
11/// well as files.10/// well as files.
...@@ -19,7 +18,7 @@ pub const StreamSource = union(enum) {...@@ -19,7 +18,7 @@ pub const StreamSource = union(enum) {
19 pub const ReadError = std.fs.File.ReadError;18 pub const ReadError = std.fs.File.ReadError;
20 pub const WriteError = std.fs.File.WriteError;19 pub const WriteError = std.fs.File.WriteError;
21 pub const SeekError = std.fs.File.SeekError;20 pub const SeekError = std.fs.File.SeekError;
22 pub const GetSeekPosError = std.fs.File.GetPosError;21 pub const GetSeekPosError = std.fs.File.GetSeekPosError;
2322
24 pub const Reader = io.Reader(*StreamSource, ReadError, read);23 pub const Reader = io.Reader(*StreamSource, ReadError, read);
25 pub const Writer = io.Writer(*StreamSource, WriteError, write);24 pub const Writer = io.Writer(*StreamSource, WriteError, write);