[Liblas-commits] hg: properly mark points when resetting to uncache them

liblas-commits at liblas.org liblas-commits at liblas.org
Tue Jul 20 22:16:46 EDT 2010


changeset 9a5ce4fa49d8 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=9a5ce4fa49d8
summary: properly mark points when resetting to uncache them

diffstat:

 src/detail/reader/reader.cpp |  29 ++++++++++++++---------------
 1 files changed, 14 insertions(+), 15 deletions(-)

diffs (44 lines):

diff -r d4a159845ef3 -r 9a5ce4fa49d8 src/detail/reader/reader.cpp
--- a/src/detail/reader/reader.cpp	Tue Jul 20 15:25:03 2010 -0500
+++ b/src/detail/reader/reader.cpp	Tue Jul 20 21:16:40 2010 -0500
@@ -317,26 +317,25 @@
 void CachedReaderImpl::Reset(liblas::Header const& header)
 {
     
-    if (!m_mask.empty()) {
+    if (m_mask.empty()) return;
 
-        typedef std::vector<uint8_t>::size_type size_type;
-        size_type header_size = static_cast<std::vector<uint8_t>::size_type>(header.GetPointRecordsCount());
-        size_type left_to_cache = std::min(m_cache_size, header_size - m_cache_start_position);
-        size_type to_mark = std::max(m_cache_size, left_to_cache);
+    typedef std::vector<uint8_t>::size_type size_type;
+    size_type old_cache_start_position = m_cache_start_position;
+    size_type header_size = static_cast<size_type>(header.GetPointRecordsCount());
+    size_type left_to_cache = std::min(m_cache_size, header_size - m_cache_start_position);
 
-        for (uint32_t i = 0; i < to_mark; ++i) {
+    size_type to_mark = std::min(m_cache_size, header_size - old_cache_start_position); 
+    for (uint32_t i = 0; i < to_mark; ++i) {
 
-            size_type const mark_pos = m_cache_start_position + i;
-            assert(mark_pos < m_mask.size());
+        size_type const mark_pos = m_cache_start_position + i;
+        assert(mark_pos < m_mask.size());
 
-            m_mask[mark_pos] = 0;
-        }
+        m_mask[mark_pos] = 0;
+    }
 
-        m_cache_start_position = 0;
-        m_cache_read_position = 0;
-    
-    }
-    
+    m_cache_start_position = 0;
+    m_cache_read_position = 0;
+
     ReaderImpl::Reset(header);
 
 }


More information about the Liblas-commits mailing list