mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
Update base64 to latest rust
This commit is contained in:
parent
6ba4a81d5c
commit
8705d95ae9
1 changed files with 4 additions and 4 deletions
|
@ -93,10 +93,10 @@ fn main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn decode(input: &mut Reader, ignore_garbage: bool) {
|
fn decode(input: &mut Reader, ignore_garbage: bool) {
|
||||||
let mut to_decode = str::from_utf8_owned(match input.read_to_end() {
|
let mut to_decode = match input.read_to_str() {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(f) => fail!(f.to_str())
|
Err(f) => fail!(f.to_str())
|
||||||
}).unwrap();
|
};
|
||||||
|
|
||||||
to_decode = str::replace(to_decode, "\n", "");
|
to_decode = str::replace(to_decode, "\n", "");
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ fn decode(input: &mut Reader, ignore_garbage: bool) {
|
||||||
"0123456789+/").iter().map(|b| char::from_u32(*b as u32).unwrap()).collect();
|
"0123456789+/").iter().map(|b| char::from_u32(*b as u32).unwrap()).collect();
|
||||||
|
|
||||||
to_decode = to_decode
|
to_decode = to_decode
|
||||||
.trim_chars(&|c| !standard_chars.contains(&c))
|
.trim_chars(|c| !standard_chars.contains(&c))
|
||||||
.to_owned();
|
.to_owned();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ fn encode(input: &mut Reader, line_wrap: uint) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(f) => fail!(f.to_str())
|
Err(f) => fail!(f.to_str())
|
||||||
};
|
};
|
||||||
let mut encoded = to_encode.to_base64(b64_conf);
|
let mut encoded = to_encode.as_slice().to_base64(b64_conf);
|
||||||
|
|
||||||
// To my knowledge, RFC 3548 does not specify which line endings to use. It
|
// To my knowledge, RFC 3548 does not specify which line endings to use. It
|
||||||
// seems that rust's base64 algorithm uses CRLF as prescribed by RFC 2045.
|
// seems that rust's base64 algorithm uses CRLF as prescribed by RFC 2045.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue