Skip to content

Commit

Permalink
Ref: #2 Improve error message for API parse_exif()
Browse files Browse the repository at this point in the history
  • Loading branch information
mindeng committed Feb 23, 2024
1 parent 6adbaa3 commit 7901045
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "nom-exif"
version = "1.0.0"
version = "1.0.1"
edition = "2021"
license-file = "LICENSE"
description = "Exif/metadata parsing library written in pure Rust, both JPEG/HEIF/HEIC images and MOV/MP4 videos are supported."
Expand Down
4 changes: 3 additions & 1 deletion src/exif/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ pub fn parse_exif<'a>(input: &'a [u8]) -> crate::Result<Exif> {
};

// parse ifd0
let (_, ifd0) = parser.parse_ifd(input.len() - remain.len())?;
let (_, ifd0) = parser
.parse_ifd(input.len() - remain.len())
.map_err(|e| format!("Parse exif failed; {e}"))?;

let exif = Exif {
header,
Expand Down
1 change: 1 addition & 0 deletions src/jpeg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ fn parse_segment<'a>(marker_code: u8, input: &'a [u8]) -> IResult<&'a [u8], Segm
///
/// The returned data might include several other SOS markers if the image is a
/// progressive JPEG.
#[allow(dead_code)]
fn read_image_data<T: Read + Seek>(mut reader: T) -> crate::Result<Vec<u8>> {
let mut header = [0u8; 2];
loop {
Expand Down

0 comments on commit 7901045

Please sign in to comment.