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 28e5635d090e41dd932bfe1ed848e6b3ff09f02f
parent ac13800df6144310267a8b3bbd0956f295f9831a
Author: Eric Scouten <scouten@adobe.com>
Date:   Tue,  4 Apr 2023 17:01:11 -0400

(IGNORE) Consistenly format hex literals as lower case (#218)


Diffstat:
Mrustfmt.toml | 9+++++++++
Msdk/src/asset_handlers/bmff_io.rs | 12++++++------
Msdk/src/asset_handlers/jpeg_io.rs | 2+-
Msdk/src/asset_handlers/tiff_io.rs | 4++--
4 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/rustfmt.toml b/rustfmt.toml @@ -1,4 +1,13 @@ +# IMPORTANT: PR validation uses nightly version of +# rustfmt. + +# Invoke by using: +# +# rustup toolchain add nightly +# cargo +nightly fmt + edition = "2018" group_imports = "StdExternalCrate" +hex_literal_case = "Lower" imports_granularity = "Crate" unstable_features = true diff --git a/sdk/src/asset_handlers/bmff_io.rs b/sdk/src/asset_handlers/bmff_io.rs @@ -45,7 +45,7 @@ const HEADER_SIZE: u64 = 8; // 4 byte type + 4 byte size const HEADER_SIZE_LARGE: u64 = 16; // 4 byte type + 4 byte size + 8 byte large size const C2PA_UUID: [u8; 16] = [ - 0xD8, 0xFE, 0xC3, 0xD6, 0x1B, 0x0E, 0x48, 0x3C, 0x92, 0x97, 0x58, 0x28, 0x87, 0x7E, 0xC4, 0x81, + 0xd8, 0xfe, 0xc3, 0xd6, 0x1b, 0x0e, 0x48, 0x3c, 0x92, 0x97, 0x58, 0x28, 0x87, 0x7e, 0xc4, 0x81, ]; const MANIFEST: &str = "manifest"; const MERKLE: &str = "merkle"; @@ -690,16 +690,16 @@ fn adjust_known_offsets<W: Write + CAIRead>( output.read_exact(&mut iloc_header)?; // get offset size (high nibble) - let offset_size: u8 = (iloc_header[0] & 0xF0) >> 4; + let offset_size: u8 = (iloc_header[0] & 0xf0) >> 4; // get length size (low nibble) - let length_size: u8 = iloc_header[0] & 0x0F; + let length_size: u8 = iloc_header[0] & 0x0f; // get box offset size (high nibble) - let base_offset_size: u8 = (iloc_header[1] & 0xF0) >> 4; + let base_offset_size: u8 = (iloc_header[1] & 0xf0) >> 4; // get index size (low nibble) - let index_size: u8 = iloc_header[1] & 0x0F; + let index_size: u8 = iloc_header[1] & 0x0f; // get item count let item_count = match version { @@ -731,7 +731,7 @@ fn adjust_known_offsets<W: Write + CAIRead>( output.read_exact(&mut cm_bytes)?; // lower nibble of 2nd byte - cm_bytes[1] & 0x0F + cm_bytes[1] & 0x0f } else { 0 }; diff --git a/sdk/src/asset_handlers/jpeg_io.rs b/sdk/src/asset_handlers/jpeg_io.rs @@ -285,7 +285,7 @@ impl CAIWriter for JpegIO { // En: Box Instance Number - 0x0001 // (NOTE: can be any unique ID, so we pick one that shouldn't conflict) // Z: Packet sequence number - 0x00000001... - let ci = vec![0x4A, 0x50]; + let ci = vec![0x4a, 0x50]; let en = vec![0x02, 0x11]; let z: u32 = u32::try_from(seg) .map_err(|_| Error::InvalidAsset("Too many JUMBF segments".to_string()))?; //seg.to_be_bytes(); diff --git a/sdk/src/asset_handlers/tiff_io.rs b/sdk/src/asset_handlers/tiff_io.rs @@ -35,8 +35,8 @@ use crate::{ const II: [u8; 2] = *b"II"; const MM: [u8; 2] = *b"MM"; -const C2PA_TAG: u16 = 0xCD41; -const XMP_TAG: u16 = 0x02BC; +const C2PA_TAG: u16 = 0xcd41; +const XMP_TAG: u16 = 0x02bc; const SUBFILE_TAG: u16 = 0x014a; const EXIFIFD_TAG: u16 = 0x8769; const GPSIFD_TAG: u16 = 0x8825;