Skip to content
Snippets Groups Projects
Commit 5a9bdd36 authored by Matthew Hall's avatar Matthew Hall
Browse files

Update to a new version of base64

Fixes #41
parent 4fc60693
No related branches found
No related tags found
No related merge requests found
...@@ -20,6 +20,6 @@ name = "example" ...@@ -20,6 +20,6 @@ name = "example"
path = "examples/main.rs" path = "examples/main.rs"
[dependencies] [dependencies]
base64 = "0.1.1" base64 = "0.5.2"
xml-rs = "0.3.0" xml-rs = "0.3.0"
flate2 = "1.0.1" flate2 = "1.0.1"
...@@ -11,7 +11,6 @@ use std::fmt; ...@@ -11,7 +11,6 @@ use std::fmt;
use xml::reader::{EventReader, Error as XmlError}; use xml::reader::{EventReader, Error as XmlError};
use xml::reader::XmlEvent; use xml::reader::XmlEvent;
use xml::attribute::OwnedAttribute; use xml::attribute::OwnedAttribute;
use base64::{u8de as decode_base64, Base64Error};
use flate2::read::{ZlibDecoder, GzDecoder}; use flate2::read::{ZlibDecoder, GzDecoder};
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
...@@ -114,7 +113,7 @@ pub enum TiledError { ...@@ -114,7 +113,7 @@ pub enum TiledError {
/// An error occured when decompressing using the /// An error occured when decompressing using the
/// [flate2](https://github.com/alexcrichton/flate2-rs) crate. /// [flate2](https://github.com/alexcrichton/flate2-rs) crate.
DecompressingError(Error), DecompressingError(Error),
Base64DecodingError(Base64Error), Base64DecodingError(base64::DecodeError),
XmlDecodingError(XmlError), XmlDecodingError(XmlError),
PrematureEnd(String), PrematureEnd(String),
Other(String) Other(String)
...@@ -829,7 +828,7 @@ fn parse_data<R: Read>(parser: &mut EventReader<R>, attrs: Vec<OwnedAttribute>, ...@@ -829,7 +828,7 @@ fn parse_data<R: Read>(parser: &mut EventReader<R>, attrs: Vec<OwnedAttribute>,
fn parse_base64<R: Read>(parser: &mut EventReader<R>) -> Result<Vec<u8>, TiledError> { fn parse_base64<R: Read>(parser: &mut EventReader<R>) -> Result<Vec<u8>, TiledError> {
loop { loop {
match try!(parser.next().map_err(TiledError::XmlDecodingError)) { match try!(parser.next().map_err(TiledError::XmlDecodingError)) {
XmlEvent::Characters(s) => return decode_base64(s.trim().as_bytes()) XmlEvent::Characters(s) => return base64::decode(s.trim().as_bytes())
.map_err(TiledError::Base64DecodingError), .map_err(TiledError::Base64DecodingError),
XmlEvent::EndElement {name, ..} => { XmlEvent::EndElement {name, ..} => {
if name.local_name == "data" { if name.local_name == "data" {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment