aboutsummaryrefslogtreecommitdiff
path: root/src/backup.cpp
diff options
context:
space:
mode:
authorJan Sucan <jan@jansucan.com>2025-01-18 13:04:54 +0100
committerJán Sučan <jan@jansucan.com>2025-01-18 13:07:06 +0100
commit1d30b8200b2a6b2ac12ad41d8a471fc4a40b8e85 (patch)
treeafe8fa4be557e3aea487dc4af841fcb62e250eb2 /src/backup.cpp
parent0e227f84dc22f90a5bb5d57891e0fe54eae525d3 (diff)
Put the buffered file code into a namespace
Diffstat (limited to 'src/backup.cpp')
-rw-r--r--src/backup.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/backup.cpp b/src/backup.cpp
index 4a76be5..238c3ae 100644
--- a/src/backup.cpp
+++ b/src/backup.cpp
@@ -77,7 +77,7 @@ class PagedStreamReader
m_buffers[0] = std::shared_ptr<char[]>(new char[m_page_size_bytes]);
m_buffers[1] = std::shared_ptr<char[]>(new char[m_page_size_bytes]);
} catch (const std::bad_alloc &e) {
- throw BufferedFileError(
+ throw BufferedFile::Error(
"cannot allocate pages for input stream data");
}
};
@@ -114,7 +114,7 @@ class PagedStreamReader
m_istream.read(data, m_page_size_bytes);
if (!m_istream.good() && !m_istream.eof()) {
- throw BufferedFileError("cannot read from stream");
+ throw BufferedFile::Error("cannot read from stream");
}
return m_istream.gcount();
@@ -387,13 +387,13 @@ backup(const OptionsBackup &opts)
std::ifstream in_istream{opts.getInFilePath(),
std::ifstream::in | std::ifstream::binary};
if (!in_istream) {
- throw BufferedFileError("cannot open input file");
+ throw BufferedFile::Error("cannot open input file");
}
std::ifstream base_istream{opts.getBaseFilePath(),
std::ifstream::in | std::ifstream::binary};
if (!base_istream) {
- throw BufferedFileError("cannot open base file");
+ throw BufferedFile::Error("cannot open base file");
}
// When backing up, the output file is truncated to hold the new data
@@ -401,7 +401,7 @@ backup(const OptionsBackup &opts)
std::ofstream::trunc |
std::ofstream::binary};
if (!out_ostream) {
- throw BufferedFileError("cannot open output file");
+ throw BufferedFile::Error("cannot open output file");
}
DiffFinder diff_finder(base_istream, in_istream, opts.getBufferSize(),