[Liblas-commits] hg: no need to copy the vlr data, properly order the setup() and...

liblas-commits at liblas.org liblas-commits at liblas.org
Wed Jun 29 09:33:54 EDT 2011


details:   http://hg.liblas.orghg/rev/3a69d4575fdb
changeset: 3035:3a69d4575fdb
user:      Howard Butler <hobu.inc at gmail.com>
date:      Tue Jun 28 16:47:35 2011 -0500
description:
no need to copy the vlr data, properly order the setup() and unpack() in the case we have a VLR
Subject: hg: text normalizing

details:   http://hg.liblas.orghg/rev/4ff2ade1966c
changeset: 3036:4ff2ade1966c
user:      Howard Butler <hobu.inc at gmail.com>
date:      Tue Jun 28 16:48:00 2011 -0500
description:
text normalizing
Subject: hg: remove lint

details:   http://hg.liblas.orghg/rev/2290ff4322f9
changeset: 3037:2290ff4322f9
user:      Howard Butler <hobu.inc at gmail.com>
date:      Wed Jun 29 08:21:16 2011 -0500
description:
remove lint
Subject: hg: setup is only for compression

details:   http://hg.liblas.orghg/rev/62bcd5d0e24e
changeset: 3038:62bcd5d0e24e
user:      Howard Butler <hobu.inc at gmail.com>
date:      Wed Jun 29 08:33:48 2011 -0500
description:
setup is only for compression

diffstat:

 include/liblas/detail/zippoint.hpp |   2 --
 src/detail/reader/zipreader.cpp    |  11 +++++------
 src/detail/zippoint.cpp            |  29 ++++++++++-------------------
 3 files changed, 15 insertions(+), 27 deletions(-)

diffs (106 lines):

diff -r 1807a68342fa -r 62bcd5d0e24e include/liblas/detail/zippoint.hpp
--- a/include/liblas/detail/zippoint.hpp	Tue Jun 28 15:49:07 2011 -0500
+++ b/include/liblas/detail/zippoint.hpp	Wed Jun 29 08:33:48 2011 -0500
@@ -84,8 +84,6 @@
     // LASzip::unpack() just reads from the vlr_data we give it (we allocate and delete)  ["our"]
     int his_vlr_num;
     unsigned char* his_vlr_data;
-    int our_vlr_num;
-    boost::scoped_array<boost::uint8_t> our_vlr_data;
 
     boost::scoped_ptr<LASzip> m_zip;
 
diff -r 1807a68342fa -r 62bcd5d0e24e src/detail/reader/zipreader.cpp
--- a/src/detail/reader/zipreader.cpp	Tue Jun 28 15:49:07 2011 -0500
+++ b/src/detail/reader/zipreader.cpp	Wed Jun 29 08:33:48 2011 -0500
@@ -109,6 +109,7 @@
         PointFormatName format = m_header->GetDataFormatId();
         boost::scoped_ptr<ZipPoint> z(new ZipPoint(format, m_header->GetVLRs()));
         m_zipPoint.swap(z);
+
     }
 
     if (!m_unzipper)
@@ -116,11 +117,11 @@
         boost::scoped_ptr<LASunzipper> z(new LASunzipper());
         m_unzipper.swap(z);
 
-        bool stat(false);
+        bool ok(false);
         m_ifs.seekg(m_header->GetDataOffset(), std::ios::beg);
-        stat = m_unzipper->open(m_ifs, m_zipPoint->GetZipper());
+        ok = m_unzipper->open(m_ifs, m_zipPoint->GetZipper());
 
-        if (!stat)
+        if (!ok)
         {
             std::ostringstream oss;
             const char* err = m_unzipper->get_error();
@@ -194,11 +195,9 @@
 void ZipReaderImpl::ReadIdiom()
 {
     bool ok = false;
-    std::cout << "ReadIdiom pos: " << m_ifs.tellg() << std::endl;
 
     ok = m_unzipper->read(m_zipPoint->m_lz_point);
-    
-    std::cout << "ReadIdiom pos: " << m_ifs.tellg() << std::endl;
+
     if (!ok)
     {
         std::ostringstream oss;
diff -r 1807a68342fa -r 62bcd5d0e24e src/detail/zippoint.cpp
--- a/src/detail/zippoint.cpp	Tue Jun 28 15:49:07 2011 -0500
+++ b/src/detail/zippoint.cpp	Wed Jun 29 08:33:48 2011 -0500
@@ -79,16 +79,6 @@
             break;
         }
     }
-    if (vlr)
-    {
-        our_vlr_num = vlr->GetData().size();
-        boost::scoped_array<boost::uint8_t> d( new boost::uint8_t[ our_vlr_num ] );
-        our_vlr_data.swap(d);
-        for (int i=0; i<our_vlr_num; i++)
-        {
-            our_vlr_data[i] = vlr->GetData()[i];
-        }
-    }
 
     unsigned char pointFormat = 0;
     unsigned short pointSize = 0;
@@ -116,11 +106,15 @@
 
     if (vlr)
     {
-        m_zip->unpack(our_vlr_data.get(), our_vlr_num);
-        m_zip->setup((const unsigned short int) m_zip->num_items, 
-                     (const LASitem*)m_zip->items, 
-                     LASZIP_COMPRESSOR_DEFAULT);
-        ConstructItems();
+        bool ok(false);
+        ok = m_zip->unpack(&(vlr->GetData()[0]), vlr->GetData().size());
+        if (!ok)
+        {
+            std::ostringstream oss;
+            oss << "Error unpacking zip VLR data: " << std::string(m_zip->get_error());
+            throw liblas_error(oss.str());
+        }
+
     } else
     {
 
@@ -130,12 +124,9 @@
             oss << "Error setting up LASzip for format " << pointFormat <<": " << m_zip->get_error(); 
             throw liblas_error(oss.str());
         }
-
-        ConstructItems();
-        
     }
 
-
+    ConstructItems();
     return;
 }
 


More information about the Liblas-commits mailing list