[Liblas-commits] hg: fix #174 to denote the error condition of having a headersiz...

liblas-commits at liblas.org liblas-commits at liblas.org
Thu Jun 17 21:47:58 EDT 2010


changeset 0fa044ad02f9 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=0fa044ad02f9
summary: fix #174 to denote the error condition of having a headersize that is smaller than the data offset

diffstat:

 src/detail/reader/header.cpp |  13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diffs (23 lines):

diff -r 268b60b0b781 -r 0fa044ad02f9 src/detail/reader/header.cpp
--- a/src/detail/reader/header.cpp	Thu Jun 17 20:08:38 2010 -0500
+++ b/src/detail/reader/header.cpp	Thu Jun 17 20:47:50 2010 -0500
@@ -133,8 +133,17 @@
     read_n(n4, m_ifs, sizeof(n4));
     if (n4 < m_header.GetHeaderSize())
     {
-        // TODO: Move this test to LASHeader::Validate()
-        throw std::domain_error("offset to point data smaller than header size");
+        std::ostringstream msg; 
+        msg <<  "The offset to the start of point data, "
+            << n4 << ", is smaller than the header size, "
+            << m_header.GetHeaderSize() << ".  This is "
+            "an invalid condition and incorrectly written "
+            "file.  We cannot ignore this error because we "
+            "do not know where to begin seeking to read the "
+            "file.  Please report whomever's software who "
+            "wrote this file to the proper authorities.  They "
+            "will be dealt with swiftly and humanely.";
+        throw std::runtime_error(msg.str());
     }
     m_header.SetDataOffset(n4);
 


More information about the Liblas-commits mailing list