diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-09-13 23:43:12 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-09-13 23:43:12 +0200 |
| commit | c1d3f6f4f645e76302ca4262de3517497fa1e14b (patch) | |
| tree | 1e12c089628be8bb798b425ef78865773b6b7e2e /src/lib | |
| parent | 73747a031e35ab8884aa16ebd3c8721dfb0391bc (diff) | |
| parent | 4f850f9958beacd8d2b39fda1941b68ffb94b2f0 (diff) | |
Merge remote-tracking branch 'origin/main' into v2.17.x
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/file_group.cc | 10 | ||||
| -rw-r--r-- | src/lib/film.cc | 2 | ||||
| -rw-r--r-- | src/lib/film.h | 5 | ||||
| -rw-r--r-- | src/lib/string_text_file.cc | 2 | ||||
| -rw-r--r-- | src/lib/util.cc | 10 | ||||
| -rw-r--r-- | src/lib/writer.cc | 2 |
6 files changed, 19 insertions, 12 deletions
diff --git a/src/lib/file_group.cc b/src/lib/file_group.cc index 228faa74d..56a5c2c59 100644 --- a/src/lib/file_group.cc +++ b/src/lib/file_group.cc @@ -84,11 +84,13 @@ FileGroup::ensure_open_path (size_t p) const _current_file->close(); } - _current_path = p; - _current_file = dcp::File(_paths[_current_path], "rb"); - if (!_current_file) { - throw OpenFileError (_paths[_current_path], errno, OpenFileError::READ); + auto file = dcp::File(_paths[p], "rb"); + if (!file) { + throw OpenFileError(_paths[p], file.open_error(), OpenFileError::READ); } + + _current_path = p; + _current_file = std::move(file); _current_size = dcp::filesystem::file_size(_paths[_current_path]); } diff --git a/src/lib/film.cc b/src/lib/film.cc index 2e7df9cf8..835719868 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -2196,7 +2196,7 @@ InfoFileHandle::InfoFileHandle (boost::mutex& mutex, boost::filesystem::path pat , _file(path, read ? "rb" : (dcp::filesystem::exists(path) ? "r+b" : "wb")) { if (!_file) { - throw OpenFileError(path, errno, read ? OpenFileError::READ : (dcp::filesystem::exists(path) ? OpenFileError::READ_WRITE : OpenFileError::WRITE)); + throw OpenFileError(path, _file.open_error(), read ? OpenFileError::READ : (dcp::filesystem::exists(path) ? OpenFileError::READ_WRITE : OpenFileError::WRITE)); } } diff --git a/src/lib/film.h b/src/lib/film.h index 12872caf1..815c6ae74 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -89,6 +89,11 @@ class InfoFileHandle public: InfoFileHandle (boost::mutex& mutex, boost::filesystem::path file, bool read); + InfoFileHandle(InfoFileHandle const&) = delete; + InfoFileHandle& operator=(InfoFileHandle const&) = delete; + InfoFileHandle(InfoFileHandle&&) = delete; + InfoFileHandle& operator=(InfoFileHandle&&) = delete; + dcp::File& get () { return _file; } diff --git a/src/lib/string_text_file.cc b/src/lib/string_text_file.cc index 9b43b35a6..f5d5e0d2a 100644 --- a/src/lib/string_text_file.cc +++ b/src/lib/string_text_file.cc @@ -57,7 +57,7 @@ StringTextFile::StringTextFile (shared_ptr<const StringTextFileContent> content) if (ext == ".stl") { dcp::File f(content->path(0), "rb"); if (!f) { - throw OpenFileError (f.path(), errno, OpenFileError::READ); + throw OpenFileError(f.path(), f.open_error(), OpenFileError::READ); } try { reader.reset(new sub::STLBinaryReader(f.get())); diff --git a/src/lib/util.cc b/src/lib/util.cc index 2e3485075..bf753d04d 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -566,7 +566,7 @@ digest_head_tail (vector<boost::filesystem::path> files, boost::uintmax_t size) while (i < int64_t (files.size()) && to_do > 0) { dcp::File f(files[i], "rb"); if (!f) { - throw OpenFileError (files[i].string(), errno, OpenFileError::READ); + throw OpenFileError(files[i].string(), f.open_error(), OpenFileError::READ); } auto this_time = min(to_do, dcp::filesystem::file_size(files[i])); @@ -585,7 +585,7 @@ digest_head_tail (vector<boost::filesystem::path> files, boost::uintmax_t size) while (i >= 0 && to_do > 0) { dcp::File f(files[i], "rb"); if (!f) { - throw OpenFileError (files[i].string(), errno, OpenFileError::READ); + throw OpenFileError(files[i].string(), f.open_error(), OpenFileError::READ); } auto this_time = min(to_do, dcp::filesystem::file_size(files[i])); @@ -691,7 +691,7 @@ valid_image_file (boost::filesystem::path f) ext == ".tif" || ext == ".tiff" || ext == ".jpg" || ext == ".jpeg" || ext == ".png" || ext == ".bmp" || ext == ".tga" || ext == ".dpx" || ext == ".j2c" || ext == ".j2k" || ext == ".jp2" || ext == ".exr" || - ext == ".jpf" || ext == ".psd" + ext == ".jpf" || ext == ".psd" || ext == ".webp" ); } @@ -954,11 +954,11 @@ copy_in_bits (boost::filesystem::path from, boost::filesystem::path to, std::fun { dcp::File f(from, "rb"); if (!f) { - throw OpenFileError (from, errno, OpenFileError::READ); + throw OpenFileError(from, f.open_error(), OpenFileError::READ); } dcp::File t(to, "wb"); if (!t) { - throw OpenFileError (to, errno, OpenFileError::WRITE); + throw OpenFileError(to, t.open_error(), OpenFileError::WRITE); } /* on the order of a second's worth of copying */ diff --git a/src/lib/writer.cc b/src/lib/writer.cc index 4b6f70f21..971085046 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -732,7 +732,7 @@ Writer::write_cover_sheet() auto const cover = film()->file("COVER_SHEET.txt"); dcp::File file(cover, "w"); if (!file) { - throw OpenFileError (cover, errno, OpenFileError::WRITE); + throw OpenFileError(cover, file.open_error(), OpenFileError::WRITE); } auto text = Config::instance()->cover_sheet (); |
