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.
+10 −11
3 files changed
- M commands.c +3 −3
- M image.c +1 −2
- M main.c +6 −6
| @@ -328,7 +328,7 @@ bool ci_scroll_to_edge(arg_t dir) | |||
| 328 | 328 | return img_pan_edge(&img, dir); | |
| 329 | 329 | } | |
| 330 | 330 | ||
| 331 | − | bool ci_drag(arg_t mode) | |
| 331 | + | bool ci_drag(arg_t drag_mode) | |
| 332 | 332 | { | |
| 333 | 333 | int x, y, ox, oy; | |
| 334 | 334 | float px, py; | |
| @@ -337,13 +337,13 @@ bool ci_drag(arg_t mode) | |||
| 337 | 337 | if ((int)(img.w * img.zoom) <= win.w && (int)(img.h * img.zoom) <= win.h) | |
| 338 | 338 | return false; | |
| 339 | 339 | ||
| 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); | |
| 341 | 341 | win_cursor_pos(&win, &x, &y); | |
| 342 | 342 | ox = x; | |
| 343 | 343 | oy = y; | |
| 344 | 344 | ||
| 345 | 345 | while (true) { | |
| 346 | − | if (mode == DRAG_ABSOLUTE) { | |
| 346 | + | if (drag_mode == DRAG_ABSOLUTE) { | |
| 347 | 347 | px = MIN(MAX(0.0, x - win.w*0.1), win.w*0.8) / (win.w*0.8) | |
| 348 | 348 | * (win.w - img.w * img.zoom); | |
| 349 | 349 | py = MIN(MAX(0.0, y - win.h*0.1), win.h*0.8) / (win.h*0.8) | |
| @@ -559,7 +559,6 @@ void img_render(img_t *img) | |||
| 559 | 559 | int sx, sy, sw, sh; | |
| 560 | 560 | int dx, dy, dw, dh; | |
| 561 | 561 | Imlib_Image bg; | |
| 562 | − | XColor c; | |
| 563 | 562 | ||
| 564 | 563 | win = img->win; | |
| 565 | 564 | img_fit(img); | |
| @@ -627,7 +626,7 @@ void img_render(img_t *img) | |||
| 627 | 626 | } | |
| 628 | 627 | imlib_image_put_back_data(data); | |
| 629 | 628 | } else { | |
| 630 | − | c = win->win_bg; | |
| 629 | + | XColor c = win->win_bg; | |
| 631 | 630 | imlib_context_set_color(c.red >> 8, c.green >> 8, c.blue >> 8, 0xFF); | |
| 632 | 631 | imlib_image_fill_rectangle(0, 0, dw, dh); | |
| 633 | 632 | } | |
| @@ -605,19 +605,19 @@ end: | |||
| 605 | 605 | return true; | |
| 606 | 606 | } | |
| 607 | 607 | ||
| 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, | |
| 609 | 609 | unsigned int state, unsigned int implicit_mod) | |
| 610 | 610 | { | |
| 611 | 611 | unsigned int i; | |
| 612 | 612 | bool dirty = false; | |
| 613 | 613 | ||
| 614 | 614 | 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)) | |
| 619 | 619 | { | |
| 620 | − | if (keys[i].cmd.func(keys[i].arg)) | |
| 620 | + | if (bindings[i].cmd.func(bindings[i].arg)) | |
| 621 | 621 | dirty = true; | |
| 622 | 622 | } | |
| 623 | 623 | } | |