summaryrefslogtreecommitdiff
path: root/src/data.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-01-24 04:15:26 +0100
committerCarl Hetherington <cth@carlh.net>2021-01-24 04:15:26 +0100
commitceaf7bc52712cb60708ed5eb5c62c5e463dd8e89 (patch)
treec55e4b85ee30138ce83263045d77d01631378b2e /src/data.cc
parent6c37cc1979b2a01205a888c4c98f3334685ee8dd (diff)
Tidying.
Diffstat (limited to 'src/data.cc')
-rw-r--r--src/data.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/data.cc b/src/data.cc
index 23e62573..79f58f93 100644
--- a/src/data.cc
+++ b/src/data.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2015-2020 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2015-2021 Carl Hetherington <cth@carlh.net>
This file is part of libdcp.
@@ -32,9 +32,14 @@
*/
+/** @file src/data.cc
+ * @brief Data class
+ */
+
+
#include "data.h"
-#include "util.h"
#include "exceptions.h"
+#include "util.h"
#include <cstdio>
#include <cerrno>
@@ -45,16 +50,15 @@ using namespace dcp;
void
Data::write (boost::filesystem::path file) const
{
- FILE* f = fopen_boost (file, "wb");
+ auto f = fopen_boost (file, "wb");
if (!f) {
throw FileError ("could not write to file", file, errno);
}
size_t const r = fwrite (data(), 1, size(), f);
+ fclose (f);
if (r != size_t(size())) {
- fclose (f);
throw FileError ("could not write to file", file, errno);
}
- fclose (f);
}