Skip to content

Commit ad86f09

Browse files
author
Cynede
committed
Merge pull request uutils#466 from Arcterus/master
base64: fix build (assuming rust-lang/rust#19594 is merged)
2 parents a980397 + 7a596d0 commit ad86f09

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/base64/base64.rs

+2-9
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ fn decode(input: &mut Reader, ignore_garbage: bool) {
115115
num == '+' as u8 || num == '/' as u8)
116116
})
117117
} else {
118-
to_decode = to_decode.as_slice().replace("\n", "");
119118
to_decode.as_slice()
120119
};
121120

@@ -142,6 +141,7 @@ fn decode(input: &mut Reader, ignore_garbage: bool) {
142141
fn encode(input: &mut Reader, line_wrap: uint) {
143142
let b64_conf = base64::Config {
144143
char_set: base64::Standard,
144+
newline: base64::Newline::LF,
145145
pad: true,
146146
line_length: match line_wrap {
147147
0 => None,
@@ -154,14 +154,7 @@ fn encode(input: &mut Reader, line_wrap: uint) {
154154
};
155155
let encoded = to_encode.as_slice().to_base64(b64_conf);
156156

157-
// To my knowledge, RFC 3548 does not specify which line endings to use. It
158-
// seems that rust's base64 algorithm uses CRLF as prescribed by RFC 2045.
159-
// However, since GNU base64 outputs only LF (presumably because that is
160-
// the standard UNIX line ending), we strip CRs from the output to maintain
161-
// compatibility.
162-
let output = encoded.replace("\r", "");
163-
164-
println(output.as_slice());
157+
println(encoded.as_slice());
165158
}
166159

167160
fn help(progname: &str, usage: &str) {

0 commit comments

Comments
 (0)