(libretro-db) Backport C89 fixes

This commit is contained in:
twinaphex 2015-09-17 07:23:36 +02:00
parent 0e5b18a619
commit 6cc98e1fa9
5 changed files with 18 additions and 39 deletions

View File

@ -81,8 +81,8 @@ int libretrodb_create(int fd, libretrodb_value_provider value_provider,
off_t root; off_t root;
libretrodb_metadata_t md; libretrodb_metadata_t md;
uint64_t item_count = 0; uint64_t item_count = 0;
struct rmsgpack_dom_value item = {}; struct rmsgpack_dom_value item = {0};
libretrodb_header_t header = {}; libretrodb_header_t header = {0};
memcpy(header.magic_number, MAGIC_NUMBER, sizeof(MAGIC_NUMBER)-1); memcpy(header.magic_number, MAGIC_NUMBER, sizeof(MAGIC_NUMBER)-1);
root = lseek(fd, 0, SEEK_CUR); root = lseek(fd, 0, SEEK_CUR);

View File

@ -17,7 +17,7 @@
#undef MAX_ARGS #undef MAX_ARGS
#define MAX_ARGS 50 #define MAX_ARGS 50
static char tmp_error_buff [MAX_ERROR_LEN] = {}; static char tmp_error_buff [MAX_ERROR_LEN] = {0};
struct buffer struct buffer
{ {

View File

@ -3,41 +3,18 @@
#include <stdint.h> #include <stdint.h>
struct rmsgpack_read_callbacks { struct rmsgpack_read_callbacks
{
int (* read_nil) (void *); int (* read_nil) (void *);
int (* read_bool)( int (* read_bool)(int, void *);
int, int (* read_int) (int64_t, void *);
void * int (* read_uint)(uint64_t, void *);
); int (* read_string)(char *, uint32_t, void *);
int (* read_int)( int (* read_bin)(void *, uint32_t, void *);
int64_t, int (* read_map_start) (uint32_t, void *);
void * int (* read_array_start)(uint32_t, void *);
);
int (* read_uint)(
uint64_t,
void *
);
int (* read_string)(
char *,
uint32_t,
void *
);
int (* read_bin)(
void *,
uint32_t,
void *
);
int (* read_map_start)(
uint32_t,
void *
);
int (* read_array_start)(
uint32_t,
void *
);
}; };
int rmsgpack_write_array_header( int rmsgpack_write_array_header(
int fd, int fd,
uint32_t size uint32_t size

View File

@ -196,7 +196,7 @@ void rmsgpack_dom_value_free(struct rmsgpack_dom_value *v)
case RDT_INT: case RDT_INT:
case RDT_BOOL: case RDT_BOOL:
case RDT_UINT: case RDT_UINT:
// Do nothing /* Do nothing */
break; break;
} }
} }

View File

@ -7,7 +7,8 @@
extern "C" { extern "C" {
#endif #endif
enum rmsgpack_dom_type { enum rmsgpack_dom_type
{
RDT_NULL = 0, RDT_NULL = 0,
RDT_BOOL, RDT_BOOL,
RDT_UINT, RDT_UINT,
@ -49,7 +50,8 @@ struct rmsgpack_dom_value
} val; } val;
}; };
struct rmsgpack_dom_pair { struct rmsgpack_dom_pair
{
struct rmsgpack_dom_value key; struct rmsgpack_dom_value key;
struct rmsgpack_dom_value value; struct rmsgpack_dom_value value;
}; };