diff options
| author | Carl Hetherington <cth@carlh.net> | 2026-04-09 23:02:36 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2026-04-09 23:02:36 +0200 |
| commit | dc684b6a6032e96a641a1a95ccfa313dbcd8158b (patch) | |
| tree | d2ff790de1b056a24e2271165516461a4c9430b1 /src | |
| parent | 83de7fadcee78561224771e2c3c4540b740d70bd (diff) | |
White space: file_group.{cc,h}
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/file_group.cc | 44 | ||||
| -rw-r--r-- | src/lib/file_group.h | 20 |
2 files changed, 32 insertions, 32 deletions
diff --git a/src/lib/file_group.cc b/src/lib/file_group.cc index 8ff684ed3..44ebe5075 100644 --- a/src/lib/file_group.cc +++ b/src/lib/file_group.cc @@ -37,42 +37,42 @@ using std::vector; /** Construct a FileGroup with no files */ -FileGroup::FileGroup () +FileGroup::FileGroup() { } /** Construct a FileGroup with a single file */ -FileGroup::FileGroup (boost::filesystem::path p) +FileGroup::FileGroup(boost::filesystem::path p) { - _paths.push_back (p); - ensure_open_path (0); - seek (0, SEEK_SET); + _paths.push_back(p); + ensure_open_path(0); + seek(0, SEEK_SET); } /** Construct a FileGroup with multiple files */ -FileGroup::FileGroup (vector<boost::filesystem::path> const & p) - : _paths (p) +FileGroup::FileGroup(vector<boost::filesystem::path> const & p) + : _paths(p) { - ensure_open_path (0); - seek (0, SEEK_SET); + ensure_open_path(0); + seek(0, SEEK_SET); } void -FileGroup::set_paths (vector<boost::filesystem::path> const & p) +FileGroup::set_paths(vector<boost::filesystem::path> const & p) { _paths = p; - ensure_open_path (0); - seek (0, SEEK_SET); + ensure_open_path(0); + seek(0, SEEK_SET); } /** Ensure that the given path index in the content is the _current_file */ void -FileGroup::ensure_open_path (size_t p) const +FileGroup::ensure_open_path(size_t p) const { if (_current_file && _current_path == p) { /* Already open */ @@ -95,7 +95,7 @@ FileGroup::ensure_open_path (size_t p) const int64_t -FileGroup::seek (int64_t pos, int whence) const +FileGroup::seek(int64_t pos, int whence) const { switch (whence) { case SEEK_SET: @@ -122,10 +122,10 @@ FileGroup::seek (int64_t pos, int whence) const } if (i < _paths.size()) { - ensure_open_path (i); + ensure_open_path(i); _current_file->seek(sub_pos, SEEK_SET); } else { - ensure_open_path (_paths.size() - 1); + ensure_open_path(_paths.size() - 1); _current_file->seek(_current_size, SEEK_SET); } @@ -138,9 +138,9 @@ FileGroup::seek (int64_t pos, int whence) const * @param amount Number of bytes to read. */ FileGroup::Result -FileGroup::read (uint8_t* buffer, int amount) const +FileGroup::read(uint8_t* buffer, int amount) const { - DCPOMATIC_ASSERT (_current_file); + DCPOMATIC_ASSERT(_current_file); int read = 0; while (true) { @@ -148,7 +148,7 @@ FileGroup::read (uint8_t* buffer, int amount) const bool eof = false; size_t to_read = amount - read; - DCPOMATIC_ASSERT (_current_file); + DCPOMATIC_ASSERT(_current_file); auto const current_position = _current_file->tell(); if (current_position == -1) { @@ -168,7 +168,7 @@ FileGroup::read (uint8_t* buffer, int amount) const } if (_current_file->error()) { - throw FileError (fmt::format("fread error {}", errno), _paths[_current_path]); + throw FileError(fmt::format("fread error {}", errno), _paths[_current_path]); } if (eof) { @@ -176,7 +176,7 @@ FileGroup::read (uint8_t* buffer, int amount) const if ((_current_path + 1) >= _paths.size()) { return { read, true }; } - ensure_open_path (_current_path + 1); + ensure_open_path(_current_path + 1); } } @@ -186,7 +186,7 @@ FileGroup::read (uint8_t* buffer, int amount) const /** @return Combined length of all the files */ int64_t -FileGroup::length () const +FileGroup::length() const { int64_t len = 0; for (size_t i = 0; i < _paths.size(); ++i) { diff --git a/src/lib/file_group.h b/src/lib/file_group.h index aac72c228..c16b50f89 100644 --- a/src/lib/file_group.h +++ b/src/lib/file_group.h @@ -40,14 +40,14 @@ class FileGroup { public: - FileGroup (); - explicit FileGroup (boost::filesystem::path); - explicit FileGroup (std::vector<boost::filesystem::path> const &); + FileGroup(); + explicit FileGroup(boost::filesystem::path); + explicit FileGroup(std::vector<boost::filesystem::path> const &); - FileGroup (FileGroup const&) = delete; - FileGroup& operator= (FileGroup const&) = delete; + FileGroup(FileGroup const&) = delete; + FileGroup& operator=(FileGroup const&) = delete; - void set_paths (std::vector<boost::filesystem::path> const &); + void set_paths(std::vector<boost::filesystem::path> const &); struct Result { Result(int bytes_read_, bool eof_) @@ -59,12 +59,12 @@ public: bool eof = false; }; - int64_t seek (int64_t, int) const; - Result read (uint8_t*, int) const; - int64_t length () const; + int64_t seek(int64_t, int) const; + Result read(uint8_t*, int) const; + int64_t length() const; private: - void ensure_open_path (size_t) const; + void ensure_open_path(size_t) const; std::vector<boost::filesystem::path> _paths; /** Index of path that we are currently reading from */ |
