The audio module will now compile with WARNS=5.

This commit is contained in:
nat 2017-07-30 00:47:48 +00:00
parent 5a32de3762
commit 86f0b20054
4 changed files with 26 additions and 24 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: auconv.c,v 1.30 2017/07/28 01:36:40 nat Exp $ */
/* $NetBSD: auconv.c,v 1.31 2017/07/30 00:47:48 nat Exp $ */
/*
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: auconv.c,v 1.30 2017/07/28 01:36:40 nat Exp $");
__KERNEL_RCSID(0, "$NetBSD: auconv.c,v 1.31 2017/07/30 00:47:48 nat Exp $");
#include <sys/types.h>
#include <sys/audioio.h>
@ -928,7 +928,7 @@ auconv_rateconv_check_rates(const struct audio_format *formats, int nformats,
if (formats[i].frequency[1] > maxrate)
maxrate = formats[i].frequency[1];
} else {
for (j = 0; j < formats[i].frequency_type; j++) {
for (j = 0; j < (int)formats[i].frequency_type; j++) {
if (formats[i].frequency[j] < minrate)
minrate = formats[i].frequency[j];
if (formats[i].frequency[j] > maxrate)

View File

@ -1,4 +1,4 @@
/* $NetBSD: audio.c,v 1.382 2017/07/29 06:45:35 isaki Exp $ */
/* $NetBSD: audio.c,v 1.383 2017/07/30 00:47:48 nat Exp $ */
/*-
* Copyright (c) 2016 Nathanial Sloss <nathanialsloss@yahoo.com.au>
@ -148,7 +148,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.382 2017/07/29 06:45:35 isaki Exp $");
__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.383 2017/07/30 00:47:48 nat Exp $");
#ifdef _KERNEL_OPT
#include "audio.h"
@ -206,7 +206,7 @@ int audiodebug = AUDIO_DEBUG;
#endif
#define ROUNDSIZE(x) (x) &= -16 /* round to nice boundary */
#define SPECIFIED(x) ((x) != ~0)
#define SPECIFIED(x) ((int)(x) != ~0)
#define SPECIFIED_CH(x) ((x) != (u_char)~0)
/* #define AUDIO_PM_IDLE */
@ -1986,7 +1986,7 @@ audio_init_ringbuffer(struct audio_softc *sc, struct audio_ringbuffer *rp,
blksize = rp->blksize;
if (blksize < AUMINBLK)
blksize = AUMINBLK;
if (blksize > rp->s.bufsize / AUMINNOBLK)
if (blksize > (int)(rp->s.bufsize / AUMINNOBLK))
blksize = rp->s.bufsize / AUMINNOBLK;
ROUNDSIZE(blksize);
DPRINTF(("audio_init_ringbuffer: MI blksize=%d\n", blksize));
@ -2348,8 +2348,8 @@ audio_drain(struct audio_softc *sc, struct audio_chan *chan)
{
struct audio_ringbuffer *cb;
struct virtual_channel *vc;
int error, drops;
int cc, i, used;
int error, cc, i, used;
uint drops;
bool hw = false;
KASSERT(mutex_owned(sc->sc_lock));
@ -2537,7 +2537,8 @@ audio_read(struct audio_softc *sc, struct uio *uio, int ioflag,
struct audio_ringbuffer *cb;
const uint8_t *outp;
uint8_t *inp;
int error, used, cc, n;
int error, used, n;
uint cc;
KASSERT(mutex_owned(sc->sc_lock));
@ -3445,7 +3446,7 @@ audio_mmap(struct audio_softc *sc, off_t *offp, size_t len, int prot,
cb = &vc->sc_mpr;
#endif
if (len > cb->s.bufsize || *offp > cb->s.bufsize - len)
if (len > cb->s.bufsize || *offp > (uint)(cb->s.bufsize - len))
return EOVERFLOW;
if (!cb->mmapped) {
@ -4524,7 +4525,7 @@ audiosetinfo(struct audio_softc *sc, struct audio_info *ai, bool reset,
int setmode;
int error;
int np, nr;
unsigned int blks;
int blks;
u_int gain;
bool rbus, pbus;
bool cleared, modechange, pausechange;
@ -6063,7 +6064,8 @@ vchan_autoconfig(struct audio_softc *sc)
{
struct audio_chan *chan;
struct virtual_channel *vc;
int error, i, j, k;
uint i, j, k;
int error;
chan = SIMPLEQ_FIRST(&sc->sc_audiochan);
vc = chan->vc;

View File

@ -1,4 +1,4 @@
/* $NetBSD: audiovar.h,v 1.59 2017/07/29 03:05:51 isaki Exp $ */
/* $NetBSD: audiovar.h,v 1.60 2017/07/30 00:47:48 nat Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -164,8 +164,8 @@ struct au_mixer_ports {
bool isenum; /* selector is enum type */
u_int allports; /* all aumasks or'd */
u_int aumask[AUDIO_N_PORTS]; /* exposed value of "ports" */
u_int misel [AUDIO_N_PORTS]; /* ord of port, for selector */
u_int miport[AUDIO_N_PORTS]; /* index of port's mixerctl */
int misel [AUDIO_N_PORTS]; /* ord of port, for selector */
int miport[AUDIO_N_PORTS]; /* index of port's mixerctl */
bool isdual; /* has working mixerout */
int mixerout; /* ord of mixerout, for dual case */
int cur_port; /* the port that gain actually controls when

View File

@ -1,4 +1,4 @@
/* $NetBSD: aurateconv.c,v 1.20 2017/06/20 07:13:09 nat Exp $ */
/* $NetBSD: aurateconv.c,v 1.21 2017/07/30 00:47:48 nat Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: aurateconv.c,v 1.20 2017/06/20 07:13:09 nat Exp $");
__KERNEL_RCSID(0, "$NetBSD: aurateconv.c,v 1.21 2017/07/30 00:47:48 nat Exp $");
#include <sys/systm.h>
#include <sys/types.h>
@ -293,7 +293,7 @@ aurateconv_fetch_to(struct audio_softc *sc, stream_fetcher_t *self,
#define READ_Sn(BITS, EN, V, STREAM, RP, PAR) \
do { \
int j; \
for (j = 0; j < (PAR)->channels; j++) { \
for (j = 0; j < (int)(PAR)->channels; j++) { \
(V)[j] = READ_S##BITS##EN(RP); \
RP = audio_stream_add_outp(STREAM, RP, (BITS) / NBBY); \
} \
@ -305,7 +305,7 @@ aurateconv_fetch_to(struct audio_softc *sc, stream_fetcher_t *self,
WP = audio_stream_add_inp(STREAM, WP, (BITS) / NBBY); \
} else if (from->channels <= to->channels) { \
int j; \
for (j = 0; j < (FROM)->channels; j++) { \
for (j = 0; j < (int)(FROM)->channels; j++) { \
WRITE_S##BITS##EN(WP, (V)[j]); \
WP = audio_stream_add_inp(STREAM, WP, (BITS) / NBBY); \
} \
@ -314,13 +314,13 @@ aurateconv_fetch_to(struct audio_softc *sc, stream_fetcher_t *self,
WP = audio_stream_add_inp(STREAM, WP, (BITS) / NBBY); \
j++; \
} \
for (; j < (TO)->channels; j++) { \
for (; j < (int)(TO)->channels; j++) { \
WRITE_S##BITS##EN(WP, 0); \
WP = audio_stream_add_inp(STREAM, WP, (BITS) / NBBY); \
} \
} else { /* from->channels < to->channels */ \
int j; \
for (j = 0; j < (TO)->channels; j++) { \
for (j = 0; j < (int)(TO)->channels; j++) { \
WRITE_S##BITS##EN(WP, (V)[j]); \
WP = audio_stream_add_inp(STREAM, WP, (BITS) / NBBY); \
} \
@ -381,7 +381,7 @@ aurateconv_slinear##BITS##_##EN (aurateconv_t *this, audio_stream_t *dst, \
READ_Sn(BITS, EN, next, src, r, from); \
} \
c256 = this->count * 256 / to->sample_rate; \
for (i = 0; i < from->channels; i++) \
for (i = 0; i < (int)from->channels; i++) \
v[i] = (c256 * next[i] + (256 - c256) * prev[i]) >> 8; \
WRITE_Sn(BITS, EN, v, dst, w, from, to); \
this->count += from->sample_rate; \
@ -452,7 +452,7 @@ aurateconv_slinear32_##EN (aurateconv_t *this, audio_stream_t *dst, \
used_src -= frame_src; \
} \
c256 = this->count * 256 / to->sample_rate; \
for (i = 0; i < from->channels; i++) \
for (i = 0; i < (int)from->channels; i++) \
v[i] = (int32_t)((c256 * next[i] + (INT64_C(256) - c256) * prev[i]) >> 8) & mask; \
WRITE_Sn(32, EN, v, dst, w, from, to); \
used_dst += frame_dst; \