1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-05 09:48:42 +00:00

(libretro-db) Don't use off_t

This commit is contained in:
twinaphex 2015-09-21 17:47:02 +02:00
parent e1fadcd813
commit 350dee9f51
2 changed files with 11 additions and 13 deletions

View File

@ -83,8 +83,7 @@ static int libretrodb_write_metadata(RFILE *fd, libretrodb_metadata_t *md)
static int validate_document(const struct rmsgpack_dom_value *doc)
{
unsigned i;
struct rmsgpack_dom_value key;
struct rmsgpack_dom_value value;
struct rmsgpack_dom_value key, value;
int rv = 0;
if (doc->type != RDT_MAP)
@ -118,14 +117,13 @@ int libretrodb_create(RFILE *fd, libretrodb_value_provider value_provider,
void *ctx)
{
int rv;
off_t root;
libretrodb_metadata_t md;
struct rmsgpack_dom_value item;
uint64_t item_count = 0;
libretrodb_header_t header = {{0}};
ssize_t root = retro_fseek(fd, 0, SEEK_CUR);
memcpy(header.magic_number, MAGIC_NUMBER, sizeof(MAGIC_NUMBER)-1);
root = retro_fseek(fd, 0, SEEK_CUR);
/* We write the header in the end because we need to know the size of
* the db first */
@ -234,8 +232,8 @@ error:
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, (ssize_t)db->first_index_offset, SEEK_SET);
ssize_t eof = retro_fseek(db->fd, 0, SEEK_END);
ssize_t offset = retro_fseek(db->fd, (ssize_t)db->first_index_offset, SEEK_SET);
while (offset < eof)
{

View File

@ -24,7 +24,7 @@ struct buffer
{
const char *data;
size_t len;
off_t offset;
ssize_t offset;
};
/* Errors */
@ -35,7 +35,7 @@ static void raise_too_many_arguments(const char **error)
*error = tmp_error_buff;
}
static void raise_expected_number(off_t where, const char **error)
static void raise_expected_number(ssize_t where, const char **error)
{
snprintf(tmp_error_buff, MAX_ERROR_LEN,
#ifdef _WIN32
@ -47,7 +47,7 @@ static void raise_expected_number(off_t where, const char **error)
*error = tmp_error_buff;
}
static void raise_expected_string(off_t where, const char ** error)
static void raise_expected_string(ssize_t where, const char ** error)
{
snprintf(tmp_error_buff, MAX_ERROR_LEN,
#ifdef _WIN32
@ -59,7 +59,7 @@ static void raise_expected_string(off_t where, const char ** error)
*error = tmp_error_buff;
}
static void raise_unexpected_eof(off_t where, const char ** error)
static void raise_unexpected_eof(ssize_t where, const char ** error)
{
snprintf(tmp_error_buff, MAX_ERROR_LEN,
#ifdef _WIN32
@ -78,7 +78,7 @@ static void raise_enomem(const char **error)
*error = tmp_error_buff;
}
static void raise_unknown_function(off_t where, const char *name,
static void raise_unknown_function(ssize_t where, const char *name,
ssize_t len, const char **error)
{
int n = snprintf(tmp_error_buff, MAX_ERROR_LEN,
@ -96,7 +96,7 @@ static void raise_unknown_function(off_t where, const char *name,
strlcpy(tmp_error_buff + n + len, "'", sizeof(tmp_error_buff));
*error = tmp_error_buff;
}
static void raise_expected_eof(off_t where, char found, const char **error)
static void raise_expected_eof(ssize_t where, char found, const char **error)
{
snprintf(tmp_error_buff, MAX_ERROR_LEN,
#ifdef _WIN32
@ -110,7 +110,7 @@ static void raise_expected_eof(off_t where, char found, const char **error)
*error = tmp_error_buff;
}
static void raise_unexpected_char(off_t where, char expected, char found,
static void raise_unexpected_char(ssize_t where, char expected, char found,
const char **error)
{
snprintf(tmp_error_buff, MAX_ERROR_LEN,