Skip to content

Commit

Permalink
Quiet compiler warning/errors. (#42)
Browse files Browse the repository at this point in the history
* Quiet compiler warning/errors.

* More compiler fixes.
  • Loading branch information
abellgithub authored Jan 5, 2021
1 parent 7f4f6c9 commit 154e7f7
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
3 changes: 3 additions & 0 deletions bu/Processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion epf/Epf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
1 change: 0 additions & 1 deletion epf/Grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion untwine/FileDimInfo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
20 changes: 13 additions & 7 deletions untwine/ProgressWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::mutex> lock(m_mutex);

Expand All @@ -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<std::mutex> lock(m_mutex);

Expand All @@ -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<std::mutex> lock(m_mutex);

Expand All @@ -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<std::mutex> lock(m_mutex);

Expand All @@ -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<HANDLE>((intptr_t)m_progressFd);
Expand Down

0 comments on commit 154e7f7

Please sign in to comment.