mirror of
https://github.com/libretro/RetroArch
synced 2025-03-30 16:20:27 +00:00
(task_database) Use size_t for size to prevent narrowing issue
This commit is contained in:
parent
ecc5c1809d
commit
a6c82df0fd
@ -251,7 +251,7 @@ static int intfstream_get_serial(intfstream_t *fd, char *serial, size_t serial_l
|
||||
}
|
||||
|
||||
static bool intfstream_file_get_serial(const char *name,
|
||||
uint64_t offset, uint64_t size, char *serial, size_t serial_len)
|
||||
uint64_t offset, size_t size, char *serial, size_t serial_len)
|
||||
{
|
||||
int rv;
|
||||
uint8_t *data = NULL;
|
||||
@ -273,12 +273,12 @@ static bool intfstream_file_get_serial(const char *name,
|
||||
if (file_size < 0)
|
||||
goto error;
|
||||
|
||||
if (offset != 0 || size < (uint64_t) file_size)
|
||||
if (offset != 0 || size < (size_t) file_size)
|
||||
{
|
||||
if (intfstream_seek(fd, (int64_t)offset, SEEK_SET) == -1)
|
||||
goto error;
|
||||
|
||||
data = (uint8_t*)malloc((size_t)size);
|
||||
data = (uint8_t*)malloc(size);
|
||||
|
||||
if (intfstream_read(fd, data, size) != (int64_t) size)
|
||||
{
|
||||
@ -312,10 +312,10 @@ error:
|
||||
static int task_database_cue_get_serial(const char *name, char* serial, size_t serial_len)
|
||||
{
|
||||
char track_path[PATH_MAX_LENGTH];
|
||||
uint64_t offset = 0;
|
||||
uint64_t size = 0;
|
||||
uint64_t offset = 0;
|
||||
size_t size = 0;
|
||||
|
||||
track_path[0] = '\0';
|
||||
track_path[0] = '\0';
|
||||
|
||||
if (cue_find_track(name, true, &offset, &size, track_path,
|
||||
sizeof(track_path)) < 0)
|
||||
@ -429,7 +429,7 @@ static int task_database_cue_get_crc(const char *name, uint32_t *crc)
|
||||
{
|
||||
char track_path[PATH_MAX_LENGTH];
|
||||
uint64_t offset = 0;
|
||||
uint64_t size = 0;
|
||||
size_t size = 0;
|
||||
|
||||
track_path[0] = '\0';
|
||||
|
||||
@ -443,7 +443,7 @@ static int task_database_cue_get_crc(const char *name, uint32_t *crc)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return intfstream_file_get_crc(track_path, offset, (size_t)size, crc);
|
||||
return intfstream_file_get_crc(track_path, offset, size, crc);
|
||||
}
|
||||
|
||||
static int task_database_gdi_get_crc(const char *name, uint32_t *crc)
|
||||
|
@ -638,7 +638,7 @@ int detect_scd_game(intfstream_t *fd, char *s, size_t len, const char *filename)
|
||||
check_suffix_50[2] = '\0';
|
||||
|
||||
/** redump serials are built differently for each prefix **/
|
||||
if ( pre_game_id[0] == 'T'
|
||||
if ( pre_game_id[0] == 'T'
|
||||
&& pre_game_id[1] == '-')
|
||||
{
|
||||
if (region_id == 'U' || region_id == 'J')
|
||||
@ -662,7 +662,7 @@ int detect_scd_game(intfstream_t *fd, char *s, size_t len, const char *filename)
|
||||
cue_append_multi_disc_suffix(s, filename);
|
||||
return true;
|
||||
}
|
||||
else if (pre_game_id[0] == 'G'
|
||||
else if (pre_game_id[0] == 'G'
|
||||
&& pre_game_id[1] == '-')
|
||||
{
|
||||
if ((index = string_index_last_occurance(pre_game_id, '-')) == -1)
|
||||
@ -823,7 +823,7 @@ int detect_dc_game(intfstream_t *fd, char *s, size_t len, const char *filename)
|
||||
raw_game_id[10] = '\0';
|
||||
|
||||
/** Scrub files with bad data and log **/
|
||||
if ( raw_game_id[0] == '\0'
|
||||
if ( raw_game_id[0] == '\0'
|
||||
|| raw_game_id[0] == ' ')
|
||||
{
|
||||
#ifdef DEBUG
|
||||
@ -1016,7 +1016,7 @@ int detect_wii_game(intfstream_t *fd, char *s, size_t len, const char *filename)
|
||||
raw_game_id[6] = '\0';
|
||||
|
||||
/** Scrub files with bad data and log **/
|
||||
if ( raw_game_id[0] == '\0'
|
||||
if ( raw_game_id[0] == '\0'
|
||||
|| raw_game_id[0] == ' ')
|
||||
{
|
||||
#ifdef DEBUG
|
||||
@ -1132,7 +1132,7 @@ static int64_t intfstream_get_file_size(const char *path)
|
||||
|
||||
static bool update_cand(int64_t *cand_index, int64_t *last_index,
|
||||
uint64_t *largest, char *last_file, uint64_t *offset,
|
||||
uint64_t *size, char *track_path, uint64_t max_len)
|
||||
size_t *size, char *track_path, uint64_t max_len)
|
||||
{
|
||||
if (*cand_index != -1)
|
||||
{
|
||||
@ -1141,7 +1141,7 @@ static bool update_cand(int64_t *cand_index, int64_t *last_index,
|
||||
*largest = *last_index - *cand_index;
|
||||
strlcpy(track_path, last_file, (size_t)max_len);
|
||||
*offset = *cand_index;
|
||||
*size = *largest;
|
||||
*size = (size_t)*largest;
|
||||
*cand_index = -1;
|
||||
return true;
|
||||
}
|
||||
@ -1151,7 +1151,7 @@ static bool update_cand(int64_t *cand_index, int64_t *last_index,
|
||||
}
|
||||
|
||||
int cue_find_track(const char *cue_path, bool first,
|
||||
uint64_t *offset, uint64_t *size, char *track_path, uint64_t max_len)
|
||||
uint64_t *offset, size_t *size, char *track_path, uint64_t max_len)
|
||||
{
|
||||
int rv;
|
||||
intfstream_info_t info;
|
||||
|
@ -45,7 +45,7 @@ int detect_wii_game(intfstream_t *fd, char *s, size_t len,
|
||||
int detect_system(intfstream_t *fd, const char **system_name,
|
||||
const char * filename);
|
||||
int cue_find_track(const char *cue_path, bool first, uint64_t *offset,
|
||||
uint64_t *size, char *track_path, uint64_t max_len);
|
||||
size_t *size, char *track_path, uint64_t max_len);
|
||||
bool cue_next_file(intfstream_t *fd, const char *cue_path,
|
||||
char *s, uint64_t len);
|
||||
int gdi_find_track(const char *gdi_path, bool first, char *track_path,
|
||||
|
Loading…
x
Reference in New Issue
Block a user