[Liblas-commits] hg: off-by-one error in ReaderImpl::Seek,
make sure we actually ...
liblas-commits at liblas.org
liblas-commits at liblas.org
Fri Aug 27 11:36:22 EDT 2010
changeset c64eebfcf3bf in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=c64eebfcf3bf
summary: off-by-one error in ReaderImpl::Seek, make sure we actually read the first point in the file
diffstat:
src/detail/reader/reader.cpp | 13 +++++--------
src/lasreader.cpp | 2 +-
2 files changed, 6 insertions(+), 9 deletions(-)
diffs (49 lines):
diff -r 0f3f66a3a126 -r c64eebfcf3bf src/detail/reader/reader.cpp
--- a/src/detail/reader/reader.cpp Thu Aug 26 21:23:10 2010 -0500
+++ b/src/detail/reader/reader.cpp Fri Aug 27 10:36:15 2010 -0500
@@ -110,20 +110,17 @@
{
m_ifs.clear();
m_ifs.seekg(header->GetDataOffset(), std::ios::beg);
+
+ m_point_reader->read();
+ ++m_current;
+ return m_point_reader->GetPoint();
}
if (m_current < m_size)
{
m_point_reader->read();
-
- // PointPtr ptr = PointPtr(new liblas::Point(m_point_reader->GetPoint()));
- // if (ptr.get() == 0) {
- // throw std::runtime_error("Unable to fetch point from reader");
- // }
-
++m_current;
- // return ptr;
return m_point_reader->GetPoint();
} else if (m_current == m_size ){
@@ -170,7 +167,7 @@
m_ifs.clear();
m_ifs.seekg(pos, std::ios::beg);
- m_current = n+1;
+ m_current = n;
}
// ReaderImpl* ReaderFactory::Create(std::istream& ifs)
diff -r 0f3f66a3a126 -r c64eebfcf3bf src/lasreader.cpp
--- a/src/lasreader.cpp Thu Aug 26 21:23:10 2010 -0500
+++ b/src/lasreader.cpp Fri Aug 27 10:36:15 2010 -0500
@@ -62,7 +62,7 @@
{
Reader::Reader(std::istream& ifs) :
- m_pimpl(new detail::ReaderImpl(ifs)),
+ m_pimpl(new detail::CachedReaderImpl(ifs,3)),
m_header(HeaderPtr()),
m_point(0),
m_empty_point(new Point()),
More information about the Liblas-commits
mailing list