[Liblas-commits] hg: fix up calls of std::min and std::max to
satisfy windows mac...
liblas-commits at liblas.org
liblas-commits at liblas.org
Tue Jan 11 10:08:36 EST 2011
details: http://hg.liblas.orghg/rev/3b90c0b0382e
changeset: 2720:3b90c0b0382e
user: Howard Butler <hobu.inc at gmail.com>
date: Tue Jan 11 09:08:12 2011 -0600
description:
fix up calls of std::min and std::max to satisfy windows macros hell.
diffstat:
apps/kdx_util.cpp | 16 ++++++++--------
apps/las2ogr.cpp | 2 +-
apps/laskernel.cpp | 4 ++--
include/liblas/bounds.hpp | 4 ++--
src/color.cpp | 6 +++---
src/detail/index/indexcell.cpp | 20 ++++++++++----------
src/detail/index/indexoutput.cpp | 22 +++++++++++-----------
src/detail/reader/cachedreader.cpp | 6 +++---
src/schema.cpp | 4 ++--
src/spatialreference.cpp | 4 ++--
src/transform.cpp | 38 +++++++++++++++++++-------------------
src/utility.cpp | 4 ++--
12 files changed, 65 insertions(+), 65 deletions(-)
diffs (truncated from 400 to 300 lines):
diff -r 97ca1d940f20 -r 3b90c0b0382e apps/kdx_util.cpp
--- a/apps/kdx_util.cpp Mon Jan 10 14:08:20 2011 -0600
+++ b/apps/kdx_util.cpp Tue Jan 11 09:08:12 2011 -0600
@@ -30,11 +30,11 @@
first = false;
}
- mins[0] = std::min(mins[0], bnd.min(0));
- mins[1] = std::min(mins[1], bnd.min(1));
+ mins[0] = (std::min)(mins[0], bnd.min(0));
+ mins[1] = (std::min)(mins[1], bnd.min(1));
- maxs[0] = std::max(maxs[0], bnd.max(0));
- maxs[1] = std::max(maxs[1], bnd.max(1));
+ maxs[0] = (std::max)(maxs[0], bnd.max(0));
+ maxs[1] = (std::max)(maxs[1], bnd.max(1));
IndexResult result(static_cast<boost::uint32_t>(i));
result.SetIDs(ids);
@@ -73,11 +73,11 @@
first = false;
}
- mins[0] = std::min(mins[0], low[0]);
- mins[1] = std::min(mins[1], low[1]);
+ mins[0] = (std::min)(mins[0], low[0]);
+ mins[1] = (std::min)(mins[1], low[1]);
- maxs[0] = std::max(maxs[0], high[0]);
- maxs[1] = std::max(maxs[1], high[1]);
+ maxs[0] = (std::max)(maxs[0], high[0]);
+ maxs[1] = (std::max)(maxs[1], high[1]);
// if (!input.good()) continue;
IDVector ids;
diff -r 97ca1d940f20 -r 3b90c0b0382e apps/las2ogr.cpp
--- a/apps/las2ogr.cpp Mon Jan 10 14:08:20 2011 -0600
+++ b/apps/las2ogr.cpp Tue Jan 11 09:08:12 2011 -0600
@@ -94,7 +94,7 @@
static int lastTick = -1;
int tick = static_cast<int>(complete * 40.0);
- tick = std::min(40, std::max(0, tick));
+ tick = (std::min)(40, std::max(0, tick));
// Have we started a new progress run?
if (tick < lastTick && lastTick >= 39)
diff -r 97ca1d940f20 -r 3b90c0b0382e apps/laskernel.cpp
--- a/apps/laskernel.cpp Mon Jan 10 14:08:20 2011 -0600
+++ b/apps/laskernel.cpp Tue Jan 11 09:08:12 2011 -0600
@@ -677,8 +677,8 @@
for(tokenizer::iterator c = rgbs.begin(); c != rgbs.end(); ++c)
{
int color_val = atoi((*c).c_str());
- if (color_val < std::numeric_limits<boost::uint16_t>::min() ||
- color_val > std::numeric_limits<boost::uint16_t>::max())
+ if (color_val < (std::numeric_limits<boost::uint16_t>::min()) ||
+ color_val > (std::numeric_limits<boost::uint16_t>::max()))
{
ostringstream oss;
oss << "Color value must be between 0-65536, not " << color_val;
diff -r 97ca1d940f20 -r 3b90c0b0382e include/liblas/bounds.hpp
--- a/include/liblas/bounds.hpp Mon Jan 10 14:08:20 2011 -0600
+++ b/include/liblas/bounds.hpp Tue Jan 11 09:08:12 2011 -0600
@@ -70,7 +70,7 @@
typedef T value_type;
- Range(T mmin=std::numeric_limits<T>::max(), T mmax=std::numeric_limits<T>::min())
+ Range(T mmin=(std::numeric_limits<T>::max()), T mmax=(std::numeric_limits<T>::min()))
: minimum(mmin), maximum(mmax) {}
@@ -129,7 +129,7 @@
bool empty(void) const
{
- return detail::compare_distance(minimum, std::numeric_limits<T>::max()) && detail::compare_distance(maximum, std::numeric_limits<T>::min());
+ return detail::compare_distance(minimum, (std::numeric_limits<T>::max())) && detail::compare_distance(maximum, (std::numeric_limits<T>::min()));
}
void shift(T v)
diff -r 97ca1d940f20 -r 3b90c0b0382e src/color.cpp
--- a/src/color.cpp Mon Jan 10 14:08:20 2011 -0600
+++ b/src/color.cpp Tue Jan 11 09:08:12 2011 -0600
@@ -55,9 +55,9 @@
Color::Color(boost::uint32_t red, boost::uint32_t green, boost::uint32_t blue)
{
- if (red > std::numeric_limits<boost::uint16_t>::max() ||
- green > std::numeric_limits<boost::uint16_t>::max() ||
- blue > std::numeric_limits<boost::uint16_t>::max())
+ if (red > (std::numeric_limits<boost::uint16_t>::max()) ||
+ green > (std::numeric_limits<boost::uint16_t>::max()) ||
+ blue > (std::numeric_limits<boost::uint16_t>::max()))
throw_invalid_color_component();
using boost::uint16_t;
diff -r 97ca1d940f20 -r 3b90c0b0382e src/detail/index/indexcell.cpp
--- a/src/detail/index/indexcell.cpp Mon Jan 10 14:08:20 2011 -0600
+++ b/src/detail/index/indexcell.cpp Tue Jan 11 09:08:12 2011 -0600
@@ -51,8 +51,8 @@
IndexCell::IndexCell() :
m_FileOffset(0),
m_NumPoints(0),
- m_MinZ(numeric_limits<ElevExtrema>::max()),
- m_MaxZ(numeric_limits<ElevExtrema>::min())
+ m_MinZ((std::numeric_limits<ElevExtrema>::max())),
+ m_MaxZ((std::numeric_limits<ElevExtrema>::min()))
{
} // IndexCell::IndexCell
@@ -94,7 +94,7 @@
bool IndexCell::RoomToAdd(boost::uint32_t a)
{
- return (m_PtRecords[a] < numeric_limits<ConsecPtAccumulator>::max());
+ return (m_PtRecords[a] < (std::numeric_limits<ConsecPtAccumulator>::max()));
} // IndexCell::RoomToAdd
void IndexCell::AddPointRecord(boost::uint32_t a)
@@ -115,7 +115,7 @@
if ((MyIT = m_PtRecords.find(a)) != m_PtRecords.end())
{
- if (MyIT->second < numeric_limits<ConsecPtAccumulator>::max())
+ if (MyIT->second < (std::numeric_limits<ConsecPtAccumulator>::max()))
{
++MyIT->second;
++m_NumPoints;
@@ -148,10 +148,10 @@
void IndexCell::UpdateZBounds(double TestZ)
{
- if (TestZ > numeric_limits<ElevExtrema>::max())
- m_MaxZ = numeric_limits<ElevExtrema>::max();
- else if (TestZ < numeric_limits<ElevExtrema>::min())
- m_MinZ = numeric_limits<ElevExtrema>::min();
+ if (TestZ > (std::numeric_limits<ElevExtrema>::max()))
+ m_MaxZ = (std::numeric_limits<ElevExtrema>::max());
+ else if (TestZ < (std::numeric_limits<ElevExtrema>::min()))
+ m_MinZ = (std::numeric_limits<ElevExtrema>::min());
else
{
if (TestZ > m_MaxZ)
@@ -191,7 +191,7 @@
{
if ((YourIT = MyIT->second.find(b)) != MyIT->second.end())
{
- if (YourIT->second < numeric_limits<ConsecPtAccumulator>::max())
+ if (YourIT->second < (std::numeric_limits<ConsecPtAccumulator>::max()))
{
++YourIT->second;
return true;
@@ -227,7 +227,7 @@
{
if ((YourIT = MyIT->second.find(b)) != MyIT->second.end())
{
- if (YourIT->second < numeric_limits<ConsecPtAccumulator>::max())
+ if (YourIT->second < (std::numeric_limits<ConsecPtAccumulator>::max()))
{
++YourIT->second;
return true;
diff -r 97ca1d940f20 -r 3b90c0b0382e src/detail/index/indexoutput.cpp
--- a/src/detail/index/indexoutput.cpp Mon Jan 10 14:08:20 2011 -0600
+++ b/src/detail/index/indexoutput.cpp Tue Jan 11 09:08:12 2011 -0600
@@ -127,7 +127,7 @@
WriteVLRData_n(m_indexVLRHeaderData, TempLong, WritePos);
// record length
- assert(WritePos <= std::numeric_limits<boost::uint16_t>::max());
+ assert(WritePos <= (std::numeric_limits<boost::uint16_t>::max()));
m_indexVLRHeaderRecord.SetRecordLength(static_cast<boost::uint16_t>(WritePos));
m_indexVLRHeaderData.resize(WritePos);
m_indexVLRHeaderRecord.SetData(m_indexVLRHeaderData);
@@ -158,7 +158,7 @@
{
if (! InitializeVLRData(x, y))
return false;
- m_indexVLRTempData.resize(numeric_limits<unsigned short>::max());
+ m_indexVLRTempData.resize((std::numeric_limits<unsigned short>::max()));
m_TempWritePos = 0;
} // if
@@ -256,7 +256,7 @@
// copy data to VLR
// if new cell data causes VLR data to exceed limit add VLR to header VLR list and start new VLR
- if (m_SomeDataReadyToWrite && (m_TempWritePos + m_DataRecordSize > numeric_limits<unsigned short>::max()))
+ if (m_SomeDataReadyToWrite && (m_TempWritePos + m_DataRecordSize > (std::numeric_limits<unsigned short>::max())))
{
m_indexVLRCellPointData.resize(m_DataRecordSize);
m_indexVLRCellRecord.SetRecordLength(static_cast<boost::uint16_t>(m_DataRecordSize));
@@ -268,7 +268,7 @@
m_DataPointsThisVLR = NumPts;
} // if
// if size allows, add to VLR cell record data
- if (m_TempWritePos + m_DataRecordSize <= numeric_limits<unsigned short>::max())
+ if (m_TempWritePos + m_DataRecordSize <= (std::numeric_limits<unsigned short>::max()))
{
boost::uint32_t WritePos = m_DataRecordSize;
// update last cell in VLR, x, y
@@ -300,17 +300,17 @@
m_DataRecordSize += m_TempWritePos;
// write the total size in the common data section
// resizing shouldn't be necessary
- if (m_indexVLRCellPointData.size() != numeric_limits<unsigned short>::max())
- m_indexVLRCellPointData.resize(numeric_limits<unsigned short>::max());
+ if (m_indexVLRCellPointData.size() != (std::numeric_limits<unsigned short>::max()))
+ m_indexVLRCellPointData.resize((std::numeric_limits<unsigned short>::max()));
WriteVLRDataNoInc_n(m_indexVLRCellPointData, m_DataRecordSize, m_VLRDataSizeLocation);
// number of points in this VLR - added in Index version 1.1
WriteVLRDataNoInc_n(m_indexVLRCellPointData, m_DataPointsThisVLR, m_VLRPointCountLocation);
// write out the part that fits in this VLR (excluding the common data)
- boost::uint32_t WrittenBytes = numeric_limits<unsigned short>::max() - WritePos;
+ boost::uint32_t WrittenBytes = (std::numeric_limits<unsigned short>::max()) - WritePos;
WriteVLRDataNoInc_str(m_indexVLRCellPointData, (char * const)&m_indexVLRTempData[0], WrittenBytes, WritePos);
// add this VLR
- m_indexVLRCellRecord.SetRecordLength(static_cast<boost::uint16_t>(numeric_limits<unsigned short>::max()));
+ m_indexVLRCellRecord.SetRecordLength(static_cast<boost::uint16_t>((std::numeric_limits<unsigned short>::max())));
m_indexVLRCellRecord.SetData(m_indexVLRCellPointData);
m_index->GetIndexHeader()->AddVLR(m_indexVLRCellRecord);
@@ -319,7 +319,7 @@
while (UnwrittenBytes > 0)
{
- boost::uint32_t NewWrittenBytes = (UnwrittenBytes < numeric_limits<unsigned short>::max() ? UnwrittenBytes: numeric_limits<unsigned short>::max());
+ boost::uint32_t NewWrittenBytes = (UnwrittenBytes < (std::numeric_limits<unsigned short>::max()) ? UnwrittenBytes: (std::numeric_limits<unsigned short>::max()));
WriteVLRDataNoInc_str(m_indexVLRCellPointData, (char * const)&m_indexVLRTempData[WrittenBytes], NewWrittenBytes, 0);
WrittenBytes += NewWrittenBytes;
UnwrittenBytes -= NewWrittenBytes;
@@ -348,7 +348,7 @@
{
try {
- m_indexVLRCellPointData.resize(numeric_limits<unsigned short>::max());
+ m_indexVLRCellPointData.resize((std::numeric_limits<unsigned short>::max()));
m_DataRecordSize = m_VLRCommonDataSize;
m_DataPointsThisVLR = 0;
@@ -385,7 +385,7 @@
{
#ifdef LIBLAS_INDEX_PADLASTVLR
boost::uint32_t PadBytes = m_DataRecordSize % 4;
- if (PadBytes && (m_DataRecordSize + PadBytes <= numeric_limits<unsigned short>::max()))
+ if (PadBytes && (m_DataRecordSize + PadBytes <= (std::numeric_limits<unsigned short>::max())))
{
m_DataRecordSize += PadBytes;
for (boost::uint32_t i = 0; i < PadBytes; ++i)
diff -r 97ca1d940f20 -r 3b90c0b0382e src/detail/reader/cachedreader.cpp
--- a/src/detail/reader/cachedreader.cpp Mon Jan 10 14:08:20 2011 -0600
+++ b/src/detail/reader/cachedreader.cpp Tue Jan 11 09:08:12 2011 -0600
@@ -98,9 +98,9 @@
m_cache_start_position = position;
cache_mask_type::size_type header_size = static_cast<cache_mask_type::size_type>(m_header->GetPointRecordsCount());
- cache_mask_type::size_type left_to_cache = std::min(m_cache_size, header_size - m_cache_start_position);
+ cache_mask_type::size_type left_to_cache = (std::min)(m_cache_size, header_size - m_cache_start_position);
- cache_mask_type::size_type to_mark = std::min(m_cache_size, header_size - old_cache_start_position);
+ cache_mask_type::size_type to_mark = (std::min)(m_cache_size, header_size - old_cache_start_position);
for (uint32_t i = 0; i < to_mark; ++i)
{
@@ -290,7 +290,7 @@
typedef cache_mask_type::size_type size_type;
size_type old_cache_start_position = m_cache_start_position;
size_type header_size = static_cast<size_type>(m_header->GetPointRecordsCount());
- size_type to_mark = std::min(m_cache_size, header_size - old_cache_start_position);
+ size_type to_mark = (std::min)(m_cache_size, header_size - old_cache_start_position);
for (uint32_t i = 0; i < to_mark; ++i) {
diff -r 97ca1d940f20 -r 3b90c0b0382e src/schema.cpp
--- a/src/schema.cpp Mon Jan 10 14:08:20 2011 -0600
+++ b/src/schema.cpp Tue Jan 11 09:08:12 2011 -0600
@@ -768,11 +768,11 @@
{
data.push_back(*i);
}
- if (data.size() > std::numeric_limits<boost::uint16_t>::max()) {
+ if (data.size() > (std::numeric_limits<boost::uint16_t>::max())) {
std::ostringstream oss;
oss << "This schema with length " << data.size() << " does"
<< " not fit within the maximum VLR size of "
- << std::numeric_limits<boost::uint16_t>::max();
+ << (std::numeric_limits<boost::uint16_t>::max());
throw std::runtime_error(oss.str());
}
vlr.SetData(data);
diff -r 97ca1d940f20 -r 3b90c0b0382e src/spatialreference.cpp
--- a/src/spatialreference.cpp Mon Jan 10 14:08:20 2011 -0600
+++ b/src/spatialreference.cpp Tue Jan 11 09:08:12 2011 -0600
@@ -380,13 +380,13 @@
}
record.SetData(data);
- if (data.size() > std::numeric_limits<boost::uint16_t>::max())
More information about the Liblas-commits
mailing list