Cleanup: use braces for interface code

This commit is contained in:
2019-03-25 10:15:20 +11:00
parent 72ede30d0f
commit e86e0aad55
28 changed files with 2819 additions and 1308 deletions

View File

@@ -257,8 +257,9 @@ static int reset_default_button_exec(bContext *C, wmOperator *op)
/* if there is a valid property that is editable... */
if (ptr.data && prop && RNA_property_editable(&ptr, prop)) {
if (RNA_property_reset(&ptr, prop, (all) ? -1 : index))
if (RNA_property_reset(&ptr, prop, (all) ? -1 : index)) {
return operator_button_property_finish(C, &ptr, prop);
}
}
return OPERATOR_CANCELLED;
@@ -316,8 +317,9 @@ static int assign_default_button_exec(bContext *C, wmOperator *UNUSED(op))
/* if there is a valid property that is editable... */
if (ptr.data && prop && RNA_property_editable(&ptr, prop)) {
if (RNA_property_assign_default(&ptr, prop))
if (RNA_property_assign_default(&ptr, prop)) {
return operator_button_property_finish(C, &ptr, prop);
}
}
return OPERATOR_CANCELLED;
@@ -1298,8 +1300,9 @@ static void edittranslation_find_po_file(const char *root, const char *uilng, ch
BLI_snprintf(tstr, sizeof(tstr), "%s.po", uilng);
BLI_join_dirfile(path, maxlen, root, uilng);
BLI_path_append(path, maxlen, tstr);
if (BLI_is_file(path))
if (BLI_is_file(path)) {
return;
}
/* Now try without the second iso code part (_ES in es_ES). */
{
@@ -1316,14 +1319,16 @@ static void edittranslation_find_po_file(const char *root, const char *uilng, ch
if (tstr[0]) {
/* Because of some codes like sr_SR@latin... */
tc = strchr(uilng, '@');
if (tc)
if (tc) {
BLI_strncpy(tstr + szt, tc, sizeof(tstr) - szt);
}
BLI_join_dirfile(path, maxlen, root, tstr);
strcat(tstr, ".po");
BLI_path_append(path, maxlen, tstr);
if (BLI_is_file(path))
if (BLI_is_file(path)) {
return;
}
}
}
@@ -1397,26 +1402,36 @@ static int edittranslation_exec(bContext *C, wmOperator *op)
ret = WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &ptr);
/* Clean up */
if (but_label.strinfo)
if (but_label.strinfo) {
MEM_freeN(but_label.strinfo);
if (rna_label.strinfo)
}
if (rna_label.strinfo) {
MEM_freeN(rna_label.strinfo);
if (enum_label.strinfo)
}
if (enum_label.strinfo) {
MEM_freeN(enum_label.strinfo);
if (but_tip.strinfo)
}
if (but_tip.strinfo) {
MEM_freeN(but_tip.strinfo);
if (rna_tip.strinfo)
}
if (rna_tip.strinfo) {
MEM_freeN(rna_tip.strinfo);
if (enum_tip.strinfo)
}
if (enum_tip.strinfo) {
MEM_freeN(enum_tip.strinfo);
if (rna_struct.strinfo)
}
if (rna_struct.strinfo) {
MEM_freeN(rna_struct.strinfo);
if (rna_prop.strinfo)
}
if (rna_prop.strinfo) {
MEM_freeN(rna_prop.strinfo);
if (rna_enum.strinfo)
}
if (rna_enum.strinfo) {
MEM_freeN(rna_enum.strinfo);
if (rna_ctxt.strinfo)
}
if (rna_ctxt.strinfo) {
MEM_freeN(rna_ctxt.strinfo);
}
return ret;
}
@@ -1544,8 +1559,9 @@ bool UI_drop_color_poll(struct bContext *C, wmDrag *drag, const wmEvent *UNUSED(
SpaceImage *sima = CTX_wm_space_image(C);
ARegion *ar = CTX_wm_region(C);
if (UI_but_active_drop_color(C))
if (UI_but_active_drop_color(C)) {
return 1;
}
if (sima && (sima->mode == SI_MODE_PAINT) &&
sima->image && (ar && ar->regiontype == RGN_TYPE_WINDOW))
@@ -1589,14 +1605,16 @@ static int drop_color_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(
}
if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) {
if (!gamma)
if (!gamma) {
IMB_colormanagement_scene_linear_to_srgb_v3(color);
}
RNA_property_float_set_array(&but->rnapoin, but->rnaprop, color);
RNA_property_update(C, &but->rnapoin, but->rnaprop);
}
else if (RNA_property_subtype(but->rnaprop) == PROP_COLOR) {
if (gamma)
if (gamma) {
IMB_colormanagement_srgb_to_scene_linear_v3(color);
}
RNA_property_float_set_array(&but->rnapoin, but->rnaprop, color);
RNA_property_update(C, &but->rnapoin, but->rnaprop);
}