[Liblas-commits] hg-main-tree: vs2010 lint

liblas-commits at liblas.org liblas-commits at liblas.org
Wed Jun 22 13:03:40 EDT 2011


details:   http://hg.libpc.orghg-main-tree/rev/8795c7220d14
changeset: 798:8795c7220d14
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Wed Jun 22 10:03:07 2011 -0700
description:
vs2010 lint

diffstat:

 src/Schema.cpp                 |   9 ++++++---
 src/XMLSchema.cpp              |  14 +++++++++-----
 src/drivers/las/Iterator.cpp   |  18 ++++++++++++++++--
 src/filters/ByteSwapFilter.cpp |   5 +++++
 4 files changed, 36 insertions(+), 10 deletions(-)

diffs (157 lines):

diff -r 4f35afd34b2c -r 8795c7220d14 src/Schema.cpp
--- a/src/Schema.cpp	Wed Jun 22 09:40:54 2011 -0700
+++ b/src/Schema.cpp	Wed Jun 22 10:03:07 2011 -0700
@@ -284,8 +284,9 @@
     pdal::Schema schema = reader.getSchema();
     return schema;
 
+#else
+    return Schema();
 #endif
-    return Schema();
 }
 
 Schema Schema::from_xml(std::string const& xml)
@@ -299,8 +300,9 @@
     pdal::Schema schema = reader.getSchema();
     return schema;
 
+#else
+    return Schema();
 #endif
-    return Schema();
 }
 
 std::string Schema::to_xml(Schema const& schema)
@@ -311,8 +313,9 @@
     
     return writer.getXML();
 
+#else
+    return std::string("");
 #endif
-    return std::string("");
 }
 
 } // namespace pdal
diff -r 4f35afd34b2c -r 8795c7220d14 src/XMLSchema.cpp
--- a/src/XMLSchema.cpp	Wed Jun 22 09:40:54 2011 -0700
+++ b/src/XMLSchema.cpp	Wed Jun 22 10:03:07 2011 -0700
@@ -121,6 +121,8 @@
 void OCISchemaStructuredErrorHandler
     (void * userData, xmlErrorPtr error)
 {
+    boost::ignore_unused_variable_warning(userData);
+ 
     std::ostringstream oss;
 
     oss << "XML error: '" << error->message <<"' ";
@@ -146,6 +148,8 @@
 void OCISchemaParserStructuredErrorHandler
     (void * userData, xmlErrorPtr error)
 {
+    boost::ignore_unused_variable_warning(userData);
+
     std::ostringstream oss;
 
     oss << "Schema parsing error: '" << error->message <<"' ";
@@ -156,6 +160,8 @@
 void OCISchemaValidationStructuredErrorHandler
     (void * userData, xmlErrorPtr error)
 {
+    boost::ignore_unused_variable_warning(userData);
+
     std::ostringstream oss;
 
     oss << "Schema validation error: '" << error->message <<"' ";
@@ -166,6 +172,7 @@
 void OCISchemaValidityError
     (void * ctx, const char* message, ... )
 {
+    boost::ignore_unused_variable_warning(ctx);
 
     const int ERROR_MESSAGE_SIZE = 256;
     char error[ERROR_MESSAGE_SIZE];
@@ -186,6 +193,7 @@
 void OCISchemaValidityDebug
     (void * ctx, const char* message, ... )
 {
+    boost::ignore_unused_variable_warning(ctx);
 
     const int ERROR_MESSAGE_SIZE = 256;
     char error[ERROR_MESSAGE_SIZE];
@@ -207,6 +215,7 @@
 void OCISchemaGenericErrorHandler
     (void * ctx, const char* message, ... )
 {
+    boost::ignore_unused_variable_warning(ctx);
 
     const int ERROR_MESSAGE_SIZE = 256;
     char error[ERROR_MESSAGE_SIZE];
@@ -606,11 +615,6 @@
 
 Dimension::Field Reader::GetDimensionField(std::string const& name, boost::uint32_t position)
 {
-
-
-
-
-
     if (!compare_no_case(name.c_str(), "X"))
         return Dimension::Field_X;
 
diff -r 4f35afd34b2c -r 8795c7220d14 src/drivers/las/Iterator.cpp
--- a/src/drivers/las/Iterator.cpp	Wed Jun 22 09:40:54 2011 -0700
+++ b/src/drivers/las/Iterator.cpp	Wed Jun 22 10:03:07 2011 -0700
@@ -174,12 +174,25 @@
 }
 
 
+static inline boost::uint32_t safeconvert64to32(boost::uint64_t x64) // BUG: move this to Utils header?
+{
+    if (x64 > std::numeric_limits<boost::uint32_t>::max())
+    {
+        throw pdal_error("cannot support seek offsets greater than 32-bits");
+    }
+
+    const boost::uint32_t x32 = static_cast<boost::uint32_t>(x64);
+    return x32;
+}
+
+
 boost::uint64_t SequentialIterator::skipImpl(boost::uint64_t count)
 {
 #ifdef PDAL_HAVE_LASZIP
     if (m_zip)
     {
-        m_unzipper->seek(getIndex() + count);
+        const boost::uint32_t pos32 = safeconvert64to32(getIndex() + count);
+        m_unzipper->seek(pos32);
     }
     else
     {
@@ -231,7 +244,8 @@
 #ifdef PDAL_HAVE_LASZIP
     if (m_zip)
     {
-        m_unzipper->seek(count);
+        const boost::uint32_t pos32 = safeconvert64to32(count);
+        m_unzipper->seek(pos32);
     }
     else
     {
diff -r 4f35afd34b2c -r 8795c7220d14 src/filters/ByteSwapFilter.cpp
--- a/src/filters/ByteSwapFilter.cpp	Wed Jun 22 09:40:54 2011 -0700
+++ b/src/filters/ByteSwapFilter.cpp	Wed Jun 22 10:03:07 2011 -0700
@@ -39,6 +39,11 @@
 #include <pdal/PointBuffer.hpp>
 #include <pdal/Endian.hpp>
 #include <iostream>
+
+#ifdef PDAL_COMPILER_MSVC
+#  pragma warning(disable: 4127)  // conditional expression is constant
+#endif
+
 namespace pdal { namespace filters {
 
 


More information about the Liblas-commits mailing list