[Liblas-commits] hg: make our_vlr_data a boost::scoped_array

liblas-commits at liblas.org liblas-commits at liblas.org
Fri Jun 24 16:30:55 EDT 2011


details:   http://hg.liblas.orghg/rev/91f2d3e1e0ab
changeset: 3016:91f2d3e1e0ab
user:      Howard Butler <hobu.inc at gmail.com>
date:      Fri Jun 24 15:21:43 2011 -0500
description:
make our_vlr_data a boost::scoped_array

diffstat:

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

diffs (59 lines):

diff -r e9bf37763cf5 -r 91f2d3e1e0ab include/liblas/detail/zippoint.hpp
--- a/include/liblas/detail/zippoint.hpp	Fri Jun 24 15:10:33 2011 -0500
+++ b/include/liblas/detail/zippoint.hpp	Fri Jun 24 15:21:43 2011 -0500
@@ -83,7 +83,7 @@
     int his_vlr_num;
     unsigned char* his_vlr_data;
     int our_vlr_num;
-    unsigned char* our_vlr_data;
+    boost::scoped_array<boost::uint8_t> our_vlr_data;
 
     boost::scoped_ptr<LASzip> m_zip;
 
diff -r e9bf37763cf5 -r 91f2d3e1e0ab src/detail/reader/zipreader.cpp
--- a/src/detail/reader/zipreader.cpp	Fri Jun 24 15:10:33 2011 -0500
+++ b/src/detail/reader/zipreader.cpp	Fri Jun 24 15:21:43 2011 -0500
@@ -125,7 +125,7 @@
             throw liblas_error(oss.str());
         }
 
-        ok = m_zip->unpack(m_zipPoint->our_vlr_data, m_zipPoint->our_vlr_num);
+        ok = m_zip->unpack(m_zipPoint->our_vlr_data.get(), m_zipPoint->our_vlr_num);
         if (!ok)
         {
             std::ostringstream oss;
diff -r e9bf37763cf5 -r 91f2d3e1e0ab src/detail/zippoint.cpp
--- a/src/detail/zippoint.cpp	Fri Jun 24 15:10:33 2011 -0500
+++ b/src/detail/zippoint.cpp	Fri Jun 24 15:21:43 2011 -0500
@@ -62,12 +62,7 @@
 
 
 ZipPoint::ZipPoint(PointFormatName format, const std::vector<VariableRecord>& vlrs)
-    : his_vlr_num(0)
-    , his_vlr_data(0)
-    , our_vlr_num(0)
-    , our_vlr_data(0)
-    , m_lz_point(NULL)
-    , m_lz_point_data(NULL)
+    : m_lz_point(NULL)
     , m_lz_point_size(0)
 {
 
@@ -87,7 +82,8 @@
     if (vlr)
     {
         our_vlr_num = vlr->GetData().size();
-        our_vlr_data = new unsigned char[our_vlr_num];
+        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];
@@ -130,7 +126,6 @@
 {
 
     delete[] m_lz_point;
-    delete[] our_vlr_data;
 
     return;
 }


More information about the Liblas-commits mailing list