summaryrefslogtreecommitdiff
path: root/usr.bin/aucat
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2012-04-11 06:05:44 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2012-04-11 06:05:44 +0000
commit61de1370078d8018aa3697f8700e90150a0e97f0 (patch)
tree37edec6d5e4b8f39c1c9b8174acebb1e2c8b54ae /usr.bin/aucat
parentcc808ad5eaeb6f21df2ea9a638191d88edf05078 (diff)
Use "unsigned int" rather than "unsigned". No object change.
suggested by deraadt@
Diffstat (limited to 'usr.bin/aucat')
-rw-r--r--usr.bin/aucat/abuf.c18
-rw-r--r--usr.bin/aucat/abuf.h62
-rw-r--r--usr.bin/aucat/aparams.c7
-rw-r--r--usr.bin/aucat/aparams.h20
-rw-r--r--usr.bin/aucat/aproc.c123
-rw-r--r--usr.bin/aucat/aproc.h62
-rw-r--r--usr.bin/aucat/aucat.c10
-rw-r--r--usr.bin/aucat/dbg.c8
-rw-r--r--usr.bin/aucat/dbg.h2
-rw-r--r--usr.bin/aucat/dev.c55
-rw-r--r--usr.bin/aucat/dev.h70
-rw-r--r--usr.bin/aucat/file.c24
-rw-r--r--usr.bin/aucat/file.h22
-rw-r--r--usr.bin/aucat/headers.c10
-rw-r--r--usr.bin/aucat/listen.c6
-rw-r--r--usr.bin/aucat/listen.h4
-rw-r--r--usr.bin/aucat/midi.c39
-rw-r--r--usr.bin/aucat/midi.h9
-rw-r--r--usr.bin/aucat/miofile.c20
-rw-r--r--usr.bin/aucat/miofile.h4
-rw-r--r--usr.bin/aucat/opt.c8
-rw-r--r--usr.bin/aucat/opt.h8
-rw-r--r--usr.bin/aucat/pipe.c8
-rw-r--r--usr.bin/aucat/pipe.h6
-rw-r--r--usr.bin/aucat/siofile.c30
-rw-r--r--usr.bin/aucat/siofile.h6
-rw-r--r--usr.bin/aucat/sock.c34
-rw-r--r--usr.bin/aucat/sock.h26
-rw-r--r--usr.bin/aucat/wav.c37
-rw-r--r--usr.bin/aucat/wav.h26
30 files changed, 388 insertions, 376 deletions
diff --git a/usr.bin/aucat/abuf.c b/usr.bin/aucat/abuf.c
index c96ffbb59ff..181b40a9c93 100644
--- a/usr.bin/aucat/abuf.c
+++ b/usr.bin/aucat/abuf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: abuf.c,v 1.23 2011/10/12 07:20:03 ratchov Exp $ */
+/* $OpenBSD: abuf.c,v 1.24 2012/04/11 06:05:43 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -77,10 +77,10 @@ abuf_dump(struct abuf *buf)
#endif
struct abuf *
-abuf_new(unsigned nfr, struct aparams *par)
+abuf_new(unsigned int nfr, struct aparams *par)
{
struct abuf *buf;
- unsigned len, bpf;
+ unsigned int len, bpf;
bpf = aparams_bpf(par);
len = nfr * bpf;
@@ -164,9 +164,9 @@ abuf_clear(struct abuf *buf)
* Get a pointer to the readable block at the given offset.
*/
unsigned char *
-abuf_rgetblk(struct abuf *buf, unsigned *rsize, unsigned ofs)
+abuf_rgetblk(struct abuf *buf, unsigned int *rsize, unsigned int ofs)
{
- unsigned count, start, used;
+ unsigned int count, start, used;
start = buf->start + ofs;
used = buf->used - ofs;
@@ -192,7 +192,7 @@ abuf_rgetblk(struct abuf *buf, unsigned *rsize, unsigned ofs)
* Discard the block at the start postion.
*/
void
-abuf_rdiscard(struct abuf *buf, unsigned count)
+abuf_rdiscard(struct abuf *buf, unsigned int count)
{
#ifdef DEBUG
if (count > buf->used) {
@@ -219,7 +219,7 @@ abuf_rdiscard(struct abuf *buf, unsigned count)
* Commit the data written at the end postion.
*/
void
-abuf_wcommit(struct abuf *buf, unsigned count)
+abuf_wcommit(struct abuf *buf, unsigned int count)
{
#ifdef DEBUG
if (count > (buf->len - buf->used)) {
@@ -243,9 +243,9 @@ abuf_wcommit(struct abuf *buf, unsigned count)
* Get a pointer to the writable block at offset ofs.
*/
unsigned char *
-abuf_wgetblk(struct abuf *buf, unsigned *rsize, unsigned ofs)
+abuf_wgetblk(struct abuf *buf, unsigned int *rsize, unsigned int ofs)
{
- unsigned end, avail, count;
+ unsigned int end, avail, count;
end = buf->start + buf->used + ofs;
diff --git a/usr.bin/aucat/abuf.h b/usr.bin/aucat/abuf.h
index 2096bb006a2..2440393ea4c 100644
--- a/usr.bin/aucat/abuf.h
+++ b/usr.bin/aucat/abuf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: abuf.h,v 1.24 2011/11/15 20:41:54 ratchov Exp $ */
+/* $OpenBSD: abuf.h,v 1.25 2012/04/11 06:05:43 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -29,35 +29,35 @@ struct abuf {
/*
* fifo parameters
*/
- unsigned bpf; /* bytes per frame */
- unsigned cmin, cmax; /* channel range of this buf */
- unsigned start; /* offset where data starts */
- unsigned used; /* valid data */
- unsigned len; /* size of the ring */
- struct aproc *rproc; /* reader */
- struct aproc *wproc; /* writer */
- struct abuf *duplex; /* link to buffer of the other direction */
- unsigned inuse; /* in abuf_{flush,fill,run}() */
- unsigned tickets; /* max data to (if throttling) */
+ unsigned int bpf; /* bytes per frame */
+ unsigned int cmin, cmax; /* channel range of this buf */
+ unsigned int start; /* offset where data starts */
+ unsigned int used; /* valid data */
+ unsigned int len; /* size of the ring */
+ struct aproc *rproc; /* reader */
+ struct aproc *wproc; /* writer */
+ struct abuf *duplex; /* link to buffer of the other dir */
+ unsigned int inuse; /* in abuf_{flush,fill,run}() */
+ unsigned int tickets; /* max data to (if throttling) */
/*
* Misc reader aproc-specific per-buffer parameters.
*/
union {
struct {
- int weight; /* dynamic range */
- int maxweight; /* max dynamic range allowed */
- unsigned vol; /* volume within the dynamic range */
- unsigned done; /* frames ready */
- unsigned xrun; /* underrun policy */
- int drop; /* frames to drop on next read */
+ int weight; /* dynamic range */
+ int maxweight; /* max dynamic range allowed */
+ unsigned int vol; /* volume within the vol */
+ unsigned int done; /* frames ready */
+ unsigned int xrun; /* underrun policy */
+ int drop; /* to drop on next read */
} mix;
struct {
- unsigned st; /* MIDI running status */
- unsigned used; /* bytes used from ``msg'' */
- unsigned idx; /* actual MIDI message size */
- unsigned len; /* MIDI message length */
-#define MIDI_MSGMAX 16 /* max size of MIDI messaage */
+ unsigned int st; /* MIDI running status */
+ unsigned int used; /* bytes used from ``msg'' */
+ unsigned int idx; /* actual MIDI message size */
+ unsigned int len; /* MIDI message length */
+#define MIDI_MSGMAX 16 /* max size of MIDI msg */
unsigned char msg[MIDI_MSGMAX];
} midi;
} r;
@@ -67,12 +67,12 @@ struct abuf {
*/
union {
struct {
- unsigned todo; /* frames to process */
+ unsigned int todo; /* frames to process */
} mix;
struct {
- unsigned done; /* frames copied */
- unsigned xrun; /* overrun policy, one of XRUN_XXX */
- int silence; /* silence to add on next write */
+ unsigned int done; /* frames copied */
+ unsigned int xrun; /* one of XRUN_XXX */
+ int silence; /* to add on next write */
} sub;
struct {
struct abuf *owner; /* current input stream */
@@ -103,14 +103,14 @@ struct abuf {
*/
#define ABUF_HUP(b) (!ABUF_WOK(b) && (b)->rproc == NULL)
-struct abuf *abuf_new(unsigned, struct aparams *);
+struct abuf *abuf_new(unsigned int, struct aparams *);
void abuf_del(struct abuf *);
void abuf_dbg(struct abuf *);
void abuf_clear(struct abuf *);
-unsigned char *abuf_rgetblk(struct abuf *, unsigned *, unsigned);
-unsigned char *abuf_wgetblk(struct abuf *, unsigned *, unsigned);
-void abuf_rdiscard(struct abuf *, unsigned);
-void abuf_wcommit(struct abuf *, unsigned);
+unsigned char *abuf_rgetblk(struct abuf *, unsigned int *, unsigned int);
+unsigned char *abuf_wgetblk(struct abuf *, unsigned int *, unsigned int);
+void abuf_rdiscard(struct abuf *, unsigned int);
+void abuf_wcommit(struct abuf *, unsigned int);
int abuf_fill(struct abuf *);
int abuf_flush(struct abuf *);
void abuf_eof(struct abuf *);
diff --git a/usr.bin/aucat/aparams.c b/usr.bin/aucat/aparams.c
index ad9d364d205..8202aacde1c 100644
--- a/usr.bin/aucat/aparams.c
+++ b/usr.bin/aucat/aparams.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aparams.c,v 1.13 2011/04/28 07:20:03 ratchov Exp $ */
+/* $OpenBSD: aparams.c,v 1.14 2012/04/11 06:05:43 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -174,7 +174,8 @@ done:
* by the machine.
*/
void
-aparams_init(struct aparams *par, unsigned cmin, unsigned cmax, unsigned rate)
+aparams_init(struct aparams *par, unsigned int cmin, unsigned int cmax,
+ unsigned int rate)
{
par->bps = sizeof(adata_t);
par->bits = ADATA_BITS;
@@ -252,7 +253,7 @@ aparams_eqrate(struct aparams *p1, struct aparams *p2)
/*
* Return the number of bytes per frame with the given parameters.
*/
-unsigned
+unsigned int
aparams_bpf(struct aparams *par)
{
return (par->cmax - par->cmin + 1) * par->bps;
diff --git a/usr.bin/aucat/aparams.h b/usr.bin/aucat/aparams.h
index 972b2a58db7..3cbaf1a383b 100644
--- a/usr.bin/aucat/aparams.h
+++ b/usr.bin/aucat/aparams.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: aparams.h,v 1.11 2010/11/05 16:42:17 ratchov Exp $ */
+/* $OpenBSD: aparams.h,v 1.12 2012/04/11 06:05:43 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -40,13 +40,13 @@
* Encoding specification.
*/
struct aparams {
- unsigned bps; /* bytes per sample */
- unsigned bits; /* actually used bits */
- unsigned le; /* 1 if little endian, 0 if big endian */
- unsigned sig; /* 1 if signed, 0 if unsigned */
- unsigned msb; /* 1 if msb justified, 0 if lsb justified */
- unsigned cmin, cmax; /* provided/consumed channels */
- unsigned rate; /* frames per second */
+ unsigned int bps; /* bytes per sample */
+ unsigned int bits; /* actually used bits */
+ unsigned int le; /* 1 if little endian, 0 if big endian */
+ unsigned int sig; /* 1 if signed, 0 if unsigned */
+ unsigned int msb; /* 1 if msb justified, 0 if lsb justified */
+ unsigned int cmin, cmax; /* provided/consumed channels */
+ unsigned int rate; /* frames per second */
};
/*
@@ -126,14 +126,14 @@ fp24_muldiv(int x, int a, int b)
extern int aparams_ctltovol[128];
extern struct aparams aparams_none;
-void aparams_init(struct aparams *, unsigned, unsigned, unsigned);
+void aparams_init(struct aparams *, unsigned int, unsigned int, unsigned int);
void aparams_dbg(struct aparams *);
int aparams_eqrate(struct aparams *, struct aparams *);
int aparams_eqenc(struct aparams *, struct aparams *);
int aparams_eq(struct aparams *, struct aparams *);
int aparams_subset(struct aparams *, struct aparams *);
void aparams_grow(struct aparams *, struct aparams *);
-unsigned aparams_bpf(struct aparams *);
+unsigned int aparams_bpf(struct aparams *);
int aparams_strtoenc(struct aparams *, char *);
int aparams_enctostr(struct aparams *, char *);
void aparams_copyenc(struct aparams *, struct aparams *);
diff --git a/usr.bin/aucat/aproc.c b/usr.bin/aucat/aproc.c
index 3d689848d93..c61fdb2b2a3 100644
--- a/usr.bin/aucat/aproc.c
+++ b/usr.bin/aucat/aproc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aproc.c,v 1.70 2012/03/23 11:59:54 ratchov Exp $ */
+/* $OpenBSD: aproc.c,v 1.71 2012/04/11 06:05:43 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -289,12 +289,12 @@ aproc_depend(struct aproc *p, struct aproc *dep)
}
int
-rfile_do(struct aproc *p, unsigned todo, unsigned *done)
+rfile_do(struct aproc *p, unsigned int todo, unsigned int *done)
{
struct abuf *obuf = LIST_FIRST(&p->outs);
struct file *f = p->u.io.file;
unsigned char *data;
- unsigned n, count, off;
+ unsigned int n, count, off;
off = p->u.io.partial;
data = abuf_wgetblk(obuf, &count, 0);
@@ -451,12 +451,12 @@ wfile_done(struct aproc *p)
}
int
-wfile_do(struct aproc *p, unsigned todo, unsigned *done)
+wfile_do(struct aproc *p, unsigned int todo, unsigned int *done)
{
struct abuf *ibuf = LIST_FIRST(&p->ins);
struct file *f = p->u.io.file;
unsigned char *data;
- unsigned n, count, off;
+ unsigned int n, count, off;
off = p->u.io.partial;
data = abuf_rgetblk(ibuf, &count, 0);
@@ -547,7 +547,7 @@ wfile_new(struct file *f)
void
mix_drop(struct abuf *buf, int extra)
{
- unsigned count;
+ unsigned int count;
buf->r.mix.drop += extra;
while (buf->r.mix.drop > 0) {
@@ -583,10 +583,10 @@ mix_drop(struct abuf *buf, int extra)
* obuf->w.mix.todo doesn't exceed the given value
*/
void
-mix_bzero(struct abuf *obuf, unsigned maxtodo)
+mix_bzero(struct abuf *obuf, unsigned int maxtodo)
{
adata_t *odata;
- unsigned ocount, todo;
+ unsigned int ocount, todo;
if (obuf->w.mix.todo >= maxtodo)
return;
@@ -611,13 +611,13 @@ mix_bzero(struct abuf *obuf, unsigned maxtodo)
/*
* Mix an input block over an output block.
*/
-unsigned
+unsigned int
mix_badd(struct abuf *ibuf, struct abuf *obuf)
{
adata_t *idata, *odata;
- unsigned cmin, cmax;
- unsigned i, j, cc, istart, inext, onext, ostart;
- unsigned scount, icount, ocount;
+ unsigned int cmin, cmax;
+ unsigned int i, j, cc, istart, inext, onext, ostart;
+ unsigned int scount, icount, ocount;
int vol, s;
#ifdef DEBUG
@@ -710,7 +710,7 @@ int
mix_xrun(struct aproc *p, struct abuf *i)
{
struct abuf *obuf = LIST_FIRST(&p->outs);
- unsigned fdrop, remain;
+ unsigned int fdrop, remain;
if (i->r.mix.done > 0)
return 1;
@@ -765,9 +765,9 @@ int
mix_in(struct aproc *p, struct abuf *ibuf)
{
struct abuf *i, *inext, *obuf = LIST_FIRST(&p->outs);
- unsigned odone;
- unsigned maxwrite;
- unsigned scount;
+ unsigned int odone;
+ unsigned int maxwrite;
+ unsigned int scount;
#ifdef DEBUG
if (debug_level >= 4) {
@@ -832,9 +832,9 @@ int
mix_out(struct aproc *p, struct abuf *obuf)
{
struct abuf *i, *inext;
- unsigned odone;
- unsigned maxwrite;
- unsigned scount;
+ unsigned int odone;
+ unsigned int maxwrite;
+ unsigned int scount;
#ifdef DEBUG
if (debug_level >= 4) {
@@ -919,7 +919,7 @@ void
mix_eof(struct aproc *p, struct abuf *ibuf)
{
struct abuf *i, *obuf = LIST_FIRST(&p->outs);
- unsigned odone;
+ unsigned int odone;
mix_setmaster(p);
@@ -1021,8 +1021,8 @@ struct aproc_ops mix_ops = {
};
struct aproc *
-mix_new(char *name, int maxlat, unsigned round,
- unsigned autovol, unsigned master)
+mix_new(char *name, int maxlat, unsigned int round,
+ unsigned int autovol, unsigned int master)
{
struct aproc *p;
@@ -1043,7 +1043,7 @@ mix_new(char *name, int maxlat, unsigned round,
void
mix_setmaster(struct aproc *p)
{
- unsigned n;
+ unsigned int n;
struct abuf *i, *j;
int weight;
@@ -1113,7 +1113,7 @@ void
sub_silence(struct abuf *buf, int extra)
{
unsigned char *data;
- unsigned count;
+ unsigned int count;
buf->w.sub.silence += extra;
if (buf->w.sub.silence > 0) {
@@ -1152,9 +1152,9 @@ void
sub_bcopy(struct abuf *ibuf, struct abuf *obuf)
{
adata_t *idata, *odata;
- unsigned cmin, cmax;
- unsigned i, j, cc, istart, inext, onext, ostart;
- unsigned icount, ocount, scount;
+ unsigned int cmin, cmax;
+ unsigned int i, j, cc, istart, inext, onext, ostart;
+ unsigned int icount, ocount, scount;
/*
* Drop samples for xrun correction
@@ -1213,7 +1213,7 @@ int
sub_xrun(struct aproc *p, struct abuf *i)
{
struct abuf *ibuf = LIST_FIRST(&p->ins);
- unsigned fdrop, remain;
+ unsigned int fdrop, remain;
if (i->w.sub.done > 0)
return 1;
@@ -1269,7 +1269,7 @@ int
sub_in(struct aproc *p, struct abuf *ibuf)
{
struct abuf *i, *inext;
- unsigned idone;
+ unsigned int idone;
if (!ABUF_ROK(ibuf))
return 0;
@@ -1315,7 +1315,7 @@ sub_out(struct aproc *p, struct abuf *obuf)
{
struct abuf *ibuf = LIST_FIRST(&p->ins);
struct abuf *i, *inext;
- unsigned idone;
+ unsigned int idone;
if (!SUB_WOK(obuf))
return 0;
@@ -1352,7 +1352,7 @@ void
sub_hup(struct aproc *p, struct abuf *obuf)
{
struct abuf *i, *ibuf = LIST_FIRST(&p->ins);
- unsigned idone;
+ unsigned int idone;
if (!aproc_inuse(p)) {
#ifdef DEBUG
@@ -1427,7 +1427,7 @@ struct aproc_ops sub_ops = {
};
struct aproc *
-sub_new(char *name, int maxlat, unsigned round)
+sub_new(char *name, int maxlat, unsigned int round)
{
struct aproc *p;
@@ -1451,19 +1451,19 @@ sub_clear(struct aproc *p)
void
resamp_bcopy(struct aproc *p, struct abuf *ibuf, struct abuf *obuf)
{
- unsigned inch;
+ unsigned int inch;
adata_t *idata;
- unsigned oblksz;
- unsigned ifr;
- unsigned onch;
+ unsigned int oblksz;
+ unsigned int ifr;
+ unsigned int onch;
int s, ds, diff;
adata_t *odata;
- unsigned iblksz;
- unsigned ofr;
- unsigned c;
+ unsigned int iblksz;
+ unsigned int ofr;
+ unsigned int c;
adata_t *ctxbuf, *ctx;
- unsigned ctx_start;
- unsigned icount, ocount;
+ unsigned int ctx_start;
+ unsigned int icount, ocount;
/*
* Calculate max frames readable at once from the input buffer.
@@ -1643,10 +1643,10 @@ struct aproc_ops resamp_ops = {
};
struct aproc *
-resamp_new(char *name, unsigned iblksz, unsigned oblksz)
+resamp_new(char *name, unsigned int iblksz, unsigned int oblksz)
{
struct aproc *p;
- unsigned i;
+ unsigned int i;
p = aproc_new(&resamp_ops, name);
p->u.resamp.iblksz = iblksz;
@@ -1676,14 +1676,14 @@ resamp_new(char *name, unsigned iblksz, unsigned oblksz)
void
enc_bcopy(struct aproc *p, struct abuf *ibuf, struct abuf *obuf)
{
- unsigned nch, scount, icount, ocount;
- unsigned f;
+ unsigned int nch, scount, icount, ocount;
+ unsigned int f;
adata_t *idata;
int s;
- unsigned oshift;
+ unsigned int oshift;
int osigbit;
- unsigned obps;
- unsigned i;
+ unsigned int obps;
+ unsigned int i;
unsigned char *odata;
int obnext;
int osnext;
@@ -1834,16 +1834,16 @@ enc_new(char *name, struct aparams *par)
void
dec_bcopy(struct aproc *p, struct abuf *ibuf, struct abuf *obuf)
{
- unsigned nch, scount, icount, ocount;
- unsigned f;
- unsigned ibps;
- unsigned i;
+ unsigned int nch, scount, icount, ocount;
+ unsigned int f;
+ unsigned int ibps;
+ unsigned int i;
int s = 0xdeadbeef;
unsigned char *idata;
int ibnext;
int isnext;
int isigbit;
- unsigned ishift;
+ unsigned int ishift;
adata_t *odata;
/*
@@ -1992,13 +1992,13 @@ dec_new(char *name, struct aparams *par)
void
join_bcopy(struct aproc *p, struct abuf *ibuf, struct abuf *obuf)
{
- unsigned h, hops;
- unsigned inch, inext;
+ unsigned int h, hops;
+ unsigned int inch, inext;
adata_t *idata;
- unsigned onch, onext;
+ unsigned int onch, onext;
adata_t *odata;
int scale;
- unsigned c, f, scount, icount, ocount;
+ unsigned int c, f, scount, icount, ocount;
/*
* Calculate max frames readable at once from the input buffer.
@@ -2136,7 +2136,7 @@ void
mon_flush(struct aproc *p)
{
struct abuf *obuf = LIST_FIRST(&p->outs);
- unsigned count;
+ unsigned int count;
#ifdef DEBUG
if (debug_level >= 4) {
@@ -2165,10 +2165,11 @@ mon_flush(struct aproc *p)
* Copy one block.
*/
void
-mon_snoop(struct aproc *p, struct abuf *ibuf, unsigned pos, unsigned todo)
+mon_snoop(struct aproc *p, struct abuf *ibuf,
+ unsigned int pos, unsigned int todo)
{
struct abuf *obuf = LIST_FIRST(&p->outs);
- unsigned scount, icount, ocount;
+ unsigned int scount, icount, ocount;
adata_t *idata, *odata;
#ifdef DEBUG
@@ -2277,7 +2278,7 @@ struct aproc_ops mon_ops = {
};
struct aproc *
-mon_new(char *name, unsigned bufsz)
+mon_new(char *name, unsigned int bufsz)
{
struct aproc *p;
diff --git a/usr.bin/aucat/aproc.h b/usr.bin/aucat/aproc.h
index c374a6c9ef2..a5376fb918a 100644
--- a/usr.bin/aucat/aproc.h
+++ b/usr.bin/aucat/aproc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: aproc.h,v 1.43 2012/03/23 11:59:54 ratchov Exp $ */
+/* $OpenBSD: aproc.h,v 1.44 2012/04/11 06:05:43 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -122,50 +122,50 @@ struct aproc {
struct aproc_ops *ops; /* call-backs */
LIST_HEAD(, abuf) ins; /* list of inputs */
LIST_HEAD(, abuf) outs; /* list of outputs */
- unsigned refs; /* extern references */
+ unsigned int refs; /* extern references */
#define APROC_ZOMB 1 /* destroyed but not freed */
#define APROC_QUIT 2 /* try to terminate if unused */
#define APROC_DROP 4 /* xrun if capable */
- unsigned flags;
+ unsigned int flags;
union { /* follow type-specific data */
struct { /* file/device io */
struct file *file; /* file to read/write */
- unsigned partial; /* bytes of partial frame */
+ unsigned int partial; /* bytes of partial frame */
} io;
struct {
- unsigned idle; /* frames since idleing */
- unsigned round; /* block size, for xruns */
+ unsigned int idle; /* frames since idleing */
+ unsigned int round; /* block size, for xruns */
int lat; /* current latency */
int maxlat; /* max latency allowed */
- unsigned abspos; /* frames produced */
+ unsigned int abspos; /* frames produced */
struct aproc *mon; /* snoop output */
- unsigned autovol; /* adjust volume dynamically */
+ unsigned int autovol; /* adjust volume dynamically */
int master; /* master attenuation */
} mix;
struct {
- unsigned idle; /* frames since idleing */
- unsigned round; /* block size, for xruns */
+ unsigned int idle; /* frames since idleing */
+ unsigned int round; /* block size, for xruns */
int lat; /* current latency */
int maxlat; /* max latency allowed */
- unsigned abspos; /* frames consumed */
+ unsigned int abspos; /* frames consumed */
} sub;
struct {
int delta; /* time position */
- unsigned bufsz; /* buffer size (latency) */
- unsigned pending; /* uncommited samples */
+ unsigned int bufsz; /* buffer size (latency) */
+ unsigned int pending; /* uncommited samples */
} mon;
struct {
#define RESAMP_NCTX 2
- unsigned ctx_start;
+ unsigned int ctx_start;
adata_t ctx[NCHAN_MAX * RESAMP_NCTX];
- unsigned iblksz, oblksz;
+ unsigned int iblksz, oblksz;
int diff;
int idelta, odelta; /* remainder of resamp_xpos */
} resamp;
struct {
int bfirst; /* bytes to skip at startup */
- unsigned bps; /* bytes per sample */
- unsigned shift; /* shift to get 32bit MSB */
+ unsigned int bps; /* bytes per sample */
+ unsigned int shift; /* shift to get 32bit MSB */
int sigbit; /* sign bits to XOR */
int bnext; /* to reach the next byte */
int snext; /* to reach the next sample */
@@ -173,16 +173,16 @@ struct aproc {
struct {
struct dev *dev; /* controlled device */
struct timo timo; /* timout for throtteling */
- unsigned fps; /* MTC frames per second */
+ unsigned int fps; /* MTC frames per second */
#define MTC_FPS_24 0
#define MTC_FPS_25 1
#define MTC_FPS_30 3
- unsigned fps_id; /* one of above */
- unsigned hr; /* MTC hours */
- unsigned min; /* MTC minutes */
- unsigned sec; /* MTC seconds */
- unsigned fr; /* MTC frames */
- unsigned qfr; /* MTC quarter frames */
+ unsigned int fps_id; /* one of above */
+ unsigned int hr; /* MTC hours */
+ unsigned int min; /* MTC minutes */
+ unsigned int sec; /* MTC seconds */
+ unsigned int fr; /* MTC frames */
+ unsigned int qfr; /* MTC quarter frames */
int delta; /* rel. to the last MTC tick */
} midi;
} u;
@@ -212,27 +212,27 @@ void aproc_opos(struct aproc *, struct abuf *, int);
struct aproc *rfile_new(struct file *);
struct aproc *wfile_new(struct file *);
-struct aproc *mix_new(char *, int, unsigned, unsigned, unsigned);
-struct aproc *sub_new(char *, int, unsigned);
-struct aproc *resamp_new(char *, unsigned, unsigned);
+struct aproc *mix_new(char *, int, unsigned int, unsigned int, unsigned int);
+struct aproc *sub_new(char *, int, unsigned int);
+struct aproc *resamp_new(char *, unsigned int, unsigned int);
struct aproc *enc_new(char *, struct aparams *);
struct aproc *dec_new(char *, struct aparams *);
struct aproc *join_new(char *);
-struct aproc *mon_new(char *, unsigned);
+struct aproc *mon_new(char *, unsigned int);
int rfile_in(struct aproc *, struct abuf *);
int rfile_out(struct aproc *, struct abuf *);
void rfile_eof(struct aproc *, struct abuf *);
void rfile_hup(struct aproc *, struct abuf *);
void rfile_done(struct aproc *);
-int rfile_do(struct aproc *, unsigned, unsigned *);
+int rfile_do(struct aproc *, unsigned int, unsigned int *);
int wfile_in(struct aproc *, struct abuf *);
int wfile_out(struct aproc *, struct abuf *);
void wfile_eof(struct aproc *, struct abuf *);
void wfile_hup(struct aproc *, struct abuf *);
void wfile_done(struct aproc *);
-int wfile_do(struct aproc *, unsigned, unsigned *);
+int wfile_do(struct aproc *, unsigned int, unsigned int *);
void mix_setmaster(struct aproc *);
void mix_clear(struct aproc *);
@@ -241,7 +241,7 @@ void mix_quit(struct aproc *);
void mix_drop(struct abuf *, int);
void sub_silence(struct abuf *, int);
void sub_clear(struct aproc *);
-void mon_snoop(struct aproc *, struct abuf *, unsigned, unsigned);
+void mon_snoop(struct aproc *, struct abuf *, unsigned int, unsigned int);
void mon_clear(struct aproc *);
#endif /* !defined(APROC_H) */
diff --git a/usr.bin/aucat/aucat.c b/usr.bin/aucat/aucat.c
index 5a2b3b1f414..1412980c4a1 100644
--- a/usr.bin/aucat/aucat.c
+++ b/usr.bin/aucat/aucat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aucat.c,v 1.133 2012/02/09 18:33:36 ratchov Exp $ */
+/* $OpenBSD: aucat.c,v 1.134 2012/04/11 06:05:43 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -214,10 +214,10 @@ opt_xrun(void)
errx(1, "%s: bad underrun/overrun policy", optarg);
}
-unsigned
+unsigned int
opt_mode(void)
{
- unsigned mode = 0;
+ unsigned int mode = 0;
char *p = optarg;
size_t len;
@@ -389,8 +389,8 @@ main(int argc, char **argv)
char *prog, *optstr, *usagestr;
int c, background, unit, active;
char base[PATH_MAX], path[PATH_MAX];
- unsigned mode, hdr, xrun, rate, join, mmc, vol;
- unsigned hold, autovol, bufsz, round;
+ unsigned int mode, hdr, xrun, rate, join, mmc, vol;
+ unsigned int hold, autovol, bufsz, round;
const char *str;
struct aparams ppar, rpar;
struct dev *d, *dnext;
diff --git a/usr.bin/aucat/dbg.c b/usr.bin/aucat/dbg.c
index 668b8524dc8..eb5202b5c96 100644
--- a/usr.bin/aucat/dbg.c
+++ b/usr.bin/aucat/dbg.c
@@ -39,8 +39,8 @@
} while (0)
char dbg_buf[DBG_BUFSZ]; /* buffer where traces are stored */
-unsigned dbg_used = 0; /* bytes used in the buffer */
-unsigned dbg_sync = 1; /* if true, flush after each '\n' */
+unsigned int dbg_used = 0; /* bytes used in the buffer */
+unsigned int dbg_sync = 1; /* if true, flush after each '\n' */
/*
* write debug info buffer on stderr
@@ -77,7 +77,7 @@ void
dbg_putx(unsigned long num)
{
char dig[sizeof(num) * 2], *p = dig, c;
- unsigned ndig;
+ unsigned int ndig;
if (num != 0) {
for (ndig = 0; num != 0; ndig++) {
@@ -100,7 +100,7 @@ void
dbg_putu(unsigned long num)
{
char dig[sizeof(num) * 3], *p = dig;
- unsigned ndig;
+ unsigned int ndig;
if (num != 0) {
for (ndig = 0; num != 0; ndig++) {
diff --git a/usr.bin/aucat/dbg.h b/usr.bin/aucat/dbg.h
index 33a27b4edbd..49038abda15 100644
--- a/usr.bin/aucat/dbg.h
+++ b/usr.bin/aucat/dbg.h
@@ -25,7 +25,7 @@ void dbg_puti(long);
void dbg_panic(void);
void dbg_flush(void);
-extern unsigned dbg_sync;
+extern unsigned int dbg_sync;
#endif /* MIDISH_DBG_H */
#endif /* DEBUG */
diff --git a/usr.bin/aucat/dev.c b/usr.bin/aucat/dev.c
index ca75241d2f5..5794ce21585 100644
--- a/usr.bin/aucat/dev.c
+++ b/usr.bin/aucat/dev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dev.c,v 1.78 2012/04/04 11:16:24 ratchov Exp $ */
+/* $OpenBSD: dev.c,v 1.79 2012/04/11 06:05:43 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -89,7 +89,7 @@ void dev_onmove(void *, int);
int devctl_open(struct dev *, struct devctl *);
struct dev *dev_list = NULL;
-unsigned dev_sndnum = 0, dev_thrnum = 0;
+unsigned int dev_sndnum = 0, dev_thrnum = 0;
#ifdef DEBUG
void
@@ -109,11 +109,11 @@ dev_dbg(struct dev *d)
* Create a sndio device
*/
struct dev *
-dev_new(char *path, unsigned mode,
- unsigned bufsz, unsigned round, unsigned hold, unsigned autovol)
+dev_new(char *path, unsigned int mode, unsigned int bufsz, unsigned int round,
+ unsigned int hold, unsigned int autovol)
{
struct dev *d;
- unsigned *pnum, i;
+ unsigned int *pnum, i;
pnum = (mode & MODE_THRU) ? &dev_thrnum : &dev_sndnum;
if (*pnum == DEV_NMAX) {
@@ -164,7 +164,7 @@ dev_new(char *path, unsigned mode,
* adjust device parameters and mode
*/
void
-dev_adjpar(struct dev *d, unsigned mode,
+dev_adjpar(struct dev *d, unsigned int mode,
struct aparams *ipar, struct aparams *opar)
{
d->reqmode |= (mode | MODE_MIDIMASK);
@@ -198,7 +198,7 @@ dev_init(struct dev *d)
* Add a MIDI port to the device
*/
int
-devctl_add(struct dev *d, char *path, unsigned mode)
+devctl_add(struct dev *d, char *path, unsigned int mode)
{
struct devctl *c;
@@ -255,7 +255,7 @@ dev_open(struct dev *d)
struct aparams par;
struct aproc *conv;
struct abuf *buf;
- unsigned siomode, cmin, cmax, rate;
+ unsigned int siomode, cmin, cmax, rate;
d->mode = d->reqmode;
d->round = d->reqround;
@@ -666,7 +666,7 @@ dev_close(struct dev *d)
void
dev_drain(struct dev *d)
{
- unsigned i;
+ unsigned int i;
struct ctl_slot *s;
for (i = 0, s = d->slot; i < CTL_NSLOT; i++, s++) {
@@ -715,8 +715,8 @@ dev_midiattach(struct dev *d, struct abuf *ibuf, struct abuf *obuf)
}
}
-unsigned
-dev_roundof(struct dev *d, unsigned newrate)
+unsigned int
+dev_roundof(struct dev *d, unsigned int newrate)
{
return (d->round * newrate + d->rate / 2) / d->rate;
}
@@ -902,7 +902,7 @@ dev_wakeup(struct dev *d)
*/
int
dev_getep(struct dev *d,
- unsigned mode, struct abuf **sibuf, struct abuf **sobuf)
+ unsigned int mode, struct abuf **sibuf, struct abuf **sobuf)
{
struct abuf *ibuf, *obuf;
@@ -974,7 +974,8 @@ dev_getep(struct dev *d,
* them underruns/overruns).
*/
void
-dev_sync(struct dev *d, unsigned mode, struct abuf *ibuf, struct abuf *obuf)
+dev_sync(struct dev *d, unsigned int mode,
+ struct abuf *ibuf, struct abuf *obuf)
{
int delta, offs;
struct abuf *mbuf = NULL;
@@ -1026,7 +1027,7 @@ dev_sync(struct dev *d, unsigned mode, struct abuf *ibuf, struct abuf *obuf)
* return the current latency (in frames), ie the latency that
* a stream would have if dev_attach() is called on it.
*
- * XXX: return a "unsigned", since result is always positive, isn't it?
+ * XXX: return a "unsigned int", since result is always positive, isn't it?
*/
int
dev_getpos(struct dev *d)
@@ -1047,14 +1048,14 @@ dev_getpos(struct dev *d)
* and rec.
*/
void
-dev_attach(struct dev *d, char *name, unsigned mode,
- struct abuf *ibuf, struct aparams *sipar, unsigned inch,
- struct abuf *obuf, struct aparams *sopar, unsigned onch,
- unsigned xrun, int vol)
+dev_attach(struct dev *d, char *name, unsigned int mode,
+ struct abuf *ibuf, struct aparams *sipar, unsigned int inch,
+ struct abuf *obuf, struct aparams *sopar, unsigned int onch,
+ unsigned int xrun, int vol)
{
struct aparams ipar, opar;
struct aproc *conv;
- unsigned round, nblk, nch;
+ unsigned int round, nblk, nch;
#ifdef DEBUG
if ((!APROC_OK(d->mix) && (mode & MODE_PLAY)) ||
@@ -1324,8 +1325,8 @@ dev_mkslot(struct dev *d, char *who)
char *s;
struct ctl_slot *slot;
char name[CTL_NAMEMAX];
- unsigned i, unit, umap = 0;
- unsigned ser, bestser, bestidx;
+ unsigned int i, unit, umap = 0;
+ unsigned int ser, bestser, bestidx;
/*
* create a ``valid'' control name (lowcase, remove [^a-z], trucate)
@@ -1483,7 +1484,7 @@ dev_slotdel(struct dev *d, int slot)
* can work because all streams have a slot
*/
void
-dev_slotvol(struct dev *d, int slot, unsigned vol)
+dev_slotvol(struct dev *d, int slot, unsigned int vol)
{
#ifdef DEBUG
if (debug_level >= 3) {
@@ -1507,7 +1508,7 @@ dev_slotvol(struct dev *d, int slot, unsigned vol)
int
dev_try(struct dev *d, int slot)
{
- unsigned i;
+ unsigned int i;
struct ctl_slot *s;
if (d->tstate != CTL_START) {
@@ -1624,7 +1625,7 @@ dev_mmcstart(struct dev *d)
void
dev_mmcstop(struct dev *d)
{
- unsigned i;
+ unsigned int i;
struct ctl_slot *s;
switch (d->tstate) {
@@ -1662,9 +1663,9 @@ dev_mmcstop(struct dev *d)
* relocate all slots simultaneously
*/
void
-dev_loc(struct dev *d, unsigned origin)
+dev_loc(struct dev *d, unsigned int origin)
{
- unsigned i;
+ unsigned int i;
struct ctl_slot *s;
#ifdef DEBUG
@@ -1707,7 +1708,7 @@ dev_onmove(void *arg, int delta)
}
void
-dev_master(struct dev *d, unsigned master)
+dev_master(struct dev *d, unsigned int master)
{
#ifdef DEBUG
if (debug_level >= 3) {
diff --git a/usr.bin/aucat/dev.h b/usr.bin/aucat/dev.h
index 68d5cda2887..cecedf175fd 100644
--- a/usr.bin/aucat/dev.h
+++ b/usr.bin/aucat/dev.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dev.h,v 1.35 2012/03/23 11:59:54 ratchov Exp $ */
+/* $OpenBSD: dev.h,v 1.36 2012/04/11 06:05:43 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -28,64 +28,64 @@ struct dev {
/*
* desired parameters
*/
- unsigned reqmode; /* mode */
+ unsigned int reqmode; /* mode */
struct aparams reqipar, reqopar; /* parameters */
- unsigned reqbufsz; /* buffer size */
- unsigned reqround; /* block size */
- unsigned hold; /* hold the device open ? */
- unsigned autovol; /* auto adjust playvol ? */
- unsigned autostart; /* don't wait for MMC start */
- unsigned refcnt; /* number of openers */
+ unsigned int reqbufsz; /* buffer size */
+ unsigned int reqround; /* block size */
+ unsigned int hold; /* hold the device open ? */
+ unsigned int autovol; /* auto adjust playvol ? */
+ unsigned int autostart; /* don't wait for MMC start */
+ unsigned int refcnt; /* number of openers */
#define DEV_NMAX 16 /* max number of devices */
- unsigned num; /* serial number */
+ unsigned int num; /* serial number */
#define DEV_CLOSED 0 /* closed */
#define DEV_INIT 1 /* stopped */
#define DEV_START 2 /* ready to start */
#define DEV_RUN 3 /* started */
- unsigned pstate; /* on of DEV_xxx */
+ unsigned int pstate; /* on of DEV_xxx */
char *path; /* sio path */
/*
* actual parameters and runtime state (i.e. once opened)
*/
- unsigned mode; /* bitmap of MODE_xxx */
- unsigned bufsz, round, rate;
+ unsigned int mode; /* bitmap of MODE_xxx */
+ unsigned int bufsz, round, rate;
struct aparams ipar, opar;
struct aproc *mix, *sub, *submon;
struct aproc *rec, *play, *mon;
struct aproc *midi;
struct devctl {
struct devctl *next;
- unsigned mode;
+ unsigned int mode;
char *path;
} *ctl_list;
/* volume control and MMC/MTC */
#define CTL_NSLOT 8
#define CTL_NAMEMAX 8
- unsigned serial;
+ unsigned int serial;
struct ctl_slot {
struct ctl_ops {
- void (*vol)(void *, unsigned);
+ void (*vol)(void *, unsigned int);
void (*start)(void *);
void (*stop)(void *);
- void (*loc)(void *, unsigned);
+ void (*loc)(void *, unsigned int);
void (*quit)(void *);
} *ops;
void *arg;
- unsigned unit;
+ unsigned int unit;
char name[CTL_NAMEMAX];
- unsigned serial;
- unsigned vol;
- unsigned tstate;
+ unsigned int serial;
+ unsigned int vol;
+ unsigned int tstate;
} slot[CTL_NSLOT];
#define CTL_OFF 0 /* ignore MMC messages */
#define CTL_STOP 1 /* stopped, can't start */
#define CTL_START 2 /* attempting to start */
#define CTL_RUN 3 /* started */
- unsigned tstate; /* one of above */
- unsigned origin; /* MTC start time */
- unsigned master; /* master volume controller */
+ unsigned int tstate; /* one of above */
+ unsigned int origin; /* MTC start time */
+ unsigned int master; /* master volume controller */
};
extern struct dev *dev_list;
@@ -98,28 +98,30 @@ void dev_unref(struct dev *);
void dev_del(struct dev *);
void dev_wakeup(struct dev *);
void dev_drain(struct dev *);
-struct dev *dev_new(char *, unsigned, unsigned, unsigned, unsigned, unsigned);
-void dev_adjpar(struct dev *, unsigned, struct aparams *, struct aparams *);
-int devctl_add(struct dev *, char *, unsigned);
+struct dev *dev_new(char *, unsigned int, unsigned int,
+ unsigned int, unsigned int, unsigned int);
+void dev_adjpar(struct dev *, unsigned int,
+ struct aparams *, struct aparams *);
+int devctl_add(struct dev *, char *, unsigned int);
void dev_midiattach(struct dev *, struct abuf *, struct abuf *);
-unsigned dev_roundof(struct dev *, unsigned);
+unsigned int dev_roundof(struct dev *, unsigned int);
int dev_getpos(struct dev *);
-void dev_attach(struct dev *, char *, unsigned,
- struct abuf *, struct aparams *, unsigned,
- struct abuf *, struct aparams *, unsigned,
- unsigned, int);
+void dev_attach(struct dev *, char *, unsigned int,
+ struct abuf *, struct aparams *, unsigned int,
+ struct abuf *, struct aparams *, unsigned int,
+ unsigned int, int);
void dev_setvol(struct dev *, struct abuf *, int);
void dev_slotdbg(struct dev *, int);
int dev_slotnew(struct dev *, char *, struct ctl_ops *, void *, int);
void dev_slotdel(struct dev *, int);
-void dev_slotvol(struct dev *, int, unsigned);
+void dev_slotvol(struct dev *, int, unsigned int);
int dev_slotstart(struct dev *, int);
void dev_slotstop(struct dev *, int);
void dev_mmcstart(struct dev *);
void dev_mmcstop(struct dev *);
-void dev_loc(struct dev *, unsigned);
-void dev_master(struct dev *, unsigned);
+void dev_loc(struct dev *, unsigned int);
+void dev_master(struct dev *, unsigned int);
#endif /* !define(DEV_H) */
diff --git a/usr.bin/aucat/file.c b/usr.bin/aucat/file.c
index 819800c2b28..cb535fc99cd 100644
--- a/usr.bin/aucat/file.c
+++ b/usr.bin/aucat/file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.29 2012/03/29 20:08:22 ratchov Exp $ */
+/* $OpenBSD: file.c,v 1.30 2012/04/11 06:05:43 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -72,7 +72,7 @@
struct timespec file_ts;
struct filelist file_list;
struct timo *timo_queue;
-unsigned timo_abstime;
+unsigned int timo_abstime;
int file_slowaccept = 0;
#ifdef DEBUG
long long file_wtime, file_utime;
@@ -95,10 +95,10 @@ timo_set(struct timo *o, void (*cb)(void *), void *arg)
* must not be already scheduled
*/
void
-timo_add(struct timo *o, unsigned delta)
+timo_add(struct timo *o, unsigned int delta)
{
struct timo **i;
- unsigned val;
+ unsigned int val;
int diff;
#ifdef DEBUG
@@ -151,7 +151,7 @@ timo_del(struct timo *o)
* calls expired timeouts
*/
void
-timo_update(unsigned delta)
+timo_update(unsigned int delta)
{
struct timo *to;
int diff;
@@ -232,7 +232,7 @@ file_dbg(struct file *f)
#endif
struct file *
-file_new(struct fileops *ops, char *name, unsigned nfds)
+file_new(struct fileops *ops, char *name, unsigned int nfds)
{
struct file *f;
@@ -591,10 +591,10 @@ filelist_done(void)
timo_done();
}
-unsigned
-file_read(struct file *f, unsigned char *data, unsigned count)
+unsigned int
+file_read(struct file *f, unsigned char *data, unsigned int count)
{
- unsigned n;
+ unsigned int n;
#ifdef DEBUG
struct timespec ts0, ts1;
long us;
@@ -625,10 +625,10 @@ file_read(struct file *f, unsigned char *data, unsigned count)
return n;
}
-unsigned
-file_write(struct file *f, unsigned char *data, unsigned count)
+unsigned int
+file_write(struct file *f, unsigned char *data, unsigned int count)
{
- unsigned n;
+ unsigned int n;
#ifdef DEBUG
struct timespec ts0, ts1;
long us;
diff --git a/usr.bin/aucat/file.h b/usr.bin/aucat/file.h
index fdaddfa6d46..723bdc7cda9 100644
--- a/usr.bin/aucat/file.h
+++ b/usr.bin/aucat/file.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.h,v 1.13 2012/03/29 20:08:22 ratchov Exp $ */
+/* $OpenBSD: file.h,v 1.14 2012/04/11 06:05:43 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -26,8 +26,8 @@ struct pollfd;
struct timo {
struct timo *next;
- unsigned val; /* time to wait before the callback */
- unsigned set; /* true if the timeout is set */
+ unsigned int val; /* time to wait before the callback */
+ unsigned int set; /* true if the timeout is set */
void (*cb)(void *arg); /* routine to call on expiration */
void *arg; /* argument to give to 'cb' */
};
@@ -36,8 +36,8 @@ struct fileops {
char *name;
size_t size;
void (*close)(struct file *);
- unsigned (*read)(struct file *, unsigned char *, unsigned);
- unsigned (*write)(struct file *, unsigned char *, unsigned);
+ unsigned int (*read)(struct file *, unsigned char *, unsigned int);
+ unsigned int (*write)(struct file *, unsigned char *, unsigned int);
void (*start)(struct file *, void (*)(void *, int), void *);
void (*stop)(struct file *);
int (*nfds)(struct file *);
@@ -55,10 +55,10 @@ struct file {
#define FILE_ZOMB 0x10 /* closed, but struct not freed */
#define FILE_RINUSE 0x20 /* inside rproc->ops->in() */
#define FILE_WINUSE 0x40 /* inside wproc->ops->out() */
- unsigned state; /* one of above */
+ unsigned int state; /* one of above */
#ifdef DEBUG
#define FILE_MAXCYCLES 20
- unsigned cycles; /* number of POLLIN/POLLOUT events */
+ unsigned int cycles; /* number of POLLIN/POLLOUT events */
#endif
char *name; /* for debug purposes */
struct aproc *rproc, *wproc; /* reader and/or writer */
@@ -75,20 +75,20 @@ extern long long file_wtime, file_utime;
#endif
void timo_set(struct timo *, void (*)(void *), void *);
-void timo_add(struct timo *, unsigned);
+void timo_add(struct timo *, unsigned int);
void timo_del(struct timo *);
void filelist_init(void);
void filelist_done(void);
void filelist_unlisten(void);
-struct file *file_new(struct fileops *, char *, unsigned);
+struct file *file_new(struct fileops *, char *, unsigned int);
void file_del(struct file *);
void file_dbg(struct file *);
void file_attach(struct file *, struct aproc *, struct aproc *);
-unsigned file_read(struct file *, unsigned char *, unsigned);
-unsigned file_write(struct file *, unsigned char *, unsigned);
+unsigned int file_read(struct file *, unsigned char *, unsigned int);
+unsigned int file_write(struct file *, unsigned char *, unsigned int);
int file_poll(void);
void file_eof(struct file *);
void file_hup(struct file *);
diff --git a/usr.bin/aucat/headers.c b/usr.bin/aucat/headers.c
index 12b0fd788d1..df958dc6648 100644
--- a/usr.bin/aucat/headers.c
+++ b/usr.bin/aucat/headers.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: headers.c,v 1.21 2011/10/14 10:54:12 ratchov Exp $ */
+/* $OpenBSD: headers.c,v 1.22 2012/04/11 06:05:43 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -76,10 +76,10 @@ char wav_guid[14] = {
};
int
-wav_readfmt(int fd, unsigned csize, struct aparams *par, short **map)
+wav_readfmt(int fd, unsigned int csize, struct aparams *par, short **map)
{
struct wavfmt fmt;
- unsigned nch, cmax, rate, bits, bps, enc;
+ unsigned int nch, cmax, rate, bits, bps, enc;
if (csize < WAV_FMT_SIZE) {
warnx("%u: bugus format chunk size", csize);
@@ -170,7 +170,7 @@ wav_readhdr(int fd, struct aparams *par, off_t *startpos, off_t *datasz, short *
{
struct wavriff riff;
struct wavchunk chunk;
- unsigned csize, rsize, pos = 0;
+ unsigned int csize, rsize, pos = 0;
int fmt_done = 0;
if (lseek(fd, 0, SEEK_SET) < 0) {
@@ -234,7 +234,7 @@ wav_readhdr(int fd, struct aparams *par, off_t *startpos, off_t *datasz, short *
int
wav_writehdr(int fd, struct aparams *par, off_t *startpos, off_t datasz)
{
- unsigned nch = par->cmax - par->cmin + 1;
+ unsigned int nch = par->cmax - par->cmin + 1;
struct {
struct wavriff riff;
struct wavchunk fmt_hdr;
diff --git a/usr.bin/aucat/listen.c b/usr.bin/aucat/listen.c
index 5c79e71407c..c34852ecae7 100644
--- a/usr.bin/aucat/listen.c
+++ b/usr.bin/aucat/listen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: listen.c,v 1.18 2012/03/29 20:08:22 ratchov Exp $ */
+/* $OpenBSD: listen.c,v 1.19 2012/04/11 06:05:43 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -96,9 +96,9 @@ listen_new_un(char *path)
}
void
-listen_new_tcp(char *addr, unsigned port)
+listen_new_tcp(char *addr, unsigned int port)
{
- char *host, serv[sizeof(unsigned) * 3 + 1];
+ char *host, serv[sizeof(unsigned int) * 3 + 1];
struct addrinfo *ailist, *ai, aihints;
struct listen *f;
int s, error, opt = 1, n = 0;
diff --git a/usr.bin/aucat/listen.h b/usr.bin/aucat/listen.h
index aa36f8df612..88de0278339 100644
--- a/usr.bin/aucat/listen.h
+++ b/usr.bin/aucat/listen.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: listen.h,v 1.8 2011/10/12 07:20:04 ratchov Exp $ */
+/* $OpenBSD: listen.h,v 1.9 2012/04/11 06:05:43 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -32,7 +32,7 @@ struct listen {
extern struct listen *listen_list;
void listen_new_un(char *);
-void listen_new_tcp(char *, unsigned);
+void listen_new_tcp(char *, unsigned int);
int listen_init(struct listen *);
int listen_nfds(struct file *);
int listen_pollfd(struct file *, struct pollfd *, int);
diff --git a/usr.bin/aucat/midi.c b/usr.bin/aucat/midi.c
index 1d8979044a2..8af7aad1e45 100644
--- a/usr.bin/aucat/midi.c
+++ b/usr.bin/aucat/midi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: midi.c,v 1.41 2012/03/23 11:59:54 ratchov Exp $ */
+/* $OpenBSD: midi.c,v 1.42 2012/04/11 06:05:43 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -68,8 +68,8 @@
/*
* length of voice and common messages (status byte included)
*/
-unsigned voice_len[] = { 3, 3, 3, 3, 2, 2, 3 };
-unsigned common_len[] = { 0, 2, 3, 2, 0, 0, 1, 1 };
+unsigned int voice_len[] = { 3, 3, 3, 3, 2, 2, 3 };
+unsigned int common_len[] = { 0, 2, 3, 2, 0, 0, 1, 1 };
/*
* call-back invoked periodically to implement throttling; at each invocation
@@ -81,7 +81,7 @@ midi_cb(void *addr)
{
struct aproc *p = (struct aproc *)addr;
struct abuf *i, *inext;
- unsigned tickets;
+ unsigned int tickets;
timo_add(&p->u.midi.timo, MIDITHRU_TIMO);
@@ -144,9 +144,10 @@ midi_msg_master(struct aproc *p, char *msg)
* send a message to the given output
*/
void
-midi_copy(struct abuf *ibuf, struct abuf *obuf, unsigned char *msg, unsigned len)
+midi_copy(struct abuf *ibuf, struct abuf *obuf, unsigned char *msg,
+ unsigned int len)
{
- unsigned ocount;
+ unsigned int ocount;
unsigned char *odata;
if (msg[0] == SYSEX_START)
@@ -206,7 +207,8 @@ midi_flush(struct aproc *p)
* ie. don't sent back the message to the sender
*/
void
-midi_send(struct aproc *p, struct abuf *ibuf, unsigned char *msg, unsigned len)
+midi_send(struct aproc *p, struct abuf *ibuf, unsigned char *msg,
+ unsigned int len)
{
struct abuf *i, *inext;
@@ -222,10 +224,10 @@ midi_send(struct aproc *p, struct abuf *ibuf, unsigned char *msg, unsigned len)
* send a quarter frame MTC message
*/
void
-midi_send_qfr(struct aproc *p, unsigned rate, int delta)
+midi_send_qfr(struct aproc *p, unsigned int rate, int delta)
{
unsigned char buf[2];
- unsigned data;
+ unsigned int data;
int qfrlen;
p->u.midi.delta += delta * MTC_SEC;
@@ -292,10 +294,11 @@ midi_send_qfr(struct aproc *p, unsigned rate, int delta)
* send a full frame MTC message
*/
void
-midi_send_full(struct aproc *p, unsigned origin, unsigned rate, unsigned round, unsigned pos)
+midi_send_full(struct aproc *p, unsigned int origin, unsigned int rate,
+ unsigned int round, unsigned int pos)
{
unsigned char buf[10];
- unsigned fps;
+ unsigned int fps;
p->u.midi.delta = MTC_SEC * pos;
if (rate % (30 * 4 * round) == 0) {
@@ -341,7 +344,7 @@ midi_send_full(struct aproc *p, unsigned origin, unsigned rate, unsigned round,
void
midi_copy_dump(struct aproc *p, struct abuf *obuf)
{
- unsigned i;
+ unsigned int i;
unsigned char msg[sizeof(struct sysex)];
struct ctl_slot *s;
@@ -368,7 +371,7 @@ midi_copy_dump(struct aproc *p, struct abuf *obuf)
* call-back.
*/
void
-midi_send_vol(struct aproc *p, int slot, unsigned vol)
+midi_send_vol(struct aproc *p, int slot, unsigned int vol)
{
unsigned char msg[3];
@@ -401,9 +404,9 @@ void
midi_onvoice(struct aproc *p, struct abuf *ibuf)
{
struct ctl_slot *slot;
- unsigned chan;
+ unsigned int chan;
#ifdef DEBUG
- unsigned i;
+ unsigned int i;
if (debug_level >= 3) {
abuf_dbg(ibuf);
@@ -435,9 +438,9 @@ void
midi_onsysex(struct aproc *p, struct abuf *ibuf)
{
struct sysex *x;
- unsigned fps, len;
+ unsigned int fps, len;
#ifdef DEBUG
- unsigned i;
+ unsigned int i;
if (debug_level >= 3) {
abuf_dbg(ibuf);
@@ -530,7 +533,7 @@ int
midi_in(struct aproc *p, struct abuf *ibuf)
{
unsigned char c, *idata;
- unsigned i, icount;
+ unsigned int i, icount;
if (!ABUF_ROK(ibuf))
return 0;
diff --git a/usr.bin/aucat/midi.h b/usr.bin/aucat/midi.h
index 0b409406c94..73a6fc8cd8a 100644
--- a/usr.bin/aucat/midi.h
+++ b/usr.bin/aucat/midi.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: midi.h,v 1.12 2012/03/23 11:59:54 ratchov Exp $ */
+/* $OpenBSD: midi.h,v 1.13 2012/04/11 06:05:43 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -23,10 +23,11 @@ struct aproc *midi_new(char *, struct dev *);
void midi_ontick(struct aproc *, int);
void midi_send_slot(struct aproc *, int);
-void midi_send_vol(struct aproc *, int, unsigned);
+void midi_send_vol(struct aproc *, int, unsigned int);
void midi_send_master(struct aproc *);
-void midi_send_full(struct aproc *, unsigned, unsigned, unsigned, unsigned);
-void midi_send_qfr(struct aproc *, unsigned, int);
+void midi_send_full(struct aproc *, unsigned int, unsigned int,
+ unsigned int, unsigned int);
+void midi_send_qfr(struct aproc *, unsigned int, int);
void midi_flush(struct aproc *);
#endif /* !defined(MIDI_H) */
diff --git a/usr.bin/aucat/miofile.c b/usr.bin/aucat/miofile.c
index 17f28077643..6238bbb5065 100644
--- a/usr.bin/aucat/miofile.c
+++ b/usr.bin/aucat/miofile.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: miofile.c,v 1.6 2011/06/20 20:18:44 ratchov Exp $ */
+/* $OpenBSD: miofile.c,v 1.7 2012/04/11 06:05:43 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -37,8 +37,8 @@ struct miofile {
};
void miofile_close(struct file *);
-unsigned miofile_read(struct file *, unsigned char *, unsigned);
-unsigned miofile_write(struct file *, unsigned char *, unsigned);
+unsigned int miofile_read(struct file *, unsigned char *, unsigned int);
+unsigned int miofile_write(struct file *, unsigned char *, unsigned int);
void miofile_start(struct file *);
void miofile_stop(struct file *);
int miofile_nfds(struct file *);
@@ -62,7 +62,7 @@ struct fileops miofile_ops = {
* open the device
*/
struct miofile *
-miofile_new(struct fileops *ops, char *path, unsigned mode)
+miofile_new(struct fileops *ops, char *path, unsigned int mode)
{
char *siopath;
struct mio_hdl *hdl;
@@ -82,11 +82,11 @@ miofile_new(struct fileops *ops, char *path, unsigned mode)
return NULL;
}
-unsigned
-miofile_read(struct file *file, unsigned char *data, unsigned count)
+unsigned int
+miofile_read(struct file *file, unsigned char *data, unsigned int count)
{
struct miofile *f = (struct miofile *)file;
- unsigned n;
+ unsigned int n;
n = mio_read(f->hdl, data, count);
if (n == 0) {
@@ -111,11 +111,11 @@ miofile_read(struct file *file, unsigned char *data, unsigned count)
}
-unsigned
-miofile_write(struct file *file, unsigned char *data, unsigned count)
+unsigned int
+miofile_write(struct file *file, unsigned char *data, unsigned int count)
{
struct miofile *f = (struct miofile *)file;
- unsigned n;
+ unsigned int n;
n = mio_write(f->hdl, data, count);
if (n == 0) {
diff --git a/usr.bin/aucat/miofile.h b/usr.bin/aucat/miofile.h
index a948fcc135b..5c59d4e1ca4 100644
--- a/usr.bin/aucat/miofile.h
+++ b/usr.bin/aucat/miofile.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: miofile.h,v 1.2 2011/06/20 20:18:44 ratchov Exp $ */
+/* $OpenBSD: miofile.h,v 1.3 2012/04/11 06:05:43 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -21,7 +21,7 @@ struct file;
struct fileops;
struct miofile;
-struct miofile *miofile_new(struct fileops *, char *, unsigned);
+struct miofile *miofile_new(struct fileops *, char *, unsigned int);
extern struct fileops miofile_ops;
diff --git a/usr.bin/aucat/opt.c b/usr.bin/aucat/opt.c
index 6bcf22b052c..fa4404fa47c 100644
--- a/usr.bin/aucat/opt.c
+++ b/usr.bin/aucat/opt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: opt.c,v 1.12 2011/11/15 08:05:22 ratchov Exp $ */
+/* $OpenBSD: opt.c,v 1.13 2012/04/11 06:05:43 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -30,10 +30,10 @@ struct opt *opt_list = NULL;
struct opt *
opt_new(char *name, struct dev *dev,
struct aparams *wpar, struct aparams *rpar,
- int maxweight, int mmc, int join, unsigned mode)
+ int maxweight, int mmc, int join, unsigned int mode)
{
struct opt *o, **po;
- unsigned len;
+ unsigned int len;
char c;
for (len = 0; name[len] != '\0'; len++) {
@@ -115,7 +115,7 @@ opt_new(char *name, struct dev *dev,
}
struct opt *
-opt_byname(char *name, unsigned num)
+opt_byname(char *name, unsigned int num)
{
struct opt *o;
diff --git a/usr.bin/aucat/opt.h b/usr.bin/aucat/opt.h
index adbbba392ec..934bd1f1728 100644
--- a/usr.bin/aucat/opt.h
+++ b/usr.bin/aucat/opt.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: opt.h,v 1.11 2011/11/15 08:05:22 ratchov Exp $ */
+/* $OpenBSD: opt.h,v 1.12 2012/04/11 06:05:43 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -31,15 +31,15 @@ struct opt {
struct aparams rpar; /* template for clients read params */
int mmc; /* true if MMC control enabled */
int join; /* true if join/expand enabled */
- unsigned mode; /* bitmap of MODE_XXX */
+ unsigned int mode; /* bitmap of MODE_XXX */
struct dev *dev; /* device to which we're attached */
};
extern struct opt *opt_list;
struct opt *opt_new(char *, struct dev *, struct aparams *, struct aparams *,
- int, int, int, unsigned);
+ int, int, int, unsigned int);
int opt_bind(struct opt *);
-struct opt *opt_byname(char *, unsigned);
+struct opt *opt_byname(char *, unsigned int);
#endif /* !defined(OPT_H) */
diff --git a/usr.bin/aucat/pipe.c b/usr.bin/aucat/pipe.c
index 528f7f47688..efe777a6563 100644
--- a/usr.bin/aucat/pipe.c
+++ b/usr.bin/aucat/pipe.c
@@ -57,8 +57,8 @@ pipe_new(struct fileops *ops, int fd, char *name)
return f;
}
-unsigned
-pipe_read(struct file *file, unsigned char *data, unsigned count)
+unsigned int
+pipe_read(struct file *file, unsigned char *data, unsigned int count)
{
struct pipe *f = (struct pipe *)file;
int n;
@@ -87,8 +87,8 @@ pipe_read(struct file *file, unsigned char *data, unsigned count)
}
-unsigned
-pipe_write(struct file *file, unsigned char *data, unsigned count)
+unsigned int
+pipe_write(struct file *file, unsigned char *data, unsigned int count)
{
struct pipe *f = (struct pipe *)file;
int n;
diff --git a/usr.bin/aucat/pipe.h b/usr.bin/aucat/pipe.h
index 63ecb85b7ad..02c7c447f8b 100644
--- a/usr.bin/aucat/pipe.h
+++ b/usr.bin/aucat/pipe.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pipe.h,v 1.5 2010/04/06 20:07:01 ratchov Exp $ */
+/* $OpenBSD: pipe.h,v 1.6 2012/04/11 06:05:43 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -28,8 +28,8 @@ extern struct fileops pipe_ops;
struct pipe *pipe_new(struct fileops *, int, char *);
void pipe_close(struct file *);
-unsigned pipe_read(struct file *, unsigned char *, unsigned);
-unsigned pipe_write(struct file *, unsigned char *, unsigned);
+unsigned int pipe_read(struct file *, unsigned char *, unsigned int);
+unsigned int pipe_write(struct file *, unsigned char *, unsigned int);
int pipe_nfds(struct file *);
int pipe_pollfd(struct file *, struct pollfd *, int);
int pipe_revents(struct file *, struct pollfd *);
diff --git a/usr.bin/aucat/siofile.c b/usr.bin/aucat/siofile.c
index 412bc23d813..2517f0f9734 100644
--- a/usr.bin/aucat/siofile.c
+++ b/usr.bin/aucat/siofile.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: siofile.c,v 1.9 2011/11/20 22:54:51 ratchov Exp $ */
+/* $OpenBSD: siofile.c,v 1.10 2012/04/11 06:05:43 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -38,9 +38,9 @@
struct siofile {
struct file file;
struct sio_hdl *hdl;
- unsigned wtickets, wbpf;
- unsigned rtickets, rbpf;
- unsigned bufsz;
+ unsigned int wtickets, wbpf;
+ unsigned int rtickets, rbpf;
+ unsigned int bufsz;
int started;
void (*onmove)(void *, int);
void *arg;
@@ -50,8 +50,8 @@ struct siofile {
};
void siofile_close(struct file *);
-unsigned siofile_read(struct file *, unsigned char *, unsigned);
-unsigned siofile_write(struct file *, unsigned char *, unsigned);
+unsigned int siofile_read(struct file *, unsigned char *, unsigned int);
+unsigned int siofile_write(struct file *, unsigned char *, unsigned int);
void siofile_start(struct file *, void (*)(void *, int), void *);
void siofile_stop(struct file *);
int siofile_nfds(struct file *);
@@ -205,15 +205,15 @@ siofile_cb(void *addr, int delta)
* Open the device.
*/
struct siofile *
-siofile_new(struct fileops *ops, char *path, unsigned *rmode,
+siofile_new(struct fileops *ops, char *path, unsigned int *rmode,
struct aparams *ipar, struct aparams *opar,
- unsigned *bufsz, unsigned *round)
+ unsigned int *bufsz, unsigned int *round)
{
char *siopath;
struct sio_par par;
struct sio_hdl *hdl;
struct siofile *f;
- unsigned mode = *rmode;
+ unsigned int mode = *rmode;
siopath = (strcmp(path, "default") == 0) ? NULL : path;
hdl = sio_open(siopath, mode, 1);
@@ -357,11 +357,11 @@ siofile_stop(struct file *file)
#endif
}
-unsigned
-siofile_read(struct file *file, unsigned char *data, unsigned count)
+unsigned int
+siofile_read(struct file *file, unsigned char *data, unsigned int count)
{
struct siofile *f = (struct siofile *)file;
- unsigned n;
+ unsigned int n;
#ifdef DEBUG
if (f->rtickets == 0) {
@@ -405,11 +405,11 @@ siofile_read(struct file *file, unsigned char *data, unsigned count)
}
-unsigned
-siofile_write(struct file *file, unsigned char *data, unsigned count)
+unsigned int
+siofile_write(struct file *file, unsigned char *data, unsigned int count)
{
struct siofile *f = (struct siofile *)file;
- unsigned n;
+ unsigned int n;
#ifdef DEBUG
if (f->wtickets == 0) {
diff --git a/usr.bin/aucat/siofile.h b/usr.bin/aucat/siofile.h
index c2242887b2e..203a8abd1c1 100644
--- a/usr.bin/aucat/siofile.h
+++ b/usr.bin/aucat/siofile.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: siofile.h,v 1.5 2010/05/02 11:54:26 ratchov Exp $ */
+/* $OpenBSD: siofile.h,v 1.6 2012/04/11 06:05:43 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -22,8 +22,8 @@ struct siofile;
struct aparams;
struct aproc;
-struct siofile *siofile_new(struct fileops *, char *, unsigned *,
- struct aparams *, struct aparams *, unsigned *, unsigned *);
+struct siofile *siofile_new(struct fileops *, char *, unsigned int *,
+ struct aparams *, struct aparams *, unsigned int *, unsigned int *);
struct aproc *rsio_new(struct file *f);
struct aproc *wsio_new(struct file *f);
diff --git a/usr.bin/aucat/sock.c b/usr.bin/aucat/sock.c
index 1b91f899c20..5b997879f4d 100644
--- a/usr.bin/aucat/sock.c
+++ b/usr.bin/aucat/sock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sock.c,v 1.62 2011/11/20 22:54:51 ratchov Exp $ */
+/* $OpenBSD: sock.c,v 1.63 2012/04/11 06:05:43 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -77,11 +77,11 @@ sock_dbg(struct sock *f)
}
#endif
-void sock_setvol(void *, unsigned);
+void sock_setvol(void *, unsigned int);
void sock_startreq(void *);
void sock_stopreq(void *);
void sock_quitreq(void *);
-void sock_locreq(void *, unsigned);
+void sock_locreq(void *, unsigned int);
struct ctl_ops ctl_sockops = {
sock_setvol,
@@ -91,7 +91,7 @@ struct ctl_ops ctl_sockops = {
sock_quitreq
};
-unsigned sock_sesrefs = 0; /* connections to the session */
+unsigned int sock_sesrefs = 0; /* connections to the session */
uint8_t sock_sescookie[AMSG_COOKIELEN]; /* owner of the session */
void
@@ -389,7 +389,7 @@ void
sock_allocbuf(struct sock *f)
{
struct abuf *rbuf = NULL, *wbuf = NULL;
- unsigned bufsz;
+ unsigned int bufsz;
bufsz = f->bufsz + f->dev->bufsz / f->dev->round * f->round;
f->pstate = SOCK_START;
@@ -435,7 +435,7 @@ sock_allocbuf(struct sock *f)
* Set volume. Callback invoked when volume is modified externally
*/
void
-sock_setvol(void *arg, unsigned vol)
+sock_setvol(void *arg, unsigned int vol)
{
struct sock *f = (struct sock *)arg;
struct abuf *rbuf;
@@ -492,7 +492,7 @@ sock_stopreq(void *arg)
* Callback invoked by MMC relocate, ignored
*/
void
-sock_locreq(void *arg, unsigned mmcpos)
+sock_locreq(void *arg, unsigned int mmcpos)
{
#ifdef DEBUG
struct sock *f = (struct sock *)arg;
@@ -528,7 +528,7 @@ void
sock_attach(struct sock *f, int force)
{
struct abuf *rbuf, *wbuf;
- unsigned rch, wch;
+ unsigned int rch, wch;
rbuf = LIST_FIRST(&f->pipe.file.rproc->outs);
wbuf = LIST_FIRST(&f->pipe.file.wproc->ins);
@@ -606,7 +606,7 @@ sock_reset(struct sock *f)
int
sock_rmsg(struct sock *f)
{
- unsigned count;
+ unsigned int count;
unsigned char *data;
while (f->rtodo > 0) {
@@ -643,9 +643,9 @@ sock_rmsg(struct sock *f)
* points to the f->rtodo or f->wtodo respectively.
*/
int
-sock_wmsg(struct sock *f, struct amsg *m, unsigned *ptodo)
+sock_wmsg(struct sock *f, struct amsg *m, unsigned int *ptodo)
{
- unsigned count;
+ unsigned int count;
unsigned char *data;
while (*ptodo > 0) {
@@ -685,7 +685,7 @@ sock_rdata(struct sock *f)
{
struct aproc *p;
struct abuf *obuf;
- unsigned n;
+ unsigned int n;
#ifdef DEBUG
if (f->rtodo == 0) {
@@ -719,7 +719,7 @@ sock_wdata(struct sock *f)
{
struct aproc *p;
struct abuf *ibuf;
- unsigned n;
+ unsigned int n;
#ifdef DEBUG
if (f->wtodo == 0) {
@@ -753,7 +753,7 @@ int
sock_setpar(struct sock *f)
{
struct amsg_par *p = &f->rmsg.u.par;
- unsigned min, max, rate, pchan, rchan, appbufsz;
+ unsigned int min, max, rate, pchan, rchan, appbufsz;
rchan = ntohs(p->rchan);
pchan = ntohs(p->pchan);
@@ -983,7 +983,7 @@ int
sock_hello(struct sock *f)
{
struct amsg_hello *p = &f->rmsg.u.hello;
- unsigned mode;
+ unsigned int mode;
mode = ntohs(p->mode);
#ifdef DEBUG
@@ -1093,7 +1093,7 @@ sock_execmsg(struct sock *f)
{
struct amsg *m = &f->rmsg;
struct abuf *obuf;
- unsigned size, ctl;
+ unsigned int size, ctl;
switch (ntohl(m->cmd)) {
case AMSG_DATA:
@@ -1421,7 +1421,7 @@ sock_buildmsg(struct sock *f)
{
struct aproc *p;
struct abuf *ibuf;
- unsigned size, max;
+ unsigned int size, max;
/*
* Send initial position
diff --git a/usr.bin/aucat/sock.h b/usr.bin/aucat/sock.h
index e844850fbb2..95538f13086 100644
--- a/usr.bin/aucat/sock.h
+++ b/usr.bin/aucat/sock.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sock.h,v 1.19 2011/04/28 06:19:57 ratchov Exp $ */
+/* $OpenBSD: sock.h,v 1.20 2012/04/11 06:05:43 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -30,18 +30,18 @@ struct sock {
* to decode/encode messages in the stream.
*/
struct amsg rmsg, wmsg; /* messages being sent/received */
- unsigned wmax; /* max frames we're allowed to write */
- unsigned rmax; /* max frames we're allowed to read */
- unsigned rtodo; /* input bytes not read yet */
- unsigned wtodo; /* output bytes not written yet */
+ unsigned int wmax; /* max frames we're allowed to write */
+ unsigned int rmax; /* max frames we're allowed to read */
+ unsigned int rtodo; /* input bytes not read yet */
+ unsigned int wtodo; /* output bytes not written yet */
#define SOCK_RDATA 0 /* data chunk being read */
#define SOCK_RMSG 1 /* amsg query being processed */
#define SOCK_RRET 2 /* amsg reply being returned */
- unsigned rstate; /* state of the read-end FSM */
+ unsigned int rstate; /* state of the read-end FSM */
#define SOCK_WIDLE 0 /* nothing to do */
#define SOCK_WMSG 1 /* amsg being written */
#define SOCK_WDATA 2 /* data chunk being written */
- unsigned wstate; /* state of the write-end FSM */
+ unsigned int wstate; /* state of the write-end FSM */
#define SOCK_AUTH 0 /* waiting for AUTH message */
#define SOCK_HELLO 1 /* waiting for HELLO message */
#define SOCK_INIT 2 /* parameter negotiation */
@@ -50,18 +50,18 @@ struct sock {
#define SOCK_RUN 5 /* attached to the mix / sub */
#define SOCK_STOP 6 /* draining rec buffers */
#define SOCK_MIDI 7 /* raw byte stream (midi) */
- unsigned pstate; /* one of the above */
- unsigned mode; /* bitmask of MODE_XXX */
+ unsigned int pstate; /* one of the above */
+ unsigned int mode; /* bitmask of MODE_XXX */
struct aparams rpar; /* read (ie play) parameters */
struct aparams wpar; /* write (ie rec) parameters */
int delta; /* pos. change to send */
int startpos; /* initial pos. to send */
int tickpending; /* delta waiting to be transmitted */
int startpending; /* initial delta waiting to be transmitted */
- unsigned walign; /* align data packets to this */
- unsigned bufsz; /* total buffer size */
- unsigned round; /* block size */
- unsigned xrun; /* one of AMSG_IGNORE, ... */
+ unsigned int walign; /* align data packets to this */
+ unsigned int bufsz; /* total buffer size */
+ unsigned int round; /* block size */
+ unsigned int xrun; /* one of AMSG_IGNORE, ... */
int vol; /* requested volume */
int lastvol; /* last volume */
int slot; /* mixer ctl slot number */
diff --git a/usr.bin/aucat/wav.c b/usr.bin/aucat/wav.c
index 27e0a2423bd..13a80916560 100644
--- a/usr.bin/aucat/wav.c
+++ b/usr.bin/aucat/wav.c
@@ -137,10 +137,10 @@ void wwav_hup(struct aproc *, struct abuf *);
void wwav_done(struct aproc *);
struct aproc *wwav_new(struct file *);
-void wav_setvol(void *, unsigned);
+void wav_setvol(void *, unsigned int);
void wav_startreq(void *);
void wav_stopreq(void *);
-void wav_locreq(void *, unsigned);
+void wav_locreq(void *, unsigned int);
void wav_quitreq(void *);
struct ctl_ops ctl_wavops = {
@@ -201,9 +201,9 @@ wav_dbg(struct wav *f)
* convert ``count'' samples using the given char->short map
*/
void
-wav_conv(unsigned char *data, unsigned count, short *map)
+wav_conv(unsigned char *data, unsigned int count, short *map)
{
- unsigned i;
+ unsigned int i;
unsigned char *iptr;
adata_t *optr;
@@ -219,11 +219,11 @@ wav_conv(unsigned char *data, unsigned count, short *map)
/*
* read method of the file structure
*/
-unsigned
-wav_read(struct file *file, unsigned char *data, unsigned count)
+unsigned int
+wav_read(struct file *file, unsigned char *data, unsigned int count)
{
struct wav *f = (struct wav *)file;
- unsigned n;
+ unsigned int n;
if (f->map)
count /= sizeof(adata_t);
@@ -256,11 +256,11 @@ wav_read(struct file *file, unsigned char *data, unsigned count)
/*
* write method of the file structure
*/
-unsigned
-wav_write(struct file *file, unsigned char *data, unsigned count)
+unsigned int
+wav_write(struct file *file, unsigned char *data, unsigned int count)
{
struct wav *f = (struct wav *)file;
- unsigned n;
+ unsigned int n;
if (f->wbytes >= 0 && count > f->wbytes) {
count = f->wbytes; /* wbytes fits in count */
@@ -383,7 +383,7 @@ wav_allocbuf(struct wav *f)
{
struct abuf *buf;
struct dev *d = f->dev;
- unsigned nfr;
+ unsigned int nfr;
f->pstate = WAV_START;
if (f->mode & MODE_PLAY) {
@@ -616,7 +616,7 @@ wav_wdata(struct wav *f)
* callback to set the volume, invoked by the MIDI control code
*/
void
-wav_setvol(void *arg, unsigned vol)
+wav_setvol(void *arg, unsigned int vol)
{
struct wav *f = (struct wav *)arg;
struct abuf *rbuf;
@@ -692,7 +692,7 @@ wav_stopreq(void *arg)
* on a stopped stream
*/
void
-wav_locreq(void *arg, unsigned mmc)
+wav_locreq(void *arg, unsigned int mmc)
{
struct wav *f = (struct wav *)arg;
@@ -730,7 +730,7 @@ wav_quitreq(void *arg)
* determine the header by the file name
*/
int
-wav_autohdr(char *name, struct dev *dev, unsigned *hdr, unsigned *mode)
+wav_autohdr(char *name, struct dev *dev, unsigned int *hdr, unsigned int *mode)
{
char *ext;
@@ -769,8 +769,9 @@ wav_autohdr(char *name, struct dev *dev, unsigned *hdr, unsigned *mode)
*/
struct wav *
wav_new_in(struct fileops *ops, struct dev *dev,
- unsigned mode, char *name, unsigned hdr,
- struct aparams *par, unsigned xrun, unsigned volctl, int mmc, int join)
+ unsigned int mode, char *name, unsigned int hdr,
+ struct aparams *par, unsigned int xrun,
+ unsigned int volctl, int mmc, int join)
{
int fd;
struct wav *f;
@@ -853,8 +854,8 @@ wav_new_in(struct fileops *ops, struct dev *dev,
*/
struct wav *
wav_new_out(struct fileops *ops, struct dev *dev,
- unsigned mode, char *name, unsigned hdr,
- struct aparams *par, unsigned xrun, int mmc, int join)
+ unsigned int mode, char *name, unsigned int hdr,
+ struct aparams *par, unsigned int xrun, int mmc, int join)
{
int fd;
struct wav *f;
diff --git a/usr.bin/aucat/wav.h b/usr.bin/aucat/wav.h
index 6d721e1ac65..2e9ca346aeb 100644
--- a/usr.bin/aucat/wav.h
+++ b/usr.bin/aucat/wav.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: wav.h,v 1.12 2011/10/12 07:20:04 ratchov Exp $ */
+/* $OpenBSD: wav.h,v 1.13 2012/04/11 06:05:43 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -28,8 +28,8 @@ struct wav {
#define HDR_AUTO 0 /* guess by looking at the file name */
#define HDR_RAW 1 /* no headers, ie openbsd native ;-) */
#define HDR_WAV 2 /* microsoft riff wave */
- unsigned hdr; /* HDR_RAW or HDR_WAV */
- unsigned xrun; /* xrun policy */
+ unsigned int hdr; /* HDR_RAW or HDR_WAV */
+ unsigned int xrun; /* xrun policy */
struct aparams hpar; /* parameters to write on the header */
off_t rbytes; /* bytes to read, -1 if no limit */
off_t wbytes; /* bytes to write, -1 if no limit */
@@ -40,16 +40,16 @@ struct wav {
int slot; /* mixer ctl slot number */
int mmc; /* use MMC control */
int join; /* join/expand channels */
- unsigned vol; /* current volume */
- unsigned maxweight; /* dynamic range when vol == 127 */
+ unsigned int vol; /* current volume */
+ unsigned int maxweight; /* dynamic range when vol == 127 */
#define WAV_CFG 0 /* parameters read from headers */
#define WAV_INIT 1 /* not trying to do anything */
#define WAV_START 2 /* buffer allocated */
#define WAV_READY 3 /* buffer filled enough */
#define WAV_RUN 4 /* buffer attached to device */
#define WAV_MIDI 5 /* midi "syx" file */
- unsigned pstate; /* one of above */
- unsigned mode; /* bitmap of MODE_* */
+ unsigned int pstate; /* one of above */
+ unsigned int mode; /* bitmap of MODE_* */
struct dev *dev; /* device playing or recording */
};
@@ -57,15 +57,17 @@ extern struct fileops wav_ops;
struct wav *wav_list;
struct wav *wav_new_in(struct fileops *, struct dev *,
- unsigned, char *, unsigned, struct aparams *, unsigned, unsigned, int, int);
+ unsigned int, char *, unsigned int, struct aparams *,
+ unsigned int, unsigned int, int, int);
struct wav *wav_new_out(struct fileops *, struct dev *,
- unsigned, char *, unsigned, struct aparams *, unsigned, int, int);
-unsigned wav_read(struct file *, unsigned char *, unsigned);
-unsigned wav_write(struct file *, unsigned char *, unsigned);
+ unsigned int, char *, unsigned int, struct aparams *,
+ unsigned int, int, int);
+unsigned int wav_read(struct file *, unsigned char *, unsigned int);
+unsigned int wav_write(struct file *, unsigned char *, unsigned int);
void wav_close(struct file *);
int wav_readhdr(int, struct aparams *, off_t *, off_t *, short **);
int wav_writehdr(int, struct aparams *, off_t *, off_t);
-void wav_conv(unsigned char *, unsigned, short *);
+void wav_conv(unsigned char *, unsigned int, short *);
int wav_init(struct wav *);
extern short wav_ulawmap[256];