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
-1
View File
@@ -194,7 +194,6 @@ unsigned readHSGRFromStream(const boost::filesystem::path &hsgr_file,
hsgr_input_stream.read(reinterpret_cast<char *>(&edge_list[0]),
number_of_edges * sizeof(EdgeT));
}
hsgr_input_stream.close();
return number_of_nodes;
}
+1 -6
View File
@@ -191,9 +191,6 @@ class StaticRTree
processed_objects_count += current_leaf.object_count;
}
// close leaf file
leaf_node_file.close();
std::uint32_t processing_level = 0;
while (1 < tree_nodes_in_level.size())
{
@@ -257,8 +254,6 @@ class StaticRTree
BOOST_ASSERT_MSG(0 < size_of_tree, "tree empty");
tree_node_file.write((char *)&size_of_tree, sizeof(std::uint32_t));
tree_node_file.write((char *)&m_search_tree[0], sizeof(TreeNode) * size_of_tree);
// close tree node file.
tree_node_file.close();
}
explicit StaticRTree(const boost::filesystem::path &node_file,
@@ -287,7 +282,7 @@ class StaticRTree
{
tree_node_file.read((char *)&m_search_tree[0], sizeof(TreeNode) * tree_size);
}
tree_node_file.close();
// open leaf node file and store thread specific pointer
if (!boost::filesystem::exists(leaf_file))
{