mirror of
https://github.com/swaywm/sway.git
synced 2025-11-06 13:29:50 -05:00
Fix dead stores found by scan-build
In addition to removing unused code, two minor problems are fixed: (1) `resize set` and `resize adjust` did not error when given too many arguments. (2) `orientation` was incorrectly overridden to be 'U' for scroll events in the swaybar tray `handle_click` function.
This commit is contained in:
parent
71a37ad186
commit
0af5b26e41
11 changed files with 14 additions and 32 deletions
|
|
@ -123,7 +123,6 @@ static struct sway_node *node_get_in_direction(struct sway_container *container,
|
|||
|
||||
if (can_move) {
|
||||
if (desired < 0 || desired >= siblings->length) {
|
||||
can_move = false;
|
||||
int len = siblings->length;
|
||||
if (config->focus_wrapping != WRAP_NO && !wrap_candidate
|
||||
&& len > 1) {
|
||||
|
|
|
|||
|
|
@ -478,8 +478,9 @@ static struct cmd_results *cmd_resize_set(int argc, char **argv) {
|
|||
argc--; argv++;
|
||||
}
|
||||
int num_consumed_args = parse_resize_amount(argc, argv, &height);
|
||||
argc -= num_consumed_args;
|
||||
argv += num_consumed_args;
|
||||
if (argc > num_consumed_args) {
|
||||
return cmd_results_new(CMD_INVALID, usage);
|
||||
}
|
||||
if (width.unit == RESIZE_UNIT_INVALID) {
|
||||
return cmd_results_new(CMD_INVALID, usage);
|
||||
}
|
||||
|
|
@ -543,12 +544,14 @@ static struct cmd_results *cmd_resize_adjust(int argc, char **argv,
|
|||
struct resize_amount second_amount;
|
||||
if (argc) {
|
||||
int num_consumed_args = parse_resize_amount(argc, argv, &second_amount);
|
||||
argc -= num_consumed_args;
|
||||
argv += num_consumed_args;
|
||||
if (argc > num_consumed_args) {
|
||||
return cmd_results_new(CMD_INVALID, usage);
|
||||
}
|
||||
if (second_amount.unit == RESIZE_UNIT_INVALID) {
|
||||
return cmd_results_new(CMD_INVALID, usage);
|
||||
}
|
||||
} else {
|
||||
second_amount.amount = 0;
|
||||
second_amount.unit = RESIZE_UNIT_INVALID;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue