Skip to content

Commit 19cc352

Browse files
committed
core: io: the read_until function checks bytes not chars, so type should reflect that.
1 parent d29ef7a commit 19cc352

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/libcore/io.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ pub trait ReaderUtil {
176176
fn read_bytes(&self, len: uint) -> ~[u8];
177177

178178
/**
179-
* Reads up until a specific character or EOF.
179+
* Reads up until a specific byte is seen or EOF.
180180
*
181181
* The `include` parameter specifies if the character should be included
182182
* in the returned string.
@@ -185,7 +185,7 @@ pub trait ReaderUtil {
185185
*
186186
* None right now.
187187
*/
188-
fn read_until(&self, c: char, include: bool) -> ~str;
188+
fn read_until(&self, c: u8, include: bool) -> ~str;
189189

190190
/**
191191
* Reads up until the first '\n' or EOF.
@@ -577,7 +577,7 @@ impl<T:Reader> ReaderUtil for T {
577577
bytes
578578
}
579579

580-
fn read_until(&self, c: char, include: bool) -> ~str {
580+
fn read_until(&self, c: u8, include: bool) -> ~str {
581581
let mut bytes = ~[];
582582
loop {
583583
let ch = self.read_byte();
@@ -593,7 +593,7 @@ impl<T:Reader> ReaderUtil for T {
593593
}
594594

595595
fn read_line(&self) -> ~str {
596-
self.read_until('\n', false)
596+
self.read_until('\n' as u8, false)
597597
}
598598

599599
fn read_chars(&self, n: uint) -> ~[char] {
@@ -667,7 +667,7 @@ impl<T:Reader> ReaderUtil for T {
667667
}
668668

669669
fn read_c_str(&self) -> ~str {
670-
self.read_until(0 as char, false)
670+
self.read_until(0u8, false)
671671
}
672672

673673
fn read_whole_stream(&self) -> ~[u8] {
@@ -693,7 +693,7 @@ impl<T:Reader> ReaderUtil for T {
693693
// include the \n, so that we can distinguish an entirely empty
694694
// line read after "...\n", and the trailing empty line in
695695
// "...\n\n".
696-
let mut line = self.read_until('\n', true);
696+
let mut line = self.read_until('\n' as u8, true);
697697

698698
// blank line at the end of the reader is ignored
699699
if self.eof() && line.is_empty() { break; }

0 commit comments

Comments
 (0)