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

Get rid of multitude of casting warnings

This commit is contained in:
twinaphex 2018-04-13 00:47:42 +02:00
parent 1751f4a0af
commit 041670fe02
11 changed files with 47 additions and 47 deletions

View File

@ -2,9 +2,9 @@ include version.all
#which compiler to build with - GCC or SNC
#set to GCC for debug builds for use with debugger
CELL_BUILD_TOOLS = GCC
CELL_BUILD_TOOLS = SNC
CELL_GPU_TYPE = RSX
CELL_PSGL_VERSION = ultra-opt
CELL_PSGL_VERSION = opt
ASSETS_DIR := media/assets
@ -96,7 +96,7 @@ ifeq ($(CELL_BUILD_TOOLS), SNC)
PPU_CXXLD = $(CELL_SDK)/host-win32/sn/bin/ps3ppuld.exe
PPU_CXX = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe
PPU_CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe
else ifneq($(system_platform), win)
else ifneq ($(system_platform), win)
PPU_CXX = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-g++.exe
PPU_CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe
PPU_CXXLD = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ld.exe
@ -119,7 +119,7 @@ DEFINES += -DHAVE_THREADS -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_HEADSET -DHAVE_LA
ifeq ($(DEBUG), 1)
PPU_OPTIMIZE_LV := -O0 -g
else
PPU_OPTIMIZE_LV := -O3 -g
PPU_OPTIMIZE_LV := -O2 -g
endif
ifeq ($(HAVE_LOGGER), 1)

View File

@ -528,12 +528,7 @@ STBRP_DEF void stbrp_pack_rects(stbrp_context *context, stbrp_rect *rects, int n
/* we use the 'was_packed' field internally to allow sorting/unsorting */
for (i=0; i < num_rects; ++i)
{
rects[i].was_packed = i;
#ifndef STBRP_LARGE_RECTS
STBRP_ASSERT(rects[i].w <= 0xffff && rects[i].h <= 0xffff);
#endif
}
/* sort according to heuristic */
STBRP_SORT(rects, num_rects, sizeof(rects[0]), rect_height_compare);

View File

@ -75,7 +75,7 @@ int64_t intfstream_write(intfstream_internal_t *intf,
const void *s, uint64_t len);
char *intfstream_gets(intfstream_internal_t *intf,
char *buffer, size_t len);
char *buffer, uint64_t len);
int intfstream_getc(intfstream_internal_t *intf);
@ -98,7 +98,7 @@ intfstream_t* intfstream_open_file(const char *path,
unsigned mode, unsigned hints);
intfstream_t *intfstream_open_memory(void *data,
unsigned mode, unsigned hints, size_t size);
unsigned mode, unsigned hints, uint64_t size);
intfstream_t *intfstream_open_chd_track(const char *path,
unsigned mode, unsigned hints, int32_t track);

View File

@ -393,7 +393,7 @@ int64_t filestream_read_file(const char *path, void **buf, int64_t *len)
if (content_buf_size < 0)
goto error;
content_buf = malloc((uint64_t)(content_buf_size + 1));
content_buf = malloc((size_t)(content_buf_size + 1));
if (!content_buf)
goto error;

View File

@ -43,7 +43,7 @@ struct intfstream_internal
struct
{
uint8_t *data;
unsigned size;
uint64_t size;
} buf;
memstream_t *fp;
bool writable;
@ -299,7 +299,7 @@ int64_t intfstream_write(intfstream_internal_t *intf,
}
char *intfstream_gets(intfstream_internal_t *intf,
char *buffer, size_t len)
char *buffer, uint64_t len)
{
if (!intf)
return NULL;
@ -307,9 +307,11 @@ char *intfstream_gets(intfstream_internal_t *intf,
switch (intf->type)
{
case INTFSTREAM_FILE:
return filestream_gets(intf->file.fp, buffer, len);
return filestream_gets(intf->file.fp,
buffer, (size_t)len);
case INTFSTREAM_MEMORY:
return memstream_gets(intf->memory.fp, buffer, len);
return memstream_gets(intf->memory.fp,
buffer, (size_t)len);
case INTFSTREAM_CHD:
#ifdef HAVE_CHD
return chdstream_gets(intf->chd.fp, buffer, len);
@ -428,14 +430,14 @@ error:
}
intfstream_t *intfstream_open_memory(void *data,
unsigned mode, unsigned hints, size_t size)
unsigned mode, unsigned hints, uint64_t size)
{
intfstream_info_t info;
intfstream_t *fd = NULL;
info.type = INTFSTREAM_MEMORY;
info.memory.buf.data = (uint8_t*)data;
info.memory.buf.size = (unsigned)size;
info.memory.buf.size = size;
info.memory.writable = false;
fd = (intfstream_t*)intfstream_init(&info);

View File

@ -103,7 +103,7 @@ uint64_t memstream_read(memstream_t *stream, void *data, uint64_t bytes)
if (bytes > avail)
bytes = avail;
memcpy(data, stream->buf + stream->ptr, bytes);
memcpy(data, stream->buf + stream->ptr, (size_t)bytes);
stream->ptr += bytes;
memstream_update_pos(stream);
return bytes;
@ -120,7 +120,7 @@ uint64_t memstream_write(memstream_t *stream, const void *data, uint64_t bytes)
if (bytes > avail)
bytes = avail;
memcpy(stream->buf + stream->ptr, data, bytes);
memcpy(stream->buf + stream->ptr, data, (size_t)bytes);
stream->ptr += bytes;
memstream_update_pos(stream);
return bytes;

View File

@ -359,7 +359,7 @@ static bool load_content_into_memory(
(uint8_t**)&ret_buf,
(void*)length);
content_rom_crc = encoding_crc32(0, ret_buf, *length);
content_rom_crc = encoding_crc32(0, ret_buf, (size_t)*length);
RARCH_LOG("CRC32: 0x%x .\n", (unsigned)content_rom_crc);
}

View File

@ -231,7 +231,7 @@ static bool intfstream_file_get_serial(const char *name,
if (intfstream_seek(fd, (int64_t)offset, SEEK_SET) == -1)
goto error;
data = (uint8_t*)malloc(size);
data = (uint8_t*)malloc((size_t)size);
if (intfstream_read(fd, data, size) != (int64_t) size)
{
@ -345,7 +345,7 @@ static int intfstream_get_crc(intfstream_t *fd, uint32_t *crc)
uint8_t buffer[4096];
while ((read = intfstream_read(fd, buffer, sizeof(buffer))) > 0)
acc = encoding_crc32(acc, buffer, read);
acc = encoding_crc32(acc, buffer, (size_t)read);
if (read < 0)
return 0;
@ -435,11 +435,11 @@ static int task_database_cue_get_crc(const char *name, uint32_t *crc)
return 0;
}
RARCH_LOG("CUE '%s' primary track: %s\n (%lu, %lu)\n", name, track_path, (unsigned long) offset, (unsigned long) size);
RARCH_LOG("CUE '%s' primary track: %s\n (%lu, %lu)\n",name, track_path, (unsigned long) offset, (unsigned long) size);
RARCH_LOG("%s\n", msg_hash_to_str(MSG_READING_FIRST_DATA_TRACK));
rv = intfstream_file_get_crc(track_path, offset, size, crc);
rv = intfstream_file_get_crc(track_path, offset, (size_t)size, crc);
if (rv == 1)
{
RARCH_LOG("CUE '%s' crc: %x\n", name, *crc);

View File

@ -431,7 +431,7 @@ static bool update_cand(int64_t *cand_index, int64_t *last_index,
if ((uint64_t)(*last_index - *cand_index) > *largest)
{
*largest = *last_index - *cand_index;
strlcpy(track_path, last_file, max_len);
strlcpy(track_path, last_file, (size_t)max_len);
*offset = *cand_index;
*size = *largest;
*cand_index = -1;
@ -576,7 +576,8 @@ error:
return -errno;
}
bool cue_next_file(intfstream_t *fd, const char *cue_path, char *path, size_t max_len)
bool cue_next_file(intfstream_t *fd,
const char *cue_path, char *path, uint64_t max_len)
{
bool rv = false;
char *tmp_token = (char*)malloc(MAX_TOKEN_LEN);
@ -592,7 +593,7 @@ bool cue_next_file(intfstream_t *fd, const char *cue_path, char *path, size_t ma
if (string_is_equal(tmp_token, "FILE"))
{
get_token(fd, tmp_token, MAX_TOKEN_LEN);
fill_pathname_join(path, cue_dir, tmp_token, max_len);
fill_pathname_join(path, cue_dir, tmp_token, (size_t)max_len);
rv = true;
break;
}
@ -694,9 +695,11 @@ int gdi_find_track(const char *gdi_path, bool first,
if ((uint64_t)file_size > largest)
{
strlcpy(track_path, last_file, max_len);
rv = 0;
strlcpy(track_path, last_file, (size_t)max_len);
rv = 0;
largest = file_size;
if (first)
{
free(gdi_dir);
@ -767,7 +770,7 @@ bool gdi_next_file(intfstream_t *fd, const char *gdi_path,
fill_pathname_basedir(gdi_dir, gdi_path, PATH_MAX_LENGTH);
fill_pathname_join(path, gdi_dir, tmp_token, max_len);
fill_pathname_join(path, gdi_dir, tmp_token, (size_t)max_len);
rv = true;
/* Disc offset */

View File

@ -93,8 +93,8 @@ struct ups_data
unsigned target_checksum;
};
typedef enum patch_error (*patch_func_t)(const uint8_t*, size_t,
const uint8_t*, size_t, uint8_t*, size_t*);
typedef enum patch_error (*patch_func_t)(const uint8_t*, uint64_t,
const uint8_t*, uint64_t, uint8_t*, uint64_t*);
static uint8_t bps_read(struct bps_data *bps)
{
@ -128,9 +128,9 @@ static void bps_write(struct bps_data *bps, uint8_t data)
}
static enum patch_error bps_apply_patch(
const uint8_t *modify_data, size_t modify_length,
const uint8_t *source_data, size_t source_length,
uint8_t *target_data, size_t *target_length)
const uint8_t *modify_data, uint64_t modify_length,
const uint8_t *source_data, uint64_t source_length,
uint8_t *target_data, uint64_t *target_length)
{
size_t i;
uint32_t checksum;
@ -309,9 +309,9 @@ static uint64_t ups_decode(struct ups_data *data)
}
static enum patch_error ups_apply_patch(
const uint8_t *patchdata, size_t patchlength,
const uint8_t *sourcedata, size_t sourcelength,
uint8_t *targetdata, size_t *targetlength)
const uint8_t *patchdata, uint64_t patchlength,
const uint8_t *sourcedata, uint64_t sourcelength,
uint8_t *targetdata, uint64_t *targetlength)
{
size_t i;
struct ups_data data;
@ -417,9 +417,9 @@ static enum patch_error ups_apply_patch(
}
static enum patch_error ips_apply_patch(
const uint8_t *patchdata, size_t patchlen,
const uint8_t *sourcedata, size_t sourcelength,
uint8_t *targetdata, size_t *targetlength)
const uint8_t *patchdata, uint64_t patchlen,
const uint8_t *sourcedata, uint64_t sourcelength,
uint8_t *targetdata, uint64_t *targetlength)
{
uint32_t offset = 5;
@ -431,7 +431,7 @@ static enum patch_error ips_apply_patch(
patchdata[4] != 'H')
return PATCH_PATCH_INVALID;
memcpy(targetdata, sourcedata, sourcelength);
memcpy(targetdata, sourcedata, (size_t)sourcelength);
*targetlength = sourcelength;
@ -501,13 +501,13 @@ static enum patch_error ips_apply_patch(
static bool apply_patch_content(uint8_t **buf,
ssize_t *size, const char *patch_desc, const char *patch_path,
patch_func_t func, void *patch_data, ssize_t patch_size)
patch_func_t func, void *patch_data, int64_t patch_size)
{
enum patch_error err = PATCH_UNKNOWN;
ssize_t ret_size = *size;
uint8_t *ret_buf = *buf;
size_t target_size = ret_size * 4; /* Just to be sure. */
uint8_t *patched_content = (uint8_t*)malloc(target_size);
uint64_t target_size = ret_size * 4; /* Just to be sure. */
uint8_t *patched_content = (uint8_t*)malloc((size_t)target_size);
RARCH_LOG("Found %s file in \"%s\", attempting to patch ...\n",
patch_desc, patch_path);

View File

@ -1370,7 +1370,7 @@ bool content_load_ram_file(unsigned slot)
(unsigned)mem_info.size);
rc = mem_info.size;
}
memcpy(mem_info.data, buf, rc);
memcpy(mem_info.data, buf, (size_t)rc);
}
if (buf)