Cleanup: Clang-Tidy, modernize-use-bool-literals

This commit is contained in:
Sergey Sharybin 2020-11-06 14:25:30 +01:00
parent dfa027fe09
commit af35ada2f3
17 changed files with 28 additions and 28 deletions

View File

@ -42,7 +42,6 @@ Checks: >
-modernize-concat-nested-namespaces,
-modernize-use-nodiscard,
-modernize-use-using,
-modernize-use-bool-literals,
-modernize-loop-convert,
-modernize-pass-by-value,
-modernize-use-default-member-init,

View File

@ -41,7 +41,7 @@ TEST(path_util, Clean)
EXPECT_STREQ("a/", path);
}
if (0) /* FIXME */
if (false) /* FIXME */
{
char path[FILE_MAX] = "./a////";
BLI_path_normalize(NULL, path);

View File

@ -747,7 +747,7 @@ void zbuf_accumulate_vecblur(NodeBlurData *nbd,
float blendfac, ipodata[4];
/* clear zbuf, if we draw future we fill in not moving pixels */
if (0) {
if (false) {
for (x = xsize * ysize - 1; x >= 0; x--) {
rectz[x] = 10e16;
}

View File

@ -1234,7 +1234,7 @@ void DepsgraphRelationBuilder::build_constraints(ID *id,
}
}
if (cti->flush_constraint_targets) {
cti->flush_constraint_targets(con, &targets, 1);
cti->flush_constraint_targets(con, &targets, true);
}
}
}

View File

@ -116,7 +116,7 @@ void FRS_init()
BKE_callback_add(&load_post_callback_funcstore, BKE_CB_EVT_LOAD_POST);
freestyle_is_initialized = 1;
freestyle_is_initialized = true;
}
void FRS_set_context(bContext *C)

View File

@ -648,10 +648,10 @@ static bool float_array_from_PyList(PyObject *obj, float *v, int n)
v[i] = PyFloat_AsDouble(PyList_GET_ITEM(obj, i));
if (v[i] == -1.0f && PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError, "list elements must be a number");
return 0;
return false;
}
}
return 1;
return true;
}
bool Vec2f_ptr_from_PyList(PyObject *obj, Vec2f &vec)
@ -707,10 +707,10 @@ static bool float_array_from_PyTuple(PyObject *obj, float *v, int n)
v[i] = PyFloat_AsDouble(PyTuple_GET_ITEM(obj, i));
if (v[i] == -1.0f && PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError, "tuple elements must be a number");
return 0;
return false;
}
}
return 1;
return true;
}
bool Vec2f_ptr_from_PyTuple(PyObject *obj, Vec2f &vec)
@ -766,21 +766,21 @@ bool float_array_from_PyObject(PyObject *obj, float *v, int n)
{
if (VectorObject_Check(obj) && ((VectorObject *)obj)->size == n) {
if (BaseMath_ReadCallback((BaseMathObject *)obj) == -1) {
return 0;
return false;
}
for (int i = 0; i < n; i++) {
v[i] = ((VectorObject *)obj)->vec[i];
}
return 1;
return true;
}
if (ColorObject_Check(obj) && n == 3) {
if (BaseMath_ReadCallback((BaseMathObject *)obj) == -1) {
return 0;
return false;
}
for (int i = 0; i < n; i++) {
v[i] = ((ColorObject *)obj)->col[i];
}
return 1;
return true;
}
if (PyList_Check(obj) && PyList_GET_SIZE(obj) == n) {
return float_array_from_PyList(obj, v, n);
@ -788,7 +788,7 @@ bool float_array_from_PyObject(PyObject *obj, float *v, int n)
if (PyTuple_Check(obj) && PyTuple_GET_SIZE(obj) == n) {
return float_array_from_PyTuple(obj, v, n);
}
return 0;
return false;
}
int convert_v4(PyObject *obj, void *v)

View File

@ -268,7 +268,7 @@ static PyObject *Freestyle_evaluateCurveMappingF(PyObject * /*self*/, PyObject *
/* disable extrapolation if enabled */
if ((cumap->flag & CUMA_EXTEND_EXTRAPOLATE)) {
cumap->flag &= ~CUMA_EXTEND_EXTRAPOLATE;
BKE_curvemapping_changed(cumap, 0);
BKE_curvemapping_changed(cumap, false);
}
return PyFloat_FromDouble(BKE_curvemapping_evaluateF(cumap, cur, value));
}

View File

@ -495,7 +495,7 @@ static PyObject *BPy_FrsMaterial_richcmpr(PyObject *objectA,
int comparison_type)
{
const BPy_FrsMaterial *matA = NULL, *matB = NULL;
bool result = 0;
bool result = false;
if (!BPy_FrsMaterial_Check(objectA) || !BPy_FrsMaterial_Check(objectB)) {
if (comparison_type == Py_NE) {

View File

@ -70,7 +70,7 @@ typedef struct GPUSelectQueryState {
eGPUDepthTest depth_test;
} GPUSelectQueryState;
static GPUSelectQueryState g_query_state = {0};
static GPUSelectQueryState g_query_state = {false};
void gpu_select_query_begin(
uint (*buffer)[4], uint bufsize, const rcti *input, char mode, int oldhits)

View File

@ -956,7 +956,7 @@ static int convert_channels(struct Depsgraph *depsgraph,
* this is because some of the pose data (e.g. pose head) don't have corresponding
* joint angles and can't be applied to the iTaSC armature dynamically */
if (!(pchan->flag & POSE_DONE)) {
BKE_pose_where_is_bone(depsgraph, ikscene->blscene, ikscene->blArmature, pchan, ctime, 1);
BKE_pose_where_is_bone(depsgraph, ikscene->blscene, ikscene->blArmature, pchan, ctime, true);
}
/* tell blender that this channel was controlled by IK,
* it's cleared on each BKE_pose_where_is() */
@ -1720,7 +1720,8 @@ static void execute_scene(struct Depsgraph *depsgraph,
/* in animation mode, we must get the bone position from action and constraints */
for (i = 0, ikchan = ikscene->channels; i < ikscene->numchan; i++, ikchan++) {
if (!(ikchan->pchan->flag & POSE_DONE)) {
BKE_pose_where_is_bone(depsgraph, blscene, ikscene->blArmature, ikchan->pchan, ctime, 1);
BKE_pose_where_is_bone(
depsgraph, blscene, ikscene->blArmature, ikchan->pchan, ctime, true);
}
/* tell blender that this channel was controlled by IK,
* it's cleared on each BKE_pose_where_is() */

View File

@ -1918,7 +1918,7 @@ struct ImBuf *imb_load_openexr(const unsigned char *mem,
// printf("OpenEXR-load: image data window %d %d %d %d\n",
// dw.min.x, dw.min.y, dw.max.x, dw.max.y);
if (0) { /* debug */
if (false) { /* debug */
exr_print_filecontents(*file);
}

View File

@ -355,7 +355,7 @@ void AnimationImporter::read_node_transform(COLLADAFW::Node *node, Object *ob)
TransformReader::get_node_mat(mat, node, &uid_animated_map, ob);
if (ob) {
copy_m4_m4(ob->obmat, mat);
BKE_object_apply_mat4(ob, ob->obmat, 0, 0);
BKE_object_apply_mat4(ob, ob->obmat, false, false);
}
}

View File

@ -438,7 +438,7 @@ Object *DocumentImporter::create_instance_node(Object *source_ob,
}
/* calc new matrix and apply */
mul_m4_m4m4(obn->obmat, obn->obmat, mat);
BKE_object_apply_mat4(obn, obn->obmat, 0, 0);
BKE_object_apply_mat4(obn, obn->obmat, false, false);
}
}
else {

View File

@ -222,7 +222,7 @@ void SceneExporter::writeNode(Object *ob)
}
if (cti->flush_constraint_targets) {
cti->flush_constraint_targets(con, &targets, 1);
cti->flush_constraint_targets(con, &targets, true);
}
}

View File

@ -248,7 +248,7 @@ void SkinInfo::link_armature(bContext *C,
DEG_id_tag_update(&obn->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
#endif
copy_m4_m4(ob->obmat, bind_shape_matrix);
BKE_object_apply_mat4(ob, ob->obmat, 0, 0);
BKE_object_apply_mat4(ob, ob->obmat, false, false);
amd->deformflag = ARM_DEF_VGROUP;

View File

@ -371,7 +371,7 @@ void bc_match_scale(Object *ob, UnitConverter &bc_unit, bool scale_to_scene)
mul_m4_m4m4(ob->obmat, bc_unit.get_scale(), ob->obmat);
}
mul_m4_m4m4(ob->obmat, bc_unit.get_rotation(), ob->obmat);
BKE_object_apply_mat4(ob, ob->obmat, 0, 0);
BKE_object_apply_mat4(ob, ob->obmat, false, false);
}
void bc_match_scale(std::vector<Object *> *objects_done,

View File

@ -272,7 +272,7 @@ TEST_F(AbstractHierarchyIteratorTest, ExportSubsetTest)
/* Even when only asking an export of transforms, on the first frame everything should be
* exported. */
{
ExportSubset export_subset = {0};
ExportSubset export_subset = {false};
export_subset.transforms = true;
export_subset.shapes = false;
iterator->set_export_subset(export_subset);
@ -296,7 +296,7 @@ TEST_F(AbstractHierarchyIteratorTest, ExportSubsetTest)
/* Third iteration, should only write data now. */
{
ExportSubset export_subset = {0};
ExportSubset export_subset = {false};
export_subset.transforms = false;
export_subset.shapes = true;
iterator->set_export_subset(export_subset);
@ -311,7 +311,7 @@ TEST_F(AbstractHierarchyIteratorTest, ExportSubsetTest)
/* Fourth iteration, should export everything now. */
{
ExportSubset export_subset = {0};
ExportSubset export_subset = {false};
export_subset.transforms = true;
export_subset.shapes = true;
iterator->set_export_subset(export_subset);