Skip to content

Commit 92c757f

Browse files
nehebnamjaejeon
authored andcommitted
ksmbd-tools: fix GCC parentheses warnings
GCC suggests clarifying order of evaluation. Signed-off-by: Rosen Penev <[email protected]> Signed-off-by: Namjae Jeon <[email protected]>
1 parent 12c0ad0 commit 92c757f

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

addshare/share_admin.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ static char **__get_options(GHashTable *kv, int is_global)
7676
for (c = 0; c < KSMBD_SHARE_CONF_MAX; c++) {
7777
const char *k = KSMBD_SHARE_CONF[c], *v = NULL, *pre;
7878

79-
if (is_global && KSMBD_SHARE_CONF_IS_GLOBAL(c) ||
79+
if ((is_global && KSMBD_SHARE_CONF_IS_GLOBAL(c)) ||
8080
KSMBD_SHARE_CONF_IS_BROKEN(c))
8181
pre = "; ";
8282
else
@@ -101,7 +101,7 @@ static void __load_conf(enum KSMBD_SHARE_CONF conf,
101101
{
102102
char *option = options[conf];
103103

104-
if (step)
104+
if (step) {
105105
if (cp_smbconf_eol(cp_ltrim(buf))) {
106106
char *p = cp_ltrim(strchr(option, '=') + 1);
107107
const char *fmt, *s;
@@ -119,6 +119,7 @@ static void __load_conf(enum KSMBD_SHARE_CONF conf,
119119
} else {
120120
options[conf] = g_strdup_printf("%s%s", option, buf);
121121
}
122+
}
122123

123124
printf("\r" "\e[2K" "%s%s" "\e[6n", option, buf);
124125

@@ -142,7 +143,7 @@ static enum KSMBD_SHARE_CONF __next_conf(enum KSMBD_SHARE_CONF conf,
142143
return __next_conf(conf - 1, -1, is_global, is_ready);
143144
}
144145

145-
if (is_global && KSMBD_SHARE_CONF_IS_GLOBAL(conf) ||
146+
if ((is_global && KSMBD_SHARE_CONF_IS_GLOBAL(conf)) ||
146147
KSMBD_SHARE_CONF_IS_BROKEN(conf))
147148
return __next_conf(conf + step, step, is_global, is_ready);
148149

@@ -430,14 +431,14 @@ static int __prompt_options_stdin(char **options, int is_global)
430431
break;
431432

432433
if (c == '\e' ||
433-
c == '[' && ccode == '\e' ||
434-
c == 'A' && ccode == '[' ||
435-
c == 'B' && ccode == '[' ||
436-
c >= '0' && c <= '9' && ccode == '[' ||
437-
c >= '0' && c <= '9' && ccode >= '0' && ccode <= '9' ||
438-
c == ';' && ccode >= '0' && ccode <= '9' ||
439-
c >= '0' && c <= '9' && ccode == ';' ||
440-
c == 'R' && ccode >= '0' && ccode <= '9') {
434+
(c == '[' && ccode == '\e') ||
435+
(c == 'A' && ccode == '[') ||
436+
(c == 'B' && ccode == '[') ||
437+
(c >= '0' && c <= '9' && ccode == '[') ||
438+
(c >= '0' && c <= '9' && ccode >= '0' && ccode <= '9') ||
439+
(c == ';' && ccode >= '0' && ccode <= '9') ||
440+
(c >= '0' && c <= '9' && ccode == ';') ||
441+
(c == 'R' && ccode >= '0' && ccode <= '9')) {
441442
ccode = c;
442443
continue;
443444
}

tools/config_parser.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -673,11 +673,11 @@ static int is_a_user_password(char *entry)
673673
}
674674
for (; entry < delim; entry++) {
675675
is_user_password =
676-
*entry >= '0' && *entry <= '9' ||
677-
*entry >= 'A' && *entry <= 'Z' ||
678-
*entry >= 'a' && *entry <= 'z' ||
679-
*entry == '+' ||
680-
*entry == '/';
676+
(*entry >= '0' && *entry <= '9') ||
677+
(*entry >= 'A' && *entry <= 'Z') ||
678+
(*entry >= 'a' && *entry <= 'z') ||
679+
(*entry == '+') ||
680+
(*entry == '/');
681681
if (!is_user_password) {
682682
pr_debug("Password contains `%c' [0x%.2X]\n",
683683
*entry,

0 commit comments

Comments
 (0)