summaryrefslogtreecommitdiff
path: root/test/cpl_hash_test.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-04-16 22:20:54 +0200
committerCarl Hetherington <cth@carlh.net>2022-05-05 23:38:41 +0200
commit8a8c977c12fc65f1f50ea05099387e0fc8840e7d (patch)
tree2d2c8663652939d643779d1ab1c18a12813fcbd2 /test/cpl_hash_test.cc
parentefe153ab23b54cdbf28c653f2ccb0f25ca6bd015 (diff)
Use dcp::File in DCP-o-matic (#2231).
Diffstat (limited to 'test/cpl_hash_test.cc')
-rw-r--r--test/cpl_hash_test.cc17
1 files changed, 8 insertions, 9 deletions
diff --git a/test/cpl_hash_test.cc b/test/cpl_hash_test.cc
index f34c29583..56dc1974c 100644
--- a/test/cpl_hash_test.cc
+++ b/test/cpl_hash_test.cc
@@ -53,18 +53,18 @@ BOOST_AUTO_TEST_CASE (hash_added_to_imported_dcp_test)
/* Remove <Hash> 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 +82,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);