Maintenance.

This commit is contained in:
Marcel Keller
2021-01-21 11:05:37 +11:00
parent 9e35aeeac2
commit 253ece7844
239 changed files with 2309 additions and 2113 deletions

View File

@@ -10,8 +10,8 @@
bool BufferBase::rewind = false;
void BufferBase::setup(ifstream* f, int length, string filename,
const char* type, const char* field)
void BufferBase::setup(ifstream* f, int length, const string& filename,
const char* type, const string& field)
{
file = f;
tuple_length = length;
@@ -60,6 +60,8 @@ void BufferBase::prune()
string tmp_name = filename + ".new";
ofstream tmp(tmp_name.c_str());
tmp << file->rdbuf();
if (tmp.fail())
throw runtime_error("problem writing to " + tmp_name);
tmp.close();
file->close();
rename(tmp_name.c_str(), filename.c_str());
@@ -77,3 +79,9 @@ void BufferBase::purge()
file = 0;
}
}
void BufferBase::check_tuple_length(int tuple_length)
{
if (tuple_length != this->tuple_length)
throw Processor_Error("inconsistent tuple length");
}