mirror of
https://github.com/libretro/RetroArch
synced 2025-03-03 04:14:00 +00:00
(PS3) Fix libretrodb warnings
This commit is contained in:
parent
340caec0a0
commit
3a0d745615
@ -180,7 +180,7 @@ int libretrodb_open(const char *path, libretrodb_t *db)
|
||||
}
|
||||
|
||||
header.metadata_offset = betoht64(header.metadata_offset);
|
||||
flseek(fp, header.metadata_offset, SEEK_SET);
|
||||
flseek(fp, (int)header.metadata_offset, SEEK_SET);
|
||||
|
||||
if (libretrodb_read_metadata(fp, &md) < 0)
|
||||
{
|
||||
@ -201,7 +201,7 @@ static int libretrodb_find_index(libretrodb_t *db, const char *index_name,
|
||||
libretrodb_index_t *idx)
|
||||
{
|
||||
off_t eof = flseek(db->fp, 0, SEEK_END);
|
||||
off_t offset = flseek(db->fp, db->first_index_offset, SEEK_SET);
|
||||
off_t offset = flseek(db->fp, (int)db->first_index_offset, SEEK_SET);
|
||||
|
||||
while (offset < eof)
|
||||
{
|
||||
@ -210,7 +210,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 = flseek(db->fp, idx->next, SEEK_CUR);
|
||||
offset = flseek(db->fp, (int)idx->next, SEEK_CUR);
|
||||
}
|
||||
|
||||
return -1;
|
||||
@ -276,11 +276,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, (uint8_t)idx.key_size, &offset);
|
||||
free(buff);
|
||||
|
||||
if (rv == 0)
|
||||
flseek(db->fp, offset, SEEK_SET);
|
||||
flseek(db->fp, (int)offset, SEEK_SET);
|
||||
|
||||
return rmsgpack_dom_read(db->fp, out);
|
||||
}
|
||||
@ -297,7 +297,7 @@ int libretrodb_cursor_reset(libretrodb_cursor_t *cursor)
|
||||
{
|
||||
cursor->eof = 0;
|
||||
return flseek(cursor->fp,
|
||||
cursor->db->root + sizeof(libretrodb_header_t),
|
||||
(int)cursor->db->root + sizeof(libretrodb_header_t),
|
||||
SEEK_SET);
|
||||
}
|
||||
|
||||
@ -412,12 +412,12 @@ int libretrodb_create_index(libretrodb_t *db,
|
||||
struct rmsgpack_dom_value item;
|
||||
struct rmsgpack_dom_value *field;
|
||||
struct bintree tree;
|
||||
uint64_t idx_header_offset;
|
||||
libretrodb_cursor_t cur = {0};
|
||||
void *buff = NULL;
|
||||
uint64_t *buff_u64 = NULL;
|
||||
uint8_t field_size = 0;
|
||||
uint64_t item_loc = libretrodb_tell(db);
|
||||
libretrodb_cursor_t cur = {0};
|
||||
void *buff = NULL;
|
||||
uint64_t *buff_u64 = NULL;
|
||||
uint64_t idx_header_offset = 0;
|
||||
uint8_t field_size = 0;
|
||||
uint64_t item_loc = libretrodb_tell(db);
|
||||
|
||||
bintree_new(&tree, node_compare, &field_size);
|
||||
|
||||
|
@ -405,9 +405,9 @@ static int read_buff(FILE *fp, size_t size, char **pbuff, uint64_t *len)
|
||||
if (read_uint(fp, &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 (fpread(fp, *pbuff, tmp_len) == -1)
|
||||
if (fpread(fp, *pbuff, (size_t)tmp_len) == -1)
|
||||
{
|
||||
free(*pbuff);
|
||||
return -errno;
|
||||
@ -479,20 +479,20 @@ int rmsgpack_read(FILE *fp,
|
||||
else if (type < MPF_FIXARRAY)
|
||||
{
|
||||
tmp_len = type - MPF_FIXMAP;
|
||||
return read_map(fp, tmp_len, callbacks, data);
|
||||
return read_map(fp, (uint32_t)tmp_len, callbacks, data);
|
||||
}
|
||||
else if (type < MPF_FIXSTR)
|
||||
{
|
||||
tmp_len = type - MPF_FIXARRAY;
|
||||
return read_array(fp, tmp_len, callbacks, data);
|
||||
return read_array(fp, (size_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 (fpread(fp, buff, tmp_len) == -1)
|
||||
if (fpread(fp, buff, (size_t)tmp_len) == -1)
|
||||
{
|
||||
free(buff);
|
||||
return -errno;
|
||||
@ -503,7 +503,7 @@ int rmsgpack_read(FILE *fp,
|
||||
free(buff);
|
||||
return 0;
|
||||
}
|
||||
return callbacks->read_string(buff, tmp_len, data);
|
||||
return callbacks->read_string(buff, (size_t)tmp_len, data);
|
||||
}
|
||||
else if (type > MPF_MAP32)
|
||||
{
|
||||
@ -534,7 +534,7 @@ int rmsgpack_read(FILE *fp,
|
||||
return rv;
|
||||
|
||||
if (callbacks->read_bin)
|
||||
return callbacks->read_bin(buff, tmp_len, data);
|
||||
return callbacks->read_bin(buff, (size_t)tmp_len, data);
|
||||
break;
|
||||
case 0xcc:
|
||||
case 0xcd:
|
||||
@ -542,7 +542,7 @@ int rmsgpack_read(FILE *fp,
|
||||
case 0xcf:
|
||||
tmp_len = 1UL << (type - 0xcc);
|
||||
tmp_uint = 0;
|
||||
if (read_uint(fp, &tmp_uint, tmp_len) == -1)
|
||||
if (read_uint(fp, &tmp_uint, (size_t)tmp_len) == -1)
|
||||
return -errno;
|
||||
|
||||
if (callbacks->read_uint)
|
||||
@ -554,7 +554,7 @@ int rmsgpack_read(FILE *fp,
|
||||
case 0xd3:
|
||||
tmp_len = 1UL << (type - 0xd0);
|
||||
tmp_int = 0;
|
||||
if (read_int(fp, &tmp_int, tmp_len) == -1)
|
||||
if (read_int(fp, &tmp_int, (size_t)tmp_len) == -1)
|
||||
return -errno;
|
||||
|
||||
if (callbacks->read_int)
|
||||
@ -567,20 +567,20 @@ int rmsgpack_read(FILE *fp,
|
||||
return rv;
|
||||
|
||||
if (callbacks->read_string)
|
||||
return callbacks->read_string(buff, tmp_len, data);
|
||||
return callbacks->read_string(buff, (size_t)tmp_len, data);
|
||||
break;
|
||||
case 0xdc:
|
||||
case 0xdd:
|
||||
if (read_uint(fp, &tmp_len, 2<<(type - 0xdc)) == -1)
|
||||
return -errno;
|
||||
|
||||
return read_array(fp, tmp_len, callbacks, data);
|
||||
return read_array(fp, (size_t)tmp_len, callbacks, data);
|
||||
case 0xde:
|
||||
case 0xdf:
|
||||
if (read_uint(fp, &tmp_len, 2<<(type - 0xde)) == -1)
|
||||
return -errno;
|
||||
|
||||
return read_map(fp, tmp_len, callbacks, data);
|
||||
return read_map(fp, (size_t)tmp_len, callbacks, data);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -519,7 +519,7 @@ int rmsgpack_dom_read_into(FILE *fp, ...)
|
||||
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 *);
|
||||
@ -528,7 +528,7 @@ int rmsgpack_dom_read_into(FILE *fp, ...)
|
||||
*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…
x
Reference in New Issue
Block a user