const-ify things, use RAII for file closure, and start to use io:: to read some stuff.
This commit is contained in:
@@ -21,10 +21,17 @@ namespace io
|
||||
{
|
||||
|
||||
// Reads the count of elements that is written in the file header and returns the number
|
||||
inline std::uint64_t readElementCount(boost::filesystem::ifstream &input_stream)
|
||||
inline std::uint64_t readElementCount64(boost::filesystem::ifstream &input_stream)
|
||||
{
|
||||
std::uint64_t number_of_elements = 0;
|
||||
input_stream.read((char *)&number_of_elements, sizeof(std::uint64_t));
|
||||
input_stream.read(reinterpret_cast<char *>(&number_of_elements), sizeof(number_of_elements));
|
||||
return number_of_elements;
|
||||
}
|
||||
|
||||
inline std::uint64_t readElementCount32(boost::filesystem::ifstream &input_stream)
|
||||
{
|
||||
std::uint32_t number_of_elements = 0;
|
||||
input_stream.read(reinterpret_cast<char *>(&number_of_elements), sizeof(number_of_elements));
|
||||
return number_of_elements;
|
||||
}
|
||||
|
||||
|
||||
@@ -357,7 +357,7 @@ class StaticRTree
|
||||
}
|
||||
boost::filesystem::ifstream tree_node_file(node_file, std::ios::binary);
|
||||
|
||||
const auto tree_size = storage::io::readElementCount(tree_node_file);
|
||||
const auto tree_size = storage::io::readElementCount64(tree_node_file);
|
||||
|
||||
m_search_tree.resize(tree_size);
|
||||
storage::io::readRamIndex(tree_node_file, &m_search_tree[0], tree_size);
|
||||
|
||||
Reference in New Issue
Block a user