Extract simple_digest().
authorCarl Hetherington <cth@carlh.net>
Thu, 23 Dec 2021 22:33:56 +0000 (23:33 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 1 May 2022 22:22:43 +0000 (00:22 +0200)
src/lib/content.cc
src/lib/util.cc
src/lib/util.h

index 3c3942aa13c351bd18e9e595c503410d69b26e87..ed0e9af6db855da97f095d134679dc8c421fd192 100644 (file)
@@ -169,15 +169,11 @@ Content::as_xml (xmlpp::Node* node, bool with_paths) const
 string
 Content::calculate_digest () const
 {
-       boost::mutex::scoped_lock lm (_mutex);
-       auto p = _paths;
-       lm.unlock ();
-
        /* Some content files are very big, so we use a poor man's
           digest here: a digest of the first and last 1e6 bytes with the
           size of the first file tacked on the end as a string.
        */
-       return digest_head_tail(p, 1000000) + raw_convert<string>(boost::filesystem::file_size(p.front()));
+       return simple_digest (paths());
 }
 
 
index 7106cc782fb077e48f49a619651b008e7be502ff..6e2a1ad642c9d2b7a945abf32314879438b233c2 100644 (file)
@@ -530,6 +530,13 @@ digest_head_tail (vector<boost::filesystem::path> files, boost::uintmax_t size)
 }
 
 
+string
+simple_digest (vector<boost::filesystem::path> paths)
+{
+       return digest_head_tail(paths, 1000000) + raw_convert<string>(boost::filesystem::file_size(paths.front()));
+}
+
+
 /** Trip an assert if the caller is not in the UI thread */
 void
 ensure_ui_thread ()
index e335434d8dc4e90030a619fbc006aee3ec1b689d..706056cdab962b3d7585453297b50551f09b9a66 100644 (file)
@@ -91,6 +91,7 @@ extern void dcpomatic_setup ();
 extern void dcpomatic_setup_path_encoding ();
 extern void dcpomatic_setup_gettext_i18n (std::string);
 extern std::string digest_head_tail (std::vector<boost::filesystem::path>, boost::uintmax_t size);
+extern std::string simple_digest (std::vector<boost::filesystem::path> paths);
 extern void ensure_ui_thread ();
 extern std::string audio_channel_name (int);
 extern std::string short_audio_channel_name (int);