Krolyxon
Commit 90bec70

Branches

Refs →

nsxiv90bec70

fix -Wshadow related warnings

fixes all -Wshadow related warnings (on gcc). this would allow us to use
`-Wshadow` in github workflow (https://github.com/nsxiv/nsxiv/pull/195).

i've thought about adding `-Wshadow` to our Makefile as well, but
decided against it to keep the Makefile CFLAGS barebore/minimal.
Author
NRK
Date
2021-12-24 06:14 +0600
Committer
N-R-K · 2022-01-06 17:53 +0000
Parent
1a18523
Commit
90bec70e7f186f0e9dbf9e03e555ba50352caff2

+10 −11

3 files changed

  1. M commands.c +3 −3
  2. M image.c +1 −2
  3. M main.c +6 −6
M commands.c View
@@ -328,7 +328,7 @@ bool ci_scroll_to_edge(arg_t dir)
328328 return img_pan_edge(&img, dir);
329329 }
330330
331−bool ci_drag(arg_t mode)
331+bool ci_drag(arg_t drag_mode)
332332 {
333333 int x, y, ox, oy;
334334 float px, py;
@@ -337,13 +337,13 @@ bool ci_drag(arg_t mode)
337337 if ((int)(img.w * img.zoom) <= win.w && (int)(img.h * img.zoom) <= win.h)
338338 return false;
339339
340− win_set_cursor(&win, mode == DRAG_ABSOLUTE ? CURSOR_DRAG_ABSOLUTE : CURSOR_DRAG_RELATIVE);
340+ win_set_cursor(&win, drag_mode == DRAG_ABSOLUTE ? CURSOR_DRAG_ABSOLUTE : CURSOR_DRAG_RELATIVE);
341341 win_cursor_pos(&win, &x, &y);
342342 ox = x;
343343 oy = y;
344344
345345 while (true) {
346− if (mode == DRAG_ABSOLUTE) {
346+ if (drag_mode == DRAG_ABSOLUTE) {
347347 px = MIN(MAX(0.0, x - win.w*0.1), win.w*0.8) / (win.w*0.8)
348348 * (win.w - img.w * img.zoom);
349349 py = MIN(MAX(0.0, y - win.h*0.1), win.h*0.8) / (win.h*0.8)
M image.c View
@@ -559,7 +559,6 @@ void img_render(img_t *img)
559559 int sx, sy, sw, sh;
560560 int dx, dy, dw, dh;
561561 Imlib_Image bg;
562− XColor c;
563562
564563 win = img->win;
565564 img_fit(img);
@@ -627,7 +626,7 @@ void img_render(img_t *img)
627626 }
628627 imlib_image_put_back_data(data);
629628 } else {
630− c = win->win_bg;
629+ XColor c = win->win_bg;
631630 imlib_context_set_color(c.red >> 8, c.green >> 8, c.blue >> 8, 0xFF);
632631 imlib_image_fill_rectangle(0, 0, dw, dh);
633632 }
M main.c View
@@ -605,19 +605,19 @@ end:
605605 return true;
606606 }
607607
608−static bool process_bindings(const keymap_t *keys, unsigned int len, KeySym ksym_or_button,
608+static bool process_bindings(const keymap_t *bindings, unsigned int len, KeySym ksym_or_button,
609609 unsigned int state, unsigned int implicit_mod)
610610 {
611611 unsigned int i;
612612 bool dirty = false;
613613
614614 for (i = 0; i < len; i++) {
615− if (keys[i].ksym_or_button == ksym_or_button &&
616− MODMASK(keys[i].mask | implicit_mod) == MODMASK(state) &&
617− keys[i].cmd.func &&
618− (keys[i].cmd.mode == MODE_ALL || keys[i].cmd.mode == mode))
615+ if (bindings[i].ksym_or_button == ksym_or_button &&
616+ MODMASK(bindings[i].mask | implicit_mod) == MODMASK(state) &&
617+ bindings[i].cmd.func &&
618+ (bindings[i].cmd.mode == MODE_ALL || bindings[i].cmd.mode == mode))
619619 {
620− if (keys[i].cmd.func(keys[i].arg))
620+ if (bindings[i].cmd.func(bindings[i].arg))
621621 dirty = true;
622622 }
623623 }