From 2f0aaaf4fd60f1963304cc7982543fc4fca94d24 Mon Sep 17 00:00:00 2001 From: bnnm Date: Mon, 20 Aug 2018 20:05:44 +0200 Subject: [PATCH] Fix some compile ifdefs and warnings --- src/meta/atsl.c | 2 ++ src/meta/bnk_sony.c | 2 +- src/meta/mus_acm.c | 2 ++ src/meta/txth.c | 2 +- src/meta/txtp.c | 2 +- src/meta/wave_segmented.c | 2 ++ src/vgmstream.c | 2 +- xmplay/xmp_vgmstream.c | 24 ++++++++++++------------ 8 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/meta/atsl.c b/src/meta/atsl.c index bb19f62f..7ec19024 100644 --- a/src/meta/atsl.c +++ b/src/meta/atsl.c @@ -120,10 +120,12 @@ VGMSTREAM * init_vgmstream_atsl(STREAMFILE *streamFile) { vgmstream = init_vgmstream_riff(temp_streamFile); if (!vgmstream) goto fail; break; +#ifdef VGM_USE_VORBIS case KOVS: vgmstream = init_vgmstream_ogg_vorbis(temp_streamFile); if (!vgmstream) goto fail; break; +#endif case KTSS: vgmstream = init_vgmstream_ktss(temp_streamFile); if (!vgmstream) goto fail; diff --git a/src/meta/bnk_sony.c b/src/meta/bnk_sony.c index 51da0c0f..2e5b1ed0 100644 --- a/src/meta/bnk_sony.c +++ b/src/meta/bnk_sony.c @@ -8,7 +8,7 @@ VGMSTREAM * init_vgmstream_bnk_sony(STREAMFILE *streamFile) { off_t start_offset, stream_offset, name_offset = 0; size_t stream_size; off_t sblk_offset, data_offset; - int channel_count, loop_flag, sample_rate, codec; + int channel_count = 0, loop_flag, sample_rate, codec; int version; uint32_t atrac9_info = 0; int loop_start = 0, loop_length = 0; diff --git a/src/meta/mus_acm.c b/src/meta/mus_acm.c index 84cfc4e2..56b9e69c 100644 --- a/src/meta/mus_acm.c +++ b/src/meta/mus_acm.c @@ -50,9 +50,11 @@ VGMSTREAM * init_vgmstream_mus_acm(STREAMFILE *streamFile) { case 0x97280301: /* ACM header id [Planescape: Torment (PC)] */ data->segments[i] = init_vgmstream_acm(temp_streamFile); break; +#ifdef VGM_USE_VORBIS case 0x4F676753: /* "OggS" [Planescape: Torment Enhanced Edition (PC)] */ data->segments[i] = init_vgmstream_ogg_vorbis(temp_streamFile); break; +#endif default: data->segments[i] = NULL; break; diff --git a/src/meta/txth.c b/src/meta/txth.c index f3e2252b..c0bff483 100644 --- a/src/meta/txth.c +++ b/src/meta/txth.c @@ -430,7 +430,7 @@ static int parse_txth(STREAMFILE * streamFile, STREAMFILE * streamText, txth_hea txth->data_size = get_streamfile_size(streamFile); /* for later use */ /* skip BOM if needed */ - if (read_16bitLE(0x00, streamText) == 0xFFFE || read_16bitLE(0x00, streamText) == 0xFEFF) + if ((uint16_t)read_16bitLE(0x00, streamText) == 0xFFFE || (uint16_t)read_16bitLE(0x00, streamText) == 0xFEFF) txt_offset = 0x02; /* read lines */ diff --git a/src/meta/txtp.c b/src/meta/txtp.c index 995bedf6..a735f375 100644 --- a/src/meta/txtp.c +++ b/src/meta/txtp.c @@ -422,7 +422,7 @@ static txtp_header* parse_txtp(STREAMFILE* streamFile) { /* skip BOM if needed */ - if (read_16bitLE(0x00, streamFile) == 0xFFFE || read_16bitLE(0x00, streamFile) == 0xFEFF) + if ((uint16_t)read_16bitLE(0x00, streamFile) == 0xFFFE || (uint16_t)read_16bitLE(0x00, streamFile) == 0xFEFF) txt_offset = 0x02; /* read lines */ diff --git a/src/meta/wave_segmented.c b/src/meta/wave_segmented.c index a4af548c..ddb947bd 100644 --- a/src/meta/wave_segmented.c +++ b/src/meta/wave_segmented.c @@ -134,6 +134,7 @@ VGMSTREAM * init_vgmstream_wave_segmented(STREAMFILE *streamFile) { break; } +#ifdef VGM_USE_VORBIS case 0x04: { /* "vorbis" */ ogg_vorbis_meta_info_t ovmi = {0}; @@ -153,6 +154,7 @@ VGMSTREAM * init_vgmstream_wave_segmented(STREAMFILE *streamFile) { break; } +#endif default: /* others: s16be/s16le/mp3 as referenced in the exe? */ VGM_LOG("WAVE: unknown codec\n"); diff --git a/src/vgmstream.c b/src/vgmstream.c index 139829ae..376a219b 100644 --- a/src/vgmstream.c +++ b/src/vgmstream.c @@ -2690,7 +2690,7 @@ int get_vgmstream_average_bitrate(VGMSTREAM * vgmstream) { * Should be called in metas before returning the VGMSTREAM. */ int vgmstream_open_stream(VGMSTREAM * vgmstream, STREAMFILE *streamFile, off_t start_offset) { - STREAMFILE * file; + STREAMFILE * file = NULL; char filename[PATH_LIMIT]; int ch; int use_streamfile_per_channel = 0; diff --git a/xmplay/xmp_vgmstream.c b/xmplay/xmp_vgmstream.c index eb26f6ce..3d0a48e8 100644 --- a/xmplay/xmp_vgmstream.c +++ b/xmplay/xmp_vgmstream.c @@ -331,20 +331,20 @@ char * WINAPI xmplay_GetTags() { void WINAPI xmplay_GetInfoText(char* format, char* length) { if (!format) return; - if (!vgmstream) - return; + if (!vgmstream) + return; - int rate = vgmstream->sample_rate; - int samples = vgmstream->num_samples; - int bps = get_vgmstream_average_bitrate(vgmstream) / 1000; - char* fmt = get_vgmstream_coding_description(vgmstream->coding_type); - - int t = samples / rate; - int tmin = t / 60; - int tsec = t % 60; + int rate = vgmstream->sample_rate; + int samples = vgmstream->num_samples; + int bps = get_vgmstream_average_bitrate(vgmstream) / 1000; + const char* fmt = get_vgmstream_coding_description(vgmstream->coding_type); - sprintf(format, "%s", fmt); - sprintf(length, "%d:%02d - %dKb/s - %dHz", tmin, tsec, bps, rate); + int t = samples / rate; + int tmin = t / 60; + int tsec = t % 60; + + sprintf(format, "%s", fmt); + sprintf(length, "%d:%02d - %dKb/s - %dHz", tmin, tsec, bps, rate); } /* info for the "General" window/tab (buf is ~40K) */