util/archive: fix warnings

Gets rid of these 4 warnings:

archive.c: In function ‘set_file_name’:
warning: comparison of integer expressions of different signedness

archive.c: In function ‘add_file’:
warning: comparison of integer expressions of different signedness

archive.c: In function ‘archive_files’:
warning: comparison of integer expressions of different signedness

archive.c: In function ‘convert_endian’:
warning: comparison of integer expressions of different signedness

BUG=None
TEST=Build and run

Signed-off-by: Martin Roth <martin@coreboot.org>
Change-Id: I57ee8b31bbc9e97168e3b818c4d053eadf8a4f84
Reviewed-on: https://review.coreboot.org/c/coreboot/+/50651
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
Martin Roth 2021-02-13 22:40:46 -07:00 committed by Patrick Georgi
parent d509076044
commit 86d6816db2
1 changed files with 4 additions and 4 deletions

View File

@ -43,7 +43,7 @@ static int set_file_name(const char *path, struct dentry *dest)
{ {
struct dentry *entry; struct dentry *entry;
char *name, *copy; char *name, *copy;
int i; uint32_t i;
copy = strdup(path); copy = strdup(path);
name = basename(copy); name = basename(copy);
@ -106,7 +106,7 @@ static int add_file(const char *path, struct dentry *entry, uint32_t offset)
path, errno, strerror(errno)); path, errno, strerror(errno));
return -1; return -1;
} }
if (fread((char *)archive + offset, sizeof(char), size, fp) != size) { if (fread((char *)archive + offset, sizeof(char), size, fp) != (size_t)size) {
fprintf(stderr, "Error: failed to read %s\n", path); fprintf(stderr, "Error: failed to read %s\n", path);
fclose(fp); fclose(fp);
return -1; return -1;
@ -169,7 +169,7 @@ static int archive_files(const char **files)
{ {
struct dentry *entry; struct dentry *entry;
uint32_t offset; uint32_t offset;
int i; uint32_t i;
entry = get_first_dentry(archive); entry = get_first_dentry(archive);
offset = get_first_offset(archive); offset = get_first_offset(archive);
@ -186,7 +186,7 @@ static int archive_files(const char **files)
static void convert_endian(void) static void convert_endian(void)
{ {
struct dentry *entry; struct dentry *entry;
int i; uint32_t i;
entry = get_first_dentry(archive); entry = get_first_dentry(archive);
for (i = 0; i < archive->count; i++) { for (i = 0; i < archive->count; i++) {