diff options
author | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2016-01-08 16:17:32 +0000 |
---|---|---|
committer | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2016-01-08 16:17:32 +0000 |
commit | a1e390b526321b81ff09163c7bf503527a48f9d1 (patch) | |
tree | 3bd80fe6329d22a6d13cefc9886145dd364181a9 /usr.bin | |
parent | cdb0894333b807aadc73cc7166ec09f4edb2936c (diff) |
Make code fit in 80 columns, remove trailing spaces & tabs.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/sndiod/abuf.c | 4 | ||||
-rw-r--r-- | usr.bin/sndiod/dev.c | 34 | ||||
-rw-r--r-- | usr.bin/sndiod/dev.h | 6 | ||||
-rw-r--r-- | usr.bin/sndiod/dsp.c | 9 | ||||
-rw-r--r-- | usr.bin/sndiod/dsp.h | 8 | ||||
-rw-r--r-- | usr.bin/sndiod/fdpass.c | 4 | ||||
-rw-r--r-- | usr.bin/sndiod/file.c | 8 | ||||
-rw-r--r-- | usr.bin/sndiod/file.h | 6 | ||||
-rw-r--r-- | usr.bin/sndiod/listen.c | 12 | ||||
-rw-r--r-- | usr.bin/sndiod/midi.c | 12 | ||||
-rw-r--r-- | usr.bin/sndiod/siofile.c | 8 | ||||
-rw-r--r-- | usr.bin/sndiod/sndiod.c | 15 | ||||
-rw-r--r-- | usr.bin/sndiod/sock.c | 14 | ||||
-rw-r--r-- | usr.bin/sndiod/utils.c | 6 |
14 files changed, 74 insertions, 72 deletions
diff --git a/usr.bin/sndiod/abuf.c b/usr.bin/sndiod/abuf.c index 710c1da81ac..42f5c6f3b94 100644 --- a/usr.bin/sndiod/abuf.c +++ b/usr.bin/sndiod/abuf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: abuf.c,v 1.3 2015/02/16 06:11:33 ratchov Exp $ */ +/* $OpenBSD: abuf.c,v 1.4 2016/01/08 16:17:31 ratchov Exp $ */ /* * Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org> * @@ -53,7 +53,7 @@ abuf_init(struct abuf *buf, unsigned int len) void abuf_done(struct abuf *buf) { -#ifdef DEBUG +#ifdef DEBUG if (buf->used > 0) { if (log_level >= 3) { log_puts("deleting non-empty buffer, used = "); diff --git a/usr.bin/sndiod/dev.c b/usr.bin/sndiod/dev.c index 8a23f6e9e98..1c038c17900 100644 --- a/usr.bin/sndiod/dev.c +++ b/usr.bin/sndiod/dev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dev.c,v 1.22 2015/11/25 18:51:08 ratchov Exp $ */ +/* $OpenBSD: dev.c,v 1.23 2016/01/08 16:17:31 ratchov Exp $ */ /* * Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org> * @@ -547,12 +547,12 @@ slot_skip(struct slot *s) if (s->mode & MODE_PLAY) { abuf_rdiscard(&s->mix.buf, s->round * s->mix.bpf); } - s->skip--; + s->skip--; } return max - s->skip; } -int +int play_filt_resamp(struct slot *s, void *res_in, void *out, int todo) { int i, offs, vol, nch; @@ -582,7 +582,7 @@ play_filt_resamp(struct slot *s, void *res_in, void *out, int todo) return todo; } -int +int play_filt_dec(struct slot *s, void *in, void *out, int todo) { void *tmp; @@ -663,7 +663,7 @@ dev_mix_adjvol(struct dev *d) } } -int +int rec_filt_resamp(struct slot *s, void *in, void *res_out, int todo) { int i, vol, offs, nch; @@ -692,7 +692,7 @@ rec_filt_resamp(struct slot *s, void *in, void *res_out, int todo) return todo; } -int +int rec_filt_enc(struct slot *s, void *in, void *out, int todo) { void *tmp; @@ -847,11 +847,11 @@ dev_cycle(struct dev *d) dev_mix_adjvol(d); continue; } - + /* * check for xruns */ - if (((s->mode & MODE_PLAY) && + if (((s->mode & MODE_PLAY) && s->mix.buf.used < s->round * s->mix.bpf) || ((s->mode & MODE_RECMASK) && s->sub.buf.len - s->sub.buf.used < @@ -917,7 +917,7 @@ void dev_onmove(struct dev *d, int delta) { long long pos; - struct slot *s, *snext; + struct slot *s, *snext; d->delta += delta; @@ -1286,11 +1286,11 @@ dev_wakeup(struct dev *d) } d->poffs = 0; - /* + /* * empty cycles don't increment delta, so it's ok to * start at 0 **/ - d->delta = 0; + d->delta = 0; d->pstate = DEV_RUN; dev_sio_start(d); @@ -1608,7 +1608,7 @@ slot_attach(struct slot *s) * start the device if not started */ dev_wakeup(d); - + /* * get the current position, the origin is when the first sample * played and/or recorded @@ -1710,7 +1710,7 @@ slot_attach(struct slot *s) s->sub.encbuf = xmalloc(s->round * slot_nch * sizeof(adata_t)); } - + /* * N-th recorded block is the N-th played block */ @@ -1728,7 +1728,7 @@ slot_ready(struct slot *s) /* * device may be disconnected, and if so we're called from * slot->ops->exit() on a closed device - */ + */ if (s->dev->pstate == DEV_CFG) return; if (s->tstate == MMC_OFF) @@ -1769,7 +1769,7 @@ slot_start(struct slot *s) log_puts("\n"); } #endif - s->mix.bpf = s->par.bps * + s->mix.bpf = s->par.bps * (s->mix.slot_cmax - s->mix.slot_cmin + 1); abuf_init(&s->mix.buf, bufsz * s->mix.bpf); } @@ -1784,7 +1784,7 @@ slot_start(struct slot *s) log_puts("\n"); } #endif - s->sub.bpf = s->par.bps * + s->sub.bpf = s->par.bps * (s->sub.slot_cmax - s->sub.slot_cmin + 1); abuf_init(&s->sub.buf, bufsz * s->sub.bpf); } @@ -1829,7 +1829,7 @@ slot_detach(struct slot *s) panic(); } #endif - } + } *ps = s->next; if (s->mode & MODE_RECMASK) { if (s->sub.encbuf) diff --git a/usr.bin/sndiod/dev.h b/usr.bin/sndiod/dev.h index 01f25e8fac8..05ce08471f4 100644 --- a/usr.bin/sndiod/dev.h +++ b/usr.bin/sndiod/dev.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dev.h,v 1.9 2015/02/16 06:28:05 ratchov Exp $ */ +/* $OpenBSD: dev.h,v 1.10 2016/01/08 16:17:31 ratchov Exp $ */ /* * Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org> * @@ -42,7 +42,7 @@ struct slot { void *arg; /* user data for callbacks */ struct aparams par; /* socket side params */ struct { - int weight; /* dynamic range */ + int weight; /* dynamic range */ int maxweight; /* max dynamic range allowed */ unsigned int vol; /* volume within the vol */ struct abuf buf; /* socket side buffer */ @@ -105,7 +105,7 @@ struct dev { /* * audio device (while opened) - */ + */ struct dev_sio sio; struct aparams par; /* encoding */ int pchan, rchan; /* play & rec channels */ diff --git a/usr.bin/sndiod/dsp.c b/usr.bin/sndiod/dsp.c index 1403230f38e..2373eaf4260 100644 --- a/usr.bin/sndiod/dsp.c +++ b/usr.bin/sndiod/dsp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dsp.c,v 1.8 2014/10/12 21:52:27 ratchov Exp $ */ +/* $OpenBSD: dsp.c,v 1.9 2016/01/08 16:17:31 ratchov Exp $ */ /* * Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org> * @@ -296,7 +296,8 @@ resamp_do(struct resamp *p, adata_t *in, adata_t *out, int todo) * initialize resampler with ibufsz/obufsz factor and "nch" channels */ void -resamp_init(struct resamp *p, unsigned int iblksz, unsigned int oblksz, int nch) +resamp_init(struct resamp *p, unsigned int iblksz, + unsigned int oblksz, int nch) { unsigned int i; @@ -446,7 +447,7 @@ enc_init(struct conv *p, struct aparams *par, int nch) p->bias = (1U << 31) >> p->shift; } else { p->bias = 0; - } + } if (!par->le) { p->bfirst = par->bps - 1; p->bnext = -1; @@ -539,7 +540,7 @@ dec_init(struct conv *p, struct aparams *par, int nch) p->bias = (1U << 31) >> p->shift; } else { p->bias = 0; - } + } if (par->le) { p->bfirst = par->bps - 1; p->bnext = -1; diff --git a/usr.bin/sndiod/dsp.h b/usr.bin/sndiod/dsp.h index 93f06566786..c61c0ed327e 100644 --- a/usr.bin/sndiod/dsp.h +++ b/usr.bin/sndiod/dsp.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dsp.h,v 1.4 2014/10/12 21:52:27 ratchov Exp $ */ +/* $OpenBSD: dsp.h,v 1.5 2016/01/08 16:17:31 ratchov Exp $ */ /* * Copyright (c) 2012 Alexandre Ratchov <alex@caoua.org> * @@ -105,9 +105,9 @@ typedef int adata_t; struct aparams { 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 le; /* 1 if little endian, else be */ unsigned int sig; /* 1 if signed, 0 if unsigned */ - unsigned int msb; /* 1 if msb justified, 0 if lsb justified */ + unsigned int msb; /* 1 if msb justified, else lsb */ }; struct resamp { @@ -124,7 +124,7 @@ struct conv { int bfirst; /* bytes to skip at startup */ unsigned int bps; /* bytes per sample */ unsigned int shift; /* shift to get 32bit MSB */ - unsigned int bias; /* bias of unsigned samples */ + unsigned int bias; /* bias of unsigned samples */ int bnext; /* to reach the next byte */ int snext; /* to reach the next sample */ int nch; diff --git a/usr.bin/sndiod/fdpass.c b/usr.bin/sndiod/fdpass.c index 7fb851121a8..4e1970dd20b 100644 --- a/usr.bin/sndiod/fdpass.c +++ b/usr.bin/sndiod/fdpass.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fdpass.c,v 1.2 2015/12/23 11:26:42 ratchov Exp $ */ +/* $OpenBSD: fdpass.c,v 1.3 2016/01/08 16:17:31 ratchov Exp $ */ /* * Copyright (c) 2015 Alexandre Ratchov <alex@caoua.org> * @@ -298,7 +298,7 @@ fdpass_in_helper(void *arg) struct port *p; if (!fdpass_recv(f, &cmd, &num, &mode, &fd)) - return; + return; switch (cmd) { case FDPASS_OPEN_SND: d = dev_bynum(num); diff --git a/usr.bin/sndiod/file.c b/usr.bin/sndiod/file.c index fc38c10c0a1..faa671e2ec0 100644 --- a/usr.bin/sndiod/file.c +++ b/usr.bin/sndiod/file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: file.c,v 1.18 2016/01/08 13:09:42 ratchov Exp $ */ +/* $OpenBSD: file.c,v 1.19 2016/01/08 16:17:31 ratchov Exp $ */ /* * Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org> * @@ -258,7 +258,7 @@ file_del(struct file *f) log_puts("bad state in file_del()\n"); panic(); } -#endif +#endif file_nfds -= f->max_nfds; f->state = FILE_ZOMB; #ifdef DEBUG @@ -282,7 +282,7 @@ file_process(struct file *f, struct pollfd *pfd) if (log_level >= 3) clock_gettime(CLOCK_MONOTONIC, &ts0); #endif - revents = (f->state != FILE_ZOMB) ? + revents = (f->state != FILE_ZOMB) ? f->ops->revents(f->arg, pfd) : 0; if ((revents & POLLHUP) && (f->state != FILE_ZOMB)) f->ops->hup(f->arg); @@ -423,7 +423,7 @@ file_poll(void) log_puts("out-of-bounds clock delta\n"); } } - file_ts = ts; + file_ts = ts; /* * process files that rely on poll diff --git a/usr.bin/sndiod/file.h b/usr.bin/sndiod/file.h index b0d625f5a12..33a366e807b 100644 --- a/usr.bin/sndiod/file.h +++ b/usr.bin/sndiod/file.h @@ -1,4 +1,4 @@ -/* $OpenBSD: file.h,v 1.4 2015/08/01 10:47:30 ratchov Exp $ */ +/* $OpenBSD: file.h,v 1.5 2016/01/08 16:17:31 ratchov Exp $ */ /* * Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org> * @@ -34,7 +34,7 @@ struct fileops { char *name; int (*pollfd)(void *, struct pollfd *); int (*revents)(void *, struct pollfd *); - /* + /* * we have to handle POLLIN and POLLOUT events * in separate handles, since handling POLLIN can * close the file, and continuing (to handle POLLOUT) @@ -52,7 +52,7 @@ struct file { #define FILE_INIT 0 /* ready */ #define FILE_ZOMB 1 /* closed, but not free()d yet */ unsigned int state; /* one of above */ - unsigned int max_nfds; /* max number of descriptors */ + unsigned int max_nfds; /* max number of descriptors */ unsigned int nfds; /* number of descriptors polled */ char *name; /* for debug purposes */ }; diff --git a/usr.bin/sndiod/listen.c b/usr.bin/sndiod/listen.c index 577518c80df..04d9cac5984 100644 --- a/usr.bin/sndiod/listen.c +++ b/usr.bin/sndiod/listen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: listen.c,v 1.9 2016/01/08 13:28:08 ratchov Exp $ */ +/* $OpenBSD: listen.c,v 1.10 2016/01/08 16:17:31 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> * @@ -130,9 +130,9 @@ listen_new_tcp(char *addr, unsigned int port) struct addrinfo *ailist, *ai, aihints; struct listen *f; int s, error, opt = 1, n = 0; - - /* - * obtain a list of possible addresses for the host/port + + /* + * obtain a list of possible addresses for the host/port */ memset(&aihints, 0, sizeof(struct addrinfo)); snprintf(serv, sizeof(serv), "%u", port); @@ -147,7 +147,7 @@ listen_new_tcp(char *addr, unsigned int port) return 0; } - /* + /* * for each address, try create a listening socket bound on * that address */ @@ -179,7 +179,7 @@ listen_new_tcp(char *addr, unsigned int port) goto bad_close; } } - + if (bind(s, ai->ai_addr, ai->ai_addrlen) < 0) { log_puts(addr); log_puts(": failed to bind socket\n"); diff --git a/usr.bin/sndiod/midi.c b/usr.bin/sndiod/midi.c index ad73fc56671..b94ac849514 100644 --- a/usr.bin/sndiod/midi.c +++ b/usr.bin/sndiod/midi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: midi.c,v 1.14 2015/11/25 18:47:12 ratchov Exp $ */ +/* $OpenBSD: midi.c,v 1.15 2016/01/08 16:17:31 ratchov Exp $ */ /* * Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org> * @@ -249,7 +249,7 @@ midi_tickets(struct midi *iep) } /* - * in the worst case output message is twice the + * in the worst case output message is twice the * input message (2-byte messages with running status) */ tickets = maxavail / 2 - iep->tickets; @@ -332,14 +332,14 @@ midi_in(struct midi *iep, unsigned char *idata, int icount) * store the given message in the output buffer */ void -midi_out(struct midi *oep, unsigned char *idata, int icount) +midi_out(struct midi *oep, unsigned char *idata, int icount) { unsigned char *odata; int ocount; #ifdef DEBUG int i; #endif - + while (icount > 0) { if (oep->obuf.used == oep->obuf.len) { #ifdef DEBUG @@ -531,9 +531,9 @@ port_close(struct port *c) panic(); } #endif - c->state = PORT_CFG; + c->state = PORT_CFG; port_mio_close(c); - + for (i = 0; i < MIDI_NEP; i++) { ep = midi_ep + i; if ((ep->txmask & c->midi->self) || diff --git a/usr.bin/sndiod/siofile.c b/usr.bin/sndiod/siofile.c index 3b8080122bf..435d3f00d8b 100644 --- a/usr.bin/sndiod/siofile.c +++ b/usr.bin/sndiod/siofile.c @@ -1,4 +1,4 @@ -/* $OpenBSD: siofile.c,v 1.10 2015/12/20 11:38:33 ratchov Exp $ */ +/* $OpenBSD: siofile.c,v 1.11 2016/01/08 16:17:31 ratchov Exp $ */ /* * Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org> * @@ -163,7 +163,7 @@ dev_sio_open(struct dev *d) log_putu(par.pchan); log_puts(": unsupported number of play channels\n"); goto bad_close; - } + } if ((mode & SIO_REC) && par.rchan > NCHAN_MAX) { log_puts(d->path); log_puts(": "); @@ -231,7 +231,7 @@ dev_sio_close(struct dev *d) #endif timo_del(&d->sio.watchdog); file_del(d->sio.file); - sio_close(d->sio.hdl); + sio_close(d->sio.hdl); } void @@ -294,7 +294,7 @@ dev_sio_pollfd(void *arg, struct pollfd *pfd) { struct dev *d = arg; int events; - + events = (d->sio.cstate == DEV_SIO_READ) ? POLLIN : POLLOUT; return sio_pollfd(d->sio.hdl, pfd, events); } diff --git a/usr.bin/sndiod/sndiod.c b/usr.bin/sndiod/sndiod.c index c5b384ef110..b870bbc84a6 100644 --- a/usr.bin/sndiod/sndiod.c +++ b/usr.bin/sndiod/sndiod.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sndiod.c,v 1.27 2016/01/08 15:55:05 ratchov Exp $ */ +/* $OpenBSD: sndiod.c,v 1.28 2016/01/08 16:17:31 ratchov Exp $ */ /* * Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org> * @@ -278,7 +278,7 @@ getbasepath(char *base, size_t size) if (errno != EEXIST) err(1, "mkdir(\"%s\")", base); } - umask(omask); + umask(omask); if (stat(base, &sb) < 0) err(1, "stat(\"%s\")", base); if (sb.st_uid != uid || (sb.st_mode & mask) != 0) @@ -432,8 +432,8 @@ main(int argc, char **argv) break; case 's': if ((d = dev_list) == NULL) { - d = mkdev(DEFAULT_DEV, &par, 0, bufsz, round, rate, - hold, autovol); + d = mkdev(DEFAULT_DEV, &par, 0, bufsz, round, + rate, hold, autovol); } if (mkopt(optarg, d, pmin, pmax, rmin, rmax, mode, vol, mmc, dup) == NULL) @@ -459,7 +459,8 @@ main(int argc, char **argv) errx(1, "%s: block size is %s", optarg, str); break; case 'f': - mkdev(optarg, &par, 0, bufsz, round, rate, hold, autovol); + mkdev(optarg, &par, 0, bufsz, round, + rate, hold, autovol); break; default: fputs(usagestr, stderr); @@ -490,11 +491,11 @@ main(int argc, char **argv) if ((pw = getpwnam(SNDIO_PRIV_USER)) == NULL) errx(1, "unknown user %s", SNDIO_PRIV_USER); hpw_uid = pw->pw_uid; - hpw_gid = pw->pw_gid; + hpw_gid = pw->pw_gid; if ((pw = getpwnam(SNDIO_USER)) == NULL) errx(1, "unknown user %s", SNDIO_USER); wpw_uid = pw->pw_uid; - wpw_gid = pw->pw_gid; + wpw_gid = pw->pw_gid; wpw_dir = xstrdup(pw->pw_dir); } else { hpw_uid = wpw_uid = hpw_gid = wpw_gid = 0xdeadbeef; diff --git a/usr.bin/sndiod/sock.c b/usr.bin/sndiod/sock.c index c9446170d4b..41ed862f1c3 100644 --- a/usr.bin/sndiod/sock.c +++ b/usr.bin/sndiod/sock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sock.c,v 1.16 2015/12/07 11:58:29 ratchov Exp $ */ +/* $OpenBSD: sock.c,v 1.17 2016/01/08 16:17:31 ratchov Exp $ */ /* * Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org> * @@ -337,7 +337,7 @@ sock_fdwrite(struct sock *f, void *data, int count) } sock_close(f); } else { -#ifdef DEBUG +#ifdef DEBUG if (log_level >= 4) { sock_log(f); log_puts(": write blocked\n"); @@ -378,7 +378,7 @@ sock_fdread(struct sock *f, void *data, int count) } sock_close(f); } else { -#ifdef DEBUG +#ifdef DEBUG if (log_level >= 4) { sock_log(f); log_puts(": read blocked\n"); @@ -1096,7 +1096,7 @@ sock_execmsg(struct sock *f) f->ralign = s->round * s->mix.bpf; } } - slot_stop(s); + slot_stop(s); break; case AMSG_SETPAR: #ifdef DEBUG @@ -1284,7 +1284,7 @@ sock_execmsg(struct sock *f) int sock_buildmsg(struct sock *f) { - unsigned int size; + unsigned int size; /* * If pos changed (or initial tick), build a MOVE message. @@ -1314,7 +1314,7 @@ sock_buildmsg(struct sock *f) if (f->fillpending > 0) { AMSG_INIT(&f->wmsg); - f->wmsg.cmd = htonl(AMSG_FLOWCTL); + f->wmsg.cmd = htonl(AMSG_FLOWCTL); f->wmsg.u.ts.delta = htonl(f->fillpending); size = f->fillpending; if (f->slot) @@ -1358,7 +1358,7 @@ sock_buildmsg(struct sock *f) } if (f->midi != NULL && f->midi->obuf.used > 0) { - size = f->midi->obuf.used; + size = f->midi->obuf.used; if (size > AMSG_DATAMAX) size = AMSG_DATAMAX; AMSG_INIT(&f->wmsg); diff --git a/usr.bin/sndiod/utils.c b/usr.bin/sndiod/utils.c index 974e20d01c3..fac443e5870 100644 --- a/usr.bin/sndiod/utils.c +++ b/usr.bin/sndiod/utils.c @@ -1,4 +1,4 @@ -/* $OpenBSD: utils.c,v 1.1 2012/11/23 07:03:28 ratchov Exp $ */ +/* $OpenBSD: utils.c,v 1.2 2016/01/08 16:17:31 ratchov Exp $ */ /* * Copyright (c) 2003-2012 Alexandre Ratchov <alex@caoua.org> * @@ -91,7 +91,7 @@ log_putx(unsigned long num) c += (c < 10) ? '0' : 'a' - 10; LOG_PUTC(c); } - } else + } else LOG_PUTC('0'); } @@ -146,7 +146,7 @@ void * xmalloc(size_t size) { void *p; - + p = malloc(size); if (p == NULL) { log_puts("failed to allocate "); |