X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=test%2Fcpl_hash_test.cc;h=39c36561b5d97cb59835a2ad69a3abfe992ba9ab;hb=ce73eaf7875a9a3326afcd839ad85eb95879c160;hp=f34c295831db4dc8ee0b676770ccea7ba1ec6c18;hpb=41262015eb2bb1fc3da8585883420975de381a65;p=dcpomatic.git diff --git a/test/cpl_hash_test.cc b/test/cpl_hash_test.cc index f34c29583..39c36561b 100644 --- a/test/cpl_hash_test.cc +++ b/test/cpl_hash_test.cc @@ -35,7 +35,6 @@ using std::make_shared; -using std::shared_ptr; using std::string; @@ -44,27 +43,27 @@ BOOST_AUTO_TEST_CASE (hash_added_to_imported_dcp_test) using namespace boost::filesystem; string const ov_name = "hash_added_to_imported_dcp_test_ov"; - shared_ptr ov = new_test_film2 ( + auto ov = new_test_film2( ov_name, - { content_factory("test/data/flat_red.png").front() } + content_factory("test/data/flat_red.png") ); make_and_verify_dcp (ov); /* Remove tags from the CPL */ for (auto i: directory_iterator(String::compose("build/test/%1/%2", ov_name, ov->dcp_name()))) { if (boost::algorithm::starts_with(i.path().filename().string(), "cpl_")) { - auto in = fopen_boost(i.path(), "r"); + dcp::File in(i.path(), "r"); BOOST_REQUIRE (in); - auto out = fopen_boost(i.path().string() + ".tmp", "w"); + dcp::File out(i.path().string() + ".tmp", "w"); BOOST_REQUIRE (out); char buffer[256]; - while (fgets(buffer, sizeof(buffer), in)) { + while (in.gets(buffer, sizeof(buffer))) { if (string(buffer).find("Hash") == string::npos) { - fputs (buffer, out); + out.puts(buffer); } } - fclose (in); - fclose (out); + in.close(); + out.close(); rename (i.path().string() + ".tmp", i.path()); } } @@ -82,15 +81,14 @@ BOOST_AUTO_TEST_CASE (hash_added_to_imported_dcp_test) int hashes = 0; for (auto i: directory_iterator(String::compose("build/test/%1/%2", vf_name, vf->dcp_name()))) { if (boost::algorithm::starts_with(i.path().filename().string(), "cpl_")) { - auto in = fopen_boost(i.path(), "r"); + dcp::File in(i.path(), "r"); BOOST_REQUIRE (in); char buffer[256]; - while (fgets (buffer, sizeof(buffer), in)) { + while (in.gets(buffer, sizeof(buffer))) { if (string(buffer).find("Hash") != string::npos) { ++hashes; } } - fclose (in); } } BOOST_CHECK_EQUAL (hashes, 2);