[Liblas-commits] hg: 6 new changesets

liblas-commits at liblas.org liblas-commits at liblas.org
Tue Mar 16 13:01:37 EDT 2010


changeset 0f93db236833 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=0f93db236833
summary: we don't do anything with the exception, so we don't need to reference it

changeset 7845cc6c99cc in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=7845cc6c99cc
summary: Use uint32_t instead of uint16_t for the size.  From a practical standpoint, no one's probably going to legitimately use the full extent of either the short or the long for a point format size though

changeset 840292ef18b5 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=840292ef18b5
summary: clean up unreferenced warnings

changeset 9949610683c5 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=9949610683c5
summary: clean up msvc warnings about throwing when extern and bool coersion warnings

changeset 2a5e2f4bf6f8 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=2a5e2f4bf6f8
summary: fix uint16_t vs uint32_t coersion when we go from the PointFormat's byte size to the header's point size

changeset 6eb35a2161cd in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=6eb35a2161cd
summary: fix so it works again

diffstat:

 apps/ts2las.cpp              |   6 ++--
 include/liblas/lasformat.hpp |   2 +-
 src/las_c_api.cpp            |  64 ++++++++++++++++++++++++-------------------
 src/lasheader.cpp            |  13 ++++++--
 src/lasreader.cpp            |   4 +-
 src/makefile.vc              |  18 +++++------
 6 files changed, 58 insertions(+), 49 deletions(-)

diffs (237 lines):

diff -r b1244e1f9b8b -r 6eb35a2161cd apps/ts2las.cpp
--- a/apps/ts2las.cpp	Tue Mar 16 00:29:51 2010 +0000
+++ b/apps/ts2las.cpp	Tue Mar 16 11:01:01 2010 -0600
@@ -115,7 +115,7 @@
         if (( version > 20020715) && (version < 20051231)) return true;
         return false;
     }
-    catch (std::exception const& e)
+    catch (std::exception const)
     {
         return false;
     }    
@@ -212,13 +212,13 @@
 
                 try {
                     writer->WritePoint(p);
-                } catch (std::exception const& e) 
+                } catch (std::exception) 
                 {
                     std::cout << "Point writing failed!" << std::endl; 
                 }
              
             }
-            catch (std::out_of_range const& e) // we reached the end of the file
+            catch (std::out_of_range) // we reached the end of the file
             {
                 std::cout << "catching out of range error!" ;
                 return true;
diff -r b1244e1f9b8b -r 6eb35a2161cd include/liblas/lasformat.hpp
--- a/include/liblas/lasformat.hpp	Tue Mar 16 00:29:51 2010 +0000
+++ b/include/liblas/lasformat.hpp	Tue Mar 16 11:01:01 2010 -0600
@@ -90,7 +90,7 @@
   
 protected:
     
-    liblas::uint16_t m_size;
+    liblas::uint32_t m_size;
     liblas::uint8_t m_versionminor;
     liblas::uint8_t m_versionmajor;
 
diff -r b1244e1f9b8b -r 6eb35a2161cd src/las_c_api.cpp
--- a/src/las_c_api.cpp	Tue Mar 16 00:29:51 2010 +0000
+++ b/src/las_c_api.cpp	Tue Mar 16 11:01:01 2010 -0600
@@ -77,6 +77,36 @@
 
 using namespace liblas;
 
+
+#ifdef _WIN32
+#define compare_no_case(a,b,n)  _strnicmp( (a), (b), (n) )
+#else
+#define compare_no_case(a,b,n)  strncasecmp( (a), (b), (n) )
+#endif
+
+std::istream* OpenInput(std::string filename) 
+{
+    std::ios::openmode const mode = std::ios::in | std::ios::binary;
+    std::istream* istrm = 0;
+    if (compare_no_case(filename.c_str(),"STDIN",5) == 0)
+    {
+        istrm = &std::cin;
+    }
+    else 
+    {
+        istrm = new std::ifstream(filename.c_str(), mode);
+    }
+    
+    if (!istrm->good())
+    {
+        delete istrm;
+        throw std::runtime_error("Reading stream was not able to be created");
+    }
+    return istrm;
+}
+
+
+
 LAS_C_START
 
 #ifndef _WIN32
@@ -88,11 +118,6 @@
 #include <spatialindex/Version.h>
 #endif
 
-#ifdef _WIN32
-#define compare_no_case(a,b,n)  _strnicmp( (a), (b), (n) )
-#else
-#define compare_no_case(a,b,n)  strncasecmp( (a), (b), (n) )
-#endif
 
 // Error stuff
 
@@ -191,26 +216,7 @@
     return static_cast<int>(errors.size());
 }
 
-std::istream* OpenInput(std::string filename) 
-{
-    std::ios::openmode const mode = std::ios::in | std::ios::binary;
-    std::istream* istrm = 0;
-    if (compare_no_case(filename.c_str(),"STDIN",5) == 0)
-    {
-        istrm = &std::cin;
-    }
-    else 
-    {
-        istrm = new std::ifstream(filename.c_str(), mode);
-    }
-    
-    if (!istrm->good())
-    {
-        delete istrm;
-        throw std::runtime_error("Reading stream was not able to be created");
-    }
-    return istrm;
-}
+
 
 LAS_DLL LASReaderH LASReader_Create(const char* filename) 
 
@@ -2070,8 +2076,8 @@
     liblas::PointFormat* format = new liblas::PointFormat(version_minor, 
                                                 version_major, 
                                                 size, 
-                                                (bool)bHasColor, 
-                                                (bool)bHasTime  );
+                                                bHasColor != 0, 
+                                                bHasTime != 0 );
     return (LASPointFormatH) format;
 }
 
@@ -2135,7 +2141,7 @@
 
     try {
         liblas::PointFormat* format = ((liblas::PointFormat*) hFormat);
-        format->Color(static_cast<bool>(bColor));
+        format->Color(bColor != 0);
     }
     catch (std::exception const& e) {
         LASError_PushError(LE_Failure, e.what(), "LASPointFormat_SetColor");
@@ -2159,7 +2165,7 @@
 
     try {
         liblas::PointFormat* format = ((liblas::PointFormat*) hFormat);
-        format->Time(static_cast<bool>(bTime));
+        format->Time(bTime != 0);
     }
     catch (std::exception const& e) {
         LASError_PushError(LE_Failure, e.what(), "LASPointFormat_SetTime");
diff -r b1244e1f9b8b -r 6eb35a2161cd src/lasheader.cpp
--- a/src/lasheader.cpp	Tue Mar 16 00:29:51 2010 +0000
+++ b/src/lasheader.cpp	Tue Mar 16 11:01:01 2010 -0600
@@ -709,18 +709,23 @@
     // byte size or the pointformat's specified size according to whether 
     // or not it has color or time (FIXME: or waveform packets once we get to 1.3 )
     // The extra space that is available can be used to store LASPoint::GetExtraData.
+    // We trim the format size to uint16_t because that's what the header stores 
     if (format.HasColor() && format.HasTime()) {
         SetDataFormatId(liblas::ePointFormat3);
-        SetDataRecordLength(std::max(static_cast<uint32_t>(ePointSize3),format.GetByteSize()));
+        SetDataRecordLength(std::max(   static_cast<uint16_t>(ePointSize3),
+                                        static_cast<uint16_t>(format.GetByteSize())));
     } else if (format.HasColor()  && !format.HasTime()) {
         SetDataFormatId(liblas::ePointFormat2);
-        SetDataRecordLength(std::max(static_cast<uint32_t>(ePointSize2),format.GetByteSize()));
+        SetDataRecordLength(std::max(   static_cast<uint16_t>(ePointSize2),
+                                        static_cast<uint16_t>(format.GetByteSize())));
     } else if (!format.HasColor()  && format.HasTime()) {
         SetDataFormatId(liblas::ePointFormat1);
-        SetDataRecordLength(std::max(static_cast<uint32_t>(ePointSize1),format.GetByteSize()));
+        SetDataRecordLength(std::max(   static_cast<uint16_t>(ePointSize1),
+                                        static_cast<uint16_t>(format.GetByteSize())));
     } else 
         SetDataFormatId(liblas::ePointFormat0);
-        SetDataRecordLength(std::max(static_cast<uint32_t>(ePointSize0),format.GetByteSize()));
+        SetDataRecordLength(std::max(   static_cast<uint16_t>(ePointSize0),
+                                        static_cast<uint16_t>(format.GetByteSize())));
     } 
     
 } // namespace liblas
diff -r b1244e1f9b8b -r 6eb35a2161cd src/lasreader.cpp
--- a/src/lasreader.cpp	Tue Mar 16 00:29:51 2010 +0000
+++ b/src/lasreader.cpp	Tue Mar 16 11:01:01 2010 -0600
@@ -101,7 +101,7 @@
     try {
         m_point = const_cast<Point*>(&(m_pimpl->ReadNextPoint(m_header)));
         return true;
-    } catch (std::out_of_range& e) {
+    } catch (std::out_of_range) {
         m_point = 0;
         return false;
     }
@@ -113,7 +113,7 @@
     try {
         m_point = const_cast<Point*>(&(m_pimpl->ReadPointAt(n, m_header)));
         return true;
-    } catch (std::out_of_range& e) {
+    } catch (std::out_of_range) {
         m_point = 0;
         return false;
     }
diff -r b1244e1f9b8b -r 6eb35a2161cd src/makefile.vc
--- a/src/makefile.vc	Tue Mar 16 00:29:51 2010 +0000
+++ b/src/makefile.vc	Tue Mar 16 11:01:01 2010 -0600
@@ -7,24 +7,22 @@
 LAS_OBJS = \
     lasclassification.obj \
     lascolor.obj \
+    lasformat.obj \
     laswriter.obj \
     lasreader.obj \
     laserror.obj \
     las_c_api.obj \
     laspoint.obj \
     lasheader.obj \
-    lasfile.obj \
     lasspatialreference.obj \
     lasvariablerecord.obj \
-    detail\reader.obj \
-    detail\reader10.obj \
-    detail\reader11.obj \
-    detail\reader12.obj \
-    detail\writer.obj \
-    detail\writer10.obj \
-    detail\writer11.obj \
-    detail\writer12.obj \
-    detail\file.obj
+    detail\reader\reader.obj \
+    detail\reader\point.obj \
+    detail\reader\header.obj \
+    detail\writer\base.obj \
+    detail\writer\header.obj \
+    detail\writer\point.obj \
+    detail\writer\writer.obj 
 
 !IF "$(SPATIALINDEX_HOME)" != "" && EXIST("$(SPATIALINDEX_HOME)")
 LAS_OBJS = $(LAS_OBJS) index\index.obj \


More information about the Liblas-commits mailing list