From: Takashi Iwai Date: Mon, 21 Nov 2005 10:48:52 +0000 (+0000) Subject: Fix compile errors/warnings X-Git-Tag: v1.0.11rc1~19 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=84ebfe7c9242288687d8f7c4a6aaa5d9a8a63b9e;p=alsa-lib.git Fix compile errors/warnings Fix compile errors/warnings. omixer is removed since ordinary_mixer isn't supported any more. --- diff --git a/test/Makefile.am b/test/Makefile.am index d6cfb94e..8ed1f0f0 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,6 +1,6 @@ check_PROGRAMS=control pcm latency seq \ playmidi1 timer rawmidi midiloop \ - omixer code oldapi queue_timer + code oldapi queue_timer control_LDADD=../src/libasound.la pcm_LDADD=../src/libasound.la @@ -10,7 +10,6 @@ playmidi1_LDADD=../src/libasound.la timer_LDADD=../src/libasound.la rawmidi_LDADD=../src/libasound.la midiloop_LDADD=../src/libasound.la -omixer_LDADD=../src/libasound.la oldapi_LDADD=../src/libasound.la queue_timer_LDADD=../src/libasound.la code_CFLAGS=-Wall -pipe -g -O2 diff --git a/test/code.c b/test/code.c index 2f460a48..e2032de5 100644 --- a/test/code.c +++ b/test/code.c @@ -94,10 +94,12 @@ void mix_areas_srv(unsigned int size, volatile s32 *sum, unsigned int src_step, unsigned int sum_step) { + src_step /= sizeof(*src); + sum_step /= sizeof(*sum); while (size-- > 0) { atomic_add(sum, *src); - ((char*)src) += src_step; - ((char*)sum) += sum_step; + src += src_step; + sum += sum_step; } } @@ -105,6 +107,8 @@ void saturate(unsigned int size, s16 *dst, const s32 *sum, unsigned int dst_step, unsigned int sum_step) { + dst_step /= sizeof(*dst); + sum_step /= sizeof(*sum); while (size-- > 0) { s32 sample = *sum; if (unlikely(sample < -0x8000)) @@ -113,8 +117,8 @@ void saturate(unsigned int size, *dst = 0x7fff; else *dst = sample; - ((char*)dst) += dst_step; - ((char*)sum) += sum_step; + dst += dst_step; + sum += sum_step; } } @@ -125,6 +129,9 @@ void mix_areas0(unsigned int size, unsigned int src_step, unsigned int sum_step) { + dst_step /= sizeof(*dst); + src_step /= sizeof(*src); + sum_step /= sizeof(*sum); while (size-- > 0) { s32 sample = *dst + *src; if (unlikely(sample < -0x8000)) @@ -133,9 +140,9 @@ void mix_areas0(unsigned int size, *dst = 0x7fff; else *dst = sample; - ((char *)dst) += dst_step; - ((char *)src) += src_step; - ((char *)sum) += sum_step; + dst += dst_step; + src += src_step; + sum += sum_step; } } @@ -151,6 +158,8 @@ void mix_areas2(unsigned int size, unsigned int dst_step, unsigned int src_step) { + dst_step /= sizeof(*dst); + src_step /= sizeof(*src); while (size-- > 0) { s32 sample = *src; s32 old_sample = *sum; @@ -167,8 +176,8 @@ void mix_areas2(unsigned int size, *dst = sample; } while (unlikely(sample != *sum)); sum++; - ((char *)dst) += dst_step; - ((char *)src) += src_step; + dst += dst_step; + src += src_step; } } diff --git a/test/latency.c b/test/latency.c index a135da87..ab2efb2b 100644 --- a/test/latency.c +++ b/test/latency.c @@ -155,9 +155,9 @@ int setparams_set(snd_pcm_t *handle, } tick_time_ok = 0; if (tick_time > 0) { - int time, ttime; + unsigned int time, ttime; snd_pcm_hw_params_get_period_time(params, &time, NULL); - snd_pcm_hw_params_get_tick_time(params, &ttime, NULL); + snd_pcm_hw_params_get_tick_time(params, &ttime, NULL); if (time < ttime) { printf("Skipping to set minimal sleep: period time < tick time\n"); } else if (ttime <= 0) { @@ -476,7 +476,7 @@ void help(void) "-e,--effect apply an effect (bandpass filter sweep)\n" ); printf("Recognized sample formats are:"); - for (k = 0; k < SND_PCM_FORMAT_LAST; ++(unsigned long) k) { + for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) { const char *s = snd_pcm_format_name(k); if (s) printf(" %s", s); diff --git a/test/midifile.c b/test/midifile.c index 1858777b..8d6ba902 100644 --- a/test/midifile.c +++ b/test/midifile.c @@ -979,7 +979,7 @@ mf_write_midi_event (delta_time, type, chan, data, size) WriteVarLen (size); /* write out the data bytes */ - for (i = 0; i < size; i++) + for (i = 0; i < (int)size; i++) eputc (data[i]); return (size); @@ -1018,7 +1018,7 @@ mf_write_meta_event (delta_time, type, data, size) /* The length of the data bytes to follow */ WriteVarLen (size); - for (i = 0; i < size; i++) + for (i = 0; i < (int)size; i++) { if (eputc (data[i]) != data[i]) return (-1); diff --git a/test/oldapi.c b/test/oldapi.c index 04fe09ae..d4eb6950 100644 --- a/test/oldapi.c +++ b/test/oldapi.c @@ -33,7 +33,7 @@ typedef void (myfcn)(void *); -int main(int argc, char *argv[]) +int main(int argc ATTRIBUTE_UNUSED, char *argv[] ATTRIBUTE_UNUSED) { myfcn *fcn; snd_pcm_hw_params_get_access(NULL); diff --git a/test/pcm.c b/test/pcm.c index 95e27bf4..17d0034f 100644 --- a/test/pcm.c +++ b/test/pcm.c @@ -12,19 +12,19 @@ #include #include -char *device = "plughw:0,0"; /* playback device */ -snd_pcm_format_t format = SND_PCM_FORMAT_S16; /* sample format */ -unsigned int rate = 44100; /* stream rate */ -unsigned int channels = 1; /* count of channels */ -unsigned int buffer_time = 500000; /* ring buffer length in us */ -unsigned int period_time = 100000; /* period time in us */ -double freq = 440; /* sinusoidal wave frequency in Hz */ -int verbose = 0; /* verbose flag */ -int resample = 1; /* enable alsa-lib resampling */ - -snd_pcm_sframes_t buffer_size; -snd_pcm_sframes_t period_size; -snd_output_t *output = NULL; +static char *device = "plughw:0,0"; /* playback device */ +static snd_pcm_format_t format = SND_PCM_FORMAT_S16; /* sample format */ +static unsigned int rate = 44100; /* stream rate */ +static unsigned int channels = 1; /* count of channels */ +static unsigned int buffer_time = 500000; /* ring buffer length in us */ +static unsigned int period_time = 100000; /* period time in us */ +static double freq = 440; /* sinusoidal wave frequency in Hz */ +static int verbose = 0; /* verbose flag */ +static int resample = 1; /* enable alsa-lib resampling */ + +static snd_pcm_sframes_t buffer_size; +static snd_pcm_sframes_t period_size; +static snd_output_t *output = NULL; static void generate_sine(const snd_pcm_channel_area_t *areas, snd_pcm_uframes_t offset, @@ -61,7 +61,7 @@ static void generate_sine(const snd_pcm_channel_area_t *areas, ires = res; tmp = (unsigned char *)(&ires); for (chn = 0; chn < channels; chn++) { - for (byte = 0; byte < bps; byte++) + for (byte = 0; byte < (unsigned int)bps; byte++) *(samples[chn] + byte) = tmp[byte]; samples[chn] += steps[chn]; } @@ -77,6 +77,7 @@ static int set_hwparams(snd_pcm_t *handle, snd_pcm_access_t access) { unsigned int rrate; + snd_pcm_uframes_t size; int err, dir; /* choose all parameters */ @@ -126,22 +127,24 @@ static int set_hwparams(snd_pcm_t *handle, printf("Unable to set buffer time %i for playback: %s\n", buffer_time, snd_strerror(err)); return err; } - err = snd_pcm_hw_params_get_buffer_size(params, &buffer_size); + err = snd_pcm_hw_params_get_buffer_size(params, &size); if (err < 0) { printf("Unable to get buffer size for playback: %s\n", snd_strerror(err)); return err; } + buffer_size = size; /* set the period time */ err = snd_pcm_hw_params_set_period_time_near(handle, params, &period_time, &dir); if (err < 0) { printf("Unable to set period time %i for playback: %s\n", period_time, snd_strerror(err)); return err; } - err = snd_pcm_hw_params_get_period_size(params, &period_size, &dir); + err = snd_pcm_hw_params_get_period_size(params, &size, &dir); if (err < 0) { printf("Unable to get period size for playback: %s\n", snd_strerror(err)); return err; } + period_size = size; /* write the parameters to device */ err = snd_pcm_hw_params(handle, params); if (err < 0) { @@ -504,8 +507,8 @@ static void async_direct_callback(snd_async_handler_t *ahandler) } static int async_direct_loop(snd_pcm_t *handle, - signed short *samples, - snd_pcm_channel_area_t *areas) + signed short *samples ATTRIBUTE_UNUSED, + snd_pcm_channel_area_t *areas ATTRIBUTE_UNUSED) { struct async_private_data data; snd_async_handler_t *ahandler; @@ -562,8 +565,8 @@ static int async_direct_loop(snd_pcm_t *handle, */ static int direct_loop(snd_pcm_t *handle, - signed short *samples, - snd_pcm_channel_area_t *areas) + signed short *samples ATTRIBUTE_UNUSED, + snd_pcm_channel_area_t *areas ATTRIBUTE_UNUSED) { double phase = 0; const snd_pcm_channel_area_t *my_areas; @@ -716,7 +719,7 @@ static void help(void) "-v,--verbose show the PCM setup parameters\n" "\n"); printf("Recognized sample formats are:"); - for (k = 0; k < SND_PCM_FORMAT_LAST; ++(unsigned long) k) { + for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) { const char *s = snd_pcm_format_name(k); if (s) printf(" %s", s); diff --git a/test/queue_timer.c b/test/queue_timer.c index cca01325..c4ffb192 100644 --- a/test/queue_timer.c +++ b/test/queue_timer.c @@ -18,19 +18,22 @@ void normalize(struct timeval *tv) } int -main(int argc, char **argv) +main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { snd_seq_t *handle; int portid; - int npfd; - struct pollfd *pfd; + /* int npfd; + struct pollfd *pfd; + */ int queue; - int i; - int rval; + /* int i; + int rval;' + */ struct timeval starttv, prevdiff; int countdown = -1; - snd_seq_queue_timer_t *timer; - snd_timer_id_t *timerid; + /* snd_seq_queue_timer_t *timer; + snd_timer_id_t *timerid; + */ if (snd_seq_open(&handle, "hw", SND_SEQ_OPEN_DUPLEX, 0) < 0) { fprintf(stderr, "failed to open ALSA sequencer interface\n"); @@ -98,9 +101,9 @@ main(int argc, char **argv) fprintf(stderr, " real time: %12ld sec %8ld usec\nqueue time: %12ld sec %8ld usec\n diff: %12ld sec %8ld usec\n diffdiff: %12ld sec %8ld usec\n", tv.tv_sec, tv.tv_usec, - rtime->tv_sec, rtime->tv_nsec / 1000, + (long)rtime->tv_sec, (long)rtime->tv_nsec / 1000, diff.tv_sec, diff.tv_usec, - diffdiff.tv_sec, diffdiff.tv_usec); + (long)diffdiff.tv_sec, (long)diffdiff.tv_usec); if (diffdiff.tv_usec > 5000 || diffdiff.tv_usec < -5000) { diff --git a/test/seq-decoder.c b/test/seq-decoder.c index c43c7347..3a1ed313 100644 --- a/test/seq-decoder.c +++ b/test/seq-decoder.c @@ -241,7 +241,9 @@ int decode_event(snd_seq_event_t * ev) return 0; } -void event_decoder_start_timer(snd_seq_t *handle, int queue, int client, int port) +void event_decoder_start_timer(snd_seq_t *handle, int queue, + int client ATTRIBUTE_UNUSED, + int port ATTRIBUTE_UNUSED) { int err; diff --git a/test/seq-sender.c b/test/seq-sender.c index 0dbc4645..5d8ac92c 100644 --- a/test/seq-sender.c +++ b/test/seq-sender.c @@ -65,7 +65,10 @@ void set_hwparams(snd_pcm_t *phandle) * Simple event sender */ -void event_sender_start_timer(snd_seq_t *handle, int client, int queue, snd_pcm_t *phandle) +void event_sender_start_timer(snd_seq_t *handle, + int client ATTRIBUTE_UNUSED, + int queue, + snd_pcm_t *phandle ATTRIBUTE_UNUSED) { int err; diff --git a/test/seq.c b/test/seq.c index f18a6fa4..34b000fd 100644 --- a/test/seq.c +++ b/test/seq.c @@ -49,7 +49,7 @@ void system_info(snd_seq_t *handle) max_queues = snd_seq_system_info_get_ports(sysinfo); } -void show_system_info(snd_seq_t *handle) +void show_system_info(snd_seq_t *handle ATTRIBUTE_UNUSED) { printf("System info\n"); printf(" Max queues : %i\n", max_queues);