Cleanup: various non functional changes

- Reduce variable scope.
- Function style casts.
- Avoid variable shadowing.
- Quiet unused assignment warnings.
- Remove redundant call in GHOST_WindowNULL constructor.
This commit is contained in:
Campbell Barton
2024-09-22 18:25:33 +10:00
parent 31e908bce4
commit 4bd0cc888e
6 changed files with 15 additions and 16 deletions

View File

@@ -22,7 +22,7 @@ class GHOST_WindowNULL : public GHOST_Window {
return GHOST_kSuccess;
}
GHOST_WindowNULL(const char *title,
GHOST_WindowNULL(const char * /*title*/,
int32_t /*left*/,
int32_t /*top*/,
uint32_t width,
@@ -33,7 +33,6 @@ class GHOST_WindowNULL : public GHOST_Window {
const bool stereoVisual)
: GHOST_Window(width, height, state, stereoVisual, false)
{
setTitle(title);
}
protected:

View File

@@ -64,7 +64,7 @@ uint16_t blender::math::float_to_half(float v)
uint32_t mant_odd = (f.u >> 13) & 1; /* resulting mantissa is odd */
/* update exponent, rounding bias part 1 */
f.u += ((uint32_t)(15 - 127) << 23) + 0xfff;
f.u += (uint32_t(15 - 127) << 23) + 0xfff;
/* rounding bias part 2 */
f.u += mant_odd;
/* take the bits! */

View File

@@ -2272,8 +2272,6 @@ static void lib_link_scenes_check_set(Main *bmain)
static void direct_link_library(FileData *fd, Library *lib, Main *main)
{
Main *newmain;
/* Make sure we have full path in lib->runtime.filepath_abs */
/* NOTE: Since existing libraries are searched by their absolute path, this has to be generated
* before the lookup below. Otherwise, in case the stored absolute filepath is not 'correct' (may
@@ -2321,7 +2319,7 @@ static void direct_link_library(FileData *fd, Library *lib, Main *main)
BKE_packedfile_blend_read(&reader, &lib->packedfile, lib->filepath);
/* new main */
newmain = BKE_main_new();
Main *newmain = BKE_main_new();
BLI_addtail(fd->mainlist, newmain);
newmain->curlib = lib;

View File

@@ -521,9 +521,9 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e
ED_area_tag_redraw(area);
}
// if (swallow) {
// retval = OPERATOR_RUNNING_MODAL;
// }
if (swallow) {
// retval = OPERATOR_RUNNING_MODAL;
}
if (texttool_suggest_first()) {
if (retval != OPERATOR_RUNNING_MODAL) {

View File

@@ -1170,7 +1170,6 @@ static void draw_text_decoration(SpaceText *st, ARegion *region)
Text *text = st->text;
int vcurl, vcurc, vsell, vselc;
bool hidden = false;
int x, y, w, i;
int offl, offc;
const int lheight = TXT_LINE_HEIGHT(st);
@@ -1206,8 +1205,8 @@ static void draw_text_decoration(SpaceText *st, ARegion *region)
immUniformThemeColor(TH_SHADE2);
x = TXT_BODY_LEFT(st);
y = region->winy;
int x = TXT_BODY_LEFT(st);
int y = region->winy;
if (st->flags & ST_SCROLL_SELECT) {
y += st->runtime->scroll_ofs_px[1];
}
@@ -1252,7 +1251,7 @@ static void draw_text_decoration(SpaceText *st, ARegion *region)
pos, x + fromc * st->runtime->cwidth_px - U.pixelsize, y, region->winx, y - lheight);
y -= lheight;
for (i = froml + 1; i < tol; i++) {
for (int i = froml + 1; i < tol; i++) {
immRecti(pos, x - U.pixelsize, y, region->winx, y - lheight);
y -= lheight;
}
@@ -1262,6 +1261,8 @@ static void draw_text_decoration(SpaceText *st, ARegion *region)
}
y -= lheight;
}
/* Quiet warnings. */
UNUSED_VARS(x, y);
}
if (st->line_hlight) {
@@ -1299,8 +1300,8 @@ static void draw_text_decoration(SpaceText *st, ARegion *region)
if (!hidden) {
/* Draw the cursor itself (we draw the sel. cursor as this is the leading edge) */
x = TXT_BODY_LEFT(st) + (vselc * st->runtime->cwidth_px);
y = region->winy - vsell * lheight;
int x = TXT_BODY_LEFT(st) + (vselc * st->runtime->cwidth_px);
int y = region->winy - vsell * lheight;
if (st->flags & ST_SCROLL_SELECT) {
y += st->runtime->scroll_ofs_px[1];
}
@@ -1311,7 +1312,7 @@ static void draw_text_decoration(SpaceText *st, ARegion *region)
char ch = text->sell->line[text->selc];
y += TXT_LINE_SPACING(st);
w = st->runtime->cwidth_px;
int w = st->runtime->cwidth_px;
if (ch == '\t') {
w *= st->tabnumber - (vselc + st->left) % st->tabnumber;
}

View File

@@ -57,6 +57,7 @@ static void event_ids_from_flag(char *str,
}
}
ofs += BLI_strncpy_rlen(str + ofs, "}", str_maxncpy - ofs);
UNUSED_VARS(ofs); /* Quiet warning. */
}
static void event_ids_from_type_and_value(const short type,