mirror of
https://github.com/libretro/RetroArch
synced 2025-03-30 07:20:36 +00:00
(rarchdb) Silence some warnings
This commit is contained in:
parent
8fc4db23dc
commit
215042cdbb
@ -208,16 +208,20 @@ static int binsearch(const void *buff, const void *item, uint64_t count, uint8_t
|
|||||||
int rarchdb_find_entry(struct rarchdb *db, const char *index_name, const void *key)
|
int rarchdb_find_entry(struct rarchdb *db, const char *index_name, const void *key)
|
||||||
{
|
{
|
||||||
struct rarchdb_index idx;
|
struct rarchdb_index idx;
|
||||||
uint64_t offset;
|
|
||||||
ssize_t nread = 0;
|
|
||||||
int rv;
|
int rv;
|
||||||
|
void *buff;
|
||||||
|
uint64_t offset;
|
||||||
|
ssize_t bufflen, nread = 0;
|
||||||
|
|
||||||
if (rarchdb_find_index(db, index_name, &idx) < 0)
|
if (rarchdb_find_index(db, index_name, &idx) < 0)
|
||||||
{
|
{
|
||||||
rarchdb_read_reset(db);
|
rarchdb_read_reset(db);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
size_t bufflen = idx.next;
|
|
||||||
void* buff = malloc(bufflen);
|
bufflen = idx.next;
|
||||||
|
buff = malloc(bufflen);
|
||||||
|
|
||||||
if (!buff)
|
if (!buff)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
@ -401,7 +401,9 @@ static int read_buff(int fd, size_t size, char** pbuff, uint64_t *len)
|
|||||||
|
|
||||||
static int read_map(int fd, uint32_t len, struct rmsgpack_read_callbacks *callbacks, void *data)
|
static int read_map(int fd, uint32_t len, struct rmsgpack_read_callbacks *callbacks, void *data)
|
||||||
{
|
{
|
||||||
int rv, i;
|
int rv;
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
callbacks->read_map_start &&
|
callbacks->read_map_start &&
|
||||||
(rv = callbacks->read_map_start(len, data)) < 0)
|
(rv = callbacks->read_map_start(len, data)) < 0)
|
||||||
@ -420,7 +422,8 @@ static int read_map(int fd, uint32_t len, struct rmsgpack_read_callbacks *callba
|
|||||||
|
|
||||||
static int read_array(int fd, uint32_t len, struct rmsgpack_read_callbacks *callbacks, void *data)
|
static int read_array(int fd, uint32_t len, struct rmsgpack_read_callbacks *callbacks, void *data)
|
||||||
{
|
{
|
||||||
int rv, i;
|
int rv;
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
callbacks->read_array_start &&
|
callbacks->read_array_start &&
|
||||||
|
@ -96,19 +96,19 @@ static int dom_read_bin(void* value, uint32_t len, void *data)
|
|||||||
|
|
||||||
static int dom_read_map_start(uint32_t len, void *data)
|
static int dom_read_map_start(uint32_t len, void *data)
|
||||||
{
|
{
|
||||||
int i;
|
unsigned i;
|
||||||
struct rmsgpack_dom_pair *items = NULL;
|
struct rmsgpack_dom_pair *items = NULL;
|
||||||
struct dom_reader_state *dom_state = (struct dom_reader_state*)data;
|
struct dom_reader_state *dom_state = (struct dom_reader_state*)data;
|
||||||
|
|
||||||
struct rmsgpack_dom_value *v = dom_reader_state_pop(dom_state);
|
struct rmsgpack_dom_value *v = dom_reader_state_pop(dom_state);
|
||||||
v->type = RDT_MAP;
|
|
||||||
v->map.len = len;
|
|
||||||
v->map.items = NULL;
|
|
||||||
|
|
||||||
items = (struct rmsgpack_dom_pair *)calloc(len, sizeof(struct rmsgpack_dom_pair));
|
v->type = RDT_MAP;
|
||||||
|
v->map.len = len;
|
||||||
|
v->map.items = NULL;
|
||||||
|
|
||||||
if (!items)
|
items = (struct rmsgpack_dom_pair *)calloc(len, sizeof(struct rmsgpack_dom_pair));
|
||||||
return -ENOMEM;
|
|
||||||
|
if (!items)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
v->map.items = items;
|
v->map.items = items;
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
@ -123,10 +123,11 @@ static int dom_read_map_start(uint32_t len, void *data)
|
|||||||
|
|
||||||
static int dom_read_array_start(uint32_t len, void *data)
|
static int dom_read_array_start(uint32_t len, void *data)
|
||||||
{
|
{
|
||||||
int i;
|
unsigned i;
|
||||||
struct dom_reader_state *dom_state = (struct dom_reader_state*)data;
|
struct dom_reader_state *dom_state = (struct dom_reader_state*)data;
|
||||||
struct rmsgpack_dom_value *v = dom_reader_state_pop(dom_state);
|
struct rmsgpack_dom_value *v = dom_reader_state_pop(dom_state);
|
||||||
struct rmsgpack_dom_value *items = NULL;
|
struct rmsgpack_dom_value *items = NULL;
|
||||||
|
|
||||||
v->type = RDT_ARRAY;
|
v->type = RDT_ARRAY;
|
||||||
v->array.len = len;
|
v->array.len = len;
|
||||||
v->array.items = NULL;
|
v->array.items = NULL;
|
||||||
@ -159,7 +160,7 @@ static struct rmsgpack_read_callbacks dom_reader_callbacks = {
|
|||||||
|
|
||||||
void rmsgpack_dom_value_free(struct rmsgpack_dom_value *v)
|
void rmsgpack_dom_value_free(struct rmsgpack_dom_value *v)
|
||||||
{
|
{
|
||||||
int i;
|
unsigned i;
|
||||||
|
|
||||||
switch (v->type)
|
switch (v->type)
|
||||||
{
|
{
|
||||||
@ -194,7 +195,7 @@ void rmsgpack_dom_value_free(struct rmsgpack_dom_value *v)
|
|||||||
struct rmsgpack_dom_value *rmsgpack_dom_value_map_value(
|
struct rmsgpack_dom_value *rmsgpack_dom_value_map_value(
|
||||||
const struct rmsgpack_dom_value *map, const struct rmsgpack_dom_value *key)
|
const struct rmsgpack_dom_value *map, const struct rmsgpack_dom_value *key)
|
||||||
{
|
{
|
||||||
int i;
|
unsigned i;
|
||||||
if (map->type != RDT_MAP)
|
if (map->type != RDT_MAP)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -209,7 +210,9 @@ struct rmsgpack_dom_value *rmsgpack_dom_value_map_value(
|
|||||||
int rmsgpack_dom_value_cmp(
|
int rmsgpack_dom_value_cmp(
|
||||||
const struct rmsgpack_dom_value *a, const struct rmsgpack_dom_value *b)
|
const struct rmsgpack_dom_value *a, const struct rmsgpack_dom_value *b)
|
||||||
{
|
{
|
||||||
int rv, i;
|
int rv;
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
if (a == b)
|
if (a == b)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
@ -261,7 +264,7 @@ int rmsgpack_dom_value_cmp(
|
|||||||
|
|
||||||
void rmsgpack_dom_value_print(struct rmsgpack_dom_value *obj)
|
void rmsgpack_dom_value_print(struct rmsgpack_dom_value *obj)
|
||||||
{
|
{
|
||||||
int i;
|
unsigned i;
|
||||||
|
|
||||||
switch (obj->type)
|
switch (obj->type)
|
||||||
{
|
{
|
||||||
@ -322,7 +325,7 @@ void rmsgpack_dom_value_print(struct rmsgpack_dom_value *obj)
|
|||||||
}
|
}
|
||||||
int rmsgpack_dom_write(int fd, const struct rmsgpack_dom_value *obj)
|
int rmsgpack_dom_write(int fd, const struct rmsgpack_dom_value *obj)
|
||||||
{
|
{
|
||||||
int i;
|
unsigned i;
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
int written = 0;
|
int written = 0;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user