Skip to content

Commit

Permalink
catch by reference to avoid slicing
Browse files Browse the repository at this point in the history
this suppress some cppcheck warning
  • Loading branch information
soyersoyer committed Jan 20, 2015
1 parent b61e088 commit 4dc3210
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion common/include/pcl/impl/pcl_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ pcl::PCLBase<PointT>::initCompute ()
{
indices_->resize (input_->points.size ());
}
catch (std::bad_alloc)
catch (const std::bad_alloc&)
{
PCL_ERROR ("[initCompute] Failed to allocate %lu indices.\n", input_->points.size ());
}
Expand Down
2 changes: 1 addition & 1 deletion common/src/pcl_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ pcl::PCLBase<pcl::PCLPointCloud2>::initCompute ()
{
indices_->resize (input_->width * input_->height);
}
catch (std::bad_alloc)
catch (const std::bad_alloc&)
{
PCL_ERROR ("[initCompute] Failed to allocate %lu indices.\n", (input_->width * input_->height));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ loadHist (const boost::filesystem::path &path, vfh_model &vfh)
if ((int)cloud.width * cloud.height != 1)
return (false);
}
catch (pcl::InvalidConversionException e)
catch (const pcl::InvalidConversionException&)
{
return (false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ loadHist (const boost::filesystem::path &path, vfh_model &vfh)
if ((int)cloud.width * cloud.height != 1)
return (false);
}
catch (pcl::InvalidConversionException e)
catch (const pcl::InvalidConversionException&)
{
return (false);
}
Expand Down
2 changes: 1 addition & 1 deletion io/src/hdl_grabber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ pcl::HDLGrabber::start ()
try {
hdl_read_socket_ = new udp::socket (hdl_read_socket_service_, udp_listener_endpoint_);
}
catch (std::exception bind) {
catch (const std::exception& bind) {
delete hdl_read_socket_;
hdl_read_socket_ = new udp::socket (hdl_read_socket_service_, udp::endpoint(boost::asio::ip::address_v4::any(), udp_listener_endpoint_.port()));
}
Expand Down
6 changes: 3 additions & 3 deletions test/io/test_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,7 @@ TEST (PCL, Locale)
std::locale::global (std::locale ("de_DE.UTF-8"));
#endif
}
catch (std::runtime_error e)
catch (const std::runtime_error&)
{
PCL_WARN ("Failed to set locale, skipping test.\n");
}
Expand All @@ -1164,7 +1164,7 @@ TEST (PCL, Locale)
std::locale::global (std::locale ("en_US.UTF-8"));
#endif
}
catch (std::runtime_error e)
catch (const std::runtime_error&)
{
PCL_WARN ("Failed to set locale, skipping test.\n");
}
Expand All @@ -1186,7 +1186,7 @@ TEST (PCL, Locale)
ASSERT_FLOAT_EQ (cloud2.points[i].z, cloud.points[i].z);
}
}
catch(std::exception& e)
catch (const std::exception&)
{
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion tools/pcd2png.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ parseScaleOption (int argc, char** argv, T& pcie)
pcie.setScalingMethod(pcie.SCALING_FIXED_FACTOR);
pcie.setScalingFactor(factor);
}
catch (boost::bad_lexical_cast)
catch (const boost::bad_lexical_cast&)
{
print_error ("The value of --scale option should be \"no\", \"auto\", or a floating point number.\n");
return false;
Expand Down

0 comments on commit 4dc3210

Please sign in to comment.