mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-02-04 04:31:36 +00:00
cpukit/libfs/dosfs: Address -Wsign-compare warnings
This warning occurs when comparing a signed variable to an unsigned one. This is frequently an int or ssize_t variable compared to a uint32_t or size_t. Sometimes the size_t is from a sizeof() use. This addresses sign comparison warnings in the dosfs.
This commit is contained in:
committed by
Gedare Bloom
parent
939d18ba4e
commit
63d3c17d8f
@@ -364,7 +364,7 @@ fat_cluster_set(
|
||||
ofs_blk,
|
||||
c,
|
||||
pattern);
|
||||
if (c != ret)
|
||||
if ((ssize_t)c != ret)
|
||||
rc = -1;
|
||||
else
|
||||
{
|
||||
@@ -444,7 +444,7 @@ fat_cluster_write(
|
||||
ofs_blk,
|
||||
c,
|
||||
&buffer[bytes_written]);
|
||||
if (c != ret)
|
||||
if ((ssize_t)c != ret)
|
||||
rc = -1;
|
||||
else
|
||||
{
|
||||
@@ -921,7 +921,7 @@ fat_init_clusters_chain(
|
||||
while ((cur_cln & fs_info->vol.mask) < fs_info->vol.eoc_val)
|
||||
{
|
||||
ret = fat_cluster_set(fs_info, cur_cln, 0, fs_info->vol.bpc, 0);
|
||||
if ( ret != fs_info->vol.bpc )
|
||||
if ( ret != (ssize_t)fs_info->vol.bpc )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -713,7 +713,7 @@ fat_file_extend(
|
||||
return rc;
|
||||
|
||||
bytes_written = fat_cluster_set (fs_info, cur_cln, ofs, bytes_remain, 0);
|
||||
if (bytes_remain != bytes_written)
|
||||
if ((ssize_t)bytes_remain != bytes_written)
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -414,7 +414,7 @@ msdos_filename_utf8_to_long_name_for_save (
|
||||
uint16_t *long_name,
|
||||
const size_t long_name_size)
|
||||
{
|
||||
ssize_t returned_size = 0;
|
||||
size_t returned_size = 0;
|
||||
int eno = 0;
|
||||
size_t name_size;
|
||||
size_t name_size_tmp;
|
||||
|
||||
@@ -783,7 +783,7 @@ static int msdos_format_determine_fmt_params
|
||||
if (ret_val == 0) {
|
||||
const char *from;
|
||||
char *to = fmt_params->OEMName;
|
||||
int cnt;
|
||||
size_t cnt;
|
||||
from = "RTEMS"; /* default: make "from" point to OS Name */
|
||||
if ((rqdata != NULL) && (rqdata->OEMName != NULL)) {
|
||||
from = rqdata->OEMName;
|
||||
@@ -810,7 +810,7 @@ static int msdos_format_determine_fmt_params
|
||||
if (ret_val == 0) {
|
||||
const char *from;
|
||||
char *to = fmt_params->VolLabel;
|
||||
int cnt;
|
||||
size_t cnt;
|
||||
from = ""; /* default: make "from" point to empty string */
|
||||
if ((rqdata != NULL) &&
|
||||
(rqdata->VolLabel != NULL)) {
|
||||
|
||||
@@ -1264,7 +1264,7 @@ msdos_compare_entry_against_filename (
|
||||
entry,
|
||||
filename );
|
||||
#endif
|
||||
if (bytes_in_entry_normalized <= size_remaining) {
|
||||
if (bytes_in_entry_normalized <= (size_t) size_remaining) {
|
||||
size_remaining = size_remaining - bytes_in_entry_normalized;
|
||||
if (0 == memcmp ( &entry_normalized[0],
|
||||
&filename[size_remaining],
|
||||
@@ -1356,7 +1356,7 @@ msdos_find_file_in_directory (
|
||||
if (bytes_read < MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE)
|
||||
rtems_set_errno_and_return_minus_one(EIO);
|
||||
|
||||
assert(bytes_read == bts2rd);
|
||||
assert(bytes_read == (ssize_t)bts2rd);
|
||||
|
||||
/* have to look at the DIR_NAME as "raw" 8-bit data */
|
||||
for (dir_entry = 0;
|
||||
@@ -1691,7 +1691,7 @@ msdos_add_file (
|
||||
int ret;
|
||||
ssize_t bytes_written;
|
||||
uint8_t lfn_checksum;
|
||||
int lfn_entry;
|
||||
unsigned int lfn_entry;
|
||||
uint8_t *entry;
|
||||
uint32_t short_file_offset;
|
||||
uint32_t length;
|
||||
@@ -2033,7 +2033,7 @@ int msdos_find_node_by_cluster_num_in_fat_file(
|
||||
if ( ret < MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE )
|
||||
rtems_set_errno_and_return_minus_one( EIO );
|
||||
|
||||
assert(ret == bts2rd);
|
||||
assert(ret == (ssize_t)bts2rd);
|
||||
|
||||
for (i = 0; i < bts2rd; i += MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user