Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/audio ANSIfy. Add static. Add __dead.
details: https://anonhg.NetBSD.org/src/rev/dc1538dd67c2
branches: trunk
changeset: 768853:dc1538dd67c2
user: joerg <joerg%NetBSD.org@localhost>
date: Sun Aug 28 01:17:47 2011 +0000
description:
ANSIfy. Add static. Add __dead.
diffstat:
usr.bin/audio/common/audio.c | 34 +++++---------
usr.bin/audio/common/libaudio.h | 4 +-
usr.bin/audio/common/sun.c | 16 ++----
usr.bin/audio/common/wav.c | 18 ++-----
usr.bin/audio/ctl/ctl.c | 80 ++++++++++++++-------------------
usr.bin/audio/play/play.c | 78 ++++++++++++++-------------------
usr.bin/audio/record/record.c | 96 +++++++++++++++++-----------------------
7 files changed, 134 insertions(+), 192 deletions(-)
diffs (truncated from 731 to 300 lines):
diff -r 903686da022d -r dc1538dd67c2 usr.bin/audio/common/audio.c
--- a/usr.bin/audio/common/audio.c Sun Aug 28 00:51:21 2011 +0000
+++ b/usr.bin/audio/common/audio.c Sun Aug 28 01:17:47 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: audio.c,v 1.19 2008/05/29 14:51:27 mrg Exp $ */
+/* $NetBSD: audio.c,v 1.20 2011/08/28 01:17:47 joerg Exp $ */
/*
* Copyright (c) 1999 Matthew R. Green
@@ -32,7 +32,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: audio.c,v 1.19 2008/05/29 14:51:27 mrg Exp $");
+__RCSID("$NetBSD: audio.c,v 1.20 2011/08/28 01:17:47 joerg Exp $");
#endif
@@ -51,7 +51,7 @@
/* what format am i? */
-struct {
+static const struct {
const char *fname;
int fno;
} formats[] = {
@@ -67,8 +67,7 @@
};
int
-audio_format_from_str(str)
- char *str;
+audio_format_from_str(char *str)
{
int i;
@@ -81,7 +80,7 @@
/* back and forth between encodings */
-struct {
+static const struct {
const char *ename;
int eno;
} encs[] = {
@@ -110,8 +109,7 @@
const char *
-audio_enc_from_val(val)
- int val;
+audio_enc_from_val(int val)
{
int i;
@@ -122,8 +120,7 @@
}
int
-audio_enc_to_val(enc)
- const char *enc;
+audio_enc_to_val(const char *enc)
{
int i;
@@ -137,9 +134,7 @@
}
void
-decode_int(arg, intp)
- const char *arg;
- int *intp;
+decode_int(const char *arg, int *intp)
{
char *ep;
int ret;
@@ -154,9 +149,7 @@
}
void
-decode_time(arg, tvp)
- const char *arg;
- struct timeval *tvp;
+decode_time(const char *arg, struct timeval *tvp)
{
char *s, *colon, *dot;
char *copy = strdup(arg);
@@ -206,9 +199,7 @@
* decode a string into an encoding value.
*/
void
-decode_encoding(arg, encp)
- const char *arg;
- int *encp;
+decode_encoding(const char *arg, int *encp)
{
size_t len;
int i;
@@ -222,7 +213,7 @@
errx(1, "unknown encoding `%s'", arg);
}
-const char *const audio_errlist[] = {
+static const char *const audio_errlist[] = {
"error zero", /* nothing? */
"no audio entry", /* AUDIO_ENOENT */
"short header", /* AUDIO_ESHORTHDR */
@@ -233,8 +224,7 @@
};
const char *
-audio_errstring(errval)
- int errval;
+audio_errstring(int errval)
{
errval = -errval;
diff -r 903686da022d -r dc1538dd67c2 usr.bin/audio/common/libaudio.h
--- a/usr.bin/audio/common/libaudio.h Sun Aug 28 00:51:21 2011 +0000
+++ b/usr.bin/audio/common/libaudio.h Sun Aug 28 01:17:47 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: libaudio.h,v 1.16 2009/06/18 02:37:27 mrg Exp $ */
+/* $NetBSD: libaudio.h,v 1.17 2011/08/28 01:17:47 joerg Exp $ */
/*
* Copyright (c) 1999, 2009 Matthew R. Green
@@ -159,6 +159,8 @@
/* returns size of header, or -ve for failure */
ssize_t audio_wav_parse_hdr (void *, size_t, u_int *, u_int *, u_int *, u_int *, size_t *);
+extern int verbose;
+
/*
* audio routine error codes
*/
diff -r 903686da022d -r dc1538dd67c2 usr.bin/audio/common/sun.c
--- a/usr.bin/audio/common/sun.c Sun Aug 28 00:51:21 2011 +0000
+++ b/usr.bin/audio/common/sun.c Sun Aug 28 01:17:47 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sun.c,v 1.6 2008/05/29 14:51:27 mrg Exp $ */
+/* $NetBSD: sun.c,v 1.7 2011/08/28 01:17:47 joerg Exp $ */
/*
* Copyright (c) 2002 Matthew R. Green
@@ -32,7 +32,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: sun.c,v 1.6 2008/05/29 14:51:27 mrg Exp $");
+__RCSID("$NetBSD: sun.c,v 1.7 2011/08/28 01:17:47 joerg Exp $");
#endif
@@ -52,7 +52,7 @@
/*
* SunOS/NeXT .au format helpers
*/
-struct {
+static const struct {
int file_encoding;
int encoding;
int precision;
@@ -80,10 +80,7 @@
};
int
-audio_sun_to_encoding(sun_encoding, encp, precp)
- int sun_encoding;
- u_int *encp;
- u_int *precp;
+audio_sun_to_encoding(int sun_encoding, u_int *encp, u_int *precp)
{
int i;
@@ -97,10 +94,7 @@
}
int
-audio_encoding_to_sun(encoding, precision, sunep)
- int encoding;
- int precision;
- int *sunep;
+audio_encoding_to_sun(int encoding, int precision, int *sunep)
{
int i;
diff -r 903686da022d -r dc1538dd67c2 usr.bin/audio/common/wav.c
--- a/usr.bin/audio/common/wav.c Sun Aug 28 00:51:21 2011 +0000
+++ b/usr.bin/audio/common/wav.c Sun Aug 28 01:17:47 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wav.c,v 1.9 2009/06/18 02:37:27 mrg Exp $ */
+/* $NetBSD: wav.c,v 1.10 2011/08/28 01:17:47 joerg Exp $ */
/*
* Copyright (c) 2002, 2009 Matthew R. Green
@@ -33,7 +33,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: wav.c,v 1.9 2009/06/18 02:37:27 mrg Exp $");
+__RCSID("$NetBSD: wav.c,v 1.10 2011/08/28 01:17:47 joerg Exp $");
#endif
@@ -51,7 +51,7 @@
#include "libaudio.h"
-struct {
+static const struct {
int wenc;
const char *wname;
} wavencs[] = {
@@ -77,8 +77,6 @@
return (wavencs[i].wname);
}
-extern int verbose;
-
/*
* sample header is:
*
@@ -92,14 +90,8 @@
* find a .wav header, etc. returns header length on success
*/
ssize_t
-audio_wav_parse_hdr(hdr, sz, enc, prec, sample, channels, datasize)
- void *hdr;
- size_t sz;
- u_int *enc;
- u_int *prec;
- u_int *sample;
- u_int *channels;
- size_t *datasize;
+audio_wav_parse_hdr(void *hdr, size_t sz, u_int *enc, u_int *prec,
+ u_int *sample, u_int *channels, size_t *datasize)
{
char *where = hdr, *owhere;
wav_audioheaderpart part;
diff -r 903686da022d -r dc1538dd67c2 usr.bin/audio/ctl/ctl.c
--- a/usr.bin/audio/ctl/ctl.c Sun Aug 28 00:51:21 2011 +0000
+++ b/usr.bin/audio/ctl/ctl.c Sun Aug 28 01:17:47 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ctl.c,v 1.38 2009/04/11 10:43:09 lukem Exp $ */
+/* $NetBSD: ctl.c,v 1.39 2011/08/28 01:17:48 joerg Exp $ */
/*
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: ctl.c,v 1.38 2009/04/11 10:43:09 lukem Exp $");
+__RCSID("$NetBSD: ctl.c,v 1.39 2011/08/28 01:17:48 joerg Exp $");
#endif
@@ -51,23 +51,22 @@
#include "libaudio.h"
-struct field *findfield (const char *name);
-void prfield (struct field *p, const char *sep);
-void rdfield (struct field *p, char *q);
-void getinfo (int fd);
-void audioctl_write (int, int, char *[]);
-void usage (void);
-int main (int argc, char **argv);
+static struct field *findfield(const char *name);
+static void prfield(const struct field *p, const char *sep);
+static void rdfield(struct field *p, char *q);
+static void getinfo(int fd);
+static void audioctl_write(int, int, char *[]);
+__dead static void usage(void);
-audio_device_t adev;
+static audio_device_t adev;
-audio_info_t info;
+static audio_info_t info;
-char encbuf[1000];
+static char encbuf[1000];
-int properties, fullduplex, rerror;
+static int properties, fullduplex, rerror;
-struct field {
+static struct field {
const char *name;
void *valp;
int format;
@@ -140,7 +139,7 @@
{ .name = NULL },
};
-static struct {
+static const struct {
const char *name;
Home |
Main Index |
Thread Index |
Old Index