Skip to content

Commit

Permalink
:reset() was using old schema bytesize instead of new one -- don't re…
Browse files Browse the repository at this point in the history
…set if they're the same anyway
  • Loading branch information
hobu committed Mar 12, 2013
1 parent 5723336 commit 42b9135
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/PointBuffer.cpp
Expand Up @@ -94,15 +94,19 @@ PointBuffer& PointBuffer::operator=(PointBuffer const& rhs)
void PointBuffer::reset(Schema const& new_schema)
{
boost::uint32_t old_size = m_schema.getByteSize();
boost::uint32_t new_size = m_schema.getByteSize();
boost::uint32_t new_size = new_schema.getByteSize();

m_schema = new_schema;
m_byteSize = new_size;

boost::uint8_t* new_array = new boost::uint8_t[ m_schema.getByteSize()*m_capacity ]();
m_data.reset(new_array);
if (m_byteSize != old_size )
{
boost::uint8_t* new_array = new boost::uint8_t[ new_size *m_capacity ]();
m_data.reset(new_array);
}

m_numPoints = 0;
m_byteSize = new_schema.getByteSize();

}

void PointBuffer::resize(boost::uint32_t const& capacity)
Expand Down

0 comments on commit 42b9135

Please sign in to comment.