Skip to content

Commit

Permalink
Fix data corruption regression in mmap based indexes.
Browse files Browse the repository at this point in the history
  • Loading branch information
joto committed Jun 8, 2016
1 parent adbd3b0 commit e135dd8
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions include/osmium/index/detail/mmap_vector_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,13 @@ namespace osmium {
}

void push_back(const T& value) {
if (m_size >= capacity()) {
resize(m_size+1);
}
data()[m_size] = value;
++m_size;
resize(m_size+1);
data()[m_size-1] = value;
}

void reserve(size_t new_capacity) {
if (new_capacity > capacity()) {
size_t old_capacity = capacity();
const size_t old_capacity = capacity();
m_mapping.resize(new_capacity);
std::fill(data() + old_capacity, data() + new_capacity, osmium::index::empty_value<T>());
}
Expand Down

0 comments on commit e135dd8

Please sign in to comment.