Cleanup: style, use braces for editor/interface

This commit is contained in:
2019-03-26 21:16:13 +11:00
parent fe7812f7c2
commit 1bde690e91
3 changed files with 16 additions and 6 deletions

View File

@@ -2555,8 +2555,9 @@ static int ui_text_position_from_hidden(uiBut *but, int pos)
butstr = (but->editstr) ? but->editstr : but->drawstr; butstr = (but->editstr) ? but->editstr : but->drawstr;
for (i = 0, strpos = butstr; i < pos; i++) for (i = 0, strpos = butstr; i < pos; i++) {
strpos = BLI_str_find_next_char_utf8(strpos, NULL); strpos = BLI_str_find_next_char_utf8(strpos, NULL);
}
return (strpos - butstr); return (strpos - butstr);
} }

View File

@@ -3279,8 +3279,9 @@ static void ui_litem_estimate_column_flow(uiLayout *litem)
flow->totcol = max_ii(litem->root->emw / maxw, 1); flow->totcol = max_ii(litem->root->emw / maxw, 1);
flow->totcol = min_ii(flow->totcol, totitem); flow->totcol = min_ii(flow->totcol, totitem);
} }
else else {
flow->totcol = flow->number; flow->totcol = flow->number;
}
/* compute sizes */ /* compute sizes */
x = 0; x = 0;
@@ -3614,7 +3615,10 @@ static void ui_litem_estimate_grid_flow(uiLayout *litem)
for (gflow->tot_rows = (int)ceilf((float)gflow->tot_items / gflow->tot_columns); for (gflow->tot_rows = (int)ceilf((float)gflow->tot_items / gflow->tot_columns);
(gflow->tot_columns - step) > 0 && (gflow->tot_columns - step) > 0 &&
(int)ceilf((float)gflow->tot_items / (gflow->tot_columns - step)) <= gflow->tot_rows; (int)ceilf((float)gflow->tot_items / (gflow->tot_columns - step)) <= gflow->tot_rows;
gflow->tot_columns -= step); gflow->tot_columns -= step)
{
/* pass */
}
} }
else { else {
/* Adjust number of rows to be multiple of given modulo. */ /* Adjust number of rows to be multiple of given modulo. */
@@ -3625,7 +3629,10 @@ static void ui_litem_estimate_grid_flow(uiLayout *litem)
for (gflow->tot_columns = (int)ceilf((float)gflow->tot_items / gflow->tot_rows); for (gflow->tot_columns = (int)ceilf((float)gflow->tot_items / gflow->tot_rows);
(gflow->tot_rows - step) > 0 && (gflow->tot_rows - step) > 0 &&
(int)ceilf((float)gflow->tot_items / (gflow->tot_rows - step)) <= gflow->tot_columns; (int)ceilf((float)gflow->tot_items / (gflow->tot_rows - step)) <= gflow->tot_columns;
gflow->tot_rows -= step); gflow->tot_rows -= step)
{
/* pass */
}
} }
} }
@@ -4417,8 +4424,9 @@ static void ui_item_flag(uiLayout *litem, int flag)
bitem = (uiButtonItem *)item; bitem = (uiButtonItem *)item;
bitem->but->flag |= flag; bitem->but->flag |= flag;
} }
else else {
ui_item_flag((uiLayout *)item, flag); ui_item_flag((uiLayout *)item, flag);
}
} }
} }

View File

@@ -1313,8 +1313,9 @@ static void edittranslation_find_po_file(const char *root, const char *uilng, ch
tc = strchr(uilng, '_'); tc = strchr(uilng, '_');
if (tc) { if (tc) {
szt = tc - uilng; szt = tc - uilng;
if (szt < sizeof(tstr)) /* Paranoid, should always be true! */ if (szt < sizeof(tstr)) { /* Paranoid, should always be true! */
BLI_strncpy(tstr, uilng, szt + 1); /* +1 for '\0' char! */ BLI_strncpy(tstr, uilng, szt + 1); /* +1 for '\0' char! */
}
} }
if (tstr[0]) { if (tstr[0]) {
/* Because of some codes like sr_SR@latin... */ /* Because of some codes like sr_SR@latin... */