diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-06-01 01:37:31 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-06-17 00:04:03 +0200 |
| commit | 21e9bd77598f7bb4588ca9b16a58667e3340f6d9 (patch) | |
| tree | 2a0c0d7184552d68ebe278f6b0f0874e00f53c9f | |
| parent | ce3066c7763fd4d04f613a788e29000208e0639e (diff) | |
Cleanup: compress some ifs.
| -rw-r--r-- | src/lib/film.cc | 3 | ||||
| -rw-r--r-- | src/lib/video_content.cc | 9 |
2 files changed, 4 insertions, 8 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc index d0a26e44c..9897a01bf 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -579,8 +579,7 @@ Film::read_metadata(optional<boost::filesystem::path> path) } { - auto c = f.optional_string_child("Container"); - if (c) { + if (auto c = f.optional_string_child("Container")) { _container = Ratio::from_id(c.get()); } } diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc index dcce499cb..d0c6c850a 100644 --- a/src/lib/video_content.cc +++ b/src/lib/video_content.cc @@ -123,17 +123,15 @@ VideoContent::VideoContent(Content* parent, cxml::ConstNodePtr node, int version _crop.bottom = node->number_child<int>("BottomCrop"); if (version <= 7) { - auto r = node->optional_string_child("Ratio"); - if (r) { _legacy_ratio = Ratio::from_id(r.get())->ratio(); + if (auto r = node->optional_string_child("Ratio")) { } } else if (version <= 37) { auto ratio = node->node_child("Scale")->optional_string_child("Ratio"); if (ratio) { _legacy_ratio = Ratio::from_id(ratio.get())->ratio(); } - auto scale = node->node_child("Scale")->optional_bool_child("Scale"); - if (scale) { + if (auto scale = node->node_child("Scale")->optional_bool_child("Scale")) { if (*scale) { /* This is what we used to call "no stretch" */ DCPOMATIC_ASSERT(_size); @@ -181,8 +179,7 @@ VideoContent::VideoContent(Content* parent, cxml::ConstNodePtr node, int version _pixel_quanta = PixelQuanta(pixel_quanta); } - auto burnt = node->optional_string_child("BurntSubtitleLanguage"); - if (burnt) { + if (auto burnt = node->optional_string_child("BurntSubtitleLanguage")) { _burnt_subtitle_language = dcp::LanguageTag(*burnt); } |
