[Liblas-commits] hg: 2 new changesets

liblas-commits at liblas.org liblas-commits at liblas.org
Wed Sep 22 15:12:30 EDT 2010


changeset 3aebb49ead90 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=3aebb49ead90
summary: clean up some warnings

changeset 24869d8813a8 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=24869d8813a8
summary: merge

diffstat:

 python/tests/SRS-GDAL.txt   |  4 ++--
 src/detail/writer/point.cpp |  8 ++++----
 src/lasheader.cpp           |  3 ++-
 src/lasschema.cpp           |  8 ++++----
 4 files changed, 12 insertions(+), 11 deletions(-)

diffs (101 lines):

diff -r 8d27a317b12e -r 24869d8813a8 python/tests/SRS-GDAL.txt
--- a/python/tests/SRS-GDAL.txt	Wed Sep 22 12:49:42 2010 -0500
+++ b/python/tests/SRS-GDAL.txt	Wed Sep 22 14:12:23 2010 -0500
@@ -123,7 +123,7 @@
 
   >>> f = file.File('../test/data/srs_vertcs.las',mode='r')
   >>> s = f.header.srs
-  >>> s.get_wkt_compoundok() == """COMPD_CS["unknown",PROJCS["WGS 84 / UTM zone 17N",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-81],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AUTHORITY["EPSG","32617"]],VERT_CS["North American Vertical Datum of 1988",VERT_DATUM["North American Vertical Datum 1988",2005,AUTHORITY["EPSG","5103"]],UNIT["metre",1.0,AUTHORITY["EPSG","9001"]],AXIS["Up",UP],AUTHORITY["EPSG","5703"]]]"""
+  >>> s.get_wkt_compoundok() == """COMPD_CS["unknown",PROJCS["WGS 84 / UTM zone 17N",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-81],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AUTHORITY["EPSG","32617"]],VERT_CS["NAVD88 height",VERT_DATUM["North American Vertical Datum 1988",2005,AUTHORITY["EPSG","5103"],EXTENSION["PROJ4_GRIDS","g2003conus.gtx,g2003alaska.gtx,g2003h01.gtx,g2003p01.gtx"]],AXIS["Up",UP],AUTHORITY["EPSG","5703"]]]"""
   True
 
   >>> s2 = srs.SRS()
@@ -131,4 +131,4 @@
   >>> s2.set_verticalcs( 5703, 'abc', 5103, 9001 )
   True
   >>> s2.get_wkt_compoundok()
-  'COMPD_CS["unknown",PROJCS["WGS 84 / UTM zone 17N",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-81],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AUTHORITY["EPSG","32617"]],VERT_CS["abc",VERT_DATUM["North American Vertical Datum 1988",2005,AUTHORITY["EPSG","5103"]],UNIT["metre",1.0,AUTHORITY["EPSG","9001"]],AXIS["Up",UP],AUTHORITY["EPSG","5703"]]]'
+  'COMPD_CS["unknown",PROJCS["WGS 84 / UTM zone 17N",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-81],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AUTHORITY["EPSG","32617"]],VERT_CS["NAVD88 height",VERT_DATUM["North American Vertical Datum 1988",2005,AUTHORITY["EPSG","5103"],EXTENSION["PROJ4_GRIDS","g2003conus.gtx,g2003alaska.gtx,g2003h01.gtx,g2003p01.gtx"]],AXIS["Up",UP],AUTHORITY["EPSG","5703"]]]'
diff -r 8d27a317b12e -r 24869d8813a8 src/detail/writer/point.cpp
--- a/src/detail/writer/point.cpp	Wed Sep 22 12:49:42 2010 -0500
+++ b/src/detail/writer/point.cpp	Wed Sep 22 14:12:23 2010 -0500
@@ -83,14 +83,14 @@
     // here instead of at each ::write() invocation to save the 
     // allocation and writing of the array
     if (m_format.GetByteSize() != m_format.GetBaseByteSize()) {
-        int16_t size = m_format.GetByteSize() - m_format.GetBaseByteSize();
+        std::size_t size = m_format.GetByteSize() - m_format.GetBaseByteSize();
         
         if (size < 0) {
             throw std::runtime_error("ByteSize of format was less than BaseByteSize, this cannot happen!");
         }
         
         m_blanks = new uint8_t[size]; // FIXME: RAII for m_blanks!!! --mloskot
-        for (int i=0; i < size; ++i) {
+        for (std::size_t i=0; i < size; ++i) {
             m_blanks[i] = 0;
         }
     }
@@ -154,7 +154,7 @@
     if (m_format.GetByteSize() != m_format.GetBaseByteSize()) {
         std::vector<uint8_t> const& data = point.GetExtraData();
 
-        int16_t size = m_format.GetByteSize() - m_format.GetBaseByteSize();
+        std::size_t size = m_format.GetByteSize() - m_format.GetBaseByteSize();
         
         if (size < 0) {
             throw std::runtime_error("ByteSize of format was less than BaseByteSize, this cannot happen!");
@@ -164,7 +164,7 @@
 
             detail::write_n(GetStream(), *m_blanks, static_cast<std::streamsize>(size));
             
-        } else if (data.size() < static_cast<uint32_t>(size)){ 
+        } else if (data.size() < size){ 
             // size can be casted now that we have already checked if it is less than 0
             int16_t difference = static_cast<uint16_t>(size) - static_cast<uint16_t>(data.size());
             detail::write_n(GetStream(), data.front(), data.size());
diff -r 8d27a317b12e -r 24869d8813a8 src/lasheader.cpp
--- a/src/lasheader.cpp	Wed Sep 22 12:49:42 2010 -0500
+++ b/src/lasheader.cpp	Wed Sep 22 14:12:23 2010 -0500
@@ -392,7 +392,8 @@
 
 uint16_t Header::GetDataRecordLength() const
 {
-    return m_schema.GetByteSize();
+    // No matter what the schema says, this must be a a short in size.
+    return static_cast<boost::uint16_t>(m_schema.GetByteSize());
 }
 
 uint32_t Header::GetPointRecordsCount() const
diff -r 8d27a317b12e -r 24869d8813a8 src/lasschema.cpp
--- a/src/lasschema.cpp	Wed Sep 22 12:49:42 2010 -0500
+++ b/src/lasschema.cpp	Wed Sep 22 14:12:23 2010 -0500
@@ -407,8 +407,8 @@
         bool isactive = v.get<bool>("active");
         bool isrequired = v.get<bool>("required");
         boost::uint32_t position = v.get<boost::uint32_t>("position");
-        double min;
-        double max;
+        double min=0;
+        double max=0;
         try {
             min = v.get<double>("minimum");
             max = v.get<double>("maximum");
@@ -424,7 +424,7 @@
         d->IsSigned(issigned);
         d->IsRequired(isrequired);
         d->SetPosition(position);
-        if (min != max && min != 0 & max != 0) {
+        if (min != max && min != 0 && max != 0) {
             d->SetMinimum(min);
             d->SetMaximum(max);
         }
@@ -753,7 +753,7 @@
     liblas::property_tree::write_xml(oss, tree);
     
     std::string s(oss.str());
-    vlr.SetRecordLength(s.size());
+    vlr.SetRecordLength(static_cast<boost::uint16_t>(s.size()));
 
     std::string::const_iterator i;
     for (i = s.begin(); i != s.end(); ++i)


More information about the Liblas-commits mailing list