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

Fix warnings reported by clang #1096

Merged
merged 14 commits into from
Jan 18, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/src/ni_agast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ class AGASTDemo
keypoints3d.height = keypoints->height;
keypoints3d.is_dense = true;

int j = 0;
size_t j = 0;
for (size_t i = 0; i < keypoints->size (); ++i)
{
const PointT &pt = (*cloud)(static_cast<long unsigned int> (keypoints->points[i].u),
Expand Down
2 changes: 1 addition & 1 deletion apps/src/ni_brisk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class BRISKDemo
keypoints3d.height = keypoints->height;
keypoints3d.is_dense = true;

int j = 0;
size_t j = 0;
for (size_t i = 0; i < keypoints->size (); ++i)
{
PointT pt = bilinearInterpolation (cloud, keypoints->points[i].x, keypoints->points[i].y);
Expand Down
2 changes: 1 addition & 1 deletion apps/src/openni_tracking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ class OpenNISegmentTracking
}

void addNormalToCloud (const CloudConstPtr &cloud,
const pcl::PointCloud<pcl::Normal>::ConstPtr &normals,
const pcl::PointCloud<pcl::Normal>::ConstPtr &,
RefCloud &result)
{
result.width = cloud->width;
Expand Down
12 changes: 6 additions & 6 deletions apps/src/stereo_ground_segmentation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,12 @@ class HRCSSegmentation
std::vector<Eigen::Matrix3f, Eigen::aligned_allocator<Eigen::Matrix3f> > covariances;
std::vector<pcl::PointIndices> inlier_indices;

for (int i = 0; i < region_indices.size (); i++)
for (size_t i = 0; i < region_indices.size (); i++)
{
if (region_indices[i].indices.size () > 1000)
{

for (int j = 0; j < region_indices[i].indices.size (); j++)
for (size_t j = 0; j < region_indices[i].indices.size (); j++)
{
pcl::PointXYZ ground_pt (cloud->points[region_indices[i].indices[j]].x,
cloud->points[region_indices[i].indices[j]].y,
Expand Down Expand Up @@ -354,11 +354,11 @@ class HRCSSegmentation

//Note the regions that have been extended
pcl::PointCloud<PointT> extended_ground_cloud;
for (int i = 0; i < region_indices.size (); i++)
for (size_t i = 0; i < region_indices.size (); i++)
{
if (region_indices[i].indices.size () > 1000)
{
for (int j = 0; j < region_indices[i].indices.size (); j++)
for (size_t j = 0; j < region_indices[i].indices.size (); j++)
{
// Check to see if it has already been labeled
if (ground_image->points[region_indices[i].indices[j]].g == ground_image->points[region_indices[i].indices[j]].b)
Expand Down Expand Up @@ -434,7 +434,7 @@ class HRCSSegmentation
if ((ptp_dist > 0.5) && (ptp_dist < 3.0))
{

for (int j = 0; j < euclidean_label_indices[i].indices.size (); j++)
for (size_t j = 0; j < euclidean_label_indices[i].indices.size (); j++)
{
ground_image->points[euclidean_label_indices[i].indices[j]].r = 255;
label_image->points[euclidean_label_indices[i].indices[j]].r = 255;
Expand All @@ -451,7 +451,7 @@ class HRCSSegmentation
}

// note the NAN points in the image as well
for (int i = 0; i < cloud->points.size (); i++)
for (size_t i = 0; i < cloud->points.size (); i++)
{
if (!pcl::isFinite (cloud->points[i]))
{
Expand Down
2 changes: 1 addition & 1 deletion io/src/robot_eye_grabber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ pcl::RobotEyeGrabber::convertPacketData (unsigned char *data_packet, size_t leng
const size_t bytes_per_point = 8;
const size_t total_points = (length - offset)/ bytes_per_point;

for (int i = 0; i < total_points; ++i)
for (size_t i = 0; i < total_points; ++i)
{
PointXYZI xyzi;
computeXYZI (xyzi, data_packet + i*bytes_per_point + offset);
Expand Down
2 changes: 1 addition & 1 deletion keypoints/include/pcl/keypoints/impl/trajkovic_2d.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ pcl::TrajkovicKeypoint2D<PointInT, PointOutT, IntensityT>::detectKeypoints (Poin
#ifdef _OPENMP
#pragma omp parallel for shared (output) num_threads (threads_)
#endif
for (int i = 0; i < indices.size (); ++i)
for (size_t i = 0; i < indices.size (); ++i)
{
int idx = indices[i];
if ((response_->points[idx] < second_threshold_) || occupency_map[idx])
Expand Down
2 changes: 1 addition & 1 deletion keypoints/include/pcl/keypoints/impl/trajkovic_3d.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ pcl::TrajkovicKeypoint3D<PointInT, PointOutT, NormalT>::detectKeypoints (PointCl
#ifdef _OPENMP
#pragma omp parallel for shared (output) num_threads (threads_)
#endif
for (int i = 0; i < indices.size (); ++i)
for (size_t i = 0; i < indices.size (); ++i)
{
int idx = indices[i];
if ((response_->points[idx] < second_threshold_) || occupency_map[idx])
Expand Down
2 changes: 1 addition & 1 deletion keypoints/include/pcl/keypoints/trajkovic_3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ namespace pcl

/// \brief \return points normals as calculated or given
inline void
getNormals (const NormalsConstPtr &normals) const { return (normals_); }
getNormals () const { return (normals_); }

/** \brief Initialize the scheduler and set the number of threads to use.
* \param nr_threads the number of hardware threads to use, 0 for automatic.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ pcl::GrabCut<PointT>::initGraph ()
graph_nodes_.clear ();
graph_nodes_.resize (indices_->size ());
int start = graph_.addNodes (indices_->size ());
for (int idx = 0; idx < indices_->size (); ++idx)
for (size_t idx = 0; idx < indices_->size (); ++idx)
{
graph_nodes_[idx] = start;
++start;
Expand Down
2 changes: 0 additions & 2 deletions stereo/include/pcl/stereo/digital_elevation_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@
#ifndef PCL_DIGITAL_ELEVATION_MAP_H_
#define PCL_DIGITAL_ELEVATION_MAP_H_

#pragma warning(disable : 4996)
#include <pcl/point_types.h>
#include <pcl/stereo/disparity_map_converter.h>
#pragma warning(default : 4996)

namespace pcl
{
Expand Down
36 changes: 18 additions & 18 deletions test/common/test_copy_make_borders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ TEST (CopyPointCloud, constant)
pcl::copyPointCloud (cloud, dst, top, bottom, left, right, pcl::BORDER_CONSTANT, constant);

for (int j = 0; j < top; ++j)
for (int i = 0; i < dst.width; ++i)
for (uint32_t i = 0; i < dst.width; ++i)
EXPECT_XYZ_EQ (dst (i,j), constant);

for (int j = top; j < cloud.height+top; ++j)
for (unsigned int j = top; j < cloud.height+top; ++j)
{
for (int i = 0; i < dst.width; ++i)
for (uint32_t i = 0; i < dst.width; ++i)
{
if (i < left)
if (static_cast<int> (i) < left)
EXPECT_XYZ_EQ (dst (i,j), constant);
else
{
Expand All @@ -71,8 +71,8 @@ TEST (CopyPointCloud, constant)
}
}

for (int j = cloud.height+top; j < dst.height; ++j)
for (int i = 0; i < dst.width; ++i)
for (uint32_t j = cloud.height+top; j < dst.height; ++j)
for (uint32_t i = 0; i < dst.width; ++i)
EXPECT_XYZ_EQ (dst (i,j), constant);
}

Expand All @@ -85,17 +85,17 @@ TEST (CopyPointCloud, replicate)
{
for (int i = 0; i < left; ++i)
EXPECT_XYZ_EQ (dst (i,j), cloud (0,0));
for (int i = left; i < cloud.width+left; ++i)
for (unsigned int i = left; i < cloud.width+left; ++i)
EXPECT_XYZ_EQ (dst (i,j), cloud (i-left,0));
for (int i = cloud.width+left; i < dst.width; ++i)
for (uint32_t i = cloud.width+left; i < dst.width; ++i)
EXPECT_XYZ_EQ (dst (i,j), cloud (cloud.width-1,0));
}

for (int j = top; j < cloud.height+top; ++j)
for (unsigned int j = top; j < cloud.height+top; ++j)
{
for (int i = 0; i < dst.width; ++i)
for (uint32_t i = 0; i < dst.width; ++i)
{
if (i < left)
if (static_cast<int> (i) < left)
EXPECT_XYZ_EQ (dst (i,j), cloud (0,j-top));
else
{
Expand All @@ -107,13 +107,13 @@ TEST (CopyPointCloud, replicate)
}
}

for (int j = cloud.height+top; j < dst.height; ++j)
for (uint32_t j = cloud.height+top; j < dst.height; ++j)
{
for (int i = 0; i < left; ++i)
EXPECT_XYZ_EQ (dst (i,j), cloud (0,cloud.height-1));
for (int i = left; i < cloud.width+left; ++i)
for (unsigned int i = left; i < cloud.width+left; ++i)
EXPECT_XYZ_EQ (dst (i,j), cloud (i-left,cloud.height-1));
for (int i = cloud.width+left; i < dst.width; ++i)
for (uint32_t i = cloud.width+left; i < dst.width; ++i)
EXPECT_XYZ_EQ (dst (i,j), cloud (cloud.width-1,cloud.height-1));
}
}
Expand All @@ -128,19 +128,19 @@ TEST (CopyPointCloud, reflect)
for (int i = 0, l = left-1; i < left; ++i, --l)
EXPECT_XYZ_EQ (dst (i,j), cloud (l, k));

for (int i = left; i < cloud.width+left; ++i)
for (unsigned int i = left; i < cloud.width+left; ++i)
EXPECT_XYZ_EQ (dst (i,j), cloud (i-left,k));

for (int i = cloud.width+left, l = cloud.width-left; i < left; ++i, --l)
EXPECT_XYZ_EQ (dst (i,j), cloud (l, k));
}

for (int j = top; j < cloud.height+top; ++j)
for (unsigned int j = top; j < cloud.height+top; ++j)
{
for (int i = 0, l = left-1; i < left; ++i, --l)
EXPECT_XYZ_EQ (dst (i,j), cloud (l, j-top));

for (int i = left; i < cloud.width + left; ++i)
for (unsigned int i = left; i < cloud.width + left; ++i)
EXPECT_XYZ_EQ (dst (i,j), cloud (i-left,j-top));

for (int i = cloud.width+left, l = cloud.width-left; i < left; ++i, --l)
Expand All @@ -152,7 +152,7 @@ TEST (CopyPointCloud, reflect)
for (int i = 0, l = left-1; i < left; ++i, --l)
EXPECT_XYZ_EQ (dst (i,j), cloud (l, k));

for (int i = left; i < cloud.width+left; ++i)
for (unsigned int i = left; i < cloud.width+left; ++i)
EXPECT_XYZ_EQ (dst (i,j), cloud (i-left,k));

for (int i = cloud.width+left, l = cloud.width-left; i < left; ++i, --l)
Expand Down
2 changes: 1 addition & 1 deletion test/geometry/test_quad_mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ TYPED_TEST (TestQuadMesh, NineQuads)
{
const FaceIndex index = mesh.addFace (ordered_faces [j]);

if (j < non_manifold [i] || !Mesh::IsManifold::value)
if (j < static_cast<unsigned int> (non_manifold [i]) || !Mesh::IsManifold::value)
{
EXPECT_TRUE (index.isValid ());
}
Expand Down
2 changes: 1 addition & 1 deletion test/io/test_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ TEST (PCL, ASCIIReader)
EXPECT_GE(reader.read("test_pcd.txt", rcloud), 0);
EXPECT_EQ(cloud.points.size(), rcloud.points.size() );

for(int i=0;i < rcloud.points.size(); i++){
for(size_t i=0;i < rcloud.points.size(); i++){
EXPECT_FLOAT_EQ(cloud.points[i].x, rcloud.points[i].x);
EXPECT_FLOAT_EQ(cloud.points[i].y,rcloud.points[i].y);
EXPECT_FLOAT_EQ(cloud.points[i].z, rcloud.points[i].z);
Expand Down
6 changes: 2 additions & 4 deletions visualization/include/pcl/visualization/impl/image_viewer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,14 @@ pcl::visualization::ImageViewer::addMask (
search.setInputCloud (image);
std::vector<float> xy;
xy.reserve (mask.size () * 2);
const float image_height_f = static_cast<float> (image->height);
for (size_t i = 0; i < mask.size (); ++i)
{
pcl::PointXY p_projected;
search.projectPoint (mask[i], p_projected);

xy.push_back (p_projected.x);
#if ((VTK_MAJOR_VERSION >= 6) || ((VTK_MAJOR_VERSION == 5) && (VTK_MINOR_VERSION > 7)))
xy.push_back (image_height_f - p_projected.y);
xy.push_back (static_cast<float> (image->height) - p_projected.y);
#else
xy.push_back (p_projected.y);
#endif
Expand Down Expand Up @@ -174,7 +173,6 @@ pcl::visualization::ImageViewer::addPlanarPolygon (
// Construct a search object to get the camera parameters and fill points
pcl::search::OrganizedNeighbor<T> search;
search.setInputCloud (image);
const float image_height_f = static_cast<float> (image->height);
std::vector<float> xy;
xy.reserve ((polygon.getContour ().size () + 1) * 2);
for (size_t i = 0; i < polygon.getContour ().size (); ++i)
Expand All @@ -183,7 +181,7 @@ pcl::visualization::ImageViewer::addPlanarPolygon (
search.projectPoint (polygon.getContour ()[i], p);
xy.push_back (p.x);
#if ((VTK_MAJOR_VERSION == 5) && (VTK_MINOR_VERSION <= 7))
xy.push_back (image_height_f - p.y);
xy.push_back (static_cast<float> (image->height) - p.y);
#else
xy.push_back (p.y);
#endif
Expand Down