Skip to content

Commit

Permalink
ksmbd-tools: fix GCC parentheses warnings
Browse files Browse the repository at this point in the history
GCC suggests clarifying order of evaluation.

Signed-off-by: Rosen Penev <[email protected]>
Signed-off-by: Namjae Jeon <[email protected]>
  • Loading branch information
neheb authored and namjaejeon committed Mar 27, 2024
1 parent 12c0ad0 commit 92c757f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
23 changes: 12 additions & 11 deletions addshare/share_admin.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ static char **__get_options(GHashTable *kv, int is_global)
for (c = 0; c < KSMBD_SHARE_CONF_MAX; c++) {
const char *k = KSMBD_SHARE_CONF[c], *v = NULL, *pre;

if (is_global && KSMBD_SHARE_CONF_IS_GLOBAL(c) ||
if ((is_global && KSMBD_SHARE_CONF_IS_GLOBAL(c)) ||
KSMBD_SHARE_CONF_IS_BROKEN(c))
pre = "; ";
else
Expand All @@ -101,7 +101,7 @@ static void __load_conf(enum KSMBD_SHARE_CONF conf,
{
char *option = options[conf];

if (step)
if (step) {
if (cp_smbconf_eol(cp_ltrim(buf))) {
char *p = cp_ltrim(strchr(option, '=') + 1);
const char *fmt, *s;
Expand All @@ -119,6 +119,7 @@ static void __load_conf(enum KSMBD_SHARE_CONF conf,
} else {
options[conf] = g_strdup_printf("%s%s", option, buf);
}
}

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

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

if (is_global && KSMBD_SHARE_CONF_IS_GLOBAL(conf) ||
if ((is_global && KSMBD_SHARE_CONF_IS_GLOBAL(conf)) ||
KSMBD_SHARE_CONF_IS_BROKEN(conf))
return __next_conf(conf + step, step, is_global, is_ready);

Expand Down Expand Up @@ -430,14 +431,14 @@ static int __prompt_options_stdin(char **options, int is_global)
break;

if (c == '\e' ||
c == '[' && ccode == '\e' ||
c == 'A' && ccode == '[' ||
c == 'B' && ccode == '[' ||
c >= '0' && c <= '9' && ccode == '[' ||
c >= '0' && c <= '9' && ccode >= '0' && ccode <= '9' ||
c == ';' && ccode >= '0' && ccode <= '9' ||
c >= '0' && c <= '9' && ccode == ';' ||
c == 'R' && ccode >= '0' && ccode <= '9') {
(c == '[' && ccode == '\e') ||
(c == 'A' && ccode == '[') ||
(c == 'B' && ccode == '[') ||
(c >= '0' && c <= '9' && ccode == '[') ||
(c >= '0' && c <= '9' && ccode >= '0' && ccode <= '9') ||
(c == ';' && ccode >= '0' && ccode <= '9') ||
(c >= '0' && c <= '9' && ccode == ';') ||
(c == 'R' && ccode >= '0' && ccode <= '9')) {
ccode = c;
continue;
}
Expand Down
10 changes: 5 additions & 5 deletions tools/config_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -673,11 +673,11 @@ static int is_a_user_password(char *entry)
}
for (; entry < delim; entry++) {
is_user_password =
*entry >= '0' && *entry <= '9' ||
*entry >= 'A' && *entry <= 'Z' ||
*entry >= 'a' && *entry <= 'z' ||
*entry == '+' ||
*entry == '/';
(*entry >= '0' && *entry <= '9') ||
(*entry >= 'A' && *entry <= 'Z') ||
(*entry >= 'a' && *entry <= 'z') ||
(*entry == '+') ||
(*entry == '/');
if (!is_user_password) {
pr_debug("Password contains `%c' [0x%.2X]\n",
*entry,
Expand Down

0 comments on commit 92c757f

Please sign in to comment.