[Liblas-commits] hg: 3 new changesets
liblas-commits at liblas.org
liblas-commits at liblas.org
Wed Dec 30 16:22:08 EST 2009
changeset 28695318b654 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=28695318b654
summary: Added missing explicit integral type conversions in read_n() function
changeset 46d3dac1bec0 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=46d3dac1bec0
summary: Added missing headers to src/CMakeLists.txt (Ticket #52). Successfully tested building with CMake + Visual Studio 2010
changeset 24ee96f79a09 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=24ee96f79a09
summary: Fixed integral types mismatch
diffstat:
include/liblas/detail/utility.hpp | 5 +++--
src/CMakeLists.txt | 18 +++++++++++++++---
src/lasvariablerecord.cpp | 7 ++++---
test/unit/common.cpp | 2 +-
test/unit/laspoint_test.cpp | 2 +-
5 files changed, 24 insertions(+), 10 deletions(-)
diffs (116 lines):
diff -r 7851feb55974 -r 24ee96f79a09 include/liblas/detail/utility.hpp
--- a/include/liblas/detail/utility.hpp Tue Dec 29 13:07:44 2009 -0600
+++ b/include/liblas/detail/utility.hpp Wed Dec 30 21:21:29 2009 +0000
@@ -431,9 +431,10 @@
throw std::runtime_error("detail::liblas::read_n input stream is not readable");
// Read bytes into temporary buffer then assign as string
- char* buf = new char[num];
+ std::size_t const bufsize = static_cast<std::size_t>(num);
+ char* buf = new char[bufsize]; // TODO:this is a leak, make exception safe with RAII
src.read(buf, num);
- dest.assign(buf, num);
+ dest.assign(buf, bufsize);
delete [] buf;
assert(dest.size() == static_cast<std::string::size_type>(num));
diff -r 7851feb55974 -r 24ee96f79a09 src/CMakeLists.txt
--- a/src/CMakeLists.txt Tue Dec 29 13:07:44 2009 -0600
+++ b/src/CMakeLists.txt Wed Dec 30 21:21:29 2009 +0000
@@ -8,13 +8,13 @@
# Collect dependencies configuration
IF(GDAL_FOUND)
- SET(LIBLAS_GDAL_CPP gt_wkt_srs.cpp gt_citation.cpp tifvsi.cpp)
+ SET(LIBLAS_GDAL_CPP gt_citation.cpp gt_wkt_srs.cpp tifvsi.cpp)
ENDIF()
IF(SPATIALINDEX_FOUND)
SET(LIBLAS_INDEX_CPP
+ index/datastream.cpp
index/index.cpp
- index/datastream.cpp
index/visitor.cpp
index/query.cpp
index/storage.cpp)
@@ -25,12 +25,23 @@
SET(LIBLAS_HEADERS_DIR ../include/liblas)
+
+IF(SPATIALINDEX_FOUND)
+ SET(LIBLAS_INDEX_HPP
+ ${LIBLAS_HEADERS_DIR}/index/datastream.hpp
+ ${LIBLAS_HEADERS_DIR}/index/index.hpp
+ ${LIBLAS_HEADERS_DIR}/index/visitor.hpp
+ ${LIBLAS_HEADERS_DIR}/index/query.hpp
+ ${LIBLAS_HEADERS_DIR}/index/storage.hpp)
+ENDIF()
+
SET(LIBLAS_HPP
${LIBLAS_HEADERS_DIR}/cstdint.hpp
${LIBLAS_HEADERS_DIR}/exception.hpp
${LIBLAS_HEADERS_DIR}/guid.hpp
${LIBLAS_HEADERS_DIR}/iterator.hpp
- ${LIBLAS_HEADERS_DIR}/lascolor.hpp
+ ${LIBLAS_HEADERS_DIR}/lasclassification.hpp
+ ${LIBLAS_HEADERS_DIR}/lascolor.hpp
${LIBLAS_HEADERS_DIR}/laserror.hpp
${LIBLAS_HEADERS_DIR}/lasfile.hpp
${LIBLAS_HEADERS_DIR}/lasheader.hpp
@@ -85,6 +96,7 @@
SET(LIBLAS_SOURCES
${LIBLAS_HPP}
${LIBLAS_DETAIL_HPP}
+ ${LIBLAS_INDEX_HPP}
${LIBLAS_CPP}
${LIBLAS_DETAIL_CPP}
${LIBLAS_INDEX_CPP}
diff -r 7851feb55974 -r 24ee96f79a09 src/lasvariablerecord.cpp
--- a/src/lasvariablerecord.cpp Tue Dec 29 13:07:44 2009 -0600
+++ b/src/lasvariablerecord.cpp Wed Dec 30 21:21:29 2009 +0000
@@ -244,8 +244,9 @@
std::cout << "Stream length: " << length << std::endl;
// FIXME: If read_n throws, buffer will leak.
- // Replace with std::vector --mloskot
- uint8_t* buffer = new uint8_t[length];
+ // Replace with std::vector or any other RAII --mloskot
+ std::size_t const buffersize = static_cast<std::size_t>(length);
+ uint8_t* buffer = new uint8_t[buffersize];
liblas::detail::read_n(buffer, in, length);
@@ -256,7 +257,7 @@
LIBLAS_SWAP_BYTES_N(buffer, length);
std::vector<uint8_t> data;
- for (std::size_t i = 0; i < static_cast<std::size_t>(length); ++i)
+ for (std::size_t i = 0; i < buffersize; ++i)
{
data.push_back(buffer[i]);
}
diff -r 7851feb55974 -r 24ee96f79a09 test/unit/common.cpp
--- a/test/unit/common.cpp Tue Dec 29 13:07:44 2009 -0600
+++ b/test/unit/common.cpp Wed Dec 30 21:21:29 2009 +0000
@@ -100,7 +100,7 @@
ensure_equals("wrong defualt edge of flight line",
p.GetFlightLineEdge(), 0);
ensure_equals("wrong defualt classification",
- p.GetClassification(), liblas::LASClassification::bitset_type(0));
+ p.GetClassification(), liblas::LASClassification::bitset_type());
ensure_equals("wrong defualt scan angle rank",
p.GetScanAngleRank(), 0);
ensure_equals("wrong defualt file marker/user data value",
diff -r 7851feb55974 -r 24ee96f79a09 test/unit/laspoint_test.cpp
--- a/test/unit/laspoint_test.cpp Tue Dec 29 13:07:44 2009 -0600
+++ b/test/unit/laspoint_test.cpp Wed Dec 30 21:21:29 2009 +0000
@@ -247,7 +247,7 @@
void to::test<11>()
{
ensure_equals("invalid default classification",
- m_default.GetClassification(), liblas::LASClassification::bitset_type(0));
+ m_default.GetClassification(), liblas::LASClassification::bitset_type());
liblas::LASClassification c;
More information about the Liblas-commits
mailing list