Skip to content

Commit

Permalink
Deal with CRC-32 for the top level elements
Browse files Browse the repository at this point in the history
Partially address #10, the crc is not validated as should yet.
  • Loading branch information
lu-zero committed Oct 4, 2018
1 parent a7d9446 commit bf1bb2a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/elements.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,16 @@ macro_rules! sub_element(
($i:expr, $parser:ident) => ({
do_parse!($i,
size: vint
>> element: flat_map!(take!(size as usize), $parser)
>> crc: opt!(ebml_binary!(0xBF))
>> element: flat_map!(take!((size - if crc.is_some() { 6 } else { 0 }) as usize), $parser)
>> (element)
)
});
($i:expr, $submac:ident!( $($args:tt)* )) => ({
do_parse!($i,
size: vint
>> element: flat_map!(take!(size as usize), $submac!($($args)*))
>> crc: opt!(ebml_binary!(0xBF))
>> element: flat_map!(take!((size - if crc.is_some() { 6 } else { 0 }) as usize), $submac!($($args)*))
>> (element)
)
});
Expand Down

0 comments on commit bf1bb2a

Please sign in to comment.