mirror of
https://github.com/data61/MP-SPDZ.git
synced 2026-01-10 05:57:57 -05:00
Maintenance.
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user