From 154e7f77cf5f4a279f85a03b67fc0d6fd2c44c14 Mon Sep 17 00:00:00 2001 From: Andrew Bell Date: Tue, 5 Jan 2021 12:40:48 -0500 Subject: [PATCH] Quiet compiler warning/errors. (#42) * Quiet compiler warning/errors. * More compiler fixes. --- bu/Processor.cpp | 3 +++ epf/Epf.cpp | 1 - epf/Grid.cpp | 1 - untwine/FileDimInfo.hpp | 4 +++- untwine/ProgressWriter.cpp | 20 +++++++++++++------- 5 files changed, 19 insertions(+), 10 deletions(-) diff --git a/bu/Processor.cpp b/bu/Processor.cpp index d2fd190..ee16394 100644 --- a/bu/Processor.cpp +++ b/bu/Processor.cpp @@ -138,6 +138,9 @@ std::cerr << m_vi.key() << " Accepted/Rejected/num points = " << bool Processor::acceptable(int pointId, GridKey key) { + //ABELL - Currently unused - see commented-out code. + (void)pointId; + VoxelInfo::Grid& grid = m_vi.grid(); auto it = grid.find(key); diff --git a/epf/Epf.cpp b/epf/Epf.cpp index d54ecfd..36b2237 100644 --- a/epf/Epf.cpp +++ b/epf/Epf.cpp @@ -73,7 +73,6 @@ void Epf::run(const Options& options, ProgressWriter& progress) { using namespace pdal; - double millionPoints = 0; BOX3D totalBounds; if (pdal::FileUtils::fileExists(options.tempDir + "/" + MetadataFilename)) diff --git a/epf/Grid.cpp b/epf/Grid.cpp index 387ba5f..8109354 100644 --- a/epf/Grid.cpp +++ b/epf/Grid.cpp @@ -42,7 +42,6 @@ int Grid::calcLevel() { int level = 0; double mp = (double)m_millionPoints; - double limit = (MaxPointsPerNode / 1000000.0); double xside = m_bounds.maxx - m_bounds.minx; double yside = m_bounds.maxy - m_bounds.miny; diff --git a/untwine/FileDimInfo.hpp b/untwine/FileDimInfo.hpp index 4cdbb26..600ffc1 100644 --- a/untwine/FileDimInfo.hpp +++ b/untwine/FileDimInfo.hpp @@ -40,7 +40,9 @@ inline std::ostream& operator<<(std::ostream& out, const FileDimInfo& fdi) inline std::istream& operator>>(std::istream& in, FileDimInfo& fdi) { - in >> fdi.name >> (int&)fdi.type >> fdi.offset; + int type; + in >> fdi.name >> type >> fdi.offset; + fdi.type = (pdal::Dimension::Type)type; return in; } diff --git a/untwine/ProgressWriter.cpp b/untwine/ProgressWriter.cpp index 7130e3c..4bd053a 100644 --- a/untwine/ProgressWriter.cpp +++ b/untwine/ProgressWriter.cpp @@ -18,7 +18,7 @@ ProgressWriter::ProgressWriter(int fd) : m_progressFd(fd), m_percent(0.0), m_inc void ProgressWriter::setIncrement(double increment) { - if (!m_progressFd) + if (m_progressFd < 0) return; std::unique_lock lock(m_mutex); @@ -27,7 +27,7 @@ void ProgressWriter::setIncrement(double increment) void ProgressWriter::setPercent(double percent) { - if (!m_progressFd) + if (m_progressFd < 0) return; std::unique_lock lock(m_mutex); @@ -36,7 +36,7 @@ void ProgressWriter::setPercent(double percent) void ProgressWriter::writeIncrement(const std::string& message) { - if (!m_progressFd) + if (m_progressFd < 0) return; std::unique_lock lock(m_mutex); @@ -49,7 +49,7 @@ void ProgressWriter::writeIncrement(const std::string& message) void ProgressWriter::write(double percent, const std::string& message) { - if (!m_progressFd) + if (m_progressFd < 0) return; std::unique_lock lock(m_mutex); @@ -62,10 +62,16 @@ void ProgressWriter::write(double percent, const std::string& message) void ProgressWriter::writeMessage(uint32_t percent, const std::string& message) { #ifndef _WIN32 - ::write(m_progressFd, &percent, sizeof(percent)); + bool err = false; + err = (::write(m_progressFd, &percent, sizeof(percent)) == -1); uint32_t ssize = (uint32_t)message.size(); - ::write(m_progressFd, &ssize, sizeof(ssize)); - ::write(m_progressFd, message.data(), ssize); + err |= (::write(m_progressFd, &ssize, sizeof(ssize)) == -1); + err |= (::write(m_progressFd, message.data(), ssize) == -1); + if (err) + { + ::close(m_progressFd); + m_progressFd = -1; + } #else DWORD numWritten; HANDLE h = reinterpret_cast((intptr_t)m_progressFd);