[Liblas-commits] hg: 4 new changesets

liblas-commits at liblas.org liblas-commits at liblas.org
Tue Jun 8 13:57:51 EDT 2010


changeset 252b784f5492 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=252b784f5492
summary: use std::vector<uint8_t> instead of std::vector<bool> and use std::vector<uint8_t>::size_type for our cache size operations to preserve precision

changeset 89ca04840d24 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=89ca04840d24
summary: ignore unused variable

changeset 5940536de7e4 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=5940536de7e4
summary: suppress warning about EQUAL and EQUALN from GDAL for all but /W4.  We have redefined those.

changeset fbb7f83ddd6e in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=fbb7f83ddd6e
summary: Default to release mode building

diffstat:

 CMakeLists.txt                          |   9 ++++-----
 include/liblas/detail/reader/reader.hpp |  11 ++++++-----
 include/liblas/lasfilter.hpp            |   2 +-
 src/detail/reader/reader.cpp            |  33 +++++++++++++++++----------------
 src/gt_citation.cpp                     |   8 ++++++--
 5 files changed, 34 insertions(+), 29 deletions(-)

diffs (190 lines):

diff -r 1111988c675c -r fbb7f83ddd6e CMakeLists.txt
--- a/CMakeLists.txt	Mon Jun 07 21:38:50 2010 -0500
+++ b/CMakeLists.txt	Tue Jun 08 11:57:27 2010 -0600
@@ -62,11 +62,10 @@
 ###############################################################################
 # General build settings
 
-if(NOT CMAKE_BUILD_TYPE)
-    set(CMAKE_BUILD_TYPE Debug CACHE STRING
-        "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel"
-        FORCE)
-endif()
+# Default to release mode 
+set(CMAKE_BUILD_TYPE Release CACHE STRING
+    "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel"
+    FORCE)
 
 set(BUILD_PEDANTIC TRUE CACHE BOOL "Choose compilation in pedantic or relaxed mode")
 
diff -r 1111988c675c -r fbb7f83ddd6e include/liblas/detail/reader/reader.hpp
--- a/include/liblas/detail/reader/reader.hpp	Mon Jun 07 21:38:50 2010 -0500
+++ b/include/liblas/detail/reader/reader.hpp	Tue Jun 08 11:57:27 2010 -0600
@@ -110,7 +110,7 @@
 {
 public:
 
-    CachedReaderImpl(std::istream& ifs, liblas::uint64_t cache_size);
+    CachedReaderImpl(std::istream& ifs, std::size_t cache_size);
     // ~CachedReaderImpl();
 
     liblas::Header const& ReadHeader();
@@ -132,13 +132,14 @@
     
     void CacheData(liblas::uint32_t position, const liblas::Header& header);
         
-    liblas::uint64_t m_cache_size;
-    std::vector<bool> m_mask;
+    std::vector<uint8_t>::size_type  m_cache_size;
+    std::vector<uint8_t> m_mask;
     
-    liblas::uint64_t m_cache_start_position;
-    liblas::uint64_t m_cache_read_position;
+    std::vector<uint8_t>::size_type m_cache_start_position;
+    std::vector<uint8_t>::size_type m_cache_read_position;
     std::vector<liblas::Point> m_cache;
 
+
 };
 
 // class ReaderFactory
diff -r 1111988c675c -r fbb7f83ddd6e include/liblas/lasfilter.hpp
--- a/include/liblas/lasfilter.hpp	Mon Jun 07 21:38:50 2010 -0500
+++ b/include/liblas/lasfilter.hpp	Tue Jun 08 11:57:27 2010 -0600
@@ -61,7 +61,7 @@
     BoundsFilter(double minx, double miny, double maxx, double maxy);
     BoundsFilter(double minx, double miny, double maxx, double maxy, double minz, double maxz);
     bool filter(const Point& point);
-    void SetKeep(bool bKeep) {return;}
+    void SetKeep(bool bKeep) {detail::ignore_unused_variable_warning(bKeep); return;}
 private:
     double mins[3];
     double maxs[3];
diff -r 1111988c675c -r fbb7f83ddd6e src/detail/reader/reader.cpp
--- a/src/detail/reader/reader.cpp	Mon Jun 07 21:38:50 2010 -0500
+++ b/src/detail/reader/reader.cpp	Tue Jun 08 11:57:27 2010 -0600
@@ -258,7 +258,7 @@
     m_current = n+1;
 }
 
-CachedReaderImpl::CachedReaderImpl(std::istream& ifs , liblas::uint64_t size) :
+CachedReaderImpl::CachedReaderImpl(std::istream& ifs , std::size_t size) :
     ReaderImpl(ifs), m_cache_size(size), m_cache_start_position(0), m_cache_read_position(0)
 {
 }
@@ -281,7 +281,7 @@
     // Mark all positions as uncached and build up the mask
     // to the size of the number of points in the file
     for (uint32_t i = 0; i < header.GetPointRecordsCount(); ++i) {
-        m_mask.push_back(false);
+        m_mask.push_back(0);
     }
 
     
@@ -293,11 +293,12 @@
         int32_t old_cache_start_position = m_cache_start_position;
         m_cache_start_position = position;
 
-        uint32_t left_to_cache = std::min(m_cache_size, header.GetPointRecordsCount() - m_cache_start_position);
+    std::vector<uint8_t>::size_type header_size = static_cast<std::vector<uint8_t>::size_type>(header.GetPointRecordsCount());
+    std::vector<uint8_t>::size_type left_to_cache = std::min(m_cache_size, header_size - m_cache_start_position);
 
-        uint32_t to_mark = std::max(m_cache_size, static_cast<liblas::uint64_t>(left_to_cache));
+    std::vector<uint8_t>::size_type to_mark = std::max(m_cache_size, left_to_cache);
         for (uint32_t i = 0; i < to_mark; ++i) {
-            m_mask[old_cache_start_position + i] = false;
+            m_mask[old_cache_start_position + i] = 0;
         }
 
         // if these aren't equal, we've hopped around with ReadPointAt
@@ -311,7 +312,7 @@
         for (uint32_t i = 0; i < left_to_cache; ++i) 
         {
             try {
-                m_mask[m_current] = true;
+                m_mask[m_current] = 1;
                 m_cache[i] = ReaderImpl::ReadNextPoint(header);
             } catch (std::out_of_range&) {
                 // cached to the end
@@ -332,7 +333,7 @@
     // }
     // std::cout << std::endl;
 
-    if (m_mask[position] == true) {
+    if (m_mask[position] == 1) {
         m_cache_read_position = position;
         return m_cache[cache_position];
     } else {
@@ -353,7 +354,7 @@
             throw std::runtime_error(out);   
         }
             
-        if (m_mask[position] == true) {
+        if (m_mask[position] == 1) {
             if (static_cast<uint32_t>(cache_position) > m_cache.size()) {
                 std::ostringstream output;
                 output  << "ReadCachedPoint:: cache position: " 
@@ -373,7 +374,6 @@
             throw std::runtime_error(out);
         }
 
-        return m_cache[cache_position];
     }
     
 }
@@ -412,13 +412,13 @@
     
     if (m_mask.size() > 0) {
 
-        uint32_t left_to_cache = std::min(m_cache_size, header.GetPointRecordsCount() - m_cache_start_position);
+    std::vector<uint8_t>::size_type header_size = static_cast<std::vector<uint8_t>::size_type>(header.GetPointRecordsCount());
+    std::vector<uint8_t>::size_type left_to_cache = std::min(m_cache_size, header_size - m_cache_start_position);
 
-        // Mark old points as uncached
-        uint32_t to_mark = std::max(m_cache_size, static_cast<liblas::uint64_t>(left_to_cache));
+    std::vector<uint8_t>::size_type to_mark = std::max(m_cache_size, left_to_cache);
         for (uint32_t i = 0; i < to_mark; ++i) {
 
-            m_mask[m_cache_start_position + i] = false;
+            m_mask[m_cache_start_position + i] = 0;
         }
 
         m_cache_start_position = 0;
@@ -444,11 +444,12 @@
 void CachedReaderImpl::SetOutputSRS(const SpatialReference& srs, const liblas::Header& header)
 {
     // We need to wipe out the cache if we've set the output srs.
-    uint32_t left_to_cache = std::min(m_cache_size, header.GetPointRecordsCount() - m_cache_start_position);
+    std::vector<uint8_t>::size_type header_size = static_cast<std::vector<uint8_t>::size_type>(header.GetPointRecordsCount());
+    std::vector<uint8_t>::size_type left_to_cache = std::min(m_cache_size, header_size - m_cache_start_position);
 
-    uint32_t to_mark = std::max(m_cache_size, static_cast<liblas::uint64_t>(left_to_cache));
+    std::vector<uint8_t>::size_type to_mark = std::max(m_cache_size, left_to_cache);
     for (uint32_t i = 0; i < to_mark; ++i) {
-        m_mask[m_cache_start_position + i] = false;
+        m_mask[m_cache_start_position + i] = 0;
     }
     
     ReaderImpl::SetOutputSRS(srs, header);
diff -r 1111988c675c -r fbb7f83ddd6e src/gt_citation.cpp
--- a/src/gt_citation.cpp	Mon Jun 07 21:38:50 2010 -0500
+++ b/src/gt_citation.cpp	Tue Jun 08 11:57:27 2010 -0600
@@ -35,12 +35,16 @@
 #include "geovalues.h"
 #include "ogr_spatialref.h"
 
-
+// Ignore warning about redifinition.  We need to use 
+// the new windows functions for this.  We'll only 
+// warn on MSVC with /W4
+#pragma warning( 4: 4005)
 #if defined(WIN32) 
 #  define EQUALN(a,b,n)           (_strnicmp(a,b,n)==0)
 #  define EQUAL(a,b)              (_stricmp(a,b)==0)
 #endif
-
+#pragma warning( default: 4005)
+    
 #define nCitationNameTypes 9
 typedef enum 
 {


More information about the Liblas-commits mailing list