don't forget to advance in the deprecated adapter

This commit is contained in:
Andrew Kelley 2025-07-22 18:42:54 -07:00
parent 6038192fad
commit 4fcb479de9
2 changed files with 6 additions and 2 deletions

View File

@ -334,10 +334,12 @@ pub fn GenericReader(
fn stream(r: *Reader, w: *Writer, limit: Limit) Reader.StreamError!usize {
const a: *@This() = @alignCast(@fieldParentPtr("new_interface", r));
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;
return error.ReadFailed;
};
w.advance(n);
return n;
}
};
};

View File

@ -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 {
const a: *@This() = @alignCast(@fieldParentPtr("new_interface", r));
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;
return error.ReadFailed;
};
w.advance(n);
return n;
}
};