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

Prefer using bool literals #2793

Merged
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
6 changes: 3 additions & 3 deletions gpu/people/include/pcl/gpu/people/label_tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,11 @@ namespace pcl
int child_number)
{
if(sorted[label].size() == 0)
return 0;
return false;
for(size_t i = 0; i < sorted[label].size(); i++)
if((sorted[label][i].child_id[child_number] != NO_CHILD) && (sorted[label][i].child_id[child_number] != LEAF))
return 1;
return 0;
return true;
return false;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion gpu/people/tools/people_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ int main(int argc, char** argv)
pcl::gpu::setDevice (device);
pcl::gpu::printShortCudaDeviceInfo (device);

bool write = 0;
bool write = false;
pc::parse_argument (argc, argv, "-w", write);

// selecting data source
Expand Down
2 changes: 1 addition & 1 deletion io/src/vtk_lib_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ pcl::io::savePolygonFile (const std::string &file_name,
else
{
PCL_ERROR ("[pcl::io::savePolygonFile]: Unsupported file type (%s)\n", extension.c_str ());
return (0);
return (false);
}
}

Expand Down
2 changes: 1 addition & 1 deletion keypoints/include/pcl/keypoints/narf_keypoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class PCL_EXPORTS NarfKeypoint : public Keypoint<PointWithRange, int>
optimal_distance_to_high_surface_change(0.25), min_interest_value(0.45f),
min_surface_change_score(0.2f), optimal_range_image_patch_size(10),
distance_for_additional_points(0.0f), add_points_on_straight_edges(false),
do_non_maximum_suppression(true), no_of_polynomial_approximations_per_point(0),
do_non_maximum_suppression(true), no_of_polynomial_approximations_per_point(false),
max_no_of_threads(1), use_recursive_scale_reduction(false),
calculate_sparse_interest_image(true) {}

Expand Down
12 changes: 6 additions & 6 deletions keypoints/src/agast_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ namespace pcl
for (y = 2; y < height_b; y++)
{
x = 1;
while (1)
while (true)
{
homogeneous:
{
Expand Down Expand Up @@ -2497,7 +2497,7 @@ namespace pcl
int_fast16_t offset10 = s_offset10;
int_fast16_t offset11 = s_offset11;

while (1)
while (true)
{
const T2 cb = *p + T2 (b_test);
const T2 c_b = *p - T2 (b_test);
Expand Down Expand Up @@ -6357,7 +6357,7 @@ namespace pcl
for (y = 1; y < ysize_b; y++)
{
x = 0;
while (1)
while (true)
{
homogeneous:
{
Expand Down Expand Up @@ -7114,7 +7114,7 @@ namespace pcl
int_fast16_t offset6 = s_offset6;
int_fast16_t offset7 = s_offset7;

while (1)
while (true)
{
const T2 cb = *p + T2 (b_test);
const T2 c_b = *p - T2 (b_test);
Expand Down Expand Up @@ -7609,7 +7609,7 @@ namespace pcl
for (y = 3; y < ysize_b; y++)
{
x = 2;
while (1)
while (true)
{
x++;
if (x > xsize_b)
Expand Down Expand Up @@ -9715,7 +9715,7 @@ namespace pcl
int_fast16_t offset14 = s_offset14;
int_fast16_t offset15 = s_offset15;

while (1)
while (true)
{
const T2 cb = *p + T2 (b_test);
const T2 c_b = *p - T2 (b_test);
Expand Down
16 changes: 8 additions & 8 deletions ml/include/pcl/ml/svm_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ namespace pcl
/** \brief Constructor. */
SVM () :
training_set_ (), prob_ (), model_ (), scaling_ (), param_ (),
class_name_ (), line_ (NULL), max_line_len_ (10000), labelled_training_set_ (1)
class_name_ (), line_ (NULL), max_line_len_ (10000), labelled_training_set_ (true)
{
}

Expand Down Expand Up @@ -260,7 +260,7 @@ namespace pcl

public:
/** \brief Constructor. */
SVMTrain() : debug_ (0), cross_validation_ (0), nr_fold_ (0)
SVMTrain() : debug_ (false), cross_validation_ (0), nr_fold_ (0)
{
class_name_ = "SVMTrain";
svm_set_print_string_function (&printNull); // Default to NULL to not print debugging info
Expand Down Expand Up @@ -345,15 +345,15 @@ namespace pcl
bool
saveTrainingSet (const char *filename)
{
return SVM::saveProblem (filename, 1);
return SVM::saveProblem (filename, true);
};

/** \brief Save the normalized training set in a file (in svmlight format).
* \return false if fails. */
bool
saveNormTrainingSet (const char *filename)
{
return SVM::saveProblemNorm (filename, prob_, 1);
return SVM::saveProblemNorm (filename, prob_, true);
};
};

Expand Down Expand Up @@ -382,7 +382,7 @@ namespace pcl

public:
/** \brief Constructor. */
SVMClassify () : model_extern_copied_ (0), predict_probability_ (0)
SVMClassify () : model_extern_copied_ (false), predict_probability_ (false)
{
class_name_ = "SvmClassify";
}
Expand Down Expand Up @@ -463,7 +463,7 @@ namespace pcl
scaling_.obj[j] = model_.scaling[j];
}

model_extern_copied_ = 1;
model_extern_copied_ = true;
};

/** \brief Read in a raw classification problem (in svmlight format).
Expand Down Expand Up @@ -520,15 +520,15 @@ namespace pcl
bool
saveClassProblem (const char *filename)
{
return SVM::saveProblem (filename, 0);
return SVM::saveProblem (filename, false);
};

/** \brief Save the normalized classification problem in a file (in svmlight format).
* \return false if fails. */
bool
saveNormClassProblem (const char *filename)
{
return SVM::saveProblemNorm (filename, prob_, 0);
return SVM::saveProblemNorm (filename, prob_, false);
};
};
}
8 changes: 4 additions & 4 deletions ml/src/svm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3260,7 +3260,7 @@ svm_model *svm_load_model (const char *model_file_name)

char cmd[81];

while (1)
while (true)
{
int res = fscanf (fp, "%80s", cmd);

Expand Down Expand Up @@ -3413,7 +3413,7 @@ svm_model *svm_load_model (const char *model_file_name)
if (res > 0 && strcmp (cmd, "SV") == 0)
{
//std::cout << cmd << std::endl;
while (1)
while (true)
{
int c = getc (fp);

Expand Down Expand Up @@ -3450,7 +3450,7 @@ svm_model *svm_load_model (const char *model_file_name)
{
p = strtok (line, ":");

while (1)
while (true)
{
p = strtok (NULL, ":");

Expand Down Expand Up @@ -3498,7 +3498,7 @@ svm_model *svm_load_model (const char *model_file_name)

int jj = 0;

while (1)
while (true)
{
idx = strtok (NULL, ":");
val = strtok (NULL, " \t");
Expand Down
Loading