diff --git a/src/meta/ea_eaac.c b/src/meta/ea_eaac.c index 60c07130..a73f5b03 100644 --- a/src/meta/ea_eaac.c +++ b/src/meta/ea_eaac.c @@ -573,7 +573,7 @@ static STREAMFILE *open_mapfile_pair(STREAMFILE *streamFile, int track, int num_ for (i = 0; i < pair_count; i++) { const char *map_name = mapfile_pairs[i][0]; const char *mus_name = mapfile_pairs[i][1]; - char buf[PATH_LIMIT]; + char buf[PATH_LIMIT] = {0}; char *pch; map_len = strlen(map_name); @@ -583,8 +583,8 @@ static STREAMFILE *open_mapfile_pair(STREAMFILE *streamFile, int track, int num_ if (strncasecmp(file_name + (file_len - map_len), map_name, map_len) != 0) continue; - strncpy(buf, mus_name, PATH_LIMIT); - pch = strtok(buf, ","); + strncpy(buf, mus_name, map_len); + pch = strtok(buf, ","); //TODO: not thread safe in std C for (j = 0; j < track && pch; j++) { pch = strtok(NULL, ","); } @@ -603,11 +603,13 @@ static STREAMFILE *open_mapfile_pair(STREAMFILE *streamFile, int track, int num_ /* hack when when multiple maps point to the same mus, uses name before "+" * ex. ZZZTR00A.TRJ+ZTR00PGR.MAP or ZZZTR00A.TRJ+ZTR00R0A.MAP both point to ZZZTR00A.TRJ */ - char *mod_name = strchr(file_name, '+'); - if (mod_name) { - mod_name[0] = '\0'; - musFile = open_streamfile_by_filename(streamFile, file_name); - if (musFile) return musFile; + { + char *mod_name = strchr(file_name, '+'); + if (mod_name) { + mod_name[0] = '\0'; + musFile = open_streamfile_by_filename(streamFile, file_name); + if (musFile) return musFile; + } } VGM_LOG("No MPF/MUS pair specified for %s.\n", file_name); @@ -616,14 +618,14 @@ static STREAMFILE *open_mapfile_pair(STREAMFILE *streamFile, int track, int num_ /* EA MPF/MUS combo - used in older 7th gen games for storing interactive music */ VGMSTREAM * init_vgmstream_ea_mpf_mus_eaac(STREAMFILE *streamFile) { - uint32_t num_tracks, track_start, track_hash, mus_sounds, mus_stream; + uint32_t num_tracks, track_start, track_hash, mus_sounds, mus_stream = 0; uint8_t version, sub_version, block_id; off_t tracks_table, samples_table, eof_offset, table_offset, entry_offset, snr_offset, sns_offset; int32_t(*read_32bit)(off_t, STREAMFILE*); STREAMFILE *musFile = NULL; VGMSTREAM *vgmstream = NULL; int i; - int target_stream = streamFile->stream_index, total_streams, is_ram; + int target_stream = streamFile->stream_index, total_streams, is_ram = 0; /* check extension */ if (!check_extensions(streamFile, "mpf")) @@ -715,7 +717,7 @@ VGMSTREAM * init_vgmstream_ea_mpf_mus_eaac(STREAMFILE *streamFile) { if (is_ram) { /* not seen so far */ - VGM_ASSERT("Found RAM SNR in MPF v5.3.\n"); + VGM_LOG("Found RAM SNR in MPF v5.3.\n"); goto fail; } diff --git a/src/meta/ea_schl.c b/src/meta/ea_schl.c index c92f200c..297273f2 100644 --- a/src/meta/ea_schl.c +++ b/src/meta/ea_schl.c @@ -663,7 +663,7 @@ static STREAMFILE* open_mapfile_pair(STREAMFILE *streamFile, int track, int num_ for (i = 0; i < pair_count; i++) { const char *map_name = mapfile_pairs[i][0]; const char *mus_name = mapfile_pairs[i][1]; - char buf[PATH_LIMIT]; + char buf[PATH_LIMIT] = {0}; char *pch; map_len = strlen(map_name); @@ -673,8 +673,8 @@ static STREAMFILE* open_mapfile_pair(STREAMFILE *streamFile, int track, int num_ if (strncasecmp(file_name + (file_len - map_len), map_name, map_len) != 0) continue; - strncpy(buf, mus_name, PATH_LIMIT); - pch = strtok(buf, ","); + strncpy(buf, mus_name, map_len); + pch = strtok(buf, ","); //TODO: not thread safe in std C for (j = 0; j < track && pch; j++) { pch = strtok(NULL, ","); } @@ -694,12 +694,14 @@ static STREAMFILE* open_mapfile_pair(STREAMFILE *streamFile, int track, int num_ /* hack when when multiple maps point to the same mus, uses name before "+" * ex. ZZZTR00A.TRJ+ZTR00PGR.MAP or ZZZTR00A.TRJ+ZTR00R0A.MAP both point to ZZZTR00A.TRJ * [Need for Speed II (PS1), Need for Speed III (PS1)] */ - char *mod_name = strchr(file_name, '+'); - if (mod_name) { - mod_name[0] = '\0'; - musFile = open_streamfile_by_filename(streamFile, file_name); - if (musFile) return musFile; + char *mod_name = strchr(file_name, '+'); + if (mod_name) + { + mod_name[0] = '\0'; + musFile = open_streamfile_by_filename(streamFile, file_name); + if (musFile) return musFile; + } } VGM_LOG("No MPF/MUS pair specified for %s.\n", file_name); @@ -773,7 +775,7 @@ fail: /* EA MPF/MUS combo - used in 6th gen games for interactive music (for EA's PathFinder tool) */ VGMSTREAM * init_vgmstream_ea_mpf_mus(STREAMFILE *streamFile) { off_t tracks_table, samples_table, section_offset, entry_offset, eof_offset, off_mult, sound_offset; - uint32_t track_start, track_hash; + uint32_t track_start, track_hash = 0; uint16_t num_nodes; uint8_t version, sub_version, num_tracks, num_sections, num_events, num_routers, num_vars, subentry_num; int32_t(*read_32bit)(off_t, STREAMFILE*); @@ -781,7 +783,7 @@ VGMSTREAM * init_vgmstream_ea_mpf_mus(STREAMFILE *streamFile) { STREAMFILE *musFile = NULL; VGMSTREAM *vgmstream = NULL; int i; - int target_stream = streamFile->stream_index, total_streams, big_endian, is_bnk; + int target_stream = streamFile->stream_index, total_streams, big_endian, is_bnk = 0; /* check extension */ if (!check_extensions(streamFile, "mpf")) diff --git a/src/meta/xwb_xsb.h b/src/meta/xwb_xsb.h index 91e4394e..c4f56cd1 100644 --- a/src/meta/xwb_xsb.h +++ b/src/meta/xwb_xsb.h @@ -258,7 +258,7 @@ fail: static int parse_xsb_old_cues(xsb_header *xsb, STREAMFILE *sf) { int32_t (*read_s32)(off_t,STREAMFILE*) = xsb->big_endian ? read_s32be : read_s32le; int16_t (*read_s16)(off_t,STREAMFILE*) = xsb->big_endian ? read_s16be : read_s16le; - uint16_t flags; + //uint16_t flags; int cue_entry; off_t offset, name_offset, jump_offset; int i, j, table_count; @@ -270,7 +270,7 @@ static int parse_xsb_old_cues(xsb_header *xsb, STREAMFILE *sf) { for (i = 0; i < xsb->simple_cues_count; i++) { /*** cue index ***/ - flags = read_s16(offset + 0x00, sf); /* 0 is normal, 2 exists and 8 often goes with -1 (random) entry */ + //flags = read_s16(offset + 0x00, sf); /* 0 is normal, 2 exists and 8 often goes with -1 (random) entry */ cue_entry = read_s16(offset + 0x02, sf); name_offset = read_s32(offset + 0x04, sf); /* 0x08: table offset, or -1 */