From 0ec05856dab205db2a874dc45340f8b522bd7634 Mon Sep 17 00:00:00 2001 From: Edward Barnard Date: Fri, 25 Dec 2015 20:45:06 +0000 Subject: Kill StartPlist and EndPlist --- src/binary/reader.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/binary') diff --git a/src/binary/reader.rs b/src/binary/reader.rs index 128c573..2463be2 100644 --- a/src/binary/reader.rs +++ b/src/binary/reader.rs @@ -144,7 +144,6 @@ impl EventReader { if self.ref_size == 0 { // Initialise here rather than in new try!(self.read_trailer()); - return Ok(Some(PlistEvent::StartPlist)); } let object_ref = match self.stack.last_mut() { @@ -163,7 +162,8 @@ impl EventReader { match item.ty { StackType::Array => return Ok(Some(PlistEvent::EndArray)), StackType::Dict => return Ok(Some(PlistEvent::EndDictionary)), - StackType::Root => return Ok(Some(PlistEvent::EndPlist)), + // We're at the end of the plist + StackType::Root => return Ok(None), } } } @@ -317,8 +317,7 @@ mod tests { let streaming_parser = EventReader::new(reader); let events: Vec = streaming_parser.map(|e| e.unwrap()).collect(); - let comparison = &[StartPlist, - StartDictionary(Some(6)), + let comparison = &[StartDictionary(Some(6)), StringValue("Lines".to_owned()), StartArray(Some(2)), StringValue("It is a tale told by an idiot,".to_owned()), @@ -334,8 +333,7 @@ mod tests { StringValue("William Shakespeare".to_owned()), StringValue("Data".to_owned()), DataValue(vec![0, 0, 0, 190, 0, 0, 0, 3, 0, 0, 0, 30, 0, 0, 0]), - EndDictionary, - EndPlist]; + EndDictionary]; assert_eq!(events, comparison); } @@ -347,6 +345,6 @@ mod tests { let reader = File::open(&Path::new("./tests/data/utf16_bplist.plist")).unwrap(); let streaming_parser = EventReader::new(reader); let events: Vec = streaming_parser.map(|e| e.unwrap()).collect(); - assert_eq!(events[39], StringValue("\u{2605} or better".to_owned())); + assert_eq!(events[38], StringValue("\u{2605} or better".to_owned())); } } -- cgit v1.2.3