commit 7b96b8afceed320bb4f97309767a525c2100ee44
parent e0af9a999f27f383cb760c998a4a0336c7ab7f38
Author: Michael Brogdon <michael.brogdon@monotype.com>
Date: Mon, 4 Mar 2024 11:04:53 -0700
Fix up some random typos. (#353)
Diffstat:
13 files changed, 55 insertions(+), 55 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
@@ -59,7 +59,7 @@ _17 November 2023_
_01 November 2023_
* (PATCH) switches af relationship for a reference to the c2pa data to an array of references, one of which is the c2pa spec ([#333](https://github.com/contentauth/c2pa-rs/pull/333))
-* Restore async versions of embedd functions ([#327](https://github.com/contentauth/c2pa-rs/pull/327))
+* Restore async versions of embed functions ([#327](https://github.com/contentauth/c2pa-rs/pull/327))
* (MINOR) Support databox thumbnails CAI-4142 ([#325](https://github.com/contentauth/c2pa-rs/pull/325))
* (MINOR) Reuse claim thumbnail as ingredient thumbnail if the store is valid ([#322](https://github.com/contentauth/c2pa-rs/pull/322))
* (MINOR) Use JUMBF URIs for ManifestStore identifiers ([#323](https://github.com/contentauth/c2pa-rs/pull/323))
diff --git a/sdk/src/assertion.rs b/sdk/src/assertion.rs
@@ -595,7 +595,7 @@ pub enum AssertionDecodeErrorCause {
#[error("the assertion version is too new: expected no later than {max}, found {found}")]
AssertionTooNew { max: usize, found: usize },
- /// Binary data could not be interepreted as UTF-8.
+ /// Binary data could not be interpreted as UTF-8.
#[error("binary data could not be interpreted as UTF-8")]
BinaryDataNotUtf8,
@@ -625,7 +625,7 @@ pub mod tests {
"left": 0,
"right": 2000,
"top": 1000,
- "botton": 4000
+ "bottom": 4000
}"#;
let json = AssertionData::Json(test_json.to_string());
let json2 = AssertionData::Json(test_json.to_string());
diff --git a/sdk/src/asset_handlers/bmff_io.rs b/sdk/src/asset_handlers/bmff_io.rs
@@ -744,8 +744,8 @@ fn adjust_known_offsets<W: Write + CAIRead>(
}
};
- // read constuction method
- let constuction_method = if version == 1 || version == 2 {
+ // read construction method
+ let construction_method = if version == 1 || version == 2 {
let mut cm_bytes = [0u8, 2];
output.read_exact(&mut cm_bytes)?;
@@ -771,7 +771,7 @@ fn adjust_known_offsets<W: Write + CAIRead>(
};
// patch the offsets if needed
- if constuction_method == 0 {
+ if construction_method == 0 {
// file offset construction method
if base_offset_size == 4 {
let new_offset = if adjust < 0 {
@@ -838,7 +838,7 @@ fn adjust_known_offsets<W: Write + CAIRead>(
};
// no base offset so just adjust the raw extent_offset value
- if constuction_method == 0 && base_offset == 0 && extent_offset != 0 {
+ if construction_method == 0 && base_offset == 0 && extent_offset != 0 {
output.seek(SeekFrom::Start(extent_offset_file_pos))?;
match offset_size {
4 => {
@@ -1260,7 +1260,7 @@ impl AssetIO for BmffIO {
// get ftyp location
// start after ftyp
- let ftyp_token = bmff_map.get("/ftyp").ok_or(Error::UnsupportedType)?; // todo check ftyps to make sure we supprt any special format requirements
+ let ftyp_token = bmff_map.get("/ftyp").ok_or(Error::UnsupportedType)?; // todo check ftyps to make sure we support any special format requirements
let ftyp_info = &bmff_tree[ftyp_token[0]].data;
let ftyp_offset = ftyp_info.offset;
let ftyp_size = ftyp_info.size;
diff --git a/sdk/src/asset_handlers/mp3_io.rs b/sdk/src/asset_handlers/mp3_io.rs
@@ -250,7 +250,7 @@ impl CAIWriter for Mp3IO {
let mut out_tag = Tag::new();
- // wrapper to protect imput stream from being gobbled
+ // wrapper to protect input stream from being gobbled
let reader = CAIReadWrapper {
reader: input_stream,
};
diff --git a/sdk/src/asset_handlers/tiff_io.rs b/sdk/src/asset_handlers/tiff_io.rs
@@ -531,8 +531,8 @@ impl<T: Read + Write + Seek> TiffCloner<T> {
let curr_offset = self.offset()?;
if curr_offset % 4 != 0 {
let padding = [0, 0, 0];
- let padd_len = 4 - (curr_offset % 4);
- self.writer.write_all(&padding[..padd_len as usize])?;
+ let pad_len = 4 - (curr_offset % 4);
+ self.writer.write_all(&padding[..pad_len as usize])?;
}
Ok(())
diff --git a/sdk/src/asset_io.rs b/sdk/src/asset_io.rs
@@ -258,7 +258,7 @@ pub trait ComposedManifestRef {
fn compose_manifest(&self, manifest_data: &[u8], format: &str) -> Result<Vec<u8>>;
}
-/// Utility funtion to rename or copy a temp file to a permanent location.
+/// Utility function to rename or copy a temp file to a permanent location.
///
/// If the rename is not possible, due to cross volume references & etc, it will copy instead.
pub fn rename_or_copy<P>(temp_file: NamedTempFile, asset_path: P) -> Result<()>
diff --git a/sdk/src/claim.rs b/sdk/src/claim.rs
@@ -199,7 +199,7 @@ pub struct Claim {
// internal scratch objects
#[serde(skip_deserializing, skip_serializing)]
- box_prefix: String, // where in JUMBF heirachy should this claim exist
+ box_prefix: String, // where in JUMBF hierarchy should this claim exist
#[serde(skip_deserializing, skip_serializing)]
signature_val: Vec<u8>, // the signature of the loaded/saved claim
diff --git a/sdk/src/jumbf/boxes.rs b/sdk/src/jumbf/boxes.rs
@@ -787,7 +787,7 @@ pub const CAI_CLAIM_UUID: &str = "6332636C00110010800000AA00389B71"; // c2cl
pub const CAI_SIGNATURE_UUID: &str = "6332637300110010800000AA00389B71"; // c2cs
pub const CAI_EMBEDDED_FILE_UUID: &str = "40CB0C32BB8A489DA70B2AD6F47F4369";
pub const CAI_EMBEDDED_FILE_DESCRIPTION_UUID: &str = "6266646200110010800000AA00389B71"; // bfdb
-pub const CAI_EMBEDED_FILE_DATA_UUID: &str = "6269646200110010800000AA00389B71"; // bidb
+pub const CAI_EMBEDDED_FILE_DATA_UUID: &str = "6269646200110010800000AA00389B71"; // bidb
pub const CAI_VERIFIABLE_CREDENTIALS_STORE_UUID: &str = "6332766300110010800000AA00389B71"; // c2vc
pub const CAI_UUID_ASSERTION_UUID: &str = "7575696400110010800000AA00389B71"; // uuid
pub const CAI_DATABOXES_STORE_UUID: &str = "6332646200110010800000AA00389B71"; // c2db
@@ -1620,7 +1620,7 @@ impl BMFFBox for JUMBFEmbeddedFileContentBox {
}
fn box_uuid(&self) -> &'static str {
- CAI_EMBEDED_FILE_DATA_UUID
+ CAI_EMBEDDED_FILE_DATA_UUID
}
fn box_payload_size(&self) -> IoResult<u32> {
diff --git a/sdk/src/salt.rs b/sdk/src/salt.rs
@@ -11,8 +11,8 @@
// specific language governing permissions and limitations under
// each license.
-/// The Saltgenerator trait always the caller to supply
-/// a funtion to generate a salt value used when hashing
+/// The SaltGenerator trait always the caller to supply
+/// a function to generate a salt value used when hashing
/// data. Providing a unique salt ensures a unique hash for
/// a given data set.
diff --git a/sdk/src/status_tracker.rs b/sdk/src/status_tracker.rs
@@ -73,10 +73,10 @@ pub trait StatusTracker {
// should we stop on the first error
fn stop_on_error(&self) -> bool;
- // return refernce to current set of validation items
+ // return reference to current set of validation items
fn get_log(&self) -> &Vec<LogItem>;
- // return mutable refernce to current set of validation items
+ // return mutable reference to current set of validation items
fn get_log_mut(&mut self) -> &mut Vec<LogItem>;
// Log an item. Returns err if available
diff --git a/sdk/src/store.rs b/sdk/src/store.rs
@@ -1671,7 +1671,7 @@ impl Store {
// if user did not supply a hash
if pc.hash_assertions().is_empty() {
- // create placholder DataHash large enough for 10 Exclusions
+ // create placeholder DataHash large enough for 10 Exclusions
let mut ph = DataHash::new("jumbf manifest", pc.alg());
for _ in 0..10 {
ph.add_exclusion(HashRange::new(0, 2));
@@ -1712,17 +1712,17 @@ impl Store {
));
}
- let mut adusted_dh = DataHash::new("jumbf manifest", pc.alg());
- adusted_dh.exclusions = dh.exclusions.clone();
- adusted_dh.hash = dh.hash.clone();
+ let mut adjusted_dh = DataHash::new("jumbf manifest", pc.alg());
+ adjusted_dh.exclusions = dh.exclusions.clone();
+ adjusted_dh.hash = dh.hash.clone();
if let Some(reader) = asset_reader {
// calc hashes
- adusted_dh.gen_hash_from_stream(reader)?;
+ adjusted_dh.gen_hash_from_stream(reader)?;
}
// update the placeholder hash
- pc.update_data_hash(adusted_dh)?;
+ pc.update_data_hash(adjusted_dh)?;
self.to_jumbf_internal(reserve_size)
}
@@ -1743,14 +1743,14 @@ impl Store {
self.get_composed_manifest(jumbf_bytes, format)
}
- /// Returns a finalized, signed manifest. The manfiest are only supported
+ /// Returns a finalized, signed manifest. The manifest are only supported
/// for cases when the client has provided a data hash content hash binding. Note,
/// this function will not work for cases like BMFF where the position
/// of the content is also encoded. This function is not compatible with
/// BMFF hash binding. If a BMFF data hash or box hash is detected that is
/// an error. The DataHash placeholder assertion will be adjusted to the contain
/// the correct values. If the asset_reader value is supplied it will also perform
- /// the hash calulations, otherwise the function uses the caller supplied values.
+ /// the hash calculations, otherwise the function uses the caller supplied values.
/// It is an error if `get_data_hashed_manifest_placeholder` was not called first
/// as this call inserts the DataHash placeholder assertion to reserve space for the
/// actual hash values not required when using BoxHashes.
@@ -1773,14 +1773,14 @@ impl Store {
self.finish_embeddable_store(&sig, &sig_placeholder, &mut jumbf_bytes, format)
}
- /// Returns a finalized, signed manifest. The manfiest are only supported
+ /// Returns a finalized, signed manifest. The manifest are only supported
/// for cases when the client has provided a data hash content hash binding. Note,
/// this function will not work for cases like BMFF where the position
/// of the content is also encoded. This function is not compatible with
/// BMFF hash binding. If a BMFF data hash or box hash is detected that is
/// an error. The DataHash placeholder assertion will be adjusted to the contain
/// the correct values. If the asset_reader value is supplied it will also perform
- /// the hash calulations, otherwise the function uses the caller supplied values.
+ /// the hash calculations, otherwise the function uses the caller supplied values.
/// It is an error if `get_data_hashed_manifest_placeholder` was not called first
/// as this call inserts the DataHash placeholder assertion to reserve space for the
/// actual hash values not required when using BoxHashes.
@@ -1805,14 +1805,14 @@ impl Store {
self.finish_embeddable_store(&sig, &sig_placeholder, &mut jumbf_bytes, format)
}
- /// Returns a finalized, signed manifest. The manfiest are only supported
+ /// Returns a finalized, signed manifest. The manifest are only supported
/// for cases when the client has provided a data hash content hash binding. Note,
/// this function will not work for cases like BMFF where the position
/// of the content is also encoded. This function is not compatible with
/// BMFF hash binding. If a BMFF data hash or box hash is detected that is
/// an error. The DataHash placeholder assertion will be adjusted to the contain
/// the correct values. If the asset_reader value is supplied it will also perform
- /// the hash calulations, otherwise the function uses the caller supplied values.
+ /// the hash calculations, otherwise the function uses the caller supplied values.
/// It is an error if `get_data_hashed_manifest_placeholder` was not called first
/// as this call inserts the DataHash placeholder assertion to reserve space for the
/// actual hash values not required when using BoxHashes.
@@ -1907,8 +1907,8 @@ impl Store {
Ok(jumbf_bytes)
}
- /// Returns the supplied manifest composed to be directly compatibile with the desired format.
- /// For example, if format is JPEG funtion will return the set of APP11 segments that contains
+ /// Returns the supplied manifest composed to be directly compatible with the desired format.
+ /// For example, if format is JPEG function will return the set of APP11 segments that contains
/// the manifest. Similarly for PNG it would be the PNG chunk complete with header and CRC.
pub fn get_composed_manifest(&self, manifest_bytes: &[u8], format: &str) -> Result<Vec<u8>> {
if let Some(h) = get_assetio_handler(format) {
@@ -2044,7 +2044,7 @@ impl Store {
let pc_mut = self.provenance_claim_mut().ok_or(Error::ClaimEncoding)?;
pc_mut.set_signature_val(s);
- // do we need to make a C2PA file in addtion to standard embedded output
+ // do we need to make a C2PA file in addition to standard embedded output
if let crate::claim::RemoteManifest::EmbedWithRemote(_url) =
pc_mut.remote_manifest()
{
@@ -2101,7 +2101,7 @@ impl Store {
let pc_mut = self.provenance_claim_mut().ok_or(Error::ClaimEncoding)?;
pc_mut.set_signature_val(s);
- // do we need to make a C2PA file in addtion to standard embedded output
+ // do we need to make a C2PA file in addition to standard embedded output
if let crate::claim::RemoteManifest::EmbedWithRemote(_url) =
pc_mut.remote_manifest()
{
@@ -2157,7 +2157,7 @@ impl Store {
let pc_mut = self.provenance_claim_mut().ok_or(Error::ClaimEncoding)?;
pc_mut.set_signature_val(s);
- // do we need to make a C2PA file in addtion to standard embedded output
+ // do we need to make a C2PA file in addition to standard embedded output
if let crate::claim::RemoteManifest::EmbedWithRemote(_url) =
pc_mut.remote_manifest()
{
@@ -2786,7 +2786,7 @@ impl Store {
}
/// Returns embedded remote manifest URL if available
- /// asset_type: extentions or mime type of the data
+ /// asset_type: extensions or mime type of the data
/// data: byte array containing the asset
pub fn get_remote_manifest_url(asset_type: &str, data: &[u8]) -> Option<String> {
let mut buf_reader = Cursor::new(data);
@@ -2837,7 +2837,7 @@ impl Store {
})
}
- /// Load Store from a in-memory asset asychronously validating
+ /// Load Store from a in-memory asset asynchronously validating
/// asset_type: asset extension or mime type
/// data: reference to bytes of the file
/// verify: if true will run verification checks when loading
@@ -2898,7 +2898,7 @@ impl Store {
})
}
- /// Load Store from a in-memory asset asychronously validating
+ /// Load Store from a in-memory asset asynchronously validating
/// asset_type: asset extension or mime type
/// init_segment: reference to bytes of the init segment
/// fragment: reference to bytes of the fragment to validate
@@ -3104,7 +3104,7 @@ pub mod tests {
let capture = claim_capture.label().to_string();
let claim2_label = claim2.label().to_string();
- // Move the claim to claims list. Note this is not real, the claims would have to be signed in between commmits
+ // Move the claim to claims list. Note this is not real, the claims would have to be signed in between commits
store.commit_claim(claim1).unwrap();
store.save_to_asset(&ap, signer.as_ref(), &op).unwrap();
store.commit_claim(claim_capture).unwrap();
@@ -3211,7 +3211,7 @@ pub mod tests {
// Do we generate JUMBF?
let signer = temp_signer();
- // Move the claim to claims list. Note this is not real, the claims would have to be signed in between commmits
+ // Move the claim to claims list. Note this is not real, the claims would have to be signed in between commits
store.commit_claim(claim1).unwrap();
store.save_to_asset(&ap, signer.as_ref(), &op).unwrap();
@@ -3461,7 +3461,7 @@ pub mod tests {
// Do we generate JUMBF?
let signer = temp_signer();
- // Move the claim to claims list. Note this is not real, the claims would have to be signed in between commmits
+ // Move the claim to claims list. Note this is not real, the claims would have to be signed in between commits
store.commit_claim(claim1).unwrap();
store.save_to_asset(&ap, signer.as_ref(), &op).unwrap();
store.commit_claim(claim_capture).unwrap();
@@ -3703,7 +3703,7 @@ pub mod tests {
// Do we generate JUMBF?
let signer = temp_signer();
- // Move the claim to claims list. Note this is not real, the claims would have to be signed in between commmits
+ // Move the claim to claims list. Note this is not real, the claims would have to be signed in between commits
store.commit_claim(claim1).unwrap();
store.save_to_asset(&ap, signer.as_ref(), &op).unwrap();
store.commit_claim(claim_capture).unwrap();
@@ -3777,7 +3777,7 @@ pub mod tests {
// Do we generate JUMBF?
let signer = temp_signer();
- // Move the claim to claims list. Note this is not real, the claims would have to be signed in between commmits
+ // Move the claim to claims list. Note this is not real, the claims would have to be signed in between commits
store.commit_claim(claim1).unwrap();
store.save_to_asset(&ap, signer.as_ref(), &op).unwrap();
store.commit_claim(claim_capture).unwrap();
@@ -3851,7 +3851,7 @@ pub mod tests {
// Do we generate JUMBF?
let signer = temp_signer();
- // Move the claim to claims list. Note this is not real, the claims would have to be signed in between commmits
+ // Move the claim to claims list. Note this is not real, the claims would have to be signed in between commits
store.commit_claim(claim1).unwrap();
store.save_to_asset(&ap, signer.as_ref(), &op).unwrap();
store.commit_claim(claim_capture).unwrap();
@@ -3917,7 +3917,7 @@ pub mod tests {
// Do we generate JUMBF?
let signer = temp_signer();
- // Move the claim to claims list. Note this is not real, the claims would have to be signed in between commmits
+ // Move the claim to claims list. Note this is not real, the claims would have to be signed in between commits
store.commit_claim(claim1).unwrap();
store.save_to_asset(&ap, signer.as_ref(), &op).unwrap();
@@ -3961,7 +3961,7 @@ pub mod tests {
// Do we generate JUMBF?
let signer = temp_signer();
- // Move the claim to claims list. Note this is not real, the claims would have to be signed in between commmits
+ // Move the claim to claims list. Note this is not real, the claims would have to be signed in between commits
store.commit_claim(claim1).unwrap();
store.save_to_asset(&ap, signer.as_ref(), &op).unwrap();
@@ -4005,7 +4005,7 @@ pub mod tests {
// Do we generate JUMBF?
let signer = temp_signer();
- // Move the claim to claims list. Note this is not real, the claims would have to be signed in between commmits
+ // Move the claim to claims list. Note this is not real, the claims would have to be signed in between commits
store.commit_claim(claim1).unwrap();
store.save_to_asset(&ap, signer.as_ref(), &op).unwrap();
@@ -4687,7 +4687,7 @@ pub mod tests {
// Do we generate JUMBF?
let signer = temp_signer();
- // Move the claim to claims list. Note this is not real, the claims would have to be signed in between commmits
+ // Move the claim to claims list. Note this is not real, the claims would have to be signed in between commits
store.commit_claim(claim1).unwrap();
store.save_to_asset(&ap, signer.as_ref(), &op).unwrap();
store.commit_claim(claim_capture).unwrap();
@@ -4766,7 +4766,7 @@ pub mod tests {
// get composed version for embedding to JPEG
let cm = store.get_composed_manifest(&em, "jpg").unwrap();
- // insert manifest into ouput asset
+ // insert manifest into output asset
let jpeg_io = get_assetio_handler_from_path(&ap).unwrap();
let ol = jpeg_io.get_object_locations(&ap).unwrap();
@@ -4847,7 +4847,7 @@ pub mod tests {
// get composed version for embedding to JPEG
let cm = store.get_composed_manifest(&em, "jpg").unwrap();
- // insert manifest into ouput asset
+ // insert manifest into output asset
let jpeg_io = get_assetio_handler_from_path(&ap).unwrap();
let ol = jpeg_io.get_object_locations(&ap).unwrap();
diff --git a/sdk/src/utils/hash_utils.rs b/sdk/src/utils/hash_utils.rs
@@ -92,7 +92,7 @@ pub fn vec_compare(va: &[u8], vb: &[u8]) -> bool {
/// Generate hash of type hash_type for supplied data array. The
/// hash_type are those specified in the multihash specification. Currently
/// we only support Sha2-256/512 or Sha2-256/512.
-/// Returns hash or None if incomptible type
+/// Returns hash or None if incompatible type
pub fn hash_by_type(hash_type: u8, data: &[u8]) -> Option<Multihash> {
match hash_type {
0x12 => Some(Sha2_256::digest(data)),
@@ -123,7 +123,7 @@ impl Hasher {
}
}
- // comsume hasher and return the final digest
+ // consume hasher and return the final digest
pub fn finalize(hasher_enum: Hasher) -> Vec<u8> {
use Hasher::*;
// return the hash
@@ -423,7 +423,7 @@ pub fn verify_by_alg(
vec_compare(hash, &data_hash)
}
-// verify the hash using the specified alogrithm
+// verify the hash using the specified algorithm
pub fn verify_asset_by_alg(
alg: &str,
hash: &[u8],
diff --git a/sdk/src/utils/patch.rs b/sdk/src/utils/patch.rs
@@ -17,7 +17,7 @@ use crate::error::{Error, Result};
/**
Patch a sequence bytes with a new set of bytes - the search_bytes are erased and replaced with replace_bytes
-This function only patches the first occurance
+This function only patches the first occurrence
returns the location where splice occurred
*/
pub fn patch_bytes(data: &mut Vec<u8>, search_bytes: &[u8], replace_bytes: &[u8]) -> Result<usize> {