Fix some 'implicit conversion loses precision' warnings

This commit is contained in:
LibretroAdmin 2022-09-01 15:15:48 +02:00
parent 793370aa97
commit 003cea5d42
12 changed files with 1178 additions and 1181 deletions

View File

@ -83,7 +83,7 @@ bitmapfont_lut_t *bitmapfont_get_lut(void)
for (i = 0; i < FONT_WIDTH; i++)
{
uint8_t rem = 1 << ((i + j * FONT_WIDTH) & 7);
unsigned offset = (i + j * FONT_WIDTH) >> 3;
size_t offset = (i + j * FONT_WIDTH) >> 3;
/* LUT value is 'true' if specified glyph
* position contains a pixel */

View File

@ -178,7 +178,7 @@ bitmapfont_lut_t *bitmapfont_10x10_load(unsigned language)
for (i = 0; i < FONT_10X10_WIDTH; i++)
{
uint8_t rem = 1 << ((i + j * FONT_10X10_WIDTH) & 7);
unsigned offset = (i + j * FONT_10X10_WIDTH) >> 3;
size_t offset = (i + j * FONT_10X10_WIDTH) >> 3;
/* LUT value is 'true' if specified glyph
* position contains a pixel */

View File

@ -176,7 +176,7 @@ bitmapfont_lut_t *bitmapfont_6x10_load(unsigned language)
for (i = 0; i < FONT_6X10_WIDTH; i++)
{
uint8_t rem = 1 << ((i + j * FONT_6X10_WIDTH) & 7);
unsigned offset = (i + j * FONT_6X10_WIDTH) >> 3;
size_t offset = (i + j * FONT_6X10_WIDTH) >> 3;
/* LUT value is 'true' if specified glyph
* position contains a pixel */

View File

@ -1008,13 +1008,13 @@ void font_driver_flush(unsigned width, unsigned height, void *font_data)
}
int font_driver_get_message_width(void *font_data,
const char *msg, unsigned len, float scale)
const char *msg, size_t len, float scale)
{
font_data_t *font = (font_data_t*)(font_data ? font_data : video_font_driver);
if (len == 0 && msg)
len = (unsigned)strlen(msg);
len = strlen(msg);
if (font && font->renderer && font->renderer->get_message_width)
return font->renderer->get_message_width(font->renderer_data, msg, len, scale);
return font->renderer->get_message_width(font->renderer_data, msg, (unsigned)len, scale);
return -1;
}

View File

@ -146,7 +146,7 @@ void font_driver_render_msg(void *data,
void font_driver_bind_block(void *font_data, void *block);
int font_driver_get_message_width(void *font_data, const char *msg, unsigned len, float scale);
int font_driver_get_message_width(void *font_data, const char *msg, size_t len, float scale);
void font_driver_flush(unsigned width, unsigned height, void *font_data);

View File

@ -7850,7 +7850,7 @@ static int xmb_pointer_up(void *userdata,
* move selection pointer up by 1 'page' */
unsigned bottom_idx = (unsigned)selection + 1;
size_t new_idx = 0;
unsigned step = 0;
size_t step = 0;
/* Determine index of entry at bottom of screen
* Note: cannot use xmb_calculate_visible_range()

View File

@ -1050,7 +1050,7 @@ SKIP_EXPLORE_BY_CATEGORY:;
{
/* List all items in a selected explore by category */
explore_string_t **entries = explore_state->by[current_cat];
unsigned i_last = RBUF_LEN(entries) - 1;
size_t i_last = RBUF_LEN(entries) - 1;
for (i = 0; i <= i_last; i++)
explore_menu_entry(list, explore_state,
entries[i]->str, EXPLORE_TYPE_FIRSTITEM + i);

View File

@ -5959,7 +5959,7 @@ static int setting_string_action_left_netplay_mitm_server(
{
size_t i;
char *netplay_mitm_server;
int offset = -1;
ssize_t offset = -1;
if (!setting)
return -1;
@ -5997,7 +5997,7 @@ static int setting_string_action_right_netplay_mitm_server(
{
size_t i;
char *netplay_mitm_server;
int offset = -1;
ssize_t offset = -1;
if (!setting)
return -1;

View File

@ -7042,7 +7042,7 @@ static netplay_t *netplay_new(const char *server, const char *mitm,
{
int flen = 0;
unsigned char *buf =
unbase64(mitm_session, strlen(mitm_session), &flen);
unbase64(mitm_session, (int)strlen(mitm_session), &flen);
if (!buf)
goto failure;

View File

@ -878,7 +878,7 @@ static void content_file_get_path(
strlcat(info_path, archive_file, sizeof(info_path));
/* Update 'content' string_list */
string_list_set(content, idx, info_path);
string_list_set(content, (unsigned)idx, info_path);
content_path = content->elems[idx].data;
string_list_free(archive_list);

View File

@ -461,7 +461,7 @@ int detect_scd_game(intfstream_t *fd, char *s, size_t len, const char *filename)
char check_suffix_50[10];
char region_id;
size_t length;
int lengthref;
size_t lengthref;
int index;
char lgame_id[10];
@ -566,12 +566,11 @@ int detect_sat_game(intfstream_t *fd, char *s, size_t len, const char *filename)
#define SAT_SERIAL_OFFSET 0x0030
#define SAT_SERIAL_LEN 9
#define SAT_REGION_OFFSET 0x0050
size_t _len;
size_t _len, length;
char raw_game_id[SAT_SERIAL_LEN+1];
char region_id;
char check_suffix_5[10];
char check_suffix_50[10];
int length;
char lgame_id[10];
char rgame_id[10];
@ -935,8 +934,6 @@ int detect_system(intfstream_t *fd, const char **system_name, const char * filen
{
int i;
char magic[50];
int magic_len;
#ifdef DEBUG
RARCH_LOG("[Scanner]: %s\n", msg_hash_to_str(MSG_COMPARING_WITH_KNOWN_MAGIC_NUMBERS));
#endif
@ -944,7 +941,7 @@ int detect_system(intfstream_t *fd, const char **system_name, const char * filen
{
if (intfstream_seek(fd, MAGIC_NUMBERS[i].offset, SEEK_SET) >= 0)
{
magic_len = strlen(MAGIC_NUMBERS[i].magic);
size_t magic_len = strlen(MAGIC_NUMBERS[i].magic);
if (intfstream_read(fd, magic, magic_len) > 0)
{
magic[magic_len] = '\0';

File diff suppressed because it is too large Load Diff