From 96d6f783b7dfac04af8a7d77033a3d05e31cfc10 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 14 Jul 2021 02:02:17 +0200 Subject: [PATCH] C++11 tidying. --- src/reel_picture_asset.h | 2 +- src/subtitle.h | 2 +- test/atmos_test.cc | 4 +++- test/local_time_test.cc | 9 ++++++--- test/make_digest_test.cc | 8 +++++--- test/mca_test.cc | 6 +++--- tools/common.cc | 7 +++++-- tools/dcpkdm.cc | 17 +++++++++++------ 8 files changed, 35 insertions(+), 20 deletions(-) diff --git a/src/reel_picture_asset.h b/src/reel_picture_asset.h index e79c4455..64fa54f4 100644 --- a/src/reel_picture_asset.h +++ b/src/reel_picture_asset.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019 Carl Hetherington + Copyright (C) 2014-2021 Carl Hetherington This file is part of libdcp. diff --git a/src/subtitle.h b/src/subtitle.h index e0132dbe..c6a628b8 100644 --- a/src/subtitle.h +++ b/src/subtitle.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2018 Carl Hetherington + Copyright (C) 2012-2021 Carl Hetherington This file is part of libdcp. diff --git a/test/atmos_test.cc b/test/atmos_test.cc index 1ac0e1f1..a56de7af 100644 --- a/test/atmos_test.cc +++ b/test/atmos_test.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2015-2019 Carl Hetherington + Copyright (C) 2015-2021 Carl Hetherington This file is part of libdcp. @@ -31,11 +31,13 @@ files in the program, then also delete it here. */ + #include "atmos_asset.h" #include "test.h" #include #include + /** Check basic read of an Atmos asset */ BOOST_AUTO_TEST_CASE (atmos_read_test) { diff --git a/test/local_time_test.cc b/test/local_time_test.cc index 4ac92240..e80a863d 100644 --- a/test/local_time_test.cc +++ b/test/local_time_test.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2020 Carl Hetherington + Copyright (C) 2014-2021 Carl Hetherington This file is part of libdcp. @@ -31,9 +31,11 @@ files in the program, then also delete it here. */ -#include -#include "local_time.h" + #include "exceptions.h" +#include "local_time.h" +#include + /** Check that dcp::LocalTime works */ BOOST_AUTO_TEST_CASE (local_time_basic_test) @@ -139,6 +141,7 @@ BOOST_AUTO_TEST_CASE (local_time_basic_test) } } + BOOST_AUTO_TEST_CASE (local_time_add_minutes_test) { { diff --git a/test/make_digest_test.cc b/test/make_digest_test.cc index 7fefd809..9d37f837 100644 --- a/test/make_digest_test.cc +++ b/test/make_digest_test.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2016-2019 Carl Hetherington + Copyright (C) 2016-2021 Carl Hetherington This file is part of libdcp. @@ -38,11 +38,13 @@ #include #include + void progress (float) { } + /** Check SHA1 digests */ BOOST_AUTO_TEST_CASE (make_digest_test) { @@ -50,12 +52,12 @@ BOOST_AUTO_TEST_CASE (make_digest_test) srand (1); int const N = 256 * 1024 * 1024; dcp::ArrayData data (N); - uint8_t* p = data.data(); + auto p = data.data(); for (int i = 0; i < N; ++i) { *p++ = rand() & 0xff; } data.write ("build/test/random"); /* Hash it */ - BOOST_CHECK_EQUAL (dcp::make_digest ("build/test/random", boost::bind (&progress, _1)), "GKbk/V3fcRtP5MaPdSmAGNbKkaU="); + BOOST_CHECK_EQUAL (dcp::make_digest("build/test/random", boost::bind(&progress, _1)), "GKbk/V3fcRtP5MaPdSmAGNbKkaU="); } diff --git a/test/mca_test.cc b/test/mca_test.cc index bcedce78..12b4f2c6 100644 --- a/test/mca_test.cc +++ b/test/mca_test.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2020 Carl Hetherington + Copyright (C) 2020-2021 Carl Hetherington This file is part of libdcp. @@ -114,8 +114,8 @@ BOOST_AUTO_TEST_CASE (write_mca_descriptors_to_mxf_test) /* Make a CPL as a roundabout way to read the metadata we just wrote to the MXF */ - shared_ptr reel_sound_asset(new dcp::ReelSoundAsset(sound_asset, 0)); - shared_ptr reel(new dcp::Reel()); + auto reel_sound_asset = make_shared(sound_asset, 0); + auto reel = make_shared(); reel->add (black_picture_asset("build/test/write_mca_descriptors_to_mxf_test", 24)); reel->add (reel_sound_asset); diff --git a/tools/common.cc b/tools/common.cc index 54bee6b5..13ce9cb0 100644 --- a/tools/common.cc +++ b/tools/common.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014 Carl Hetherington + Copyright (C) 2014-2021 Carl Hetherington This file is part of libdcp. @@ -31,13 +31,15 @@ files in the program, then also delete it here. */ + #include "common.h" #include "dcp.h" -using std::dynamic_pointer_cast; + using std::shared_ptr; using std::vector; + void dcp::filter_notes (vector& notes, bool ignore_missing_assets) { @@ -52,3 +54,4 @@ dcp::filter_notes (vector& notes, bool ignore_missing_ass notes = filtered; } + diff --git a/tools/dcpkdm.cc b/tools/dcpkdm.cc index a3e099ba..20b07ebc 100644 --- a/tools/dcpkdm.cc +++ b/tools/dcpkdm.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2017-2019 Carl Hetherington + Copyright (C) 2017-2021 Carl Hetherington This file is part of libdcp. @@ -31,18 +31,21 @@ files in the program, then also delete it here. */ -#include "encrypted_kdm.h" + +#include "certificate_chain.h" #include "decrypted_kdm.h" -#include "util.h" +#include "encrypted_kdm.h" #include "exceptions.h" -#include "certificate_chain.h" +#include "util.h" #include -using std::string; -using std::cout; + using std::cerr; +using std::cout; +using std::string; using boost::optional; + static void help (string n) { @@ -51,6 +54,7 @@ help (string n) << " -p, --private-key private key file\n"; } + static string tm_to_string (struct tm t) { @@ -59,6 +63,7 @@ tm_to_string (struct tm t) return buffer; } + int main (int argc, char* argv[]) try -- 2.30.2