Fix some compile ifdefs and warnings

This commit is contained in:
bnnm 2018-08-20 20:05:44 +02:00
parent bb07299dae
commit 2f0aaaf4fd
8 changed files with 22 additions and 16 deletions

View File

@ -120,10 +120,12 @@ VGMSTREAM * init_vgmstream_atsl(STREAMFILE *streamFile) {
vgmstream = init_vgmstream_riff(temp_streamFile); vgmstream = init_vgmstream_riff(temp_streamFile);
if (!vgmstream) goto fail; if (!vgmstream) goto fail;
break; break;
#ifdef VGM_USE_VORBIS
case KOVS: case KOVS:
vgmstream = init_vgmstream_ogg_vorbis(temp_streamFile); vgmstream = init_vgmstream_ogg_vorbis(temp_streamFile);
if (!vgmstream) goto fail; if (!vgmstream) goto fail;
break; break;
#endif
case KTSS: case KTSS:
vgmstream = init_vgmstream_ktss(temp_streamFile); vgmstream = init_vgmstream_ktss(temp_streamFile);
if (!vgmstream) goto fail; if (!vgmstream) goto fail;

View File

@ -8,7 +8,7 @@ VGMSTREAM * init_vgmstream_bnk_sony(STREAMFILE *streamFile) {
off_t start_offset, stream_offset, name_offset = 0; off_t start_offset, stream_offset, name_offset = 0;
size_t stream_size; size_t stream_size;
off_t sblk_offset, data_offset; 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; int version;
uint32_t atrac9_info = 0; uint32_t atrac9_info = 0;
int loop_start = 0, loop_length = 0; int loop_start = 0, loop_length = 0;

View File

@ -50,9 +50,11 @@ VGMSTREAM * init_vgmstream_mus_acm(STREAMFILE *streamFile) {
case 0x97280301: /* ACM header id [Planescape: Torment (PC)] */ case 0x97280301: /* ACM header id [Planescape: Torment (PC)] */
data->segments[i] = init_vgmstream_acm(temp_streamFile); data->segments[i] = init_vgmstream_acm(temp_streamFile);
break; break;
#ifdef VGM_USE_VORBIS
case 0x4F676753: /* "OggS" [Planescape: Torment Enhanced Edition (PC)] */ case 0x4F676753: /* "OggS" [Planescape: Torment Enhanced Edition (PC)] */
data->segments[i] = init_vgmstream_ogg_vorbis(temp_streamFile); data->segments[i] = init_vgmstream_ogg_vorbis(temp_streamFile);
break; break;
#endif
default: default:
data->segments[i] = NULL; data->segments[i] = NULL;
break; break;

View File

@ -430,7 +430,7 @@ static int parse_txth(STREAMFILE * streamFile, STREAMFILE * streamText, txth_hea
txth->data_size = get_streamfile_size(streamFile); /* for later use */ txth->data_size = get_streamfile_size(streamFile); /* for later use */
/* skip BOM if needed */ /* 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; txt_offset = 0x02;
/* read lines */ /* read lines */

View File

@ -422,7 +422,7 @@ static txtp_header* parse_txtp(STREAMFILE* streamFile) {
/* skip BOM if needed */ /* 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; txt_offset = 0x02;
/* read lines */ /* read lines */

View File

@ -134,6 +134,7 @@ VGMSTREAM * init_vgmstream_wave_segmented(STREAMFILE *streamFile) {
break; break;
} }
#ifdef VGM_USE_VORBIS
case 0x04: { /* "vorbis" */ case 0x04: { /* "vorbis" */
ogg_vorbis_meta_info_t ovmi = {0}; ogg_vorbis_meta_info_t ovmi = {0};
@ -153,6 +154,7 @@ VGMSTREAM * init_vgmstream_wave_segmented(STREAMFILE *streamFile) {
break; break;
} }
#endif
default: /* others: s16be/s16le/mp3 as referenced in the exe? */ default: /* others: s16be/s16le/mp3 as referenced in the exe? */
VGM_LOG("WAVE: unknown codec\n"); VGM_LOG("WAVE: unknown codec\n");

View File

@ -2690,7 +2690,7 @@ int get_vgmstream_average_bitrate(VGMSTREAM * vgmstream) {
* Should be called in metas before returning the VGMSTREAM. * Should be called in metas before returning the VGMSTREAM.
*/ */
int vgmstream_open_stream(VGMSTREAM * vgmstream, STREAMFILE *streamFile, off_t start_offset) { int vgmstream_open_stream(VGMSTREAM * vgmstream, STREAMFILE *streamFile, off_t start_offset) {
STREAMFILE * file; STREAMFILE * file = NULL;
char filename[PATH_LIMIT]; char filename[PATH_LIMIT];
int ch; int ch;
int use_streamfile_per_channel = 0; int use_streamfile_per_channel = 0;

View File

@ -331,20 +331,20 @@ char * WINAPI xmplay_GetTags() {
void WINAPI xmplay_GetInfoText(char* format, char* length) { void WINAPI xmplay_GetInfoText(char* format, char* length) {
if (!format) if (!format)
return; return;
if (!vgmstream) if (!vgmstream)
return; return;
int rate = vgmstream->sample_rate; int rate = vgmstream->sample_rate;
int samples = vgmstream->num_samples; int samples = vgmstream->num_samples;
int bps = get_vgmstream_average_bitrate(vgmstream) / 1000; int bps = get_vgmstream_average_bitrate(vgmstream) / 1000;
char* fmt = get_vgmstream_coding_description(vgmstream->coding_type); const char* fmt = get_vgmstream_coding_description(vgmstream->coding_type);
int t = samples / rate;
int tmin = t / 60;
int tsec = t % 60;
sprintf(format, "%s", fmt); int t = samples / rate;
sprintf(length, "%d:%02d - %dKb/s - %dHz", tmin, tsec, bps, 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) */ /* info for the "General" window/tab (buf is ~40K) */