Skip to content

Commit

Permalink
Bump base64 to 0.21
Browse files Browse the repository at this point in the history
  • Loading branch information
matze authored Feb 17, 2023
1 parent 7bb3c55 commit aa38213
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ default = ["serde"]
enable_unstable_features_that_may_break_with_minor_version_bumps = []

[dependencies]
base64 = "0.13.0"
base64 = "0.21.0"
time = { version = "0.3.3", features = ["parsing", "formatting"] }
indexmap = "1.0.2"
line-wrap = "0.1.1"
Expand Down
4 changes: 3 additions & 1 deletion src/stream/xml_reader.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use base64::{engine::general_purpose::STANDARD as base64_standard, Engine};
use quick_xml::{events::Event as XmlEvent, Error as XmlReaderError, Reader as EventReader};
use std::io::{self, BufReader, Read};

Expand Down Expand Up @@ -138,7 +139,8 @@ impl<R: Read> ReaderState<R> {
let mut encoded = self.read_content(buffer)?;
// Strip whitespace and line endings from input string
encoded.retain(|c| !c.is_ascii_whitespace());
let data = base64::decode(&encoded)
let data = base64_standard
.decode(&encoded)
.map_err(|_| self.with_pos(ErrorKind::InvalidDataString))?;
return Ok(Some(Event::Data(data.into())));
}
Expand Down
6 changes: 4 additions & 2 deletions src/stream/xml_writer.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use base64::{engine::general_purpose::STANDARD as base64_standard, Engine};
use quick_xml::{
events::{BytesEnd, BytesStart, BytesText, Event as XmlEvent},
Error as XmlWriterError, Writer as EventWriter,
Expand Down Expand Up @@ -307,8 +308,9 @@ fn base64_encode_plist(data: &[u8], indent: usize) -> String {
output[..line_ending.len()].copy_from_slice(&line_ending);

// Encode `data` as a base 64 string
let base64_string_len =
base64::encode_config_slice(data, base64::STANDARD, &mut output[line_ending.len()..]);
let base64_string_len = base64_standard
.encode_slice(data, &mut output[line_ending.len()..])
.expect("encoding slice fits base64 buffer");

// Line wrap the base 64 encoded string
let line_wrap_len = line_wrap::line_wrap(
Expand Down

0 comments on commit aa38213

Please sign in to comment.