[Liblas-commits] hg-main-tree: apply Will's patch for #38 to enable
MSVC2008 buil...
liblas-commits at liblas.org
liblas-commits at liblas.org
Wed Jul 27 09:36:29 EDT 2011
details: http://hg.libpc.orghg-main-tree/rev/ae34a3faf6e7
changeset: 952:ae34a3faf6e7
user: Howard Butler <hobu.inc at gmail.com>
date: Wed Jul 27 08:36:22 2011 -0500
description:
apply Will's patch for #38 to enable MSVC2008 building
diffstat:
src/PointBuffer.cpp | 2 +-
src/drivers/las/Header.cpp | 52 ++++++++++++++++----------------
src/drivers/las/LasHeaderReader.cpp | 24 +++++++-------
src/drivers/las/LasHeaderWriter.cpp | 42 ++++++++++++------------
src/drivers/las/VariableLengthRecord.cpp | 10 +++---
test/unit/Support.cpp | 6 +-
6 files changed, 68 insertions(+), 68 deletions(-)
diffs (truncated from 447 to 300 lines):
diff -r 0dab4c7fe9f6 -r ae34a3faf6e7 src/PointBuffer.cpp
--- a/src/PointBuffer.cpp Wed Jul 27 02:45:47 2011 -0700
+++ b/src/PointBuffer.cpp Wed Jul 27 08:36:22 2011 -0500
@@ -122,7 +122,7 @@
void PointBuffer::getData(boost::uint8_t** data, std::size_t* array_size) const
{
*array_size = getSchemaLayout().getByteSize();
- *data = (uint8_t*) malloc (*array_size);
+ *data = (boost::uint8_t*) malloc (*array_size);
memcpy(*data, m_data.get(), *array_size);
}
diff -r 0dab4c7fe9f6 -r ae34a3faf6e7 src/drivers/las/Header.cpp
--- a/src/drivers/las/Header.cpp Wed Jul 27 02:45:47 2011 -0700
+++ b/src/drivers/las/Header.cpp Wed Jul 27 08:36:22 2011 -0500
@@ -78,24 +78,24 @@
std::strncpy(m_signature, v.c_str(), eFileSignatureSize);
}
-uint16_t LasHeader::GetFileSourceId() const
+boost::uint16_t LasHeader::GetFileSourceId() const
{
return m_sourceId;
}
-void LasHeader::SetFileSourceId(uint16_t v)
+void LasHeader::SetFileSourceId(boost::uint16_t v)
{
// TODO: Should we warn or throw about type overflow occuring when
// user passes 65535 + 1 = 0
m_sourceId = v;
}
-uint16_t LasHeader::GetReserved() const
+boost::uint16_t LasHeader::GetReserved() const
{
return m_reserved;
}
-void LasHeader::SetReserved(uint16_t v)
+void LasHeader::SetReserved(boost::uint16_t v)
{
// TODO: Should we warn or throw about type overflow occuring when
// user passes 65535 + 1 = 0
@@ -112,12 +112,12 @@
m_projectGuid = v;
}
-uint8_t LasHeader::GetVersionMajor() const
+boost::uint8_t LasHeader::GetVersionMajor() const
{
return m_versionMajor;
}
-void LasHeader::SetVersionMajor(uint8_t v)
+void LasHeader::SetVersionMajor(boost::uint8_t v)
{
if (eVersionMajorMin > v || v > eVersionMajorMax)
throw std::out_of_range("version major out of range");
@@ -125,12 +125,12 @@
m_versionMajor = v;
}
-uint8_t LasHeader::GetVersionMinor() const
+boost::uint8_t LasHeader::GetVersionMinor() const
{
return m_versionMinor;
}
-void LasHeader::SetVersionMinor(uint8_t v)
+void LasHeader::SetVersionMinor(boost::uint8_t v)
{
if (v > eVersionMinorMax)
throw std::out_of_range("version minor out of range");
@@ -190,12 +190,12 @@
std::strncpy(m_softwareId, v.c_str(), eSoftwareIdSize);
}
-uint16_t LasHeader::GetCreationDOY() const
+boost::uint16_t LasHeader::GetCreationDOY() const
{
return m_createDOY;
}
-void LasHeader::SetCreationDOY(uint16_t v)
+void LasHeader::SetCreationDOY(boost::uint16_t v)
{
if (v > 366)
throw std::out_of_range("day of year out of range");
@@ -203,12 +203,12 @@
m_createDOY = v;
}
-uint16_t LasHeader::GetCreationYear() const
+boost::uint16_t LasHeader::GetCreationYear() const
{
return m_createYear;
}
-void LasHeader::SetCreationYear(uint16_t v)
+void LasHeader::SetCreationYear(boost::uint16_t v)
{
// mloskot: I've taken these values arbitrarily
if (v > 9999)
@@ -217,26 +217,26 @@
m_createYear = v;
}
-uint16_t LasHeader::GetHeaderSize() const
+boost::uint16_t LasHeader::GetHeaderSize() const
{
return m_headerSize;
}
-void LasHeader::SetHeaderSize(uint16_t v)
+void LasHeader::SetHeaderSize(boost::uint16_t v)
{
m_headerSize = v;
}
-uint32_t LasHeader::GetDataOffset() const
+boost::uint32_t LasHeader::GetDataOffset() const
{
return m_dataOffset;
}
-void LasHeader::SetDataOffset(uint32_t v)
+void LasHeader::SetDataOffset(boost::uint32_t v)
{
- // uint32_t const dataSignatureSize = 2;
- // uint16_t const hsize = GetHeaderSize();
+ // boost::uint32_t const dataSignatureSize = 2;
+ // boost::uint16_t const hsize = GetHeaderSize();
//
// if ( (m_versionMinor == 0 && v < hsize + dataSignatureSize) ||
// (m_versionMinor == 1 && v < hsize) ||
@@ -259,18 +259,18 @@
m_pointFormat = v;
}
-uint16_t LasHeader::GetDataRecordLength() const
+boost::uint16_t LasHeader::GetDataRecordLength() const
{
// No matter what the schema says, this must be a short in size.
return pdal::drivers::las::Support::getPointDataSize(m_pointFormat);
}
-uint32_t LasHeader::GetPointRecordsCount() const
+boost::uint32_t LasHeader::GetPointRecordsCount() const
{
return m_pointRecordsCount;
}
-void LasHeader::SetPointRecordsCount(uint32_t v)
+void LasHeader::SetPointRecordsCount(boost::uint32_t v)
{
m_pointRecordsCount = v;
}
@@ -280,11 +280,11 @@
return m_pointRecordsByReturn;
}
-void LasHeader::SetPointRecordsByReturnCount(std::size_t index, uint32_t v)
+void LasHeader::SetPointRecordsByReturnCount(std::size_t index, boost::uint32_t v)
{
assert(m_pointRecordsByReturn.size() == LasHeader::ePointsByReturnSize);
- uint32_t& t = m_pointRecordsByReturn.at(index);
+ boost::uint32_t& t = m_pointRecordsByReturn.at(index);
t = v;
}
@@ -392,13 +392,13 @@
std::tm* ptm = std::gmtime(&now);
if (0 != ptm)
{
- m_createDOY = static_cast<uint16_t>(ptm->tm_yday);
- m_createYear = static_cast<uint16_t>(ptm->tm_year + 1900);
+ m_createDOY = static_cast<boost::uint16_t>(ptm->tm_yday);
+ m_createYear = static_cast<boost::uint16_t>(ptm->tm_year + 1900);
}
m_headerSize = eHeaderSize;
- m_sourceId = m_reserved = uint16_t();
+ m_sourceId = m_reserved = boost::uint16_t();
memset(m_projectGuid.data, 0, 16);
m_dataOffset = eHeaderSize; // excluding 2 bytes of Point Data Start Signature
diff -r 0dab4c7fe9f6 -r ae34a3faf6e7 src/drivers/las/LasHeaderReader.cpp
--- a/src/drivers/las/LasHeaderReader.cpp Wed Jul 27 02:45:47 2011 -0700
+++ b/src/drivers/las/LasHeaderReader.cpp Wed Jul 27 08:36:22 2011 -0500
@@ -160,8 +160,8 @@
Utils::read_n(n1, m_istream, sizeof(n1));
// the high two bits are reserved for laszip compression type
- uint8_t compression_bit_7 = (n1 & 0x80) >> 7;
- uint8_t compression_bit_6 = (n1 & 0x40) >> 6;
+ boost::uint8_t compression_bit_7 = (n1 & 0x80) >> 7;
+ boost::uint8_t compression_bit_6 = (n1 & 0x40) >> 6;
if (!compression_bit_7 && !compression_bit_6)
{
m_header.SetCompressed(false);
@@ -214,8 +214,8 @@
std::size_t const return_count_length = 5;
for (std::size_t i = 0; i < return_count_length; ++i)
{
- uint32_t count = 0;
- Utils::read_n(count, m_istream, sizeof(uint32_t));
+ boost::uint32_t count = 0;
+ Utils::read_n(count, m_istream, sizeof(boost::uint32_t));
m_header.SetPointRecordsByReturnCount(i, count);
}
@@ -286,10 +286,10 @@
bool LasHeaderReader::hasLAS10PadSignature()
{
- uint8_t const sgn1 = 0xCC;
- uint8_t const sgn2 = 0xDD;
- uint8_t pad1 = 0x0;
- uint8_t pad2 = 0x0;
+ boost::uint8_t const sgn1 = 0xCC;
+ boost::uint8_t const sgn2 = 0xDD;
+ boost::uint8_t pad1 = 0x0;
+ boost::uint8_t pad2 = 0x0;
std::streamsize const current_pos = m_istream.tellg();
@@ -298,8 +298,8 @@
// borken dishes back up in the cabinet
try
{
- Utils::read_n(pad1, m_istream, sizeof(uint8_t));
- Utils::read_n(pad2, m_istream, sizeof(uint8_t));
+ Utils::read_n(pad1, m_istream, sizeof(boost::uint8_t));
+ Utils::read_n(pad2, m_istream, sizeof(boost::uint8_t));
}
catch (std::out_of_range& e)
{
@@ -379,7 +379,7 @@
void LasHeaderReader::readAllVLRs()
{
- const uint32_t count = m_numVLRs;
+ const boost::uint32_t count = m_numVLRs;
if (count == 0)
{
return;
@@ -453,7 +453,7 @@
std::ios::off_type remainder = point_bytes % length;
- if ( m_header.GetPointRecordsCount() != static_cast<uint32_t>(count)) {
+ if ( m_header.GetPointRecordsCount() != static_cast<boost::uint32_t>(count)) {
std::ostringstream msg;
msg << "The number of points in the header that was set "
diff -r 0dab4c7fe9f6 -r ae34a3faf6e7 src/drivers/las/LasHeaderWriter.cpp
--- a/src/drivers/las/LasHeaderWriter.cpp Wed Jul 27 02:45:47 2011 -0700
+++ b/src/drivers/las/LasHeaderWriter.cpp Wed Jul 27 08:36:22 2011 -0500
@@ -65,9 +65,9 @@
{
using namespace std;
- uint8_t n1 = 0;
- uint16_t n2 = 0;
- uint32_t n4 = 0;
+ boost::uint8_t n1 = 0;
+ boost::uint16_t n2 = 0;
+ boost::uint32_t n4 = 0;
// This test should only be true if we were opened in both
// std::ios::in *and* std::ios::out
@@ -126,11 +126,11 @@
}
{
- int32_t difference = (int32_t)m_header.GetDataOffset() - (int32_t)GetRequiredHeaderSize();
+ boost::int32_t difference = (boost::int32_t)m_header.GetDataOffset() - (boost::int32_t)GetRequiredHeaderSize();
if (difference <= 0)
{
- int32_t d = abs(difference);
+ boost::int32_t d = abs(difference);
if (m_header.GetVersionMinor() == 0)
{
// Add the two extra bytes for the 1.0 pad
@@ -217,8 +217,8 @@
Utils::write_n(m_ostream, n4, sizeof(n4));
// 16. Point Data Format ID
- n1 = static_cast<uint8_t>(m_header.getPointFormat());
- uint8_t n1tmp = n1;
+ n1 = static_cast<boost::uint8_t>(m_header.getPointFormat());
+ boost::uint8_t n1tmp = n1;
if (m_header.Compressed()) // high bit set indicates laszip compression
n1tmp |= 0x80;
Utils::write_n(m_ostream, n1tmp, sizeof(n1tmp));
More information about the Liblas-commits
mailing list