mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-27 10:10:57 +00:00
(libretrodb) Silence warnings
This commit is contained in:
parent
55e54a30b4
commit
483a4264e5
@ -213,7 +213,7 @@ int libretrodb_open(const char *path, libretrodb_t *db)
|
||||
}
|
||||
|
||||
header.metadata_offset = betoht64(header.metadata_offset);
|
||||
retro_fseek(fd, header.metadata_offset, SEEK_SET);
|
||||
retro_fseek(fd, (ssize_t)header.metadata_offset, SEEK_SET);
|
||||
|
||||
if (libretrodb_read_metadata(fd, &md) < 0)
|
||||
{
|
||||
@ -236,7 +236,7 @@ static int libretrodb_find_index(libretrodb_t *db, const char *index_name,
|
||||
libretrodb_index_t *idx)
|
||||
{
|
||||
off_t eof = retro_fseek(db->fd, 0, SEEK_END);
|
||||
off_t offset = retro_fseek(db->fd, db->first_index_offset, SEEK_SET);
|
||||
off_t offset = retro_fseek(db->fd, (ssize_t)db->first_index_offset, SEEK_SET);
|
||||
|
||||
while (offset < eof)
|
||||
{
|
||||
@ -245,7 +245,7 @@ static int libretrodb_find_index(libretrodb_t *db, const char *index_name,
|
||||
if (strncmp(index_name, idx->name, strlen(idx->name)) == 0)
|
||||
return 0;
|
||||
|
||||
offset = retro_fseek(db->fd, idx->next, SEEK_CUR);
|
||||
offset = retro_fseek(db->fd, (ssize_t)idx->next, SEEK_CUR);
|
||||
}
|
||||
|
||||
return -1;
|
||||
@ -311,11 +311,11 @@ int libretrodb_find_entry(libretrodb_t *db, const char *index_name,
|
||||
nread += rv;
|
||||
}
|
||||
|
||||
rv = binsearch(buff, key, db->count, idx.key_size, &offset);
|
||||
rv = binsearch(buff, key, db->count, (ssize_t)idx.key_size, &offset);
|
||||
free(buff);
|
||||
|
||||
if (rv == 0)
|
||||
retro_fseek(db->fd, offset, SEEK_SET);
|
||||
retro_fseek(db->fd, (ssize_t)offset, SEEK_SET);
|
||||
|
||||
return rmsgpack_dom_read(db->fd, out);
|
||||
}
|
||||
@ -332,7 +332,7 @@ int libretrodb_cursor_reset(libretrodb_cursor_t *cursor)
|
||||
{
|
||||
cursor->eof = 0;
|
||||
return retro_fseek(cursor->fd,
|
||||
cursor->db->root + sizeof(libretrodb_header_t),
|
||||
(ssize_t)(cursor->db->root + sizeof(libretrodb_header_t)),
|
||||
SEEK_SET);
|
||||
}
|
||||
|
||||
@ -425,7 +425,7 @@ static int node_iter(void *value, void *ctx)
|
||||
struct node_iter_ctx *nictx = (struct node_iter_ctx*)ctx;
|
||||
|
||||
if (retro_fwrite(nictx->db->fd, value,
|
||||
nictx->idx->key_size + sizeof(uint64_t)) > 0)
|
||||
(ssize_t)(nictx->idx->key_size + sizeof(uint64_t))) > 0)
|
||||
return 0;
|
||||
|
||||
return -1;
|
||||
@ -532,10 +532,11 @@ int libretrodb_create_index(libretrodb_t *db,
|
||||
item_loc = libretrodb_tell(db);
|
||||
}
|
||||
|
||||
(void)rv;
|
||||
(void)idx_header_offset;
|
||||
|
||||
idx_header_offset = retro_fseek(db->fd, 0, SEEK_END);
|
||||
|
||||
(void)idx_header_offset;
|
||||
(void)rv;
|
||||
|
||||
strncpy(idx.name, name, 50);
|
||||
|
||||
idx.name[49] = '\0';
|
||||
|
@ -455,9 +455,9 @@ static int read_buff(RFILE *fd, size_t size, char **pbuff, uint64_t *len)
|
||||
if (read_uint(fd, &tmp_len, size) == -1)
|
||||
return -errno;
|
||||
|
||||
*pbuff = (char *)calloc(tmp_len + 1, sizeof(char));
|
||||
*pbuff = (char *)calloc((size_t)(tmp_len + 1), sizeof(char));
|
||||
|
||||
if (retro_fread(fd, *pbuff, tmp_len) == -1)
|
||||
if (retro_fread(fd, *pbuff, (size_t)tmp_len) == -1)
|
||||
{
|
||||
free(*pbuff);
|
||||
return -errno;
|
||||
@ -529,20 +529,20 @@ int rmsgpack_read(RFILE *fd,
|
||||
else if (type < MPF_FIXARRAY)
|
||||
{
|
||||
tmp_len = type - MPF_FIXMAP;
|
||||
return read_map(fd, tmp_len, callbacks, data);
|
||||
return read_map(fd, (uint32_t)tmp_len, callbacks, data);
|
||||
}
|
||||
else if (type < MPF_FIXSTR)
|
||||
{
|
||||
tmp_len = type - MPF_FIXARRAY;
|
||||
return read_array(fd, tmp_len, callbacks, data);
|
||||
return read_array(fd, (uint32_t)tmp_len, callbacks, data);
|
||||
}
|
||||
else if (type < MPF_NIL)
|
||||
{
|
||||
tmp_len = type - MPF_FIXSTR;
|
||||
buff = (char *)calloc(tmp_len + 1, sizeof(char));
|
||||
buff = (char *)calloc((size_t)(tmp_len + 1), sizeof(char));
|
||||
if (!buff)
|
||||
return -ENOMEM;
|
||||
if (retro_fread(fd, buff, tmp_len) == -1)
|
||||
if (retro_fread(fd, buff, (ssize_t)tmp_len) == -1)
|
||||
{
|
||||
free(buff);
|
||||
goto error;
|
||||
@ -553,7 +553,7 @@ int rmsgpack_read(RFILE *fd,
|
||||
free(buff);
|
||||
return 0;
|
||||
}
|
||||
return callbacks->read_string(buff, tmp_len, data);
|
||||
return callbacks->read_string(buff, (uint32_t)tmp_len, data);
|
||||
}
|
||||
else if (type > MPF_MAP32)
|
||||
{
|
||||
@ -584,7 +584,7 @@ int rmsgpack_read(RFILE *fd,
|
||||
return rv;
|
||||
|
||||
if (callbacks->read_bin)
|
||||
return callbacks->read_bin(buff, tmp_len, data);
|
||||
return callbacks->read_bin(buff, (uint32_t)tmp_len, data);
|
||||
break;
|
||||
case _MPF_UINT8:
|
||||
case _MPF_UINT16:
|
||||
@ -592,7 +592,7 @@ int rmsgpack_read(RFILE *fd,
|
||||
case _MPF_UINT64:
|
||||
tmp_len = UINT32_C(1) << (type - _MPF_UINT8);
|
||||
tmp_uint = 0;
|
||||
if (read_uint(fd, &tmp_uint, tmp_len) == -1)
|
||||
if (read_uint(fd, &tmp_uint, (size_t)tmp_len) == -1)
|
||||
goto error;
|
||||
|
||||
if (callbacks->read_uint)
|
||||
@ -604,7 +604,7 @@ int rmsgpack_read(RFILE *fd,
|
||||
case _MPF_INT64:
|
||||
tmp_len = UINT32_C(1) << (type - _MPF_INT8);
|
||||
tmp_int = 0;
|
||||
if (read_int(fd, &tmp_int, tmp_len) == -1)
|
||||
if (read_int(fd, &tmp_int, (size_t)tmp_len) == -1)
|
||||
goto error;
|
||||
|
||||
if (callbacks->read_int)
|
||||
@ -617,18 +617,18 @@ int rmsgpack_read(RFILE *fd,
|
||||
return rv;
|
||||
|
||||
if (callbacks->read_string)
|
||||
return callbacks->read_string(buff, tmp_len, data);
|
||||
return callbacks->read_string(buff, (uint32_t)tmp_len, data);
|
||||
break;
|
||||
case _MPF_ARRAY16:
|
||||
case _MPF_ARRAY32:
|
||||
if (read_uint(fd, &tmp_len, 2<<(type - _MPF_ARRAY16)) == -1)
|
||||
goto error;
|
||||
return read_array(fd, tmp_len, callbacks, data);
|
||||
return read_array(fd, (uint32_t)tmp_len, callbacks, data);
|
||||
case _MPF_MAP16:
|
||||
case _MPF_MAP32:
|
||||
if (read_uint(fd, &tmp_len, 2<<(type - _MPF_MAP16)) == -1)
|
||||
goto error;
|
||||
return read_map(fd, tmp_len, callbacks, data);
|
||||
return read_map(fd, (uint32_t)tmp_len, callbacks, data);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -474,7 +474,7 @@ int rmsgpack_dom_read_into(RFILE *fd, ...)
|
||||
min_len = (value->val.binary.len > *uint_value) ?
|
||||
*uint_value : value->val.binary.len;
|
||||
|
||||
memcpy(buff_value, value->val.binary.buff, min_len);
|
||||
memcpy(buff_value, value->val.binary.buff, (size_t)min_len);
|
||||
break;
|
||||
case RDT_STRING:
|
||||
buff_value = va_arg(ap, char *);
|
||||
@ -483,7 +483,7 @@ int rmsgpack_dom_read_into(RFILE *fd, ...)
|
||||
*uint_value : value->val.string.len + 1;
|
||||
*uint_value = min_len;
|
||||
|
||||
memcpy(buff_value, value->val.string.buff, min_len);
|
||||
memcpy(buff_value, value->val.string.buff, (size_t)min_len);
|
||||
break;
|
||||
default:
|
||||
rv = -1;
|
||||
|
Loading…
Reference in New Issue
Block a user