Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added modernize-use-auto to clang-tidy-checks #5397

Merged
Prev Previous commit
Next Next commit
Ran clang-tidy after rebase
  • Loading branch information
gnawme committed Sep 4, 2022
commit dc09085727084d5043c19af131f7978f5446bb99
22 changes: 11 additions & 11 deletions io/src/ply_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ pcl::PLYWriter::writeASCII (const std::string &file_name,
}

unsigned int nr_points = cloud.width * cloud.height;
unsigned int point_size = static_cast<unsigned int> (cloud.data.size () / nr_points);
auto point_size = static_cast<unsigned int> (cloud.data.size () / nr_points);

// Write the header information if available
if (use_camera)
Expand Down Expand Up @@ -1015,7 +1015,7 @@ pcl::PLYWriter::writeContentWithCameraASCII (int nr_points,
}
else
{
const pcl::RGB& color = cloud.at<pcl::RGB>(i, cloud.fields[d].offset + c * sizeof (pcl::RGB));
const auto& color = cloud.at<pcl::RGB>(i, cloud.fields[d].offset + c * sizeof (pcl::RGB));
fs << static_cast<int>(color.r) << " " << static_cast<int>(color.g) << " " << static_cast<int>(color.b) << " " << static_cast<int>(color.a);
}
break;
Expand All @@ -1028,7 +1028,7 @@ pcl::PLYWriter::writeContentWithCameraASCII (int nr_points,
}
else
{
const pcl::RGB& color = cloud.at<pcl::RGB>(i, cloud.fields[d].offset + c * sizeof (pcl::RGB));
const auto& color = cloud.at<pcl::RGB>(i, cloud.fields[d].offset + c * sizeof (pcl::RGB));
fs << static_cast<int>(color.r) << " " << static_cast<int>(color.g) << " " << static_cast<int>(color.b);
}
break;
Expand Down Expand Up @@ -1130,7 +1130,7 @@ pcl::PLYWriter::writeContentWithRangeGridASCII (int nr_points,
}
else
{
const pcl::RGB& color = cloud.at<pcl::RGB>(i, cloud.fields[d].offset + c * sizeof (pcl::RGB));
const auto& color = cloud.at<pcl::RGB>(i, cloud.fields[d].offset + c * sizeof (pcl::RGB));
line << static_cast<int>(color.r) << " " << static_cast<int>(color.g) << " " << static_cast<int>(color.b) << " " << static_cast<int>(color.a);
}
break;
Expand All @@ -1150,7 +1150,7 @@ pcl::PLYWriter::writeContentWithRangeGridASCII (int nr_points,
}
else
{
const pcl::RGB& color = cloud.at<pcl::RGB>(i, cloud.fields[d].offset + c * sizeof (pcl::RGB));
const auto& color = cloud.at<pcl::RGB>(i, cloud.fields[d].offset + c * sizeof (pcl::RGB));
line << static_cast<int>(color.r) << " " << static_cast<int>(color.g) << " " << static_cast<int>(color.b);
}
break;
Expand Down Expand Up @@ -1332,7 +1332,7 @@ pcl::PLYWriter::writeBinary (const std::string &file_name,
}
else
{
const pcl::RGB& color = cloud.at<pcl::RGB>(i, cloud.fields[d].offset + (total + c) * sizeof (pcl::RGB));
const auto& color = cloud.at<pcl::RGB>(i, cloud.fields[d].offset + (total + c) * sizeof (pcl::RGB));
fpout.write (reinterpret_cast<const char*> (&color.r), sizeof (unsigned char));
fpout.write (reinterpret_cast<const char*> (&color.g), sizeof (unsigned char));
fpout.write (reinterpret_cast<const char*> (&color.b), sizeof (unsigned char));
Expand All @@ -1348,7 +1348,7 @@ pcl::PLYWriter::writeBinary (const std::string &file_name,
}
else
{
const pcl::RGB& color = cloud.at<pcl::RGB>(i, cloud.fields[d].offset + (total + c) * sizeof (pcl::RGB));
const auto& color = cloud.at<pcl::RGB>(i, cloud.fields[d].offset + (total + c) * sizeof (pcl::RGB));
fpout.write (reinterpret_cast<const char*> (&color.r), sizeof (unsigned char));
fpout.write (reinterpret_cast<const char*> (&color.g), sizeof (unsigned char));
fpout.write (reinterpret_cast<const char*> (&color.b), sizeof (unsigned char));
Expand Down Expand Up @@ -1530,13 +1530,13 @@ pcl::io::savePLYFile (const std::string &file_name, const pcl::PolygonMesh &mesh
(mesh.cloud.fields[d].name == "rgb"))

{
const pcl::RGB& color = mesh.cloud.at<RGB>(i, mesh.cloud.fields[d].offset);
const auto& color = mesh.cloud.at<RGB>(i, mesh.cloud.fields[d].offset);
fs << int (color.r) << " " << int (color.g) << " " << int (color.b) << " ";
}
else if ((mesh.cloud.fields[d].datatype == pcl::PCLPointField::UINT32) &&
(mesh.cloud.fields[d].name == "rgba"))
{
const pcl::RGB& color = mesh.cloud.at<RGB>(i, mesh.cloud.fields[d].offset);
const auto& color = mesh.cloud.at<RGB>(i, mesh.cloud.fields[d].offset);
fs << int (color.r) << " " << int (color.g) << " " << int (color.b) << " " << int (color.a) << " ";
}
else if ((mesh.cloud.fields[d].datatype == pcl::PCLPointField::FLOAT32) && (
Expand Down Expand Up @@ -1629,15 +1629,15 @@ pcl::io::savePLYFileBinary (const std::string &file_name, const pcl::PolygonMesh
(mesh.cloud.fields[d].name == "rgb"))

{
const pcl::RGB& color = mesh.cloud.at<RGB>(i, mesh.cloud.fields[d].offset);
const auto& color = mesh.cloud.at<RGB>(i, mesh.cloud.fields[d].offset);
fpout.write (reinterpret_cast<const char*> (&color.r), sizeof (unsigned char));
fpout.write (reinterpret_cast<const char*> (&color.g), sizeof (unsigned char));
fpout.write (reinterpret_cast<const char*> (&color.b), sizeof (unsigned char));
}
else if ((mesh.cloud.fields[d].datatype == pcl::PCLPointField::UINT32) &&
(mesh.cloud.fields[d].name == "rgba"))
{
const pcl::RGB& color = mesh.cloud.at<RGB>(i, mesh.cloud.fields[d].offset);
const auto& color = mesh.cloud.at<RGB>(i, mesh.cloud.fields[d].offset);
fpout.write (reinterpret_cast<const char*> (&color.r), sizeof (unsigned char));
fpout.write (reinterpret_cast<const char*> (&color.g), sizeof (unsigned char));
fpout.write (reinterpret_cast<const char*> (&color.b), sizeof (unsigned char));
Expand Down