1
0
Fork 0
mirror of https://git.tukaani.org/xz.git synced 2024-04-04 12:36:23 +02:00

lib: Silence -Wsign-conversion in getopt.c.

This commit is contained in:
Jia Tan 2023-09-24 21:25:01 +08:00
parent a6234f677d
commit db17656721

View file

@ -213,7 +213,7 @@ process_long_option (int argc, char **argv, const char *optstring,
for (nameend = d->__nextchar; *nameend && *nameend != '='; nameend++) for (nameend = d->__nextchar; *nameend && *nameend != '='; nameend++)
/* Do nothing. */ ; /* Do nothing. */ ;
namelen = nameend - d->__nextchar; namelen = (size_t)(nameend - d->__nextchar);
/* First look for an exact match, counting the options as a side /* First look for an exact match, counting the options as a side
effect. */ effect. */
@ -260,7 +260,7 @@ process_long_option (int argc, char **argv, const char *optstring,
{ {
if (__libc_use_alloca (n_options)) if (__libc_use_alloca (n_options))
ambig_set = alloca (n_options); ambig_set = alloca (n_options);
else if ((ambig_set = malloc (n_options)) == NULL) else if ((ambig_set = malloc ((size_t)n_options)) == NULL)
/* Fall back to simpler error message. */ /* Fall back to simpler error message. */
ambig_fallback = 1; ambig_fallback = 1;
else else
@ -268,7 +268,7 @@ process_long_option (int argc, char **argv, const char *optstring,
if (ambig_set) if (ambig_set)
{ {
memset (ambig_set, 0, n_options); memset (ambig_set, 0, (size_t)n_options);
ambig_set[indfound] = 1; ambig_set[indfound] = 1;
} }
} }