mirror of
https://github.com/ziglang/zig.git
synced 2026-02-17 14:59:14 +00:00
std.fs.File.Reader: fix freestanding build failures
This should be enough to unblock people for now. We'll revisit the way these things are organized with the upcoming std.Io interface. fixes #24685
This commit is contained in:
parent
47e6528762
commit
e395c24c6d
@ -1214,6 +1214,10 @@ pub const Reader = struct {
|
||||
return err;
|
||||
}
|
||||
}
|
||||
if (posix.Stat == void) {
|
||||
r.size_err = error.Streaming;
|
||||
return error.Streaming;
|
||||
}
|
||||
if (stat(r.file)) |st| {
|
||||
if (st.kind == .file) {
|
||||
r.size = st.size;
|
||||
@ -1236,6 +1240,10 @@ pub const Reader = struct {
|
||||
setPosAdjustingBuffer(r, @intCast(@as(i64, @intCast(r.pos)) + offset));
|
||||
},
|
||||
.streaming, .streaming_reading => {
|
||||
if (posix.SEEK == void) {
|
||||
r.seek_err = error.Unseekable;
|
||||
return error.Unseekable;
|
||||
}
|
||||
const seek_err = r.seek_err orelse e: {
|
||||
if (posix.lseek_CUR(r.file.handle, offset)) |_| {
|
||||
setPosAdjustingBuffer(r, @intCast(@as(i64, @intCast(r.pos)) + offset));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user