fs/io/OutputStream: use C++ exceptions in Write()

This commit is contained in:
Max Kellermann
2015-12-16 10:24:43 +01:00
parent 36d6ead65c
commit e4a06da14e
24 changed files with 241 additions and 333 deletions

View File

@@ -90,9 +90,6 @@ directory_save(BufferedOutputStream &os, const Directory &directory)
if (!child.IsMount())
directory_save(os, child);
if (!os.Check())
return;
}
for (const auto &song : directory.songs)

View File

@@ -364,8 +364,8 @@ SimpleDatabase::GetStats(const DatabaseSelection &selection,
return ::GetStats(*this, selection, stats, error);
}
bool
SimpleDatabase::Save(Error &error)
void
SimpleDatabase::Save()
{
{
const ScopeDatabaseLock protect;
@@ -395,16 +395,12 @@ SimpleDatabase::Save(Error &error)
db_save_internal(bos, *root);
if (!bos.Flush(error)) {
return false;
}
bos.Flush();
#ifdef ENABLE_ZLIB
if (gzip != nullptr) {
bool success = gzip->Flush(error);
gzip->Flush();
gzip.reset();
if (!success)
return false;
}
#endif
@@ -413,8 +409,6 @@ SimpleDatabase::Save(Error &error)
FileInfo fi;
if (GetFileInfo(path, fi))
mtime = fi.GetModificationTime();
return true;
}
bool

View File

@@ -83,7 +83,7 @@ public:
return *root;
}
bool Save(Error &error);
void Save();
/**
* Returns true if there is a valid database file on the disk.