RAII for auto-closing file streams

Small fixes I didn't want to include in unrelated PRs.

There are a few left in `storage.cpp` but since it's a single function
in 600 lines of code, I didn't want to touch the mess. The others are
safe to remove, cucumber and test run on Finland gives 👍.
This commit is contained in:
Daniel J. Hofmann
2016-03-07 15:25:47 +01:00
parent ae4161b780
commit ac0279aa83
13 changed files with 5 additions and 40 deletions
-4
View File
@@ -90,8 +90,6 @@ void ExtractionContainers::PrepareData(const std::string &output_file_name,
PrepareEdges(segment_state);
WriteEdges(file_out_stream);
file_out_stream.close();
PrepareRestrictions();
WriteRestrictions(restrictions_file_name);
@@ -139,7 +137,6 @@ void ExtractionContainers::WriteNames(const std::string &names_file_name) const
name_file_stream.write(write_buffer, buffer_len);
name_file_stream.close();
TIMER_STOP(write_name_index);
std::cout << "ok, after " << TIMER_SEC(write_name_index) << "s" << std::endl;
}
@@ -586,7 +583,6 @@ void ExtractionContainers::WriteRestrictions(const std::string &path) const
}
restrictions_out_stream.seekp(count_position);
restrictions_out_stream.write((char *)&written_restriction_count, sizeof(unsigned));
restrictions_out_stream.close();
util::SimpleLogger().Write() << "usable restrictions: " << written_restriction_count;
}