From 1d30b8200b2a6b2ac12ad41d8a471fc4a40b8e85 Mon Sep 17 00:00:00 2001 From: Jan Sucan Date: Sat, 18 Jan 2025 13:04:54 +0100 Subject: Put the buffered file code into a namespace --- src/backup.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/backup.cpp') 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(new char[m_page_size_bytes]); m_buffers[1] = std::shared_ptr(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(), -- cgit v1.2.3