mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-29 19:37:30 +01:00
Fix minor compiler warnings (missing const/static/case defaults/etc)
This commit is contained in:
parent
75b0b275f1
commit
1ff0cecca8
@ -333,8 +333,8 @@ fail:
|
||||
static size_t make_opus_comment(uint8_t * buf, int buf_size) {
|
||||
size_t comment_size;
|
||||
int vendor_string_length, user_comment_0_length;
|
||||
char * vendor_string = "vgmstream";
|
||||
char * user_comment_0_string = "vgmstream Opus converter";
|
||||
const char * vendor_string = "vgmstream";
|
||||
const char * user_comment_0_string = "vgmstream Opus converter";
|
||||
vendor_string_length = strlen(vendor_string);
|
||||
user_comment_0_length = strlen(user_comment_0_string);
|
||||
|
||||
|
@ -121,7 +121,7 @@ g72x_init_state(
|
||||
* computes the estimated signal from 6-zero predictor.
|
||||
*
|
||||
*/
|
||||
int
|
||||
static int
|
||||
predictor_zero(
|
||||
struct g72x_state *state_ptr)
|
||||
{
|
||||
@ -139,7 +139,7 @@ predictor_zero(
|
||||
* computes the estimated signal from 2-pole predictor.
|
||||
*
|
||||
*/
|
||||
int
|
||||
static int
|
||||
predictor_pole(
|
||||
struct g72x_state *state_ptr)
|
||||
{
|
||||
@ -152,7 +152,7 @@ predictor_pole(
|
||||
* computes the quantization step size of the adaptive quantizer.
|
||||
*
|
||||
*/
|
||||
int
|
||||
static int
|
||||
step_size(
|
||||
struct g72x_state *state_ptr)
|
||||
{
|
||||
@ -181,7 +181,7 @@ step_size(
|
||||
* codeword 'i' and quantization step size scale factor 'y'.
|
||||
* Multiplication is performed in log base 2 domain as addition.
|
||||
*/
|
||||
int
|
||||
static int
|
||||
reconstruct(
|
||||
int sign, /* 0 for non-negative value */
|
||||
int dqln, /* G.72x codeword */
|
||||
@ -210,7 +210,7 @@ reconstruct(
|
||||
*
|
||||
* updates the state variables for each output code
|
||||
*/
|
||||
void
|
||||
static void
|
||||
update(
|
||||
/*int code_size,*/ /* distinguish 723_40 with others */
|
||||
int y, /* quantizer step size */
|
||||
@ -427,7 +427,7 @@ static short _fitab[16] = {0, 0, 0, 0x200, 0x200, 0x200, 0x600, 0xE00,
|
||||
* returns the resulting linear PCM, A-law or u-law value.
|
||||
* return -1 for unknown out_coding value.
|
||||
*/
|
||||
int
|
||||
static int
|
||||
g721_decoder(
|
||||
int i,
|
||||
struct g72x_state *state_ptr)
|
||||
|
@ -234,6 +234,7 @@ int mpeg_get_frame_info(STREAMFILE *streamfile, off_t offset, mpeg_frame_info *
|
||||
case 384: info->frame_size = (12l * info->bit_rate * 1000l / info->sample_rate + padding) * 4; break;
|
||||
case 576: info->frame_size = (72l * info->bit_rate * 1000l / info->sample_rate + padding); break;
|
||||
case 1152: info->frame_size = (144l * info->bit_rate * 1000l / info->sample_rate + padding); break;
|
||||
default: goto fail;
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -7,13 +7,13 @@ const int SHC = 10;
|
||||
double K0[4] = { 0.0, 0.9375, 1.796875, 1.53125};
|
||||
double K1[4] = { 0.0, 0.0, -0.8125,-0.859375};
|
||||
|
||||
int IK0(int fid)
|
||||
static int IK0(int fid)
|
||||
{ return ((int)((-K0[fid]) * (1 << SHC))); }
|
||||
|
||||
int IK1(int fid)
|
||||
static int IK1(int fid)
|
||||
{ return ((int)((-K1[fid]) * (1 << SHC))); }
|
||||
|
||||
int CLAMP(int value, int Minim, int Maxim)
|
||||
static int CLAMP(int value, int Minim, int Maxim)
|
||||
{
|
||||
if (value < Minim) value = Minim;
|
||||
if (value > Maxim) value = Maxim;
|
||||
|
@ -8,7 +8,7 @@
|
||||
/* Included primarily for 3DO */
|
||||
|
||||
/* for reading integers inexplicably packed into 80 bit floats */
|
||||
uint32_t read80bitSANE(off_t offset, STREAMFILE *streamFile) {
|
||||
static uint32_t read80bitSANE(off_t offset, STREAMFILE *streamFile) {
|
||||
uint8_t buf[10];
|
||||
int32_t exponent;
|
||||
int32_t mantissa;
|
||||
@ -31,7 +31,7 @@ uint32_t read80bitSANE(off_t offset, STREAMFILE *streamFile) {
|
||||
return mantissa*((buf[0]&0x80)?-1:1);
|
||||
}
|
||||
|
||||
uint32_t find_marker(STREAMFILE *streamFile, off_t MarkerChunkOffset,
|
||||
static uint32_t find_marker(STREAMFILE *streamFile, off_t MarkerChunkOffset,
|
||||
int marker_id) {
|
||||
uint16_t marker_count;
|
||||
int i;
|
||||
|
@ -45,6 +45,9 @@ VGMSTREAM * init_vgmstream_mn_str(STREAMFILE *streamFile) {
|
||||
vgmstream->interleave_block_size = 0x800;
|
||||
vgmstream->layout_type = layout_none;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
goto fail;
|
||||
}
|
||||
|
||||
vgmstream->num_samples = read_32bitLE(0x4C,streamFile);
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#define NAME_LENGTH PATH_LIMIT
|
||||
|
||||
int exists(char *filename, STREAMFILE *streamfile) {
|
||||
static int exists(char *filename, STREAMFILE *streamfile) {
|
||||
STREAMFILE * temp =
|
||||
streamfile->open(streamfile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
if (!temp) return 0;
|
||||
@ -25,7 +25,7 @@ int exists(char *filename, STREAMFILE *streamfile) {
|
||||
}
|
||||
|
||||
/* needs the name of a file in the directory to test, as all we can do reliably is attempt to open a file */
|
||||
int find_directory_name(char *name_base, char *dir_name, int subdir_name_size, char *subdir_name, char *name, char *file_name, STREAMFILE *streamfile) {
|
||||
static int find_directory_name(char *name_base, char *dir_name, int subdir_name_size, char *subdir_name, char *name, char *file_name, STREAMFILE *streamfile) {
|
||||
/* find directory name */
|
||||
{
|
||||
char temp_dir_name[NAME_LENGTH];
|
||||
|
@ -5,13 +5,13 @@
|
||||
/* Sony PSX CD-XA */
|
||||
/* No looped file ! */
|
||||
|
||||
off_t init_xa_channel(int *channel,STREAMFILE *streamFile);
|
||||
static off_t init_xa_channel(int *channel,STREAMFILE *streamFile);
|
||||
|
||||
uint8_t AUDIO_CODING_GET_STEREO(uint8_t value) {
|
||||
static uint8_t AUDIO_CODING_GET_STEREO(uint8_t value) {
|
||||
return (uint8_t)(value & 3);
|
||||
}
|
||||
|
||||
uint8_t AUDIO_CODING_GET_FREQ(uint8_t value) {
|
||||
static uint8_t AUDIO_CODING_GET_FREQ(uint8_t value) {
|
||||
return (uint8_t)((value >> 2) & 3);
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
/* Resource Interchange File Format */
|
||||
|
||||
/* return milliseconds */
|
||||
long parse_marker(unsigned char * marker) {
|
||||
static long parse_marker(unsigned char * marker) {
|
||||
long hh,mm,ss,ms;
|
||||
if (memcmp("Marker ",marker,7)) return -1;
|
||||
|
||||
@ -18,8 +18,7 @@ long parse_marker(unsigned char * marker) {
|
||||
}
|
||||
|
||||
/* loop points have been found hiding here */
|
||||
void parse_adtl(off_t adtl_offset, off_t adtl_length, STREAMFILE *streamFile,
|
||||
long *loop_start, long *loop_end, int *loop_flag) {
|
||||
static void parse_adtl(off_t adtl_offset, off_t adtl_length, STREAMFILE *streamFile, long *loop_start, long *loop_end, int *loop_flag) {
|
||||
int loop_start_found = 0;
|
||||
int loop_end_found = 0;
|
||||
|
||||
@ -92,12 +91,7 @@ struct riff_fmt_chunk {
|
||||
int interleave;
|
||||
};
|
||||
|
||||
int read_fmt(int big_endian,
|
||||
STREAMFILE * streamFile,
|
||||
off_t current_chunk,
|
||||
struct riff_fmt_chunk * fmt,
|
||||
int sns,
|
||||
int mwv) {
|
||||
static int read_fmt(int big_endian, STREAMFILE * streamFile, off_t current_chunk, struct riff_fmt_chunk * fmt, int sns, int mwv) {
|
||||
|
||||
int codec, bps;
|
||||
int32_t (*read_32bit)(off_t,STREAMFILE*) = NULL;
|
||||
@ -404,7 +398,9 @@ VGMSTREAM * init_vgmstream_riff(STREAMFILE *streamFile) {
|
||||
* (ex. Cave PC games have PCM16LE + JUNK + smpl created by "Samplitude software") */
|
||||
if (JunkFound
|
||||
&& check_extensions(streamFile,"wav,lwav") /* for some .MED IMA */
|
||||
&& (fmt.coding_type==coding_MSADPCM || fmt.coding_type==coding_MS_IMA)) goto fail;
|
||||
&& (fmt.coding_type==coding_MSADPCM || fmt.coding_type==coding_MS_IMA))
|
||||
goto fail;
|
||||
|
||||
|
||||
switch (fmt.coding_type) {
|
||||
case coding_PCM16LE:
|
||||
@ -731,6 +727,7 @@ VGMSTREAM * init_vgmstream_rifx(STREAMFILE *streamFile) {
|
||||
break;
|
||||
case 0x4A554E4B: /* JUNK */
|
||||
JunkFound = 1;
|
||||
break;
|
||||
default:
|
||||
/* ignorance is bliss */
|
||||
break;
|
||||
|
@ -1158,6 +1158,8 @@ VGMSTREAM * init_vgmstream_rsd6xma(STREAMFILE *streamFile) {
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
default:
|
||||
goto fail;
|
||||
}
|
||||
/* open the file for reading */
|
||||
if (!vgmstream_open_stream(vgmstream, streamFile, start_offset))
|
||||
|
@ -169,7 +169,7 @@ static size_t read_stdio(STDIOSTREAMFILE *streamfile,uint8_t * dest, off_t offse
|
||||
/* request outside buffer: new fread */
|
||||
{
|
||||
size_t length_read = read_the_rest(dest,offset,length,streamfile);
|
||||
#if PROFILE_STREAMFILE
|
||||
#ifdef PROFILE_STREAMFILE
|
||||
if (length_read < length)
|
||||
streamfile->error_count++;
|
||||
#endif
|
||||
|
@ -18,6 +18,8 @@ const char * filename_extension(const char * filename) {
|
||||
return ext;
|
||||
}
|
||||
|
||||
/* unused */
|
||||
/*
|
||||
void interleave_channel(sample * outbuffer, sample * inbuffer, int32_t sample_count, int channel_count, int channel_number) {
|
||||
int32_t insample,outsample;
|
||||
|
||||
@ -30,6 +32,7 @@ void interleave_channel(sample * outbuffer, sample * inbuffer, int32_t sample_co
|
||||
outbuffer[outsample]=inbuffer[insample];
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/* failed attempt at interleave in place */
|
||||
/*
|
||||
|
@ -665,7 +665,6 @@ VGMSTREAM * allocate_vgmstream(int channel_count, int looped) {
|
||||
}
|
||||
|
||||
void close_vgmstream(VGMSTREAM * vgmstream) {
|
||||
int i,j;
|
||||
if (!vgmstream)
|
||||
return;
|
||||
|
||||
@ -841,19 +840,23 @@ void close_vgmstream(VGMSTREAM * vgmstream) {
|
||||
}
|
||||
|
||||
/* now that the special cases have had their chance, clean up the standard items */
|
||||
for (i=0;i<vgmstream->channels;i++) {
|
||||
if (vgmstream->ch[i].streamfile) {
|
||||
close_streamfile(vgmstream->ch[i].streamfile);
|
||||
/* Multiple channels might have the same streamfile. Find the others
|
||||
* that are the same as this and clear them so they won't be closed
|
||||
* again. */
|
||||
for (j=0;j<vgmstream->channels;j++) {
|
||||
if (i!=j && vgmstream->ch[j].streamfile ==
|
||||
vgmstream->ch[i].streamfile) {
|
||||
vgmstream->ch[j].streamfile = NULL;
|
||||
{
|
||||
int i,j;
|
||||
|
||||
for (i=0;i<vgmstream->channels;i++) {
|
||||
if (vgmstream->ch[i].streamfile) {
|
||||
close_streamfile(vgmstream->ch[i].streamfile);
|
||||
/* Multiple channels might have the same streamfile. Find the others
|
||||
* that are the same as this and clear them so they won't be closed
|
||||
* again. */
|
||||
for (j=0;j<vgmstream->channels;j++) {
|
||||
if (i!=j && vgmstream->ch[j].streamfile ==
|
||||
vgmstream->ch[i].streamfile) {
|
||||
vgmstream->ch[j].streamfile = NULL;
|
||||
}
|
||||
}
|
||||
vgmstream->ch[i].streamfile = NULL;
|
||||
}
|
||||
vgmstream->ch[i].streamfile = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -955,6 +958,8 @@ void render_vgmstream(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstre
|
||||
case layout_scd_int:
|
||||
render_vgmstream_scd_int(buffer,sample_count,vgmstream);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1819,6 +1824,8 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to
|
||||
chan);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ extern int optind, opterr, optopt;
|
||||
static void make_wav_header(uint8_t * buf, int32_t sample_count, int32_t sample_rate, int channels);
|
||||
static void make_smpl_chunk(uint8_t * buf, int32_t loop_start, int32_t loop_end);
|
||||
|
||||
void usage(const char * name) {
|
||||
static void usage(const char * name) {
|
||||
fprintf(stderr,"vgmstream test decoder " VERSION " " __DATE__ "\n"
|
||||
"Usage: %s [-o outfile.wav] [-l loop count]\n"
|
||||
" [-f fade time] [-d fade delay] [-ipcmxeE] infile\n"
|
||||
@ -284,7 +284,7 @@ int main(int argc, char ** argv) {
|
||||
}
|
||||
|
||||
/* signal ignore fade for get_vgmstream_play_samples */
|
||||
if (loop_count && fade_ignore) {
|
||||
if (loop_count > 0 && fade_ignore) {
|
||||
fade_seconds = -1.0;
|
||||
}
|
||||
|
||||
@ -292,7 +292,7 @@ int main(int argc, char ** argv) {
|
||||
if (!play && !adxencd && !oggenc && !batchvar) printf("samples to play: %d (%.4lf seconds)\n",len,(double)len/s->sample_rate);
|
||||
fade_samples = fade_seconds * s->sample_rate;
|
||||
|
||||
if (loop_count && fade_ignore) {
|
||||
if (loop_count > 0 && fade_ignore) {
|
||||
s->loop_target = (int)loop_count;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user