diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-06-28 23:00:57 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-06-29 01:25:46 +0200 |
| commit | b3b70e6d7c2ec6787d0b492442bb4f7537b4b580 (patch) | |
| tree | f1b9f14b5c8e9831e7bd23bc7e88817132511a31 | |
| parent | e702623781c8d5853b79a29ca8c5f495d0ade3d1 (diff) | |
Add asset_hashes_can_differ option to the equality checks.v1.8.74
Before recent changes Asset::_hash would be empty when the equality
checks were run (and Asset::equals() compares them directly).
This mean that differences in asset hash were being ignored, but
are no longer; so now we need this option to restore that behaviour
where required.
| -rw-r--r-- | src/asset.cc | 10 | ||||
| -rw-r--r-- | src/types.h | 2 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/asset.cc b/src/asset.cc index d88c690d..330bd653 100644 --- a/src/asset.cc +++ b/src/asset.cc @@ -143,11 +143,15 @@ Asset::hash (function<void (float)> progress) const bool -Asset::equals (std::shared_ptr<const Asset> other, EqualityOptions, NoteHandler note) const +Asset::equals(std::shared_ptr<const Asset> other, EqualityOptions opt, NoteHandler note) const { if (_hash != other->_hash) { - note (NoteType::ERROR, "Asset: hashes differ"); - return false; + if (!opt.asset_hashes_can_differ) { + note(NoteType::ERROR, "Asset: hashes differ"); + return false; + } else { + note(NoteType::NOTE, "Asset: hashes differ"); + } } return true; diff --git a/src/types.h b/src/types.h index a670fdd5..87d7ffc8 100644 --- a/src/types.h +++ b/src/types.h @@ -254,6 +254,8 @@ struct EqualityOptions bool reel_annotation_texts_can_differ = false; /** true if <Hash>es in Reels can differ */ bool reel_hashes_can_differ = false; + /** true if asset hashes can differ */ + bool asset_hashes_can_differ = false; /** true if IssueDate nodes can differ */ bool issue_dates_can_differ = false; bool load_font_nodes_can_differ = false; |
