cpukit/.../imfs: Address -Wsign-compare warnings

This warning occurs when comparing a signed variable to an unsigned one.
This addresses warnings that only occurred on 64-bit targets.  For the
ones which only appeared on 64-bit targets, the cause was frequently
a mismatch when comparing a combination off_t, ssize_t, and int.
This commit is contained in:
Joel Sherrill
2026-01-30 09:17:33 -06:00
parent 0b7eb103fe
commit feac23ce18
2 changed files with 5 additions and 5 deletions

View File

@@ -114,7 +114,7 @@ typedef block_p *block_ptr;
IMFS_MEMFILE_BLOCK_SLOTS * IMFS_MEMFILE_BLOCK_SLOTS))
#define IMFS_MEMFILE_MAXIMUM_SIZE \
((LAST_TRIPLY_INDIRECT + 1) * IMFS_MEMFILE_BYTES_PER_BLOCK)
(size_t)((LAST_TRIPLY_INDIRECT + 1) * IMFS_MEMFILE_BYTES_PER_BLOCK)
/** @} */

View File

@@ -138,7 +138,7 @@ static int memfile_ftruncate(
* as an extend operation.
*/
if ( length > memfile->File.size )
if ( length > (int64_t)memfile->File.size )
return IMFS_memfile_extend( memfile, true, length );
/*
@@ -179,13 +179,13 @@ static int IMFS_memfile_extend(
/*
* Verify new file size is supported
*/
if ( new_length >= IMFS_MEMFILE_MAXIMUM_SIZE )
if ( new_length >= (int64_t)IMFS_MEMFILE_MAXIMUM_SIZE )
rtems_set_errno_and_return_minus_one( EFBIG );
/*
* Verify new file size is actually larger than current size
*/
if ( new_length <= memfile->File.size )
if ( new_length <= (int64_t)memfile->File.size )
return 0;
/*
@@ -560,7 +560,7 @@ ssize_t IMFS_memfile_write(
last_byte = start + my_length;
if ( last_byte > memfile->File.size ) {
bool zero_fill = start > memfile->File.size;
bool zero_fill = start > (int64_t)memfile->File.size;
status = IMFS_memfile_extend( memfile, zero_fill, last_byte );
if ( status )