Skip to content

Commit 498bc93

Browse files
authored
Add more bugprone-* clang-tidy checks, Part B (#6380)
* Add more bugprone-I clang-tidy checks, Part B * Fix numerous clang-format escapes * Fix more clang-format escapes * Fix yet more clang-format issues * Yeah, more clang-format issues * Revert odd clang-tidy 'fix' * Restore missing operator= * Revert weird clang-tidy 'fix' * Add [[maybe_unused]] to parameters * Fix typo in initialization list * Remove extraneous parentheses in return statement * Address review comments * Check dynamic_cast output for nullptr before dereferencing * Check dynamic_cast output before dereferencing in modeler * Add nullptr checks to existing dynamic_cast * Address review comments * Fix clang-format escapes * Fix a missing return value * Address review comments
1 parent 208630b commit 498bc93

163 files changed

Lines changed: 688 additions & 757 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pc_source/source.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ class Model {
5151
if (resolution <= 0)
5252
return assembled_;
5353

54-
typename std::map<float, PointTPtrConst>::iterator it =
55-
voxelized_assembled_.find(resolution);
54+
auto it = voxelized_assembled_.find(resolution);
5655
if (it == voxelized_assembled_.end()) {
5756
PointTPtr voxelized(new pcl::PointCloud<PointT>);
5857
pcl::VoxelGrid<PointT> grid_;

apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_crh.hpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,7 @@ pcl::rec_3d_framework::GlobalNNCRHRecognizer<Distance, PointInT, FeatureT>::getP
2222
using mv_pair = std::pair<std::string, int>;
2323
mv_pair pair_model_view = std::make_pair(model.id_, view_id);
2424

25-
std::map<mv_pair,
26-
Eigen::Matrix4f,
27-
std::less<>,
28-
Eigen::aligned_allocator<std::pair<const mv_pair, Eigen::Matrix4f>>>::
29-
iterator it = poses_cache_.find(pair_model_view);
25+
auto it = poses_cache_.find(pair_model_view);
3026

3127
if (it != poses_cache_.end()) {
3228
pose_matrix = it->second;

apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_cvfh.hpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,7 @@ pcl::rec_3d_framework::GlobalNNCVFHRecognizer<Distance, PointInT, FeatureT>::get
2222
using mv_pair = std::pair<std::string, int>;
2323
mv_pair pair_model_view = std::make_pair(model.id_, view_id);
2424

25-
std::map<mv_pair,
26-
Eigen::Matrix4f,
27-
std::less<>,
28-
Eigen::aligned_allocator<std::pair<const mv_pair, Eigen::Matrix4f>>>::
29-
iterator it = poses_cache_.find(pair_model_view);
25+
auto it = poses_cache_.find(pair_model_view);
3026

3127
if (it != poses_cache_.end()) {
3228
pose_matrix = it->second;

apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/local_recognizer.hpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -460,11 +460,7 @@ pcl::rec_3d_framework::LocalRecognitionPipeline<Distance, PointInT, FeatureT>::g
460460
using mv_pair = std::pair<std::string, int>;
461461
mv_pair pair_model_view = std::make_pair(model.id_, view_id);
462462

463-
std::map<mv_pair,
464-
Eigen::Matrix4f,
465-
std::less<>,
466-
Eigen::aligned_allocator<std::pair<const mv_pair, Eigen::Matrix4f>>>::
467-
iterator it = poses_cache_.find(pair_model_view);
463+
auto it = poses_cache_.find(pair_model_view);
468464

469465
if (it != poses_cache_.end()) {
470466
pose_matrix = it->second;
@@ -489,8 +485,7 @@ pcl::rec_3d_framework::LocalRecognitionPipeline<Distance, PointInT, FeatureT>::
489485

490486
if (use_cache_) {
491487
std::pair<std::string, int> pair_model_view = std::make_pair(model.id_, view_id);
492-
typename std::map<std::pair<std::string, int>, PointInTPtr>::iterator it =
493-
keypoints_cache_.find(pair_model_view);
488+
auto it = keypoints_cache_.find(pair_model_view);
494489

495490
if (it != keypoints_cache_.end()) {
496491
keypoints_cloud = it->second;

apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/local_recognizer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ class PCL_EXPORTS LocalRecognitionPipeline {
195195
}
196196

197197
public:
198-
LocalRecognitionPipeline() : search_model_("")
198+
LocalRecognitionPipeline()
199199
{
200200
use_cache_ = false;
201201
threshold_accept_model_hypothesis_ = 0.2f;

apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/tools/openni_frame_source.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ class PCL_EXPORTS OpenNIFrameSource {
3131

3232
pcl::OpenNIGrabber grabber_;
3333
PointCloudPtr most_recent_frame_;
34-
int frame_counter_;
34+
int frame_counter_{0};
3535
std::mutex mutex_;
36-
bool active_;
36+
bool active_{true};
3737
};
3838

3939
} // namespace OpenNIFrameSource

apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/utils/persistence_utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ writeMatrixToFile(const std::string& file, Eigen::Matrix4f& matrix)
5454
for (std::size_t i = 0; i < 4; i++) {
5555
for (std::size_t j = 0; j < 4; j++) {
5656
out << matrix(i, j);
57-
if (!(i == 3 && j == 3))
57+
if (i != 3 || j != 3)
5858
out << " ";
5959
}
6060
}

apps/3d_rec_framework/src/tools/local_recognition_mian_dataset.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ recognizeAndVisualize(
102102
for (std::size_t i = 0; i < files.size(); i++) {
103103
std::cout << files[i] << std::endl;
104104
if (scene != -1)
105-
if ((std::size_t)scene != i)
105+
if (static_cast<std::size_t>(scene) != i)
106106
continue;
107107

108108
const std::string file = ply_files_dir.string() + files[i];

apps/3d_rec_framework/src/tools/openni_frame_source.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44

55
namespace OpenNIFrameSource {
66

7-
OpenNIFrameSource::OpenNIFrameSource(const std::string& device_id)
8-
: grabber_(device_id), frame_counter_(0), active_(true)
7+
OpenNIFrameSource::OpenNIFrameSource(const std::string& device_id) : grabber_(device_id)
98
{
109
std::function<void(const PointCloudConstPtr&)> frame_cb =
1110
[this](const PointCloudConstPtr& cloud) { onNewFrame(cloud); };

apps/cloud_composer/include/pcl/apps/cloud_composer/commands.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class CloudCommand : public QUndoCommand {
5454
public:
5555
CloudCommand(ConstItemList input_data, QUndoCommand* parent = nullptr);
5656

57-
~CloudCommand();
57+
~CloudCommand() override;
5858

5959
virtual bool
6060
runCommand(AbstractTool* tool) = 0;
@@ -112,8 +112,8 @@ class CloudCommand : public QUndoCommand {
112112
bool
113113
canUseTemplates(ConstItemList& input_data);
114114

115-
bool can_use_templates_;
116-
int template_type_;
115+
bool can_use_templates_{false};
116+
int template_type_{-1};
117117
};
118118

119119
class ModifyItemCommand : public CloudCommand {

0 commit comments

Comments
 (0)