diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-07-10 01:24:48 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-07-10 01:24:48 +0200 |
| commit | 13154bc1a9b341f46994607fdde2e725444a6e21 (patch) | |
| tree | 3fcf211b397092798b2aa39af4cc567d146a574c /src | |
| parent | 9853cbf566fdfdea096333c4caa788c29fa5c57b (diff) | |
Remove String namespace from around compose().compose
Diffstat (limited to 'src')
| -rw-r--r-- | src/asset_factory.cc | 2 | ||||
| -rw-r--r-- | src/atmos_asset_writer.cc | 2 | ||||
| -rw-r--r-- | src/certificate.cc | 2 | ||||
| -rw-r--r-- | src/certificate_chain.cc | 16 | ||||
| -rw-r--r-- | src/combine.h | 6 | ||||
| -rw-r--r-- | src/compose.h | 6 | ||||
| -rw-r--r-- | src/cpl.cc | 2 | ||||
| -rw-r--r-- | src/dcp.cc | 6 | ||||
| -rw-r--r-- | src/dcp.h | 6 | ||||
| -rw-r--r-- | src/dcp_time.cc | 20 | ||||
| -rw-r--r-- | src/decrypted_kdm.cc | 2 | ||||
| -rw-r--r-- | src/encrypted_kdm.cc | 2 | ||||
| -rw-r--r-- | src/exceptions.cc | 28 | ||||
| -rw-r--r-- | src/interop_subtitle_asset.cc | 6 | ||||
| -rw-r--r-- | src/j2k_transcode.cc | 6 | ||||
| -rw-r--r-- | src/language_tag.cc | 12 | ||||
| -rw-r--r-- | src/mono_picture_asset.cc | 2 | ||||
| -rw-r--r-- | src/mono_picture_frame.cc | 2 | ||||
| -rw-r--r-- | src/picture_asset.cc | 8 | ||||
| -rw-r--r-- | src/reel_asset.cc | 2 | ||||
| -rw-r--r-- | src/reel_picture_asset.cc | 4 | ||||
| -rw-r--r-- | src/rgb_xyz.cc | 8 | ||||
| -rw-r--r-- | src/smpte_subtitle_asset.cc | 10 | ||||
| -rw-r--r-- | src/sound_asset.cc | 22 | ||||
| -rw-r--r-- | src/sound_asset_writer.cc | 4 | ||||
| -rw-r--r-- | src/stereo_picture_frame.cc | 2 | ||||
| -rw-r--r-- | src/subtitle_asset.cc | 6 | ||||
| -rw-r--r-- | src/types.cc | 6 | ||||
| -rw-r--r-- | src/util.cc | 4 | ||||
| -rw-r--r-- | src/verify.cc | 118 | ||||
| -rw-r--r-- | src/verify_j2k.cc | 12 |
31 files changed, 164 insertions, 170 deletions
diff --git a/src/asset_factory.cc b/src/asset_factory.cc index 0b6c9ad5..261568e5 100644 --- a/src/asset_factory.cc +++ b/src/asset_factory.cc @@ -93,7 +93,7 @@ dcp::asset_factory (boost::filesystem::path path, bool ignore_incorrect_picture_ case ASDCP::ESS_DCDATA_DOLBY_ATMOS: return make_shared<AtmosAsset>(path); default: - throw ReadError (String::compose("Unknown MXF essence type %1 in %2", static_cast<int>(type), path.string())); + throw ReadError (compose("Unknown MXF essence type %1 in %2", static_cast<int>(type), path.string())); } return {}; diff --git a/src/atmos_asset_writer.cc b/src/atmos_asset_writer.cc index 1fe4b4e2..94620c8b 100644 --- a/src/atmos_asset_writer.cc +++ b/src/atmos_asset_writer.cc @@ -109,7 +109,7 @@ AtmosAssetWriter::write (uint8_t const * data, int size) auto const r = _state->mxf_writer.WriteFrame (_state->frame_buffer, _crypto_context->context(), _crypto_context->hmac()); if (ASDCP_FAILURE(r)) { - boost::throw_exception (MiscError(String::compose("could not write atmos MXF frame (%1)", static_cast<int>(r)))); + boost::throw_exception (MiscError(compose("could not write atmos MXF frame (%1)", static_cast<int>(r)))); } ++_frames_written; diff --git a/src/certificate.cc b/src/certificate.cc index 4508729f..4e2f1e8a 100644 --- a/src/certificate.cc +++ b/src/certificate.cc @@ -439,7 +439,7 @@ Certificate::public_key () const _public_key = EVP_PKEY_get1_RSA (key); if (!_public_key) { - throw MiscError (String::compose ("could not get RSA public key (%1)", ERR_error_string (ERR_get_error(), 0))); + throw MiscError (compose("could not get RSA public key (%1)", ERR_error_string (ERR_get_error(), 0))); } return _public_key; diff --git a/src/certificate_chain.cc b/src/certificate_chain.cc index 006d26b2..4d90a44d 100644 --- a/src/certificate_chain.cc +++ b/src/certificate_chain.cc @@ -114,7 +114,7 @@ command (string cmd) int const code = WEXITSTATUS (r); #endif if (code) { - throw dcp::MiscError (String::compose ("error %1 in %2 within %3", code, cmd, boost::filesystem::current_path().string())); + throw dcp::MiscError (compose("error %1 in %2 within %3", code, cmd, boost::filesystem::current_path().string())); } } @@ -130,7 +130,7 @@ public_key_digest (boost::filesystem::path private_key, boost::filesystem::path boost::filesystem::path public_name = private_key.string() + ".public"; /* Create the public key from the private key */ - command (String::compose("\"%1\" rsa -outform PEM -pubout -in %2 -out %3", openssl.string(), private_key.string(), public_name.string())); + command (compose("\"%1\" rsa -outform PEM -pubout -in %2 -out %3", openssl.string(), private_key.string(), public_name.string())); /* Read in the public key from the file */ @@ -231,7 +231,7 @@ CertificateChain::CertificateChain ( { command ( - String::compose ( + compose( "%1 req -new -x509 -sha256 -config ca.cnf -days %2 -set_serial 5" " -subj \"%3\" -key ca.key -outform PEM -out ca.self-signed.pem", quoted_openssl, days, ca_subject @@ -265,7 +265,7 @@ CertificateChain::CertificateChain ( { command ( - String::compose ( + compose( "%1 req -new -config intermediate.cnf -days %2 -subj \"%3\" -key intermediate.key -out intermediate.csr", quoted_openssl, days - 1, inter_subject ) @@ -273,7 +273,7 @@ CertificateChain::CertificateChain ( } command ( - String::compose ( + compose( "%1 x509 -req -sha256 -days %2 -CA ca.self-signed.pem -CAkey ca.key -set_serial 6" " -in intermediate.csr -extfile intermediate.cnf -extensions v3_ca -out intermediate.signed.pem", quoted_openssl, days - 1 @@ -306,7 +306,7 @@ CertificateChain::CertificateChain ( { command ( - String::compose ( + compose( "%1 req -new -config leaf.cnf -days %2 -subj \"%3\" -key leaf.key -outform PEM -out leaf.csr", quoted_openssl, days - 2, leaf_subject ) @@ -314,7 +314,7 @@ CertificateChain::CertificateChain ( } command ( - String::compose ( + compose( "%1 x509 -req -sha256 -days %2 -CA intermediate.signed.pem -CAkey intermediate.key" " -set_serial 7 -in leaf.csr -extfile leaf.cnf -extensions v3_ca -out leaf.signed.pem", quoted_openssl, days - 2 @@ -659,7 +659,7 @@ CertificateChain::add_signature_value (xmlpp::Element* parent, string ns, bool a } int const r = xmlSecDSigCtxSign (signature_context, parent->cobj ()); if (r < 0) { - throw MiscError (String::compose ("could not sign (%1)", r)); + throw MiscError (compose("could not sign (%1)", r)); } xmlSecDSigCtxDestroy (signature_context); diff --git a/src/combine.h b/src/combine.h index 819efc89..0f9e4f7a 100644 --- a/src/combine.h +++ b/src/combine.h @@ -51,10 +51,10 @@ class CertificateChain; void combine ( std::vector<boost::filesystem::path> inputs, boost::filesystem::path output, - std::string issuer = String::compose("libdcp %1", dcp::version), - std::string creator = String::compose("libdcp %1", dcp::version), + std::string issuer = compose("libdcp %1", dcp::version), + std::string creator = compose("libdcp %1", dcp::version), std::string issue_date = LocalTime().as_string(), - std::string annotation_text = String::compose("Created by libdcp %1", dcp::version), + std::string annotation_text = compose("Created by libdcp %1", dcp::version), std::shared_ptr<const CertificateChain> signer = std::shared_ptr<CertificateChain>() ); diff --git a/src/compose.h b/src/compose.h index a7bc1154..128600fb 100644 --- a/src/compose.h +++ b/src/compose.h @@ -60,9 +60,6 @@ void collect(std::vector<std::string>& string_args, T arg, Ts... rest) } -namespace String { - - template <typename...Ts> std::string compose(std::string fmt, Ts... args) { @@ -82,8 +79,5 @@ std::string compose(std::string fmt, Ts... args) } -} - - #endif @@ -565,7 +565,7 @@ CPL::equals (shared_ptr<const Asset> other, EqualityOptions opt, NoteHandler not } if (_reels.size() != other_cpl->_reels.size()) { - note (NoteType::ERROR, String::compose ("CPL: reel counts differ (%1 vs %2)", _reels.size(), other_cpl->_reels.size())); + note (NoteType::ERROR, compose("CPL: reel counts differ (%1 vs %2)", _reels.size(), other_cpl->_reels.size())); return false; } @@ -236,7 +236,7 @@ DCP::read (vector<dcp::VerificationNote>* notes, bool ignore_incorrect_picture_m p->parse_file (path.string()); } catch (std::exception& e) { delete p; - throw ReadError(String::compose("XML error in %1", path.string()), e.what()); + throw ReadError(compose("XML error in %1", path.string()), e.what()); } auto const root = p->get_document()->get_root_node()->get_name(); @@ -271,7 +271,7 @@ DCP::read (vector<dcp::VerificationNote>* notes, bool ignore_incorrect_picture_m } else if (*pkl_type == "image/png") { /* It's an Interop PNG subtitle; let it go */ } else { - throw ReadError (String::compose("Unknown asset type %1 in PKL", *pkl_type)); + throw ReadError (compose("Unknown asset type %1 in PKL", *pkl_type)); } } @@ -306,7 +306,7 @@ DCP::equals (DCP const & other, EqualityOptions opt, NoteHandler note) const auto b = other.cpls (); if (a.size() != b.size()) { - note (NoteType::ERROR, String::compose ("CPL counts differ: %1 vs %2", a.size(), b.size())); + note (NoteType::ERROR, compose("CPL counts differ: %1 vs %2", a.size(), b.size())); return false; } @@ -151,10 +151,10 @@ public: * @param name_format Name format to use for the CPL and PKL filenames */ void write_xml ( - std::string issuer = String::compose("libdcp %1", dcp::version), - std::string creator = String::compose("libdcp %1", dcp::version), + std::string issuer = compose("libdcp %1", dcp::version), + std::string creator = compose("libdcp %1", dcp::version), std::string issue_date = LocalTime().as_string(), - std::string annotation_text = String::compose("Created by libdcp %1", dcp::version), + std::string annotation_text = compose("Created by libdcp %1", dcp::version), std::shared_ptr<const CertificateChain> signer = std::shared_ptr<const CertificateChain>(), NameFormat name_format = NameFormat("%t") ); diff --git a/src/dcp_time.cc b/src/dcp_time.cc index 4e67afb7..c9b184f7 100644 --- a/src/dcp_time.cc +++ b/src/dcp_time.cc @@ -102,7 +102,7 @@ Time::Time (string time, optional<int> tcr_) split (b, time, is_any_of (":")); if (b.size() < 3 || b[0].empty() || b[1].empty() || b[0].length() > 2 || b[1].length() > 2) { - boost::throw_exception (ReadError (String::compose ("unrecognised time specification %1", time))); + boost::throw_exception (ReadError (compose("unrecognised time specification %1", time))); } if (!tcr_) { @@ -112,17 +112,17 @@ Time::Time (string time, optional<int> tcr_) vector<string> bs; split (bs, b[2], is_any_of (".")); if (bs.size() != 2) { - boost::throw_exception (ReadError (String::compose ("unrecognised time specification %1", time))); + boost::throw_exception (ReadError (compose("unrecognised time specification %1", time))); } h = raw_convert<int> (b[0]); m = raw_convert<int> (b[1]); if (bs[0].empty() || bs[0].length() > 2) { - boost::throw_exception (ReadError (String::compose ("unrecognised time specification %1; %2 has bad length", time, bs[0]))); + boost::throw_exception (ReadError (compose("unrecognised time specification %1; %2 has bad length", time, bs[0]))); } s = raw_convert<int> (bs[0]); if (bs[1].empty() || bs[1].length() > 3) { - boost::throw_exception (ReadError (String::compose ("unrecognised time specification %1; %2 has bad length", time, bs[1]))); + boost::throw_exception (ReadError (compose("unrecognised time specification %1; %2 has bad length", time, bs[1]))); } e = raw_convert<int> (bs[1]); tcr = 1000; @@ -131,33 +131,33 @@ Time::Time (string time, optional<int> tcr_) h = raw_convert<int> (b[0]); m = raw_convert<int> (b[1]); if (b[2].empty() || b[2].length() > 2) { - boost::throw_exception (ReadError (String::compose ("unrecognised time specification %1; %2 has bad length", time, b[2]))); + boost::throw_exception (ReadError (compose("unrecognised time specification %1; %2 has bad length", time, b[2]))); } s = raw_convert<int> (b[2]); if (b[3].empty() || b[3].length() > 3) { - boost::throw_exception (ReadError (String::compose ("unrecognised time specification %1; %2 has bad length", time, b[3]))); + boost::throw_exception (ReadError (compose("unrecognised time specification %1; %2 has bad length", time, b[3]))); } e = raw_convert<int> (b[3]); tcr = 250; } else { - boost::throw_exception (ReadError (String::compose ("unrecognised time specification %1", time))); + boost::throw_exception (ReadError (compose("unrecognised time specification %1", time))); } } else { /* SMPTE: HH:MM:SS:EE */ split (b, time, is_any_of (":")); if (b.size() != 4) { - boost::throw_exception (ReadError (String::compose ("unrecognised time specification %1; does not have 4 parts", time))); + boost::throw_exception (ReadError (compose("unrecognised time specification %1; does not have 4 parts", time))); } h = raw_convert<int> (b[0]); m = raw_convert<int> (b[1]); if (b[2].empty() || b[2].length() > 2) { - boost::throw_exception (ReadError (String::compose ("unrecognised time specification %1; %2 has bad length", time, b[2]))); + boost::throw_exception (ReadError (compose("unrecognised time specification %1; %2 has bad length", time, b[2]))); } s = raw_convert<int> (b[2]); if (b[3].empty() || b[3].length() > 2) { - boost::throw_exception (ReadError (String::compose ("unrecognised time specification %1; %2 has bad length", time, b[3]))); + boost::throw_exception (ReadError (compose("unrecognised time specification %1; %2 has bad length", time, b[3]))); } e = raw_convert<int> (b[3]); tcr = tcr_.get(); diff --git a/src/decrypted_kdm.cc b/src/decrypted_kdm.cc index 7210a848..df57588f 100644 --- a/src/decrypted_kdm.cc +++ b/src/decrypted_kdm.cc @@ -362,7 +362,7 @@ DecryptedKDM::encrypt ( unsigned char encrypted[RSA_size(rsa)]; int const encrypted_len = RSA_public_encrypt (p - block, block, encrypted, rsa, RSA_PKCS1_OAEP_PADDING); if (encrypted_len == -1) { - throw MiscError (String::compose ("Could not encrypt KDM (%1)", ERR_error_string (ERR_get_error(), 0))); + throw MiscError (compose("Could not encrypt KDM (%1)", ERR_error_string (ERR_get_error(), 0))); } /* Lazy overallocation */ diff --git a/src/encrypted_kdm.cc b/src/encrypted_kdm.cc index 5706f953..ebac5200 100644 --- a/src/encrypted_kdm.cc +++ b/src/encrypted_kdm.cc @@ -448,7 +448,7 @@ public: if (disable_forensic_marking_audio) { auto mrkflg = audio_disable; if (*disable_forensic_marking_audio > 0) { - mrkflg += String::compose ("-above-channel-%1", *disable_forensic_marking_audio); + mrkflg += compose("-above-channel-%1", *disable_forensic_marking_audio); } forensic_mark_flag_list->add_child("ForensicMarkFlag")->add_child_text (mrkflg); } diff --git a/src/exceptions.cc b/src/exceptions.cc index 3cf1a782..12f8ec12 100644 --- a/src/exceptions.cc +++ b/src/exceptions.cc @@ -48,7 +48,7 @@ using namespace dcp; FileError::FileError (string message, boost::filesystem::path filename, int number) - : runtime_error (String::compose ("%1 (%2) (error %3)", message, filename.string(), number)) + : runtime_error (compose("%1 (%2) (error %3)", message, filename.string(), number)) , _filename (filename) , _number (number) { @@ -57,49 +57,49 @@ FileError::FileError (string message, boost::filesystem::path filename, int numb UnresolvedRefError::UnresolvedRefError (string id) - : runtime_error (String::compose ("Unresolved reference to asset id %1", id)) + : runtime_error (compose("Unresolved reference to asset id %1", id)) { } TimeFormatError::TimeFormatError (string bad_time) - : runtime_error (String::compose ("Bad time string %1", bad_time)) + : runtime_error (compose("Bad time string %1", bad_time)) { } BadContentKindError::BadContentKindError (string content_kind) - : ReadError (String::compose("Bad content kind '%1'", content_kind)) + : ReadError (compose("Bad content kind '%1'", content_kind)) { } NotEncryptedError::NotEncryptedError (string const & what) - : runtime_error (String::compose ("%1 is not encrypted", what)) + : runtime_error (compose("%1 is not encrypted", what)) { } ProgrammingError::ProgrammingError (string file, int line) - : runtime_error (String::compose ("Programming error at %1:%2", file, line)) + : runtime_error (compose("Programming error at %1:%2", file, line)) { } KDMDecryptionError::KDMDecryptionError (std::string message, int cipher_length, int modulus_dmax) - : runtime_error (String::compose ("Could not decrypt KDM (%1) (%2/%3)", message, cipher_length, modulus_dmax)) + : runtime_error (compose("Could not decrypt KDM (%1) (%2/%3)", message, cipher_length, modulus_dmax)) { } KDMFormatError::KDMFormatError (std::string message) - : runtime_error (String::compose ("Could not parse KDM (%1)", message)) + : runtime_error (compose("Could not parse KDM (%1)", message)) { } @@ -113,7 +113,7 @@ CertificateChainError::CertificateChainError (string message) ReadError::ReadError (string message, string detail) - : runtime_error(String::compose("%1 (%2)", message, detail)) + : runtime_error(compose("%1 (%2)", message, detail)) , _message(message) , _detail(detail) { @@ -122,7 +122,7 @@ ReadError::ReadError (string message, string detail) MissingSubtitleImageError::MissingSubtitleImageError (string id) - : runtime_error (String::compose("Could not load image for subtitle %1", id)) + : runtime_error (compose("Could not load image for subtitle %1", id)) { } @@ -141,7 +141,7 @@ BadKDMDateError::BadKDMDateError (bool starts_too_early) StartCompressionError::StartCompressionError (optional<int> code) - : runtime_error (String::compose("Could not start JPEG2000 encoding%1", code ? String::compose(" (%1", *code) : "")) + : runtime_error (compose("Could not start JPEG2000 encoding%1", code ? compose(" (%1", *code) : "")) , _code (code) {} @@ -172,14 +172,14 @@ DuplicateIdError::DuplicateIdError (std::string message) MainSoundConfigurationError::MainSoundConfigurationError (std::string s) - : runtime_error (String::compose("Could not parse MainSoundConfiguration %1", s)) + : runtime_error (compose("Could not parse MainSoundConfiguration %1", s)) { } UnknownChannelIdError::UnknownChannelIdError (std::string id) - : runtime_error (String::compose("Unrecognised channel id '%1'", id)) + : runtime_error (compose("Unrecognised channel id '%1'", id)) { } @@ -193,7 +193,7 @@ NoReelsError::NoReelsError () MissingAssetmapError::MissingAssetmapError (boost::filesystem::path dir) - : ReadError (String::compose("Could not find ASSETMAP nor ASSETMAP.xml in '%1'", dir.string())) + : ReadError (compose("Could not find ASSETMAP nor ASSETMAP.xml in '%1'", dir.string())) { } diff --git a/src/interop_subtitle_asset.cc b/src/interop_subtitle_asset.cc index 51c41d18..2adaa5f4 100644 --- a/src/interop_subtitle_asset.cc +++ b/src/interop_subtitle_asset.cc @@ -96,7 +96,7 @@ InteropSubtitleAsset::InteropSubtitleAsset (boost::filesystem::path file) for (auto i: _subtitles) { auto si = dynamic_pointer_cast<SubtitleImage>(i); if (si) { - si->read_png_file (file.parent_path() / String::compose("%1.png", si->id())); + si->read_png_file (file.parent_path() / compose("%1.png", si->id())); } } } @@ -136,7 +136,7 @@ void InteropSubtitleAsset::add_font (string load_id, dcp::ArrayData data) { _fonts.push_back (Font(load_id, make_uuid(), data)); - auto const uri = String::compose("font_%1.ttf", _load_font_nodes.size()); + auto const uri = compose("font_%1.ttf", _load_font_nodes.size()); _load_font_nodes.push_back (shared_ptr<InteropLoadFontNode>(new InteropLoadFontNode(load_id, uri))); } @@ -210,7 +210,7 @@ InteropSubtitleAsset::write (boost::filesystem::path p) const for (auto i: _subtitles) { auto im = dynamic_pointer_cast<dcp::SubtitleImage> (i); if (im) { - im->write_png_file(p.parent_path() / String::compose("%1.png", im->id())); + im->write_png_file(p.parent_path() / compose("%1.png", im->id())); } } diff --git a/src/j2k_transcode.cc b/src/j2k_transcode.cc index 6b0aa58d..6cdeec42 100644 --- a/src/j2k_transcode.cc +++ b/src/j2k_transcode.cc @@ -172,9 +172,9 @@ dcp::decompress_j2k (uint8_t const * data, int64_t size, int reduce) opj_destroy_codec (decoder); opj_stream_destroy (stream); if (format == OPJ_CODEC_J2K) { - boost::throw_exception (ReadError (String::compose ("could not decode JPEG2000 codestream of %1 bytes.", size))); + boost::throw_exception (ReadError (compose("could not decode JPEG2000 codestream of %1 bytes.", size))); } else { - boost::throw_exception (ReadError (String::compose ("could not decode JP2 file of %1 bytes.", size))); + boost::throw_exception (ReadError (compose("could not decode JP2 file of %1 bytes.", size))); } } @@ -204,7 +204,7 @@ dcp::decompress_j2k (uint8_t* data, int64_t size, int reduce) if (!image) { opj_destroy_decompress (decoder); opj_cio_close (cio); - boost::throw_exception (ReadError (String::compose ("could not decode JPEG2000 codestream of %1 bytes.", size))); + boost::throw_exception (ReadError (compose("could not decode JPEG2000 codestream of %1 bytes.", size))); } opj_destroy_decompress (decoder); diff --git a/src/language_tag.cc b/src/language_tag.cc index 9ceaba00..2bd77a28 100644 --- a/src/language_tag.cc +++ b/src/language_tag.cc @@ -82,7 +82,7 @@ LanguageTag::Subtag::Subtag (string subtag, SubtagType type) : _subtag (subtag) { if (!get_subtag_data(type, subtag)) { - throw LanguageTagError(String::compose("Unknown %1 string %2", subtag_type_name(type), subtag)); + throw LanguageTagError(compose("Unknown %1 string %2", subtag_type_name(type), subtag)); } } @@ -92,7 +92,7 @@ LanguageTag::LanguageTag (string tag) vector<string> parts; boost::split (parts, tag, boost::is_any_of("-")); if (parts.empty()) { - throw LanguageTagError (String::compose("Could not parse language tag %1", tag)); + throw LanguageTagError (compose("Could not parse language tag %1", tag)); } vector<string>::size_type p = 0; @@ -142,7 +142,7 @@ LanguageTag::LanguageTag (string tag) } catch (...) {} if (p < parts.size()) { - throw LanguageTagError (String::compose("Unrecognised subtag %1", parts[p])); + throw LanguageTagError (compose("Unrecognised subtag %1", parts[p])); } } @@ -201,7 +201,7 @@ void LanguageTag::add_variant (VariantSubtag variant) { if (find(_variants.begin(), _variants.end(), variant) != _variants.end()) { - throw LanguageTagError (String::compose("Duplicate Variant subtag %1", variant.subtag())); + throw LanguageTagError (compose("Duplicate Variant subtag %1", variant.subtag())); } _variants.push_back (variant); @@ -217,7 +217,7 @@ check_for_duplicates (vector<T> const& subtags, dcp::LanguageTag::SubtagType typ optional<T> last; for (auto const& i: sorted) { if (last && i == *last) { - throw LanguageTagError (String::compose("Duplicate %1 subtag %2", dcp::LanguageTag::subtag_type_name(type), i.subtag())); + throw LanguageTagError (compose("Duplicate %1 subtag %2", dcp::LanguageTag::subtag_type_name(type), i.subtag())); } last = i; } @@ -236,7 +236,7 @@ void LanguageTag::add_extlang (ExtlangSubtag extlang) { if (find(_extlangs.begin(), _extlangs.end(), extlang) != _extlangs.end()) { - throw LanguageTagError (String::compose("Duplicate Extlang subtag %1", extlang.subtag())); + throw LanguageTagError (compose("Duplicate Extlang subtag %1", extlang.subtag())); } _extlangs.push_back (extlang); diff --git a/src/mono_picture_asset.cc b/src/mono_picture_asset.cc index ea753d0e..33ad3b21 100644 --- a/src/mono_picture_asset.cc +++ b/src/mono_picture_asset.cc @@ -170,7 +170,7 @@ MonoPictureAsset::equals (shared_ptr<const Asset> other, EqualityOptions opt, No #pragma omp critical #endif { - note (NoteType::PROGRESS, String::compose("Compared video frame %1 of %2", i, _intrinsic_duration)); + note (NoteType::PROGRESS, compose("Compared video frame %1 of %2", i, _intrinsic_duration)); for (auto const& i: notes) { note (i.first, i.second); } diff --git a/src/mono_picture_frame.cc b/src/mono_picture_frame.cc index c40eb01a..93b47e1b 100644 --- a/src/mono_picture_frame.cc +++ b/src/mono_picture_frame.cc @@ -90,7 +90,7 @@ MonoPictureFrame::MonoPictureFrame (ASDCP::JP2K::MXFReader* reader, int n, share auto const r = reader->ReadFrame (n, *_buffer, c->context(), check_hmac ? c->hmac() : nullptr); if (ASDCP_FAILURE(r)) { - boost::throw_exception (ReadError(String::compose ("could not read video frame %1 (%2)", n, static_cast<int>(r)))); + boost::throw_exception (ReadError(compose("could not read video frame %1 (%2)", n, static_cast<int>(r)))); } } diff --git a/src/picture_asset.cc b/src/picture_asset.cc index e905aeb1..ab8460c9 100644 --- a/src/picture_asset.cc +++ b/src/picture_asset.cc @@ -160,7 +160,7 @@ PictureAsset::frame_buffer_equals ( for (int c = 0; c < 3; ++c) { if (image_A->size() != image_B->size()) { - note (NoteType::ERROR, String::compose ("image sizes for frame %1 differ", frame)); + note (NoteType::ERROR, compose("image sizes for frame %1 differ", frame)); return false; } @@ -186,12 +186,12 @@ PictureAsset::frame_buffer_equals ( auto const std_dev = sqrt (double (total_squared_deviation) / abs_diffs.size()); - note (NoteType::NOTE, String::compose("mean difference %1 deviation %2", mean, std_dev)); + note (NoteType::NOTE, compose("mean difference %1 deviation %2", mean, std_dev)); if (mean > opt.max_mean_pixel_error) { note ( NoteType::ERROR, - String::compose ("mean %1 out of range %2 in frame %3", mean, opt.max_mean_pixel_error, frame) + compose("mean %1 out of range %2 in frame %3", mean, opt.max_mean_pixel_error, frame) ); return false; @@ -200,7 +200,7 @@ PictureAsset::frame_buffer_equals ( if (std_dev > opt.max_std_dev_pixel_error) { note ( NoteType::ERROR, - String::compose ("standard deviation %1 out of range %2 in frame %3", std_dev, opt.max_std_dev_pixel_error, frame) + compose("standard deviation %1 out of range %2 in frame %3", std_dev, opt.max_std_dev_pixel_error, frame) ); return false; diff --git a/src/reel_asset.cc b/src/reel_asset.cc index 1807ae66..8e8e6b2d 100644 --- a/src/reel_asset.cc +++ b/src/reel_asset.cc @@ -139,7 +139,7 @@ ReelAsset::asset_equals (shared_ptr<const ReelAsset> other, EqualityOptions opt, } if (_intrinsic_duration != other->_intrinsic_duration) { - note (NoteType::ERROR, String::compose ("Reel: intrinsic durations differ (%1 vs %2)", _intrinsic_duration, other->_intrinsic_duration)); + note (NoteType::ERROR, compose("Reel: intrinsic durations differ (%1 vs %2)", _intrinsic_duration, other->_intrinsic_duration)); return false; } diff --git a/src/reel_picture_asset.cc b/src/reel_picture_asset.cc index 15ccf013..795122ac 100644 --- a/src/reel_picture_asset.cc +++ b/src/reel_picture_asset.cc @@ -91,7 +91,7 @@ ReelPictureAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const { auto asset = ReelFileAsset::write_to_cpl (node, standard); - asset->add_child("FrameRate")->add_child_text(String::compose("%1 %2", _frame_rate.numerator, _frame_rate.denominator)); + asset->add_child("FrameRate")->add_child_text(compose("%1 %2", _frame_rate.numerator, _frame_rate.denominator)); if (standard == Standard::INTEROP) { @@ -116,7 +116,7 @@ ReelPictureAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const asset->add_child("ScreenAspectRatio")->add_child_text(raw_convert<string>(closest.get(), 2, true)); } else { asset->add_child("ScreenAspectRatio")->add_child_text( - String::compose ("%1 %2", _screen_aspect_ratio.numerator, _screen_aspect_ratio.denominator) + compose("%1 %2", _screen_aspect_ratio.numerator, _screen_aspect_ratio.denominator) ); } diff --git a/src/rgb_xyz.cc b/src/rgb_xyz.cc index 734d5a95..4e83944b 100644 --- a/src/rgb_xyz.cc +++ b/src/rgb_xyz.cc @@ -180,21 +180,21 @@ dcp::xyz_to_rgb ( if (cx < 0 || cx > 4095) { if (note) { - note.get()(NoteType::NOTE, String::compose("XYZ value %1 out of range", cx)); + note.get()(NoteType::NOTE, compose("XYZ value %1 out of range", cx)); } cx = max (min (cx, 4095), 0); } if (cy < 0 || cy > 4095) { if (note) { - note.get()(NoteType::NOTE, String::compose("XYZ value %1 out of range", cy)); + note.get()(NoteType::NOTE, compose("XYZ value %1 out of range", cy)); } cy = max (min (cy, 4095), 0); } if (cz < 0 || cz > 4095) { if (note) { - note.get()(NoteType::NOTE, String::compose("XYZ value %1 out of range", cz)); + note.get()(NoteType::NOTE, compose("XYZ value %1 out of range", cz)); } cz = max (min (cz, 4095), 0); } @@ -322,7 +322,7 @@ dcp::rgb_to_xyz ( } if (clamped && note) { - note.get()(NoteType::NOTE, String::compose("%1 XYZ value(s) clamped", clamped)); + note.get()(NoteType::NOTE, compose("%1 XYZ value(s) clamped", clamped)); } return xyz; diff --git a/src/smpte_subtitle_asset.cc b/src/smpte_subtitle_asset.cc index 19ef8b5b..8645c828 100644 --- a/src/smpte_subtitle_asset.cc +++ b/src/smpte_subtitle_asset.cc @@ -123,7 +123,7 @@ SMPTESubtitleAsset::SMPTESubtitleAsset (boost::filesystem::path file) } catch (cxml::Error& e) { boost::throw_exception ( ReadError ( - String::compose ( + compose( "Failed to read subtitle file %1; MXF failed with %2, XML failed with %3", file, static_cast<int>(r), e.what() ) @@ -138,11 +138,11 @@ SMPTESubtitleAsset::SMPTESubtitleAsset (boost::filesystem::path file) auto im = dynamic_pointer_cast<SubtitleImage>(i); if (im && im->png_image().size() == 0) { /* Even more dubious; allow <id>.png or urn:uuid:<id>.png */ - auto p = file.parent_path() / String::compose("%1.png", im->id()); + auto p = file.parent_path() / compose("%1.png", im->id()); if (boost::filesystem::is_regular_file(p)) { im->read_png_file (p); } else if (starts_with (im->id(), "urn:uuid:")) { - p = file.parent_path() / String::compose("%1.png", remove_urn_uuid(im->id())); + p = file.parent_path() / compose("%1.png", remove_urn_uuid(im->id())); if (boost::filesystem::is_regular_file(p)) { im->read_png_file (p); } @@ -303,7 +303,7 @@ SMPTESubtitleAsset::set_key (Key key) if (ASDCP_FAILURE (r)) { boost::throw_exception ( ReadError ( - String::compose ("Could not read encrypted subtitle MXF (%1)", static_cast<int> (r)) + compose("Could not read encrypted subtitle MXF (%1)", static_cast<int> (r)) ) ); } @@ -520,7 +520,7 @@ SMPTESubtitleAsset::equals (shared_ptr<const Asset> other_asset, EqualityOptions } if (_language != other->_language) { - note (NoteType::ERROR, String::compose("Subtitle languages differ (`%1' vs `%2')", _language.get_value_or("[none]"), other->_language.get_value_or("[none]"))); + note (NoteType::ERROR, compose("Subtitle languages differ (`%1' vs `%2')", _language.get_value_or("[none]"), other->_language.get_value_or("[none]"))); return false; } diff --git a/src/sound_asset.cc b/src/sound_asset.cc index bbb21913..83b86d63 100644 --- a/src/sound_asset.cc +++ b/src/sound_asset.cc @@ -146,7 +146,7 @@ SoundAsset::equals (shared_ptr<const Asset> other, EqualityOptions opt, NoteHand if (desc_A.EditRate != desc_B.EditRate) { note ( NoteType::ERROR, - String::compose ( + compose( "audio edit rates differ: %1/%2 cf %3/%4", desc_A.EditRate.Numerator, desc_A.EditRate.Denominator, desc_B.EditRate.Numerator, desc_B.EditRate.Denominator ) @@ -155,7 +155,7 @@ SoundAsset::equals (shared_ptr<const Asset> other, EqualityOptions opt, NoteHand } else if (desc_A.AudioSamplingRate != desc_B.AudioSamplingRate) { note ( NoteType::ERROR, - String::compose ( + compose( "audio sampling rates differ: %1 cf %2", desc_A.AudioSamplingRate.Numerator, desc_A.AudioSamplingRate.Denominator, desc_B.AudioSamplingRate.Numerator, desc_B.AudioSamplingRate.Numerator @@ -163,25 +163,25 @@ SoundAsset::equals (shared_ptr<const Asset> other, EqualityOptions opt, NoteHand ); return false; } else if (desc_A.Locked != desc_B.Locked) { - note (NoteType::ERROR, String::compose ("audio locked flags differ: %1 cf %2", desc_A.Locked, desc_B.Locked)); + note (NoteType::ERROR, compose("audio locked flags differ: %1 cf %2", desc_A.Locked, desc_B.Locked)); return false; } else if (desc_A.ChannelCount != desc_B.ChannelCount) { - note (NoteType::ERROR, String::compose ("audio channel counts differ: %1 cf %2", desc_A.ChannelCount, desc_B.ChannelCount)); + note (NoteType::ERROR, compose("audio channel counts differ: %1 cf %2", desc_A.ChannelCount, desc_B.ChannelCount)); return false; } else if (desc_A.QuantizationBits != desc_B.QuantizationBits) { - note (NoteType::ERROR, String::compose ("audio bits per sample differ: %1 cf %2", desc_A.QuantizationBits, desc_B.QuantizationBits)); + note (NoteType::ERROR, compose("audio bits per sample differ: %1 cf %2", desc_A.QuantizationBits, desc_B.QuantizationBits)); return false; } else if (desc_A.BlockAlign != desc_B.BlockAlign) { - note (NoteType::ERROR, String::compose ("audio bytes per sample differ: %1 cf %2", desc_A.BlockAlign, desc_B.BlockAlign)); + note (NoteType::ERROR, compose("audio bytes per sample differ: %1 cf %2", desc_A.BlockAlign, desc_B.BlockAlign)); return false; } else if (desc_A.AvgBps != desc_B.AvgBps) { - note (NoteType::ERROR, String::compose ("audio average bps differ: %1 cf %2", desc_A.AvgBps, desc_B.AvgBps)); + note (NoteType::ERROR, compose("audio average bps differ: %1 cf %2", desc_A.AvgBps, desc_B.AvgBps)); return false; } else if (desc_A.LinkedTrackID != desc_B.LinkedTrackID) { - note (NoteType::ERROR, String::compose ("audio linked track IDs differ: %1 cf %2", desc_A.LinkedTrackID, desc_B.LinkedTrackID)); + note (NoteType::ERROR, compose("audio linked track IDs differ: %1 cf %2", desc_A.LinkedTrackID, desc_B.LinkedTrackID)); return false; } else if (desc_A.ContainerDuration != desc_B.ContainerDuration) { - note (NoteType::ERROR, String::compose ("audio container durations differ: %1 cf %2", desc_A.ContainerDuration, desc_B.ContainerDuration)); + note (NoteType::ERROR, compose("audio container durations differ: %1 cf %2", desc_A.ContainerDuration, desc_B.ContainerDuration)); return false; } else if (desc_A.ChannelFormat != desc_B.ChannelFormat) { /* XXX */ @@ -198,7 +198,7 @@ SoundAsset::equals (shared_ptr<const Asset> other, EqualityOptions opt, NoteHand auto frame_B = other_reader->get_frame (i); if (frame_A->size() != frame_B->size()) { - note (NoteType::ERROR, String::compose ("sizes of audio data for frame %1 differ", i)); + note (NoteType::ERROR, compose("sizes of audio data for frame %1 differ", i)); return false; } @@ -207,7 +207,7 @@ SoundAsset::equals (shared_ptr<const Asset> other, EqualityOptions opt, NoteHand for (int channel = 0; channel < frame_A->channels(); ++channel) { int32_t const d = abs(frame_A->get(channel, sample) - frame_B->get(channel, sample)); if (d > opt.max_audio_sample_error) { - note (NoteType::ERROR, String::compose("PCM data difference of %1 in frame %2, channel %3, sample %4", d, i, channel, sample)); + note (NoteType::ERROR, compose("PCM data difference of %1 in frame %2, channel %3, sample %4", d, i, channel, sample)); return false; } } diff --git a/src/sound_asset_writer.cc b/src/sound_asset_writer.cc index 346dcc12..29f3360d 100644 --- a/src/sound_asset_writer.cc +++ b/src/sound_asset_writer.cc @@ -242,7 +242,7 @@ SoundAssetWriter::write_current_frame () { auto const r = _state->mxf_writer.WriteFrame (_state->frame_buffer, _crypto_context->context(), _crypto_context->hmac()); if (ASDCP_FAILURE(r)) { - boost::throw_exception (MiscError(String::compose("could not write audio MXF frame (%1)", static_cast<int>(r)))); + boost::throw_exception (MiscError(compose("could not write audio MXF frame (%1)", static_cast<int>(r)))); } ++_frames_written; @@ -263,7 +263,7 @@ SoundAssetWriter::finalize () if (_started) { auto const r = _state->mxf_writer.Finalize(); if (ASDCP_FAILURE(r)) { - boost::throw_exception (MiscError(String::compose ("could not finalise audio MXF (%1)", static_cast<int>(r)))); + boost::throw_exception (MiscError(compose("could not finalise audio MXF (%1)", static_cast<int>(r)))); } } diff --git a/src/stereo_picture_frame.cc b/src/stereo_picture_frame.cc index 46a0ef80..be45c847 100644 --- a/src/stereo_picture_frame.cc +++ b/src/stereo_picture_frame.cc @@ -102,7 +102,7 @@ StereoPictureFrame::StereoPictureFrame (ASDCP::JP2K::MXFSReader* reader, int n, _buffer = make_shared<ASDCP::JP2K::SFrameBuffer>(4 * Kumu::Megabyte); if (ASDCP_FAILURE (reader->ReadFrame (n, *_buffer, c->context(), check_hmac ? c->hmac() : nullptr))) { - boost::throw_exception (ReadError (String::compose ("could not read video frame %1 of %2", n))); + boost::throw_exception (ReadError (compose("could not read video frame %1 of %2", n))); } } diff --git a/src/subtitle_asset.cc b/src/subtitle_asset.cc index e236b77a..c540c96c 100644 --- a/src/subtitle_asset.cc +++ b/src/subtitle_asset.cc @@ -88,7 +88,7 @@ string_attribute (xmlpp::Element const * node, string name) { auto a = node->get_attribute (name); if (!a) { - throw XMLError (String::compose ("missing attribute %1", name)); + throw XMLError (compose("missing attribute %1", name)); } return string (a->get_value ()); } @@ -524,7 +524,7 @@ SubtitleAsset::equals (shared_ptr<const Asset> other_asset, EqualityOptions opti } if (_subtitles.size() != other->_subtitles.size()) { - note (NoteType::ERROR, String::compose("different number of subtitles: %1 vs %2", _subtitles.size(), other->_subtitles.size())); + note (NoteType::ERROR, compose("different number of subtitles: %1 vs %2", _subtitles.size(), other->_subtitles.size())); return false; } @@ -543,7 +543,7 @@ SubtitleAsset::equals (shared_ptr<const Asset> other_asset, EqualityOptions opti } if (string_i && *string_i != *string_j) { - note (NoteType::ERROR, String::compose("subtitles differ in text or metadata: %1 vs %2", string_i->text(), string_j->text())); + note (NoteType::ERROR, compose("subtitles differ in text or metadata: %1 vs %2", string_i->text(), string_j->text())); return false; } diff --git a/src/types.cc b/src/types.cc index 40ceb18c..3e50af38 100644 --- a/src/types.cc +++ b/src/types.cc @@ -91,7 +91,7 @@ Fraction::Fraction (string s) string Fraction::as_string () const { - return String::compose ("%1 %2", numerator, denominator); + return compose("%1 %2", numerator, denominator); } @@ -505,7 +505,7 @@ void Luminance::set_value (float v) { if (v < 0) { - throw dcp::MiscError (String::compose("Invalid luminance value %1", v)); + throw dcp::MiscError (compose("Invalid luminance value %1", v)); } _value = v; @@ -546,7 +546,7 @@ Luminance::string_to_unit (string u) return Unit::FOOT_LAMBERT; } - throw XMLError (String::compose("Invalid luminance unit %1", u)); + throw XMLError (compose("Invalid luminance unit %1", u)); } diff --git a/src/util.cc b/src/util.cc index a36e2429..222b5a05 100644 --- a/src/util.cc +++ b/src/util.cc @@ -281,7 +281,7 @@ dcp::file_to_string (boost::filesystem::path p, uintmax_t max_length) { auto len = boost::filesystem::file_size (p); if (len > max_length) { - throw MiscError (String::compose("Unexpectedly long file (%1)", p.string())); + throw MiscError (compose("Unexpectedly long file (%1)", p.string())); } auto f = fopen_boost (p, "r"); @@ -414,7 +414,7 @@ dcp::unique_string (vector<string> existing, string base) { int const max_tries = existing.size() + 1; for (int i = 0; i < max_tries; ++i) { - string trial = String::compose("%1%2", base, i); + string trial = compose("%1%2", base, i); if (find(existing.begin(), existing.end(), trial) == existing.end()) { return trial; } diff --git a/src/verify.cc b/src/verify.cc index 6e335c6f..47ae205f 100644 --- a/src/verify.cc +++ b/src/verify.cc @@ -335,7 +335,7 @@ validate_xml (T xml, boost::filesystem::path xsd_dtd_directory, vector<Verificat */ string locations; for (auto i: schema) { - locations += String::compose("%1 %1 ", i, i); + locations += compose("%1 %1 ", i, i); } parser.setExternalSchemaLocation(locations.c_str()); @@ -519,7 +519,7 @@ verify_main_picture_asset ( notes.push_back({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INVALID_PICTURE_SIZE_IN_PIXELS, - String::compose("%1x%2", asset->size().width, asset->size().height), + compose("%1x%2", asset->size().width, asset->size().height), file }); } @@ -532,7 +532,7 @@ verify_main_picture_asset ( notes.push_back({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INVALID_PICTURE_FRAME_RATE_FOR_2K, - String::compose("%1/%2", asset->edit_rate().numerator, asset->edit_rate().denominator), + compose("%1/%2", asset->edit_rate().numerator, asset->edit_rate().denominator), file }); } @@ -543,7 +543,7 @@ verify_main_picture_asset ( notes.push_back({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INVALID_PICTURE_FRAME_RATE_FOR_4K, - String::compose("%1/%2", asset->edit_rate().numerator, asset->edit_rate().denominator), + compose("%1/%2", asset->edit_rate().numerator, asset->edit_rate().denominator), file }); } @@ -553,7 +553,7 @@ verify_main_picture_asset ( notes.push_back({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INVALID_PICTURE_ASSET_RESOLUTION_FOR_3D, - String::compose("%1/%2", asset->edit_rate().numerator, asset->edit_rate().denominator), + compose("%1/%2", asset->edit_rate().numerator, asset->edit_rate().denominator), file }); @@ -679,7 +679,7 @@ verify_smpte_timed_text_asset ( { VerificationNote::Type::BV21_ERROR, VerificationNote::Code::MISMATCHED_TIMED_TEXT_DURATION, - String::compose("%1 %2", *reel_asset_duration, asset->intrinsic_duration()), + compose("%1 %2", *reel_asset_duration, asset->intrinsic_duration()), asset->file().get() }); } @@ -1287,7 +1287,7 @@ dcp::verify ( notes.push_back ({ VerificationNote::Type::ERROR, VerificationNote::Code::INVALID_PICTURE_FRAME_RATE, - String::compose("%1/%2", frame_rate.numerator, frame_rate.denominator) + compose("%1/%2", frame_rate.numerator, frame_rate.denominator) }); } /* Check asset */ @@ -1460,65 +1460,65 @@ dcp::note_to_string (VerificationNote note) case VerificationNote::Code::FAILED_READ: return *note.note(); case VerificationNote::Code::MISMATCHED_CPL_HASHES: - return String::compose("The hash of the CPL %1 in the PKL does not agree with the CPL file.", note.note().get()); + return compose("The hash of the CPL %1 in the PKL does not agree with the CPL file.", note.note().get()); case VerificationNote::Code::INVALID_PICTURE_FRAME_RATE: - return String::compose("The picture in a reel has an invalid frame rate %1.", note.note().get()); + return compose("The picture in a reel has an invalid frame rate %1.", note.note().get()); case VerificationNote::Code::INCORRECT_PICTURE_HASH: - return String::compose("The hash of the picture asset %1 does not agree with the PKL file.", note.file()->filename()); + return compose("The hash of the picture asset %1 does not agree with the PKL file.", note.file()->filename()); case VerificationNote::Code::MISMATCHED_PICTURE_HASHES: - return String::compose("The PKL and CPL hashes differ for the picture asset %1.", note.file()->filename()); + return compose("The PKL and CPL hashes differ for the picture asset %1.", note.file()->filename()); case VerificationNote::Code::INCORRECT_SOUND_HASH: - return String::compose("The hash of the sound asset %1 does not agree with the PKL file.", note.file()->filename()); + return compose("The hash of the sound asset %1 does not agree with the PKL file.", note.file()->filename()); case VerificationNote::Code::MISMATCHED_SOUND_HASHES: - return String::compose("The PKL and CPL hashes differ for the sound asset %1.", note.file()->filename()); + return compose("The PKL and CPL hashes differ for the sound asset %1.", note.file()->filename()); case VerificationNote::Code::EMPTY_ASSET_PATH: return "The asset map contains an empty asset path."; case VerificationNote::Code::MISSING_ASSET: - return String::compose("The file %1 for an asset in the asset map cannot be found.", note.file()->filename()); + return compose("The file %1 for an asset in the asset map cannot be found.", note.file()->filename()); case VerificationNote::Code::MISMATCHED_STANDARD: return "The DCP contains both SMPTE and Interop parts."; case VerificationNote::Code::INVALID_XML: - return String::compose("An XML file is badly formed: %1 (%2:%3)", note.note().get(), note.file()->filename(), note.line().get()); + return compose("An XML file is badly formed: %1 (%2:%3)", note.note().get(), note.file()->filename(), note.line().get()); case VerificationNote::Code::MISSING_ASSETMAP: return "No ASSETMAP or ASSETMAP.xml was found."; case VerificationNote::Code::INVALID_INTRINSIC_DURATION: - return String::compose("The intrinsic duration of the asset %1 is less than 1 second.", note.note().get()); + return compose("The intrinsic duration of the asset %1 is less than 1 second.", note.note().get()); case VerificationNote::Code::INVALID_DURATION: - return String::compose("The duration of the asset %1 is less than 1 second.", note.note().get()); + return compose("The duration of the asset %1 is less than 1 second.", note.note().get()); case VerificationNote::Code::INVALID_PICTURE_FRAME_SIZE_IN_BYTES: - return String::compose("The instantaneous bit rate of the picture asset %1 is larger than the limit of 250Mbit/s in at least one place.", note.file()->filename()); + return compose("The instantaneous bit rate of the picture asset %1 is larger than the limit of 250Mbit/s in at least one place.", note.file()->filename()); case VerificationNote::Code::NEARLY_INVALID_PICTURE_FRAME_SIZE_IN_BYTES: - return String::compose("The instantaneous bit rate of the picture asset %1 is close to the limit of 250Mbit/s in at least one place.", note.file()->filename()); + return compose("The instantaneous bit rate of the picture asset %1 is close to the limit of 250Mbit/s in at least one place.", note.file()->filename()); case VerificationNote::Code::EXTERNAL_ASSET: - return String::compose("The asset %1 that this DCP refers to is not included in the DCP. It may be a VF.", note.note().get()); + return compose("The asset %1 that this DCP refers to is not included in the DCP. It may be a VF.", note.note().get()); case VerificationNote::Code::THREED_ASSET_MARKED_AS_TWOD: - return String::compose("The asset %1 is 3D but its MXF is marked as 2D.", note.file()->filename()); + return compose("The asset %1 is 3D but its MXF is marked as 2D.", note.file()->filename()); case VerificationNote::Code::INVALID_STANDARD: return "This DCP does not use the SMPTE standard."; case VerificationNote::Code::INVALID_LANGUAGE: - return String::compose("The DCP specifies a language '%1' which does not conform to the RFC 5646 standard.", note.note().get()); + return compose("The DCP specifies a language '%1' which does not conform to the RFC 5646 standard.", note.note().get()); case VerificationNote::Code::INVALID_PICTURE_SIZE_IN_PIXELS: - return String::compose("The size %1 of picture asset %2 is not allowed.", note.note().get(), note.file()->filename()); + return compose("The size %1 of picture asset %2 is not allowed.", note.note().get(), note.file()->filename()); case VerificationNote::Code::INVALID_PICTURE_FRAME_RATE_FOR_2K: - return String::compose("The frame rate %1 of picture asset %2 is not allowed for 2K DCPs.", note.note().get(), note.file()->filename()); + return compose("The frame rate %1 of picture asset %2 is not allowed for 2K DCPs.", note.note().get(), note.file()->filename()); case VerificationNote::Code::INVALID_PICTURE_FRAME_RATE_FOR_4K: - return String::compose("The frame rate %1 of picture asset %2 is not allowed for 4K DCPs.", note.note().get(), note.file()->filename()); + return compose("The frame rate %1 of picture asset %2 is not allowed for 4K DCPs.", note.note().get(), note.file()->filename()); case VerificationNote::Code::INVALID_PICTURE_ASSET_RESOLUTION_FOR_3D: return "3D 4K DCPs are not allowed."; case VerificationNote::Code::INVALID_CLOSED_CAPTION_XML_SIZE_IN_BYTES: - return String::compose("The size %1 of the closed caption asset %2 is larger than the 256KB maximum.", note.note().get(), note.file()->filename()); + return compose("The size %1 of the closed caption asset %2 is larger than the 256KB maximum.", note.note().get(), note.file()->filename()); case VerificationNote::Code::INVALID_TIMED_TEXT_SIZE_IN_BYTES: - return String::compose("The size %1 of the timed text asset %2 is larger than the 115MB maximum.", note.note().get(), note.file()->filename()); + return compose("The size %1 of the timed text asset %2 is larger than the 115MB maximum.", note.note().get(), note.file()->filename()); case VerificationNote::Code::INVALID_TIMED_TEXT_FONT_SIZE_IN_BYTES: - return String::compose("The size %1 of the fonts in timed text asset %2 is larger than the 10MB maximum.", note.note().get(), note.file()->filename()); + return compose("The size %1 of the fonts in timed text asset %2 is larger than the 10MB maximum.", note.note().get(), note.file()->filename()); case VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE: - return String::compose("The XML for the SMPTE subtitle asset %1 has no <Language> tag.", note.file()->filename()); + return compose("The XML for the SMPTE subtitle asset %1 has no <Language> tag.", note.file()->filename()); case VerificationNote::Code::MISMATCHED_SUBTITLE_LANGUAGES: return "Some subtitle assets have different <Language> tags than others"; case VerificationNote::Code::MISSING_SUBTITLE_START_TIME: - return String::compose("The XML for the SMPTE subtitle asset %1 has no <StartTime> tag.", note.file()->filename()); + return compose("The XML for the SMPTE subtitle asset %1 has no <StartTime> tag.", note.file()->filename()); case VerificationNote::Code::INVALID_SUBTITLE_START_TIME: - return String::compose("The XML for a SMPTE subtitle asset %1 has a non-zero <StartTime> tag.", note.file()->filename()); + return compose("The XML for a SMPTE subtitle asset %1 has a non-zero <StartTime> tag.", note.file()->filename()); case VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME: return "The first subtitle or closed caption is less than 4 seconds from the start of the DCP."; case VerificationNote::Code::INVALID_SUBTITLE_DURATION: @@ -1538,11 +1538,11 @@ dcp::note_to_string (VerificationNote note) case VerificationNote::Code::INVALID_CLOSED_CAPTION_LINE_LENGTH: return "There are more than 32 characters in at least one closed caption line."; case VerificationNote::Code::INVALID_SOUND_FRAME_RATE: - return String::compose("The sound asset %1 has a sampling rate of %2", note.file()->filename(), note.note().get()); + return compose("The sound asset %1 has a sampling rate of %2", note.file()->filename(), note.note().get()); case VerificationNote::Code::MISSING_CPL_ANNOTATION_TEXT: - return String::compose("The CPL %1 has no <AnnotationText> tag.", note.note().get()); + return compose("The CPL %1 has no <AnnotationText> tag.", note.note().get()); case VerificationNote::Code::MISMATCHED_CPL_ANNOTATION_TEXT: - return String::compose("The CPL %1 has an <AnnotationText> which differs from its <ContentTitleText>", note.note().get()); + return compose("The CPL %1 has an <AnnotationText> which differs from its <ContentTitleText>", note.note().get()); case VerificationNote::Code::MISMATCHED_ASSET_DURATION: return "All assets in a reel do not have the same duration."; case VerificationNote::Code::MISSING_MAIN_SUBTITLE_FROM_SOME_REELS: @@ -1550,15 +1550,15 @@ dcp::note_to_string (VerificationNote note) case VerificationNote::Code::MISMATCHED_CLOSED_CAPTION_ASSET_COUNTS: return "At least one reel has closed captions, but reels have different numbers of closed caption assets."; case VerificationNote::Code::MISSING_SUBTITLE_ENTRY_POINT: - return String::compose("The subtitle asset %1 has no <EntryPoint> tag.", note.note().get()); + return compose("The subtitle asset %1 has no <EntryPoint> tag.", note.note().get()); case VerificationNote::Code::INCORRECT_SUBTITLE_ENTRY_POINT: - return String::compose("The subtitle asset %1 has an <EntryPoint> other than 0.", note.note().get()); + return compose("The subtitle asset %1 has an <EntryPoint> other than 0.", note.note().get()); case VerificationNote::Code::MISSING_CLOSED_CAPTION_ENTRY_POINT: - return String::compose("The closed caption asset %1 has no <EntryPoint> tag.", note.note().get()); + return compose("The closed caption asset %1 has no <EntryPoint> tag.", note.note().get()); case VerificationNote::Code::INCORRECT_CLOSED_CAPTION_ENTRY_POINT: - return String::compose("The closed caption asset %1 has an <EntryPoint> other than 0.", note.note().get()); + return compose("The closed caption asset %1 has an <EntryPoint> other than 0.", note.note().get()); case VerificationNote::Code::MISSING_HASH: - return String::compose("The asset %1 has no <Hash> tag in the CPL.", note.note().get()); + return compose("The asset %1 has no <Hash> tag in the CPL.", note.note().get()); case VerificationNote::Code::MISSING_FFEC_IN_FEATURE: return "The DCP is marked as a Feature but there is no FFEC (first frame of end credits) marker"; case VerificationNote::Code::MISSING_FFMC_IN_FEATURE: @@ -1568,49 +1568,49 @@ dcp::note_to_string (VerificationNote note) case VerificationNote::Code::MISSING_LFOC: return "There should be a LFOC (last frame of content) marker"; case VerificationNote::Code::INCORRECT_FFOC: - return String::compose("The FFOC marker is %1 instead of 1", note.note().get()); + return compose("The FFOC marker is %1 instead of 1", note.note().get()); case VerificationNote::Code::INCORRECT_LFOC: - return String::compose("The LFOC marker is %1 instead of 1 less than the duration of the last reel.", note.note().get()); + return compose("The LFOC marker is %1 instead of 1 less than the duration of the last reel.", note.note().get()); case VerificationNote::Code::MISSING_CPL_METADATA: - return String::compose("The CPL %1 has no <CompositionMetadataAsset> tag.", note.note().get()); + return compose("The CPL %1 has no <CompositionMetadataAsset> tag.", note.note().get()); case VerificationNote::Code::MISSING_CPL_METADATA_VERSION_NUMBER: - return String::compose("The CPL %1 has no <VersionNumber> in its <CompositionMetadataAsset>.", note.note().get()); + return compose("The CPL %1 has no <VersionNumber> in its <CompositionMetadataAsset>.", note.note().get()); case VerificationNote::Code::MISSING_EXTENSION_METADATA: - return String::compose("The CPL %1 has no <ExtensionMetadata> in its <CompositionMetadataAsset>.", note.note().get()); + return compose("The CPL %1 has no <ExtensionMetadata> in its <CompositionMetadataAsset>.", note.note().get()); case VerificationNote::Code::INVALID_EXTENSION_METADATA: - return String::compose("The CPL %1 has a malformed <ExtensionMetadata> (%2).", note.file()->filename(), note.note().get()); + return compose("The CPL %1 has a malformed <ExtensionMetadata> (%2).", note.file()->filename(), note.note().get()); case VerificationNote::Code::UNSIGNED_CPL_WITH_ENCRYPTED_CONTENT: - return String::compose("The CPL %1, which has encrypted content, is not signed.", note.note().get()); + return compose("The CPL %1, which has encrypted content, is not signed.", note.note().get()); case VerificationNote::Code::UNSIGNED_PKL_WITH_ENCRYPTED_CONTENT: - return String::compose("The PKL %1, which has encrypted content, is not signed.", note.note().get()); + return compose("The PKL %1, which has encrypted content, is not signed.", note.note().get()); case VerificationNote::Code::MISMATCHED_PKL_ANNOTATION_TEXT_WITH_CPL: - return String::compose("The PKL %1 has only one CPL but its <AnnotationText> does not match the CPL's <ContentTitleText>.", note.note().get()); + return compose("The PKL %1 has only one CPL but its <AnnotationText> does not match the CPL's <ContentTitleText>.", note.note().get()); case VerificationNote::Code::PARTIALLY_ENCRYPTED: return "Some assets are encrypted but some are not."; case VerificationNote::Code::INVALID_JPEG2000_CODESTREAM: - return String::compose("The JPEG2000 codestream for at least one frame is invalid (%1)", note.note().get()); + return compose("The JPEG2000 codestream for at least one frame is invalid (%1)", note.note().get()); case VerificationNote::Code::INVALID_JPEG2000_GUARD_BITS_FOR_2K: - return String::compose("The JPEG2000 codestream uses %1 guard bits in a 2K image instead of 1.", note.note().get()); + return compose("The JPEG2000 codestream uses %1 guard bits in a 2K image instead of 1.", note.note().get()); case VerificationNote::Code::INVALID_JPEG2000_GUARD_BITS_FOR_4K: - return String::compose("The JPEG2000 codestream uses %1 guard bits in a 4K image instead of 2.", note.note().get()); + return compose("The JPEG2000 codestream uses %1 guard bits in a 4K image instead of 2.", note.note().get()); case VerificationNote::Code::INVALID_JPEG2000_TILE_SIZE: return "The JPEG2000 tile size is not the same as the image size."; case VerificationNote::Code::INVALID_JPEG2000_CODE_BLOCK_WIDTH: - return String::compose("The JPEG2000 codestream uses a code block width of %1 instead of 32.", note.note().get()); + return compose("The JPEG2000 codestream uses a code block width of %1 instead of 32.", note.note().get()); case VerificationNote::Code::INVALID_JPEG2000_CODE_BLOCK_HEIGHT: - return String::compose("The JPEG2000 codestream uses a code block height of %1 instead of 32.", note.note().get()); + return compose("The JPEG2000 codestream uses a code block height of %1 instead of 32.", note.note().get()); case VerificationNote::Code::INCORRECT_JPEG2000_POC_MARKER_COUNT_FOR_2K: - return String::compose("%1 POC markers found in 2K JPEG2000 codestream instead of 0.", note.note().get()); + return compose("%1 POC markers found in 2K JPEG2000 codestream instead of 0.", note.note().get()); case VerificationNote::Code::INCORRECT_JPEG2000_POC_MARKER_COUNT_FOR_4K: - return String::compose("%1 POC markers found in 4K JPEG2000 codestream instead of 1.", note.note().get()); + return compose("%1 POC markers found in 4K JPEG2000 codestream instead of 1.", note.note().get()); case VerificationNote::Code::INCORRECT_JPEG2000_POC_MARKER: - return String::compose("Incorrect POC marker content found (%1)", note.note().get()); + return compose("Incorrect POC marker content found (%1)", note.note().get()); case VerificationNote::Code::INVALID_JPEG2000_POC_MARKER_LOCATION: return "POC marker found outside main header"; case VerificationNote::Code::INVALID_JPEG2000_TILE_PARTS_FOR_2K: - return String::compose("The JPEG2000 codestream has %1 tile parts in a 2K image instead of 3.", note.note().get()); + return compose("The JPEG2000 codestream has %1 tile parts in a 2K image instead of 3.", note.note().get()); case VerificationNote::Code::INVALID_JPEG2000_TILE_PARTS_FOR_4K: - return String::compose("The JPEG2000 codestream has %1 tile parts in a 4K image instead of 6.", note.note().get()); + return compose("The JPEG2000 codestream has %1 tile parts in a 4K image instead of 6.", note.note().get()); case VerificationNote::Code::MISSING_JPEG200_TLM_MARKER: return "No TLM marker was found in a JPEG2000 codestream."; case VerificationNote::Code::MISMATCHED_TIMED_TEXT_RESOURCE_ID: @@ -1622,7 +1622,7 @@ dcp::note_to_string (VerificationNote note) vector<string> parts; boost::split (parts, note.note().get(), boost::is_any_of(" ")); DCP_ASSERT (parts.size() == 2); - return String::compose("The reel duration of some timed text (%1) is not the same as the ContainerDuration of its MXF (%2).", parts[0], parts[1]); + return compose("The reel duration of some timed text (%1) is not the same as the ContainerDuration of its MXF (%2).", parts[0], parts[1]); } case VerificationNote::Code::MISSED_CHECK_OF_ENCRYPTED: return "Some aspect of this DCP could not be checked because it is encrypted."; diff --git a/src/verify_j2k.cc b/src/verify_j2k.cc index 5317b2f7..ea28596d 100644 --- a/src/verify_j2k.cc +++ b/src/verify_j2k.cc @@ -136,21 +136,21 @@ dcp::verify_j2k (shared_ptr<const Data> j2k, vector<VerificationNote>& notes) auto require_8 = [&](uint8_t value, string note) { auto v = get_8 (); if (v != value) { - throw InvalidCodestream (String::compose(note, v)); + throw InvalidCodestream (compose(note, v)); } }; auto require_16 = [&](uint16_t value, string note) { auto v = get_16 (); if (v != value) { - throw InvalidCodestream (String::compose(note, v)); + throw InvalidCodestream (compose(note, v)); } }; auto require_32 = [&](uint32_t value, string note) { auto v = get_32 (); if (v != value) { - throw InvalidCodestream (String::compose(note, v)); + throw InvalidCodestream (compose(note, v)); } }; @@ -198,7 +198,7 @@ dcp::verify_j2k (shared_ptr<const Data> j2k, vector<VerificationNote>& notes) if (!marker_name) { char buffer[16]; snprintf (buffer, 16, "%2x", marker_id); - throw InvalidCodestream(String::compose("unknown marker %1", buffer)); + throw InvalidCodestream(compose("unknown marker %1", buffer)); } else if (*marker_name == "SOT") { require_16(10, "invalid SOT size %1"); get_16(); // tile index @@ -287,13 +287,13 @@ dcp::verify_j2k (shared_ptr<const Data> j2k, vector<VerificationNote>& notes) auto require_8_poc = [&](uint16_t value, string note) { if (get_8() != value) { - notes.push_back ({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INCORRECT_JPEG2000_POC_MARKER, String::compose(note, value) }); + notes.push_back ({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INCORRECT_JPEG2000_POC_MARKER, compose(note, value) }); } }; auto require_16_poc = [&](uint16_t value, string note) { if (get_16() != value) { - notes.push_back ({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INCORRECT_JPEG2000_POC_MARKER, String::compose(note, value) }); + notes.push_back ({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INCORRECT_JPEG2000_POC_MARKER, compose(note, value) }); } }; |
