From: Carl Hetherington Date: Fri, 2 Apr 2021 21:44:58 +0000 (+0200) Subject: Add to_upper() method to util.{cc,h} X-Git-Tag: v2.15.138~5^2~5 X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=48bfa4b2040d2bacd6befdab6c12b2ee3e9be5a1 Add to_upper() method to util.{cc,h} --- diff --git a/src/lib/film.cc b/src/lib/film.cc index b34c85295..1f188021b 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -919,9 +919,8 @@ Film::isdcf_name (bool if_created_now) const auto audio_langs = audio_languages(); auto audio_language = (audio_langs.empty() || !audio_langs.front().language()) ? "XX" : audio_langs.front().language()->subtag(); - transform (audio_language.begin(), audio_language.end(), audio_language.begin(), ::toupper); - d += "_" + audio_language; + d += "_" + to_upper (audio_language); /* I'm not clear on the precise details of the convention for CCAP labelling; for now I'm just appending -CCAP if we have any closed captions. @@ -945,7 +944,7 @@ Film::isdcf_name (bool if_created_now) const if (burnt_in) { transform (lang.begin(), lang.end(), lang.begin(), ::tolower); } else { - transform (lang.begin(), lang.end(), lang.begin(), ::toupper); + lang = to_upper (lang); } d += "-" + lang; @@ -959,8 +958,7 @@ Film::isdcf_name (bool if_created_now) const if (_release_territory) { auto territory = _release_territory->subtag(); - transform (territory.begin(), territory.end(), territory.begin(), ::toupper); - d += "_" + territory; + d += "_" + to_upper (territory); if (_ratings.empty ()) { d += "-NR"; } else { diff --git a/src/lib/util.cc b/src/lib/util.cc index 24ea42b8f..d3511e8c7 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -1167,3 +1167,12 @@ default_font_file () return liberation_normal; } + + +string +to_upper (string s) +{ + transform (s.begin(), s.end(), s.begin(), ::toupper); + return s; +} + diff --git a/src/lib/util.h b/src/lib/util.h index ceb30701c..7f8106f3c 100644 --- a/src/lib/util.h +++ b/src/lib/util.h @@ -122,6 +122,7 @@ extern void copy_in_bits (boost::filesystem::path from, boost::filesystem::path extern dcp::Size scale_for_display (dcp::Size s, dcp::Size display_container, dcp::Size film_container); extern dcp::DecryptedKDM decrypt_kdm_with_helpful_error (dcp::EncryptedKDM kdm); extern boost::filesystem::path default_font_file (); +extern std::string to_upper (std::string s); template std::list