diff options
Diffstat (limited to 'src/array_data.cc')
| -rw-r--r-- | src/array_data.cc | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/array_data.cc b/src/array_data.cc index 2df53830..1234ba22 100644 --- a/src/array_data.cc +++ b/src/array_data.cc @@ -38,10 +38,11 @@ #include "array_data.h" -#include "util.h" +#include "file.h" #include "exceptions.h" -#include <cstdio> +#include "util.h" #include <cerrno> +#include <cstdio> using boost::shared_array; @@ -83,14 +84,12 @@ ArrayData::ArrayData (boost::filesystem::path file) _size = boost::filesystem::file_size (file); _data.reset (new uint8_t[_size]); - auto f = fopen_boost (file, "rb"); + File f(file, "rb"); if (!f) { throw FileError ("could not open file for reading", file, errno); } - auto const r = fread (_data.get(), 1, _size, f); - fclose (f); - if (r != static_cast<size_t>(_size)) { + if (f.read(_data.get(), 1, _size) != static_cast<size_t>(_size)) { throw FileError ("could not read from file", file, errno); } } |
