mirror of
https://github.com/ziglang/zig.git
synced 2025-12-23 14:43:17 +00:00
don't forget to advance in the deprecated adapter
This commit is contained in:
parent
6038192fad
commit
4fcb479de9
@ -334,10 +334,12 @@ pub fn GenericReader(
|
|||||||
fn stream(r: *Reader, w: *Writer, limit: Limit) Reader.StreamError!usize {
|
fn stream(r: *Reader, w: *Writer, limit: Limit) Reader.StreamError!usize {
|
||||||
const a: *@This() = @alignCast(@fieldParentPtr("new_interface", r));
|
const a: *@This() = @alignCast(@fieldParentPtr("new_interface", r));
|
||||||
const buf = limit.slice(try w.writableSliceGreedy(1));
|
const buf = limit.slice(try w.writableSliceGreedy(1));
|
||||||
return a.derp_reader.read(buf) catch |err| {
|
const n = a.derp_reader.read(buf) catch |err| {
|
||||||
a.err = err;
|
a.err = err;
|
||||||
return error.ReadFailed;
|
return error.ReadFailed;
|
||||||
};
|
};
|
||||||
|
w.advance(n);
|
||||||
|
return n;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@ -393,10 +393,12 @@ pub const Adapter = struct {
|
|||||||
fn stream(r: *std.io.Reader, w: *std.io.Writer, limit: std.io.Limit) std.io.Reader.StreamError!usize {
|
fn stream(r: *std.io.Reader, w: *std.io.Writer, limit: std.io.Limit) std.io.Reader.StreamError!usize {
|
||||||
const a: *@This() = @alignCast(@fieldParentPtr("new_interface", r));
|
const a: *@This() = @alignCast(@fieldParentPtr("new_interface", r));
|
||||||
const buf = limit.slice(try w.writableSliceGreedy(1));
|
const buf = limit.slice(try w.writableSliceGreedy(1));
|
||||||
return a.derp_reader.read(buf) catch |err| {
|
const n = a.derp_reader.read(buf) catch |err| {
|
||||||
a.err = err;
|
a.err = err;
|
||||||
return error.ReadFailed;
|
return error.ReadFailed;
|
||||||
};
|
};
|
||||||
|
w.advance(n);
|
||||||
|
return n;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user