(rarchDB) Fix some warnings

This commit is contained in:
twinaphex 2014-12-30 21:17:34 +01:00
parent 11318eb669
commit 8d929854af
3 changed files with 10 additions and 2 deletions

View File

@ -4,7 +4,9 @@
#include "bintree.h"
#if 0
static int NIL_VALUE = 1;
#endif
static void* NIL_NODE = &NIL_NODE;
static struct bintree_node *new_nil_node(struct bintree_node *parent);

View File

@ -4,16 +4,21 @@
#include <stdint.h>
#include <retro_endianness.h>
#ifndef swap16
#define swap16(val) \
((((uint16_t)(val) & 0x00ff) << 8) \
| (((uint16_t)(val) & 0xff00) >> 8))
#endif
#ifndef swap32
#define swap32(val) \
((((uint32_t)(val) & 0x000000ff) << 24) \
| (((uint32_t)(val) & 0x0000ff00) << 8) \
| (((uint32_t)(val) & 0x00ff0000) >> 8) \
| (((uint32_t)(val) & 0xff000000) >> 24))
#endif
#ifndef swap64
#define swap64(val) \
((((uint64_t)(val) & 0x00000000000000ffULL) << 56) \
| (((uint64_t)(val) & 0x000000000000ff00ULL) << 40) \
@ -23,6 +28,7 @@
| (((uint64_t)(val) & 0x0000ff0000000000ULL) >> 24) \
| (((uint64_t)(val) & 0x00ff000000000000ULL) >> 40) \
| (((uint64_t)(val) & 0xff00000000000000ULL) >> 56))
#endif
#define httobe64(x) (is_little_endian() ? swap64(x) : (x))

View File

@ -368,7 +368,7 @@ static int read_int(int fd, int64_t *out, size_t size)
static int read_buff(int fd, size_t size, char** pbuff, uint64_t *len)
{
uint64_t tmp_len;
uint64_t tmp_len = 0;
if(read_uint(fd, &tmp_len, size) == -1)
return -errno;
@ -426,7 +426,7 @@ int rmsgpack_read(int fd, struct rmsgpack_read_callbacks *callbacks, void *data)
uint64_t tmp_uint = 0;
int64_t tmp_int = 0;
uint8_t type = 0;
char* buff;
char* buff = NULL;
if (read(fd, &type, sizeof(uint8_t)) == -1)
return -errno;