Ticket #4595: tar: fix comparison of integer expressions of different signedness.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
This commit is contained in:
Andrew Borodin 2024-10-07 21:30:15 +03:00 committed by Yury V. Zaytsev
parent 9d462b135c
commit 4b1cdccb48
2 changed files with 3 additions and 3 deletions

View File

@ -128,7 +128,7 @@ tar_flush_read (tar_super_t *archive)
size_t status; size_t status;
status = mc_read (archive->fd, archive->record_start->buffer, record_size); status = mc_read (archive->fd, archive->record_start->buffer, record_size);
if (status == record_size) if ((idx_t) status == record_size)
return TRUE; return TRUE;
return tar_short_read (status, archive); return tar_short_read (status, archive);
@ -286,7 +286,7 @@ stoint (const char *arg, char **arglim, gboolean *overflow, intmax_t minval, uin
v |= ckd_add (&i, i, *p - '0') ? 1 : 0; v |= ckd_add (&i, i, *p - '0') ? 1 : 0;
} }
v |= maxval < i ? 1 : 0; v |= maxval < (uintmax_t) i ? 1 : 0;
if (v != 0) if (v != 0)
i = maxval; i = maxval;
} }

View File

@ -327,7 +327,7 @@ tar_available_space_after (const union block *pointer)
static read_header static read_header
tar_checksum (const union block *header) tar_checksum (const union block *header)
{ {
int i; unsigned int i;
int unsigned_sum = 0; /* the POSIX one :-) */ int unsigned_sum = 0; /* the POSIX one :-) */
int signed_sum = 0; /* the Sun one :-( */ int signed_sum = 0; /* the Sun one :-( */
int recorded_sum; int recorded_sum;