Mercurial > touhou
diff src/th06/anm0.rs @ 755:fc937d93a57c
Bump nom to version 6, and image to 0.23.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Mon, 04 Jan 2021 21:14:02 +0100 |
parents | 258f4aebf3fc |
children |
line wrap: on
line diff
--- a/src/th06/anm0.rs +++ b/src/th06/anm0.rs @@ -88,7 +88,7 @@ fn parse_name(i: &[u8]) -> IResult<&[u8] let string = match String::from_utf8(slice.to_vec()) { Ok(string) => string, // XXX: use a more specific error instead. - Err(_) => return Err(nom::Err::Failure((i, nom::error::ErrorKind::Eof))) + Err(_) => return Err(nom::Err::Failure(nom::error::Error::new(i, nom::error::ErrorKind::Eof))) }; Ok((i, string)) } @@ -127,7 +127,7 @@ macro_rules! declare_anm_instructions { } )* // XXX: use a more specific error instead. - _ => return Err(nom::Err::Failure((i, nom::error::ErrorKind::Eof))) + _ => return Err(nom::Err::Failure(nom::error::Error::new(i, nom::error::ErrorKind::Eof))) }; Ok((i, instr)) } @@ -185,7 +185,7 @@ fn parse_anm0(input: &[u8]) -> IResult<& let png_filename = if first_name_offset > 0 { if input.len() < first_name_offset as usize { - return Err(nom::Err::Failure((input, nom::error::ErrorKind::Eof))); + return Err(nom::Err::Failure(nom::error::Error::new(input, nom::error::ErrorKind::Eof))); } let i = &input[first_name_offset as usize..]; let (_, name) = parse_name(i)?; @@ -196,7 +196,7 @@ fn parse_anm0(input: &[u8]) -> IResult<& let alpha_filename = if second_name_offset > 0 { if input.len() < second_name_offset as usize { - return Err(nom::Err::Failure((input, nom::error::ErrorKind::Eof))); + return Err(nom::Err::Failure(nom::error::Error::new(input, nom::error::ErrorKind::Eof))); } let i = &input[second_name_offset as usize..]; let (_, name) = parse_name(i)?; @@ -209,7 +209,7 @@ fn parse_anm0(input: &[u8]) -> IResult<& let mut i = &input[..]; for offset in sprite_offsets.into_iter().map(|x| x as usize) { if input.len() < offset { - return Err(nom::Err::Failure((input, nom::error::ErrorKind::Eof))); + return Err(nom::Err::Failure(nom::error::Error::new(input, nom::error::ErrorKind::Eof))); } i = &input[offset..]; let (_, sprite) = parse_sprite(i)?; @@ -219,7 +219,7 @@ fn parse_anm0(input: &[u8]) -> IResult<& let mut scripts = HashMap::new(); for (index, offset) in script_offsets.into_iter().map(|(index, offset)| (index as u8, offset as usize)) { if input.len() < offset { - return Err(nom::Err::Failure((input, nom::error::ErrorKind::Eof))); + return Err(nom::Err::Failure(nom::error::Error::new(input, nom::error::ErrorKind::Eof))); } i = &input[offset..]; let mut instruction_offsets = vec![]; @@ -247,7 +247,7 @@ fn parse_anm0(input: &[u8]) -> IResult<& Ok(ptr) => *offset = ptr as u32, Err(ptr) => { // XXX: use a more specific error instead. - return Err(nom::Err::Failure((input, nom::error::ErrorKind::Eof))); + return Err(nom::Err::Failure(nom::error::Error::new(input, nom::error::ErrorKind::Eof))); //println!("Instruction offset not found for pointer: {}", ptr); } }