Skip to content

Commit

Permalink
Fix undeclared identifier error in readUntilDelimiterBuffer and incor…
Browse files Browse the repository at this point in the history
…rect number of parameters in readUntilDelimiterAlloc (#877)
  • Loading branch information
raulgrell authored and andrewrk committed Mar 31, 2018
1 parent 51a6ff1 commit eb6ff79
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions std/io.zig
Expand Up @@ -144,7 +144,7 @@ pub fn InStream(comptime ReadError: type) type {
/// If `buffer.len()` would exceed `max_size`, `error.StreamTooLong` is returned and the contents
/// read from the stream so far are lost.
pub fn readUntilDelimiterBuffer(self: &Self, buffer: &Buffer, delimiter: u8, max_size: usize) !void {
try buf.resize(0);
try buffer.resize(0);

while (true) {
var byte: u8 = try self.readByte();
Expand All @@ -153,11 +153,11 @@ pub fn InStream(comptime ReadError: type) type {
return;
}

if (buf.len() == max_size) {
if (buffer.len() == max_size) {
return error.StreamTooLong;
}

try buf.appendByte(byte);
try buffer.appendByte(byte);
}
}

Expand All @@ -171,7 +171,7 @@ pub fn InStream(comptime ReadError: type) type {
var buf = Buffer.initNull(allocator);
defer buf.deinit();

try self.readUntilDelimiterBuffer(self, &buf, delimiter, max_size);
try self.readUntilDelimiterBuffer(&buf, delimiter, max_size);
return buf.toOwnedSlice();
}

Expand Down

0 comments on commit eb6ff79

Please sign in to comment.