diff options
author | Sebastian Parborg <darkdefende@gmail.com> | 2020-07-03 22:22:41 +0300 |
---|---|---|
committer | Sebastian Parborg <darkdefende@gmail.com> | 2020-07-03 22:23:33 +0300 |
commit | d7dbf90a0252ae09649b9033d1f199fa6acd8d07 (patch) | |
tree | b968d8183fe6456dcfe42f6587cc786c90d56182 /source | |
parent | 185fe9cd8bb177070ce8aecaa036d9880cce380e (diff) |
Clang-tidy: Enable braces-around-statements warning
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenlib/intern/fileops.c | 6 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 3 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_channels_defines.c | 12 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_filter.c | 9 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_templates.c | 12 | ||||
-rw-r--r-- | source/blender/editors/object/object_vgroup.c | 12 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/outliner_tree.c | 9 | ||||
-rw-r--r-- | source/blender/makesrna/intern/makesrna.c | 71 |
8 files changed, 84 insertions, 50 deletions
diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index b9133edcae3..e87350ecbb6 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -177,8 +177,9 @@ size_t BLI_gzip_mem_to_file_at_pos( strm.zfree = Z_NULL; strm.opaque = Z_NULL; ret = deflateInit(&strm, compression_level); - if (ret != Z_OK) + if (ret != Z_OK) { return 0; + } strm.avail_in = len; strm.next_in = (Bytef *)buf; @@ -224,8 +225,9 @@ size_t BLI_ungzip_file_to_mem_at_pos(void *buf, size_t len, FILE *file, size_t g strm.avail_in = 0; strm.next_in = Z_NULL; ret = inflateInit(&strm); - if (ret != Z_OK) + if (ret != Z_OK) { return 0; + } do { strm.avail_in = fread(in, 1, chunk, file); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 971d67d7d9a..836260c46e5 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2111,8 +2111,9 @@ void blo_end_volume_pointer_map(FileData *fd, Main *oldmain) /* used entries were restored, so we put them to zero */ for (i = 0; i < fd->volumemap->nentries; i++, entry++) { - if (entry->nr > 0) + if (entry->nr > 0) { entry->newp = NULL; + } } for (; volume; volume = volume->id.next) { diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 843b8400a32..79c465c1f33 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -2842,8 +2842,9 @@ static void *acf_dshair_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings se case ACHANNEL_SETTING_SELECT: /* selected */ case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */ case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */ - if (hair->adt) + if (hair->adt) { return GET_ACF_FLAG_PTR(hair->adt->flag, type); + } return NULL; default: /* unsupported */ @@ -2922,8 +2923,9 @@ static void *acf_dspointcloud_setting_ptr(bAnimListElem *ale, case ACHANNEL_SETTING_SELECT: /* selected */ case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */ case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */ - if (pointcloud->adt) + if (pointcloud->adt) { return GET_ACF_FLAG_PTR(pointcloud->adt->flag, type); + } return NULL; default: /* unsupported */ @@ -3002,8 +3004,9 @@ static void *acf_dsvolume_setting_ptr(bAnimListElem *ale, case ACHANNEL_SETTING_SELECT: /* selected */ case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */ case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */ - if (volume->adt) + if (volume->adt) { return GET_ACF_FLAG_PTR(volume->adt->flag, type); + } return NULL; default: /* unsupported */ @@ -3080,8 +3083,9 @@ static void *acf_dssimulation_setting_ptr(bAnimListElem *ale, case ACHANNEL_SETTING_SELECT: /* selected */ case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */ case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */ - if (simulation->adt) + if (simulation->adt) { return GET_ACF_FLAG_PTR(simulation->adt->flag, type); + } return NULL; default: /* unsupported */ diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 08be6c72bbc..bbb673caa71 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -2601,8 +2601,9 @@ static size_t animdata_filter_ds_obdata( { Hair *hair = (Hair *)ob->data; - if (ads->filterflag2 & ADS_FILTER_NOHAIR) + if (ads->filterflag2 & ADS_FILTER_NOHAIR) { return 0; + } type = ANIMTYPE_DSHAIR; expanded = FILTER_HAIR_OBJD(hair); @@ -2612,8 +2613,9 @@ static size_t animdata_filter_ds_obdata( { PointCloud *pointcloud = (PointCloud *)ob->data; - if (ads->filterflag2 & ADS_FILTER_NOPOINTCLOUD) + if (ads->filterflag2 & ADS_FILTER_NOPOINTCLOUD) { return 0; + } type = ANIMTYPE_DSPOINTCLOUD; expanded = FILTER_POINTS_OBJD(pointcloud); @@ -2623,8 +2625,9 @@ static size_t animdata_filter_ds_obdata( { Volume *volume = (Volume *)ob->data; - if (ads->filterflag2 & ADS_FILTER_NOVOLUME) + if (ads->filterflag2 & ADS_FILTER_NOVOLUME) { return 0; + } type = ANIMTYPE_DSVOLUME; expanded = FILTER_VOLUME_OBJD(volume); diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index f3e2eef6f31..8f98f380854 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -1879,8 +1879,9 @@ void uiTemplateModifiers(uiLayout *UNUSED(layout), bContext *C) else { /* The expansion might have been changed elsewhere, so we still need to set it. */ LISTBASE_FOREACH (Panel *, panel, ®ion->panels) { - if ((panel->type != NULL) && (panel->type->flag & PNL_INSTANCED)) + if ((panel->type != NULL) && (panel->type->flag & PNL_INSTANCED)) { UI_panel_set_expand_from_list_data(C, panel); + } } /* Assuming there's only one group of instanced panels, update the custom data pointers. */ @@ -2055,8 +2056,9 @@ void uiTemplateConstraints(uiLayout *UNUSED(layout), bContext *C, bool use_bone_ else { /* The expansion might have been changed elsewhere, so we still need to set it. */ LISTBASE_FOREACH (Panel *, panel, ®ion->panels) { - if ((panel->type != NULL) && (panel->type->flag & PNL_INSTANCED)) + if ((panel->type != NULL) && (panel->type->flag & PNL_INSTANCED)) { UI_panel_set_expand_from_list_data(C, panel); + } } } } @@ -2115,8 +2117,9 @@ void uiTemplateGpencilModifiers(uiLayout *UNUSED(layout), bContext *C) else { /* The expansion might have been changed elsewhere, so we still need to set it. */ LISTBASE_FOREACH (Panel *, panel, ®ion->panels) { - if ((panel->type != NULL) && (panel->type->flag & PNL_INSTANCED)) + if ((panel->type != NULL) && (panel->type->flag & PNL_INSTANCED)) { UI_panel_set_expand_from_list_data(C, panel); + } } /* Assuming there's only one group of instanced panels, update the custom data pointers. */ @@ -2193,8 +2196,9 @@ void uiTemplateShaderFx(uiLayout *UNUSED(layout), bContext *C) else { /* The expansion might have been changed elsewhere, so we still need to set it. */ LISTBASE_FOREACH (Panel *, panel, ®ion->panels) { - if ((panel->type != NULL) && (panel->type->flag & PNL_INSTANCED)) + if ((panel->type != NULL) && (panel->type->flag & PNL_INSTANCED)) { UI_panel_set_expand_from_list_data(C, panel); + } } } } diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index ca5e1921595..b8dbc5c279d 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -1769,12 +1769,14 @@ static void vgroup_lock_all(Object *ob, int action, int mask) switch (mask) { case VGROUP_MASK_INVERT_UNSELECTED: case VGROUP_MASK_SELECTED: - if (!selected[i]) + if (!selected[i]) { continue; + } break; case VGROUP_MASK_UNSELECTED: - if (selected[i]) + if (selected[i]) { continue; + } break; default:; } @@ -1789,12 +1791,14 @@ static void vgroup_lock_all(Object *ob, int action, int mask) for (dg = ob->defbase.first, i = 0; dg; dg = dg->next, i++) { switch (mask) { case VGROUP_MASK_SELECTED: - if (!selected[i]) + if (!selected[i]) { continue; + } break; case VGROUP_MASK_UNSELECTED: - if (selected[i]) + if (selected[i]) { continue; + } break; default:; } diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index 544c41a3a7b..2f42f3be50c 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -769,20 +769,23 @@ static void outliner_add_id_contents(SpaceOutliner *soops, } case ID_HA: { Hair *hair = (Hair *)id; - if (outliner_animdata_test(hair->adt)) + if (outliner_animdata_test(hair->adt)) { outliner_add_element(soops, &te->subtree, hair, te, TSE_ANIM_DATA, 0); + } break; } case ID_PT: { PointCloud *pointcloud = (PointCloud *)id; - if (outliner_animdata_test(pointcloud->adt)) + if (outliner_animdata_test(pointcloud->adt)) { outliner_add_element(soops, &te->subtree, pointcloud, te, TSE_ANIM_DATA, 0); + } break; } case ID_VO: { Volume *volume = (Volume *)id; - if (outliner_animdata_test(volume->adt)) + if (outliner_animdata_test(volume->adt)) { outliner_add_element(soops, &te->subtree, volume, te, TSE_ANIM_DATA, 0); + } break; } case ID_SIM: { diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 59087df16dd..b34c324bd91 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -96,8 +96,9 @@ static void rna_generate_static_parameter_prototypes(FILE *f, /* helpers */ #define WRITE_COMMA \ { \ - if (!first) \ + if (!first) { \ fprintf(f, ", "); \ + } \ first = 0; \ } \ (void)0 @@ -118,10 +119,12 @@ static int replace_if_different(const char *tmpfile, const char *dep_files[]) FILE *file_test = fopen(orgfile, "rb"); \ if (file_test) { \ fclose(file_test); \ - if (fp_org) \ + if (fp_org) { \ fclose(fp_org); \ - if (fp_new) \ + } \ + if (fp_new) { \ fclose(fp_new); \ + } \ if (remove(orgfile) != 0) { \ CLOG_ERROR(&LOG, "remove error (%s): \"%s\"", strerror(errno), orgfile); \ return -1; \ @@ -1080,21 +1083,26 @@ static char *rna_def_property_set_func( if (prop->flag & PROP_ID_SELF_CHECK) { rna_print_id_get(f, dp); - fprintf(f, " if (id == value.data) return;\n\n"); + fprintf(f, " if (id == value.data) {\n"); + fprintf(f, " return;\n"); + fprintf(f, " }\n"); } if (prop->flag & PROP_ID_REFCOUNT) { - fprintf(f, "\n if (data->%s)\n", dp->dnaname); + fprintf(f, "\n if (data->%s) {\n", dp->dnaname); fprintf(f, " id_us_min((ID *)data->%s);\n", dp->dnaname); - fprintf(f, " if (value.data)\n"); - fprintf(f, " id_us_plus((ID *)value.data);\n\n"); + fprintf(f, " }\n"); + fprintf(f, " if (value.data) {\n"); + fprintf(f, " id_us_plus((ID *)value.data);\n"); + fprintf(f, " }\n"); } else { PointerPropertyRNA *pprop = (PointerPropertyRNA *)dp->prop; StructRNA *type = (pprop->type) ? rna_find_struct((const char *)pprop->type) : NULL; if (type && (type->flag & STRUCT_ID)) { - fprintf(f, " if (value.data)\n"); - fprintf(f, " id_lib_extern((ID *)value.data);\n\n"); + fprintf(f, " if (value.data) {\n"); + fprintf(f, " id_lib_extern((ID *)value.data);\n"); + fprintf(f, " }\n"); } } @@ -1141,14 +1149,14 @@ static char *rna_def_property_set_func( if (dp->dnaarraylength == 1) { if (prop->type == PROP_BOOLEAN && dp->booleanbit) { fprintf(f, - " if (%svalues[i]) data->%s |= (", + " if (%svalues[i]) { data->%s |= (", (dp->booleannegative) ? "!" : "", dp->dnaname); rna_int_print(f, dp->booleanbit); - fprintf(f, " << i);\n"); - fprintf(f, " else data->%s &= ~(", dp->dnaname); + fprintf(f, " << i); }\n"); + fprintf(f, " else { data->%s &= ~(", dp->dnaname); rna_int_print(f, dp->booleanbit); - fprintf(f, " << i);\n"); + fprintf(f, " << i); }\n"); } else { fprintf( @@ -1159,14 +1167,14 @@ static char *rna_def_property_set_func( else { if (prop->type == PROP_BOOLEAN && dp->booleanbit) { fprintf(f, - " if (%svalues[i]) data->%s[i] |= ", + " if (%svalues[i]) { data->%s[i] |= ", (dp->booleannegative) ? "!" : "", dp->dnaname); rna_int_print(f, dp->booleanbit); - fprintf(f, ";\n"); - fprintf(f, " else data->%s[i] &= ~", dp->dnaname); + fprintf(f, "; }\n"); + fprintf(f, " else { data->%s[i] &= ~", dp->dnaname); rna_int_print(f, dp->booleanbit); - fprintf(f, ";\n"); + fprintf(f, "; }\n"); } else if (rna_color_quantize(prop, dp)) { fprintf( @@ -1215,13 +1223,15 @@ static char *rna_def_property_set_func( else { rna_print_data_get(f, dp); if (prop->type == PROP_BOOLEAN && dp->booleanbit) { - fprintf( - f, " if (%svalue) data->%s |= ", (dp->booleannegative) ? "!" : "", dp->dnaname); + fprintf(f, + " if (%svalue) { data->%s |= ", + (dp->booleannegative) ? "!" : "", + dp->dnaname); rna_int_print(f, dp->booleanbit); - fprintf(f, ";\n"); - fprintf(f, " else data->%s &= ~", dp->dnaname); + fprintf(f, "; }\n"); + fprintf(f, " else { data->%s &= ~", dp->dnaname); rna_int_print(f, dp->booleanbit); - fprintf(f, ";\n"); + fprintf(f, "; }\n"); } else if (prop->type == PROP_ENUM && dp->enumbitflags) { fprintf(f, " data->%s &= ~", dp->dnaname); @@ -1278,7 +1288,7 @@ static char *rna_def_property_length_func( else { rna_print_data_get(f, dp); if (!(prop->flag & PROP_NEVER_NULL)) { - fprintf(f, " if (data->%s == NULL) return 0;\n", dp->dnaname); + fprintf(f, " if (data->%s == NULL) { return 0; }\n", dp->dnaname); } fprintf(f, " return strlen(data->%s);\n", dp->dnaname); } @@ -1393,8 +1403,9 @@ static char *rna_def_property_begin_func( getfunc = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "get"); - fprintf(f, "\n if (iter->valid)\n"); - fprintf(f, " iter->ptr = %s(iter);\n", getfunc); + fprintf(f, "\n if (iter->valid) {\n"); + fprintf(f, " iter->ptr = %s(iter);", getfunc); + fprintf(f, "\n }\n"); fprintf(f, "}\n\n"); @@ -1479,14 +1490,15 @@ static char *rna_def_property_lookup_int_func(FILE *f, fprintf(f, " found = (index == -1 && iter.valid);\n"); fprintf(f, " }\n"); fprintf(f, " else {\n"); - fprintf(f, " while (index-- > 0 && internal->link)\n"); + fprintf(f, " while (index-- > 0 && internal->link) {\n"); fprintf(f, " internal->link = internal->link->next;\n"); + fprintf(f, " }\n"); fprintf(f, " found = (index == -1 && internal->link);\n"); fprintf(f, " }\n"); } fprintf(f, - " if (found) *r_ptr = %s_%s_get(&iter);\n", + " if (found) { *r_ptr = %s_%s_get(&iter); }\n", srna->identifier, rna_safe_id(prop->identifier)); fprintf(f, " }\n\n"); @@ -1672,8 +1684,9 @@ static char *rna_def_property_next_func(FILE *f, getfunc = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "get"); - fprintf(f, "\n if (iter->valid)\n"); - fprintf(f, " iter->ptr = %s(iter);\n", getfunc); + fprintf(f, "\n if (iter->valid) {\n"); + fprintf(f, " iter->ptr = %s(iter);", getfunc); + fprintf(f, "\n }\n"); fprintf(f, "}\n\n"); |