diff --git a/libretro-common/formats/cdfs/cdfs.c b/libretro-common/formats/cdfs/cdfs.c index 14223a8540..3206ae245a 100644 --- a/libretro-common/formats/cdfs/cdfs.c +++ b/libretro-common/formats/cdfs/cdfs.c @@ -418,7 +418,7 @@ static cdfs_track_t* cdfs_open_cue_track( const char *track = line + 5; cdfs_skip_spaces(&track); - sscanf(track, "%d", &track_number); + sscanf(track, "%d", (int*)&track_number); while (*track && *track != ' ' && *track != '\n') ++track; diff --git a/libretro-common/media/media_detect_cd.c b/libretro-common/media/media_detect_cd.c index 072822c66c..9014d7f64b 100644 --- a/libretro-common/media/media_detect_cd.c +++ b/libretro-common/media/media_detect_cd.c @@ -85,8 +85,10 @@ bool media_detect_cd_info_cue(const char *path, media_detect_cd_info_t *info) if (!file) { +#ifdef MEDIA_CUE_PARSE_DEBUG printf("[MEDIA] Could not open cue path for reading: %s\n", path); fflush(stdout); +#endif return false; } @@ -148,7 +150,7 @@ bool media_detect_cd_info_cue(const char *path, media_detect_cd_info_t *info) if (!string_is_empty(track)) { unsigned track_number = 0; - sscanf(track, "%d", &track_number); + sscanf(track, "%d", (int*)&track_number); #ifdef MEDIA_CUE_PARSE_DEBUG printf("Found track: %d\n", track_number); fflush(stdout); @@ -184,7 +186,7 @@ bool media_detect_cd_info_cue(const char *path, media_detect_cd_info_t *info) if (!string_is_empty(index)) { unsigned index_number = 0; - sscanf(index, "%d", &index_number); + sscanf(index, "%d", (int*)&index_number); if (index_number == 1) { @@ -206,7 +208,7 @@ bool media_detect_cd_info_cue(const char *path, media_detect_cd_info_t *info) if (strlen(track_mode) == 10) { - sscanf(track_mode, "MODE%d/%d", &track_mode_number, &track_sector_size); + sscanf(track_mode, "MODE%d/%d", (int*)&track_mode_number, (int*)&track_sector_size); #ifdef MEDIA_CUE_PARSE_DEBUG printf("Found track mode %d with sector size %d\n", track_mode_number, track_sector_size); fflush(stdout); @@ -216,7 +218,7 @@ bool media_detect_cd_info_cue(const char *path, media_detect_cd_info_t *info) unsigned min = 0; unsigned sec = 0; unsigned frame = 0; - sscanf(pregap, "%02d:%02d:%02d", &min, &sec, &frame); + sscanf(pregap, "%02d:%02d:%02d", (int*)&min, (int*)&sec, (int*)&frame); if (min || sec || frame || strstr(pregap, "00:00:00")) { @@ -244,18 +246,20 @@ bool media_detect_cd_info_cue(const char *path, media_detect_cd_info_t *info) { if (strstr(track_path, "/") || strstr(track_path, "\\")) { +#ifdef MEDIA_CUE_PARSE_DEBUG printf("using path %s\n", track_path); fflush(stdout); +#endif return media_detect_cd_info(track_path, data_track_pregap_bytes, info); } - else - { - fill_pathname_basedir(track_abs_path, path, sizeof(track_abs_path)); - strlcat(track_abs_path, track_path, sizeof(track_abs_path)); - printf("using abs path %s\n", track_abs_path); - fflush(stdout); - return media_detect_cd_info(track_abs_path, data_track_pregap_bytes, info); - } + + fill_pathname_basedir(track_abs_path, path, sizeof(track_abs_path)); + strlcat(track_abs_path, track_path, sizeof(track_abs_path)); +#ifdef MEDIA_CUE_PARSE_DEBUG + printf("using abs path %s\n", track_abs_path); + fflush(stdout); +#endif + return media_detect_cd_info(track_abs_path, data_track_pregap_bytes, info); } return true; @@ -273,8 +277,10 @@ bool media_detect_cd_info(const char *path, uint64_t pregap_bytes, media_detect_ if (!file) { +#ifdef MEDIA_CUE_PARSE_DEBUG printf("[MEDIA] Could not open path for reading: %s\n", path); fflush(stdout); +#endif return false; } @@ -295,8 +301,10 @@ bool media_detect_cd_info(const char *path, uint64_t pregap_bytes, media_detect_ if (read_bytes != buf_size) { +#ifdef MEDIA_CUE_PARSE_DEBUG printf("[MEDIA] Could not read from media: got %" PRId64 " bytes instead of %d.\n", read_bytes, buf_size); fflush(stdout); +#endif filestream_close(file); free(buf); return false;