From 986816f8cc7d64979e7b49c4aabf5051e10640ca Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 15 Jan 2024 14:52:07 +0000 Subject: [PATCH] eeptools: Fix compiler warnings Signed-off-by: Phil Elwell --- eeptools/eepdump.c | 1 - eeptools/eeplib.c | 8 ++++---- eeptools/eeplib.h | 3 ++- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eeptools/eepdump.c b/eeptools/eepdump.c index 3edcbab..dd73476 100644 --- a/eeptools/eepdump.c +++ b/eeptools/eepdump.c @@ -3,7 +3,6 @@ #include #include #include -#include #include "eeplib.h" diff --git a/eeptools/eeplib.c b/eeptools/eeplib.c index a030fe5..a81a757 100644 --- a/eeptools/eeplib.c +++ b/eeptools/eeplib.c @@ -234,11 +234,11 @@ bool eepio_end(void) return eepio_error("ftell failed"); if (pos != pos_end) eepio_warning("Dump finished before EOF"); - if (pos != eep_header.eeplen) + if (pos != (long)eep_header.eeplen) eepio_warning("Dump finished before length specified in header"); - if (pos_end != eep_header.eeplen) + if (pos_end != (long)eep_header.eeplen) eepio_warning("EOF does not match length specified in header"); - if (pos_end != eep_header.eeplen) + if (pos_end != (long)eep_header.eeplen) eepio_warning("%i bytes of file not processed"); } return !eepio_got_error(); @@ -284,7 +284,7 @@ void eepio_atom_end(void) if (eepio_dir == EEPIO_READ) { long pos = ftell(eepio_fp); - if (pos - eepio_atom_data_start != eep_atom_header.dlen) + if (pos - eepio_atom_data_start != (long)eep_atom_header.dlen) eepio_warning("atom data length mismatch"); if (crc_actual != eep_atom_crc) eepio_warning("atom CRC16 mismatch. Calculated CRC16=0x%02x", crc_actual); diff --git a/eeptools/eeplib.h b/eeptools/eeplib.h index 53a9ac1..4f5f3ca 100644 --- a/eeptools/eeplib.h +++ b/eeptools/eeplib.h @@ -5,6 +5,7 @@ #include #include #include +#include // minimal sizes of data structures #define HEADER_SIZE 12 @@ -23,7 +24,7 @@ #define CRC16 0x8005 // Signature is "R-Pi" in ASCII. It is required to reversed (little endian) on disk. -#define HEADER_SIGN be32toh((((char)'R' << 24) | ((char)'-' << 16) | ((char)'P' << 8) | ((char)'i'))) +#define HEADER_SIGN (uint32_t)be32toh((((char)'R' << 24) | ((char)'-' << 16) | ((char)'P' << 8) | ((char)'i'))) #define count_of(x) ((sizeof(x) / sizeof(x[0]))) #define max(x, y) ((x) > (y) ? (x) : (y))