Skip to content

Commit

Permalink
Merge pull request #4 from xandkar/sk/disable-prints
Browse files Browse the repository at this point in the history
Disable surprise prints in library code, but leave them in test code
  • Loading branch information
mindeng authored Jul 10, 2024
2 parents 5c4220e + 5af1524 commit 9b7fdf7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 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.2.0"
version = "1.2.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
20 changes: 10 additions & 10 deletions src/bbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ mod tests {

let mut boxes = Vec::new();
let (remain, bbox) = travel_while(&meta.body_data()[4..], |bbox| {
println!("got {}", bbox.header.box_type);
// println!("got {}", bbox.header.box_type);
boxes.push(bbox.header.box_type.to_owned());
bbox.box_type() != "iloc"
})
Expand All @@ -362,7 +362,7 @@ mod tests {
let mut boxes = Vec::new();

let (remain, bbox) = travel_while(&buf, |bbox| {
println!("got {}", bbox.header.box_type);
// println!("got {}", bbox.header.box_type);
boxes.push((bbox.header.box_type.to_owned(), bbox.to_owned()));
bbox.box_type() != "moov"
})
Expand All @@ -381,7 +381,7 @@ mod tests {

let mut boxes = Vec::new();
let (remain, bbox) = travel_while(moov.body_data(), |bbox| {
println!("got {}", bbox.header.box_type);
// println!("got {}", bbox.header.box_type);
boxes.push(bbox.header.box_type.to_owned());
bbox.box_type() != "meta"
})
Expand All @@ -395,7 +395,7 @@ mod tests {
let meta = bbox;
let mut boxes = Vec::new();
let (remain, _) = travel_while(meta.body_data(), |bbox| {
println!("got {}", bbox.header.box_type);
// println!("got {}", bbox.header.box_type);
boxes.push(bbox.header.box_type.to_owned());
bbox.box_type() != "ilst"
})
Expand All @@ -414,7 +414,7 @@ mod tests {
let mut boxes = Vec::new();

let (remain, bbox) = travel_while(&buf, |bbox| {
println!("got {}", bbox.header.box_type);
// println!("got {}", bbox.header.box_type);
boxes.push((bbox.header.box_type.to_owned(), bbox.to_owned()));
bbox.box_type() != "moov"
})
Expand All @@ -433,7 +433,7 @@ mod tests {

let mut boxes = Vec::new();
let (remain, bbox) = travel_while(moov.body_data(), |bbox| {
println!("got {}", bbox.header.box_type);
// println!("got {}", bbox.header.box_type);
boxes.push((bbox.header.box_type.to_owned(), bbox.to_owned()));
bbox.box_type() != "udta"
})
Expand All @@ -452,7 +452,7 @@ mod tests {
let meta = bbox;
let mut boxes = Vec::new();
let (remain, _) = travel_while(meta.body_data(), |bbox| {
println!("got {}", bbox.header.box_type);
// println!("got {}", bbox.header.box_type);
boxes.push(bbox.header.box_type.to_owned());
bbox.box_type() != "©xyz"
})
Expand All @@ -464,7 +464,7 @@ mod tests {

let mut boxes = Vec::new();
let (remain, bbox) = travel_while(trak.body_data(), |bbox| {
println!("got {}", bbox.header.box_type);
// println!("got {}", bbox.header.box_type);
boxes.push(bbox.header.box_type.to_owned());
bbox.box_type() != "mdia"
})
Expand All @@ -477,7 +477,7 @@ mod tests {
let mdia = bbox;
let mut boxes = Vec::new();
let (remain, _) = travel_while(mdia.body_data(), |bbox| {
println!("got {}", bbox.header.box_type);
// println!("got {}", bbox.header.box_type);
boxes.push(bbox.header.box_type.to_owned());
bbox.box_type() != "minf"
})
Expand All @@ -504,7 +504,7 @@ mod tests {

let (_, bbox) = find_box(&buf, "moov/udta/©xyz").unwrap();
let bbox = bbox.unwrap();
println!("bbox: {:?}", bbox.header);
// println!("bbox: {:?}", bbox.header);

// gps info
assert_eq!(
Expand Down
2 changes: 1 addition & 1 deletion src/bbox/iloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl ParseBody<IlocBox> for IlocBox {

let (remain, extent_count) = be_u16(remain)?;
if extent_count > MAX_ILOC_EXTENTS_PER_ITEM {
eprintln!("extent_count: {extent_count}");
// eprintln!("extent_count: {extent_count}");
context("extent_count > 32", fail::<_, (), _>)(remain)?;
}

Expand Down
6 changes: 3 additions & 3 deletions src/bbox/ilst.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ fn parse_value(type_code: u32, data: &[u8]) -> crate::Result<EntryValue> {
8 => be_i64(data)?.1.into(),
x => {
let msg = format!("Invalid ilst item data; data type is BE Signed Integer while data len is : {x}");
eprintln!("{msg}");
// eprintln!("{msg}");
return Err(msg.into());
}
},
Expand All @@ -106,15 +106,15 @@ fn parse_value(type_code: u32, data: &[u8]) -> crate::Result<EntryValue> {
8 => be_u64(data)?.1.into(),
x => {
let msg = format!("Invalid ilst item data; data type is BE Unsigned Integer while data len is : {x}");
eprintln!("{msg}");
// eprintln!("{msg}");
return Err(msg.into());
}
},
23 => be_f32(data)?.1.into(),
24 => be_f64(data)?.1.into(),
o => {
let msg = format!("Unsupported ilst item data type: {o}");
eprintln!("{msg}");
// eprintln!("{msg}");
return Err(msg.into());
}
};
Expand Down

0 comments on commit 9b7fdf7

Please sign in to comment.