c2pa-rs

A fork of https://github.com/contentauth/c2pa-rs/
git clone git://archive.git.mtrnord.blog/mtrnords-photography-manager/c2pa-rs.git
Log | Files | Refs | README

commit a7a5808afb1ad8b3ed55db6593f714ec2d6af7eb
parent 372c7b683a11ba6caa1f993a68236bbebb9d12d2
Author: Dave Kozma <dkozma@adobe.com>
Date:   Thu, 23 Jun 2022 15:31:15 -0400

Return assertion instance values starting at `1` instead of `2` (#60)


Diffstat:
Msdk/src/manifest_assertion.rs | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sdk/src/manifest_assertion.rs b/sdk/src/manifest_assertion.rs @@ -101,7 +101,7 @@ impl ManifestAssertion { /// This can be used to set an instance number, but generally should not be used /// Instance numbers will be assigned automatically when the assertions are embedded pub(crate) fn set_instance(mut self, instance: usize) -> Self { - self.instance = if instance > 1 { Some(instance) } else { None }; + self.instance = if instance > 0 { Some(instance) } else { None }; self } @@ -215,8 +215,10 @@ pub(crate) mod tests { let mut ma = ManifestAssertion::new(Actions::LABEL.to_owned(), value); assert_eq!(ma.label(), Actions::LABEL); - ma = ma.set_instance(1); + ma = ma.set_instance(0); assert_eq!(ma.instance, None); + ma = ma.set_instance(1); + assert_eq!(ma.instance(), 1); ma = ma.set_instance(2); assert_eq!(ma.instance(), 2); assert_eq!(ma.kind(), &ManifestAssertionKind::Cbor);