mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
head: saturate to max int size on 32 bit platforms
This commit is contained in:
parent
cc1112660a
commit
37eee0e1e6
1 changed files with 1 additions and 7 deletions
|
@ -282,13 +282,7 @@ fn read_n_lines(input: &mut impl io::BufRead, n: u64, separator: u8) -> io::Resu
|
||||||
}
|
}
|
||||||
|
|
||||||
fn catch_too_large_numbers_in_backwards_bytes_or_lines(n: u64) -> Option<usize> {
|
fn catch_too_large_numbers_in_backwards_bytes_or_lines(n: u64) -> Option<usize> {
|
||||||
match usize::try_from(n) {
|
usize::try_from(n).ok()
|
||||||
Ok(value) => Some(value),
|
|
||||||
Err(e) => {
|
|
||||||
show!(HeadError::NumTooLarge(e));
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn read_but_last_n_bytes(mut input: impl Read, n: u64) -> io::Result<u64> {
|
fn read_but_last_n_bytes(mut input: impl Read, n: u64) -> io::Result<u64> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue