[nas] [PATCHES] more ANSIfication of clients
Erik Auerswald
auerswal at unix-ag.uni-kl.de
Thu Jul 27 06:26:04 MDT 2006
Hi,
the attached patches continue the K&R -> ANSI function declaration
updates for the client progs. Only auedit is not changed because it is
more complicated to do so. My attempt at ANSIfying auedit resulted in
a not working auedit.
Erik
-------------- next part --------------
Index: clients/audio/auphone/auphone.c
===================================================================
--- clients/audio/auphone/auphone.c (revision 168)
+++ clients/audio/auphone/auphone.c (working copy)
@@ -108,6 +108,8 @@
#define MakeLabel(_w, _parent, _name) \
MakeWidget(_w, _parent, labelWidgetClass, _name)
+typedef struct GlobalDataStruct *GlobalDataPtr;
+
typedef struct
{
AuServer *aud;
@@ -120,11 +122,11 @@
currentMode,
tracks,
volEl;
- void (*callback) ();
+ void (*callback) (GlobalDataPtr);
XtInputId id;
} ServerRec, *ServerPtr;
-typedef struct
+typedef struct GlobalDataStruct
{
Display *dpy;
XtAppContext appContext;
@@ -150,7 +152,7 @@
outBytes,
bufSize;
float latency;
-} GlobalData, *GlobalDataPtr;
+} GlobalData;
static GlobalData globals; /* for actions */
@@ -218,9 +220,7 @@
*busyData;
static int
-fatalError(message, arg)
-char *message,
- *arg;
+fatalError(char *message, char *arg)
{
fprintf(stderr, message, arg);
fprintf(stderr, "\n");
@@ -229,9 +229,7 @@
}
static void
-readData(g, e)
-GlobalDataPtr g;
-AuElementNotifyEvent *e;
+readData(GlobalDataPtr g, AuElementNotifyEvent *e)
{
int n;
@@ -240,7 +238,7 @@
g->bufSize = e->num_bytes;
if (!(g->buf = (char *) malloc(g->bufSize)))
- fatalError("malloc failed");
+ fatalError("malloc failed", NULL);
}
else
{
@@ -252,7 +250,7 @@
g->bufSize += e->num_bytes;
if (!(g->buf = (char *) realloc(g->buf, g->bufSize)))
- fatalError("malloc failed");
+ fatalError("malloc failed", NULL);
}
n = AuReadElement(g->local.aud, e->flow, e->element_num, e->num_bytes,
@@ -262,8 +260,7 @@
}
static void
-writeData(g)
-GlobalDataPtr g;
+writeData(GlobalDataPtr g)
{
int n;
@@ -295,10 +292,7 @@
}
static AuBool
-EventHandler(aud, ev, handler)
-AuServer *aud;
-AuEvent *ev;
-AuEventHandlerRec *handler;
+EventHandler(AuServer *aud, AuEvent *ev, AuEventHandlerRec *handler)
{
GlobalDataPtr g = (GlobalDataPtr) handler->data;
AuElementNotifyEvent *event = (AuElementNotifyEvent *) ev;
@@ -349,11 +343,7 @@
}
static void
-createEmptyBucket(g, aud, server, flow)
-GlobalDataPtr g;
-AuServer *aud;
-char *server;
-AuFlowID flow;
+createEmptyBucket(GlobalDataPtr g, AuServer *aud, char *server, AuFlowID flow)
{
char buf[100];
AuString desc;
@@ -374,10 +364,7 @@
}
static void
-showStatus(g, format, arg)
-GlobalDataPtr g;
-char *format,
- *arg;
+showStatus(GlobalDataPtr g, char *format, char *arg)
{
char buf[50];
@@ -386,8 +373,7 @@
}
static void
-makePhone(g)
-GlobalDataPtr g;
+makePhone(GlobalDataPtr g)
{
AuElement elements[3];
ServerPtr l = &g->local,
@@ -415,7 +401,7 @@
}
if (i == AuServerNumDevices(r->aud))
- fatalError("Can't find output device");
+ fatalError("Can't find output device", NULL);
AuMakeElementImportClient(&elements[0], SAMPLE_RATE, DATA_FORMAT,
l->tracks, AuTrue, MAX_SAMPLES, LOW_WATER,
@@ -432,13 +418,8 @@
}
static int
-getCallerInfo(g, user, server, flow, device, mult)
-GlobalDataPtr g;
-char **user,
- **server;
-AuFlowID *flow;
-int *device,
- *mult;
+getCallerInfo(GlobalDataPtr g, char **user, char **server, AuFlowID *flow,
+ int *device, int *mult)
{
int n,
i;
@@ -467,10 +448,7 @@
}
static void
-callerId(w, gp, call_data)
-Widget w;
-XtPointer gp,
- call_data;
+callerId(Widget w, XtPointer gp, XtPointer call_data)
{
GlobalDataPtr g = (GlobalDataPtr) gp;
AuFlowID flow;
@@ -483,27 +461,25 @@
if (getCallerInfo(g, &user, &server, &flow, &dev, &mult))
{
sprintf(buf, "%s@%s", user, server);
- showStatus(g, buf);
+ showStatus(g, buf, NULL);
free(user);
free(server);
}
else
- showStatus(g, "No callers");
+ showStatus(g, "No callers", NULL);
}
-static Boolean doHangup();
+static Boolean doHangup(XtPointer g);
static void
-remoteHangup(g)
-GlobalDataPtr g;
+remoteHangup(GlobalDataPtr g)
{
g->local.volFlow = 0;
XtAppAddWorkProc(g->appContext, doHangup, g);
}
static void
-remoteAnswered(g)
-GlobalDataPtr g;
+remoteAnswered(GlobalDataPtr g)
{
ServerPtr l = &g->local,
r = &g->remote;
@@ -516,7 +492,7 @@
while (!getCallerInfo(g, &user, &server, &l->volFlow, &dev, &l->volEl));
sprintf(buf, "%s@%s", user, server);
- showStatus(g, buf);
+ showStatus(g, buf, NULL);
free(user);
free(server);
XtVaSetValues(g->volSlider, XtNvalue, DEFAULT_OUTPUT_VOLUME, NULL);
@@ -531,8 +507,7 @@
}
static Bool
-ringRemote(g)
-GlobalDataPtr g;
+ringRemote(GlobalDataPtr g)
{
AuBucketID b;
AuDeviceID d;
@@ -579,7 +554,7 @@
}
if (i == AuServerNumDevices(r->aud))
- fatalError("Can't find output device");
+ fatalError("Can't find output device", NULL);
AuFreeBucketAttributes(r->aud, n, ba);
@@ -601,7 +576,7 @@
if (!(r->handler = AuRegisterEventHandler(r->aud, 0, 0, 0, EventHandler,
(AuPointer) g)))
- fatalError("AuRegisterEventHandler failed");
+ fatalError("AuRegisterEventHandler failed", NULL);
createEmptyBucket(g, r->aud, AuServerString(g->local.aud), r->flow);
@@ -611,8 +586,7 @@
}
static void
-ringLocal(g)
-GlobalDataPtr g;
+ringLocal(GlobalDataPtr g)
{
AuElement elements[3];
AuElementAction actions[2];
@@ -636,7 +610,7 @@
}
if (i == AuServerNumDevices(l->aud))
- fatalError("Can't find output device");
+ fatalError("Can't find output device", NULL);
AuMakeElementImportBucket(&elements[0], ringoutRate, l->ringoutBucket,
AuUnlimitedSamples, 0, 2, actions);
@@ -648,12 +622,11 @@
AuSetElements(l->aud, l->flow, AuTrue, 3, elements, NULL);
AuStartFlow(l->aud, l->flow, NULL);
- showStatus(g, "Ringing...");
+ showStatus(g, "Ringing...", NULL);
}
static void
-busySignal(g)
-GlobalDataPtr g;
+busySignal(GlobalDataPtr g)
{
AuElement elements[3];
AuElementAction actions[2];
@@ -677,7 +650,7 @@
}
if (i == AuServerNumDevices(l->aud))
- fatalError("Can't find output device");
+ fatalError("Can't find output device", NULL);
AuMakeElementImportBucket(&elements[0], busyRate, l->busyBucket,
AuUnlimitedSamples, 0, 2, actions);
@@ -689,14 +662,11 @@
AuSetElements(l->aud, l->flow, AuTrue, 3, elements, NULL);
AuStartFlow(l->aud, l->flow, NULL);
- showStatus(g, "Busy");
+ showStatus(g, "Busy", NULL);
}
static void
-call(w, gp, call_data)
-Widget w;
-XtPointer gp,
- call_data;
+call(Widget w, XtPointer gp, XtPointer call_data)
{
GlobalDataPtr g = (GlobalDataPtr) gp;
int i,
@@ -717,7 +687,7 @@
}
if (!(r->flow = AuCreateFlow(r->aud, NULL)))
- fatalError("Couldn't create remote flow");
+ fatalError("Couldn't create remote flow", NULL);
/* look for an input device */
for (i = 0; i < AuServerNumDevices(r->aud); i++)
@@ -768,10 +738,7 @@
}
static void
-answer(w, gp, call_data)
-Widget w;
-XtPointer gp,
- call_data;
+answer(Widget w, XtPointer gp, XtPointer call_data)
{
GlobalDataPtr g = (GlobalDataPtr) gp;
AuFlowID flow;
@@ -786,22 +753,22 @@
if (!getCallerInfo(g, &user, &server, &flow, &dev, &l->volEl))
{
- showStatus(g, "No callers");
+ showStatus(g, "No callers", NULL);
return;
}
sprintf(buf, "%s@%s", user, server);
- showStatus(g, buf);
+ showStatus(g, buf, NULL);
if (!(r->aud = AuOpenServer(server, 0, NULL, 0, NULL, NULL)))
- fatalError("Can't open remote server");
+ fatalError("Can't open remote server", NULL);
if (!(r->flow = AuCreateFlow(r->aud, NULL)))
- fatalError("Couldn't create remote flow");
+ fatalError("Couldn't create remote flow", NULL);
if (!(r->handler = AuRegisterEventHandler(r->aud, 0, 0, 0, EventHandler,
(AuPointer) g)))
- fatalError("AuRegisterEventHandler failed");
+ fatalError("AuRegisterEventHandler failed", NULL);
makePhone(g);
@@ -828,9 +795,9 @@
}
static Boolean
-doHangup(g)
-GlobalDataPtr g;
+doHangup(XtPointer gp)
{
+ GlobalDataPtr g = (GlobalDataPtr) gp;
ServerPtr l = &g->local,
r = &g->remote;
@@ -852,25 +819,18 @@
XtSetSensitive(g->hangup, False);
XtSetSensitive(g->volSlider, False);
- showStatus(g, "Disconnected");
+ showStatus(g, "Disconnected", NULL);
return True;
}
static void
-hangup(w, gp, call_data)
-Widget w;
-XtPointer gp,
- call_data;
+hangup(Widget w, XtPointer gp, XtPointer call_data)
{
- GlobalDataPtr g = (GlobalDataPtr) gp;
- doHangup(g);
+ doHangup(gp);
}
static void
-quit(w, gp, call_data)
-Widget w;
-XtPointer gp,
- call_data;
+quit(Widget w, XtPointer gp, XtPointer call_data)
{
GlobalDataPtr g = (GlobalDataPtr) gp;
if (g->remote.aud)
@@ -883,10 +843,7 @@
}
static void
-mode(w, gp, call_data)
-Widget w;
-XtPointer gp,
- call_data;
+mode(Widget w, XtPointer gp, XtPointer call_data)
{
GlobalDataPtr g = (GlobalDataPtr) gp;
AuDeviceAttributes da;
@@ -911,10 +868,7 @@
}
static void
-adjustVolume(w, gp, volp)
-Widget w;
-XtPointer gp,
- volp;
+adjustVolume(Widget w, XtPointer gp, XtPointer volp)
{
GlobalDataPtr g = (GlobalDataPtr)gp;
int vol = (int)volp;
@@ -933,10 +887,7 @@
}
static void
-adjustInputGain(w, gp, gainp)
-Widget w;
-XtPointer gp,
- gainp;
+adjustInputGain(Widget w, XtPointer gp, XtPointer gainp)
{
GlobalDataPtr g = (GlobalDataPtr)gp;
int gain = (int)gainp;
@@ -954,8 +905,7 @@
}
static void
-createWidgets(g)
-GlobalDataPtr g;
+createWidgets(GlobalDataPtr g)
{
Widget w;
@@ -992,8 +942,7 @@
}
static void
-alignWidgets(g)
-GlobalDataPtr g;
+alignWidgets(GlobalDataPtr g)
{
Position x,
maxX;
@@ -1016,11 +965,7 @@
}
static void
-callAction(w, event, params, num_params)
-Widget w;
-XEvent *event;
-String *params;
-Cardinal *num_params;
+callAction(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
GlobalDataPtr g = &globals;
@@ -1028,11 +973,7 @@
}
static void
-quitAction(w, event, params, num_params)
-Widget w;
-XEvent *event;
-String *params;
-Cardinal *num_params;
+quitAction(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
GlobalDataPtr g = &globals;
@@ -1044,11 +985,7 @@
}
static void
-initLocalAudioServer(g, audioServer, ring, volume)
-GlobalDataPtr g;
-char *audioServer,
- *ring;
-int volume;
+initLocalAudioServer(GlobalDataPtr g, char *audioServer, char *ring, int volume)
{
ServerPtr l = &g->local;
AuDeviceAttributes *da;
@@ -1059,14 +996,14 @@
char buf[50];
if (!(l->aud = AuOpenServer(audioServer, 0, NULL, 0, NULL, NULL)))
- fatalError("Can't connect to audio server");
+ fatalError("Can't connect to audio server %s", audioServer);
if (!(l->flow = AuCreateFlow(l->aud, NULL)))
- fatalError("Couldn't create flow");
+ fatalError("Couldn't create flow", NULL);
if (!(l->handler = AuRegisterEventHandler(l->aud, 0, 0, 0, EventHandler,
(AuPointer) g)))
- fatalError("AuRegisterEventHandler failed");
+ fatalError("AuRegisterEventHandler failed", NULL);
/* look for an input device */
for (i = 0; i < AuServerNumDevices(l->aud); i++)
@@ -1078,17 +1015,17 @@
}
if (i == AuServerNumDevices(l->aud))
- fatalError("Audio server has no input devices");
+ fatalError("Audio server has no input devices", NULL);
if (AuDeviceUse(AuServerDevice(l->aud, i)) & AuComponentUseExclusiveMask)
- fatalError("Audio server cannot record and play simultaneously");
+ fatalError("Audio server cannot record and play simultaneously", NULL);
ba = AuListBuckets(l->aud, 0, NULL, &n, NULL);
for (i = 0; i < n; i++)
if (!strncmp(RINGOUT, AuBucketDescription(&ba[i])->data,
strlen(RINGOUT)))
- fatalError("auphone is already running on this server");
+ fatalError("auphone is already running on this server", NULL);
da = AuServerDevice(l->aud, l->inputDeviceNum);
@@ -1129,7 +1066,7 @@
fatalError("Can't open ring %s", ring);
if (!(chunk = (char *) malloc(CHUNK_SIZE)))
- fatalError("malloc failed");
+ fatalError("malloc failed", NULL);
sprintf(buf, "%s %d", RINGIN, volume);
AuSetString(&desc, AuStringLatin1, strlen(buf), buf);
@@ -1138,11 +1075,11 @@
SoundNumTracks(s), AuAccessImportMask |
AuAccessListMask, SoundSampleRate(s),
SoundNumSamples(s), &desc, NULL)))
- fatalError("Can't create bucket");
+ fatalError("Can't create bucket", NULL);
if (!(flow = AuGetScratchFlowToBucket(l->aud, bucket, &import,
NULL)))
- fatalError("Error creating flow");
+ fatalError("Error creating flow", NULL);
numBytes = SoundNumBytes(s);
@@ -1173,7 +1110,7 @@
if (!AuSoundCreateBucketFromData(l->aud, s, ringinData,
AuAccessImportMask |
AuAccessListMask, NULL, NULL))
- fatalError("Can't create bucket");
+ fatalError("Can't create bucket", NULL);
SoundDestroy(s);
}
@@ -1198,9 +1135,7 @@
}
int
-main(argc, argv)
-int argc;
-char **argv;
+main(int argc, char **argv)
{
GlobalDataPtr g = &globals;
char *audioServer = NULL,
@@ -1228,7 +1163,7 @@
XtVaSetValues(g->top, XtNiconPixmap, icon, NULL);
-#define ARG() (--argc ? *++argv : (char *) fatalError(USAGE))
+#define ARG() (--argc ? *++argv : (char *) fatalError(USAGE, NULL))
while (--argc)
{
@@ -1250,7 +1185,7 @@
g->latency = (float) atof(ARG());
break;
default:
- fatalError(USAGE);
+ fatalError(USAGE, NULL);
}
}
-------------- next part --------------
Index: clients/audio/auplay/auplay.c
===================================================================
--- clients/audio/auplay/auplay.c (revision 168)
+++ clients/audio/auplay/auplay.c (working copy)
@@ -27,14 +27,14 @@
* auplay -- a trivial program for playing audio files.
*/
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdio.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <stdio.h>
#include <stdlib.h>
-#include <signal.h>
+#include <signal.h>
#include <string.h>
-#include <audio/audiolib.h>
-#include <audio/soundlib.h>
+#include <audio/audiolib.h>
+#include <audio/soundlib.h>
#define FILENM_SIZE 256 /* max lenth of a filename on stdin */
@@ -46,8 +46,7 @@
static AuFlowID auflowid = 0;
void
-sighandler(i)
-int i;
+sighandler(int i)
{
char buf[BUFSIZ];
@@ -72,11 +71,8 @@
#define VOL(volume) ((1 << 16) * (volume) / 100)
static void
-sync_play_cb(aud, handler, ev, data)
-AuServer *aud;
-AuEventHandlerRec *handler;
-AuEvent *ev;
-AuPointer data;
+sync_play_cb(AuServer *aud, AuEventHandlerRec *handler, AuEvent *ev,
+ AuPointer data)
{
int *d = (int *) data;
@@ -84,10 +80,8 @@
}
static AuBool
-localAuSoundPlaySynchronousFromFile(aud, fname, volume)
-AuServer *aud;
-_AuConst char *fname;
-int volume;
+localAuSoundPlaySynchronousFromFile(AuServer *aud, const char *fname,
+ int volume)
{
AuStatus ret;
AuEvent ev;
@@ -110,10 +104,8 @@
return AuTrue;
}
-
-
static void
-usage()
+usage(void)
{
fprintf(stderr,
"Usage: %s [-iIl] [-audio servername] [-volume percent] files ...\n",
@@ -122,8 +114,7 @@
}
static void
-do_file(fname)
-char *fname;
+do_file(char *fname)
{
Sound s;
@@ -155,9 +146,7 @@
fprintf(stderr, "Couldn't play file \"%s\"\n", fname);
}
-main(argc, argv)
-int argc;
-char **argv;
+main(int argc, char **argv)
{
int i,
numfnames,
-------------- next part --------------
Index: clients/audio/aurecord/aurecord.c
===================================================================
--- clients/audio/aurecord/aurecord.c (revision 168)
+++ clients/audio/aurecord/aurecord.c (working copy)
@@ -69,7 +69,7 @@
static AuFlowID flow;
static void
-usage()
+usage(void)
{
int i;
@@ -96,9 +96,7 @@
}
static void
-fatalError(message, arg)
-char *message,
- *arg;
+fatalError(char *message, char *arg)
{
fprintf(stderr, message, arg);
fprintf(stderr, "\n");
@@ -122,8 +120,7 @@
#if !(defined(SYSV) || defined(SVR4))
stop()
#else /* defined(SYSV) || defined(SVR4) */
-stop(sig)
-int sig;
+stop(int sig)
#endif /* defined(SYSV) || defined(SVR4) */
{
AuStopFlow(aud, flow, NULL);
@@ -131,18 +128,13 @@
}
static void
-finished(aud, handler, ev, data)
-AuServer *aud;
-AuEventHandlerRec *handler;
-AuEvent *ev;
-AuPointer data;
+finished(AuServer *aud, AuEventHandlerRec *handler, AuEvent *ev, AuPointer data)
{
*(AuBool *) data = AuTrue;
}
static int
-convertMode(s)
-char *s;
+convertMode(char *s)
{
if (!strcasecmp(s, "mic"))
return AuDeviceLineModeHigh;
@@ -155,8 +147,7 @@
}
static int
-convertDataFormat(s)
-char *s;
+convertDataFormat(char *s)
{
int f;
@@ -169,8 +160,7 @@
}
static int
-convertFileFormat(s)
-char *s;
+convertFileFormat(char *s)
{
int f;
@@ -183,9 +173,7 @@
}
int
-main(argc, argv)
-int argc;
-char **argv;
+main(int argc, char **argv)
{
char *arg,
*audioServer = NULL,
@@ -230,7 +218,7 @@
}
if (!(aud = AuOpenServer(audioServer, 0, NULL, 0, NULL, NULL)))
- fatalError("Can't connect to audio server");
+ fatalError("Can't connect to audio server", NULL);
if (!filename)
usage();
@@ -255,7 +243,7 @@
}
if (inputDeviceId == AuNone)
- fatalError("Audio server has no input devices");
+ fatalError("Audio server has no input devices", NULL);
signal(SIGTERM, stop);
@@ -266,7 +254,7 @@
finished, (AuPointer) &done, mode, fileFormat,
comment, rate, dataFormat, &flow,
NULL, NULL))
- fatalError("Can't record to file");
+ fatalError("Can't record to file", NULL);
while (!done)
{
-------------- next part --------------
Index: clients/audio/autool/audiotool.c
===================================================================
--- clients/audio/autool/audiotool.c (revision 168)
+++ clients/audio/autool/audiotool.c (working copy)
@@ -29,7 +29,7 @@
#include "config.h"
-#include <stdio.h>
+#include <stdio.h>
#if defined(HAVE_STDLIB_H)
# include <stdlib.h>
@@ -39,8 +39,8 @@
# include <malloc.h>
#endif
-#include <audio/audiolib.h>
-#include <audio/soundlib.h>
+#include <audio/audiolib.h>
+#include <audio/soundlib.h>
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
@@ -116,7 +116,7 @@
NULL
};
-static void fatalError();
+static void fatalError(char *message, char *arg);
#define Invert(w) \
{ \
@@ -208,14 +208,12 @@
}
static VolumeListId
-AddToVolumeList(flow, elementNumber)
-AuFlowID flow;
-unsigned int elementNumber;
+AddToVolumeList(AuFlowID flow, unsigned int elementNumber)
{
VolumeListPtr p;
if (!(p = (VolumeListPtr) malloc(sizeof(VolumeListRec))))
- fatalError("malloc error in AddToVolumeList");
+ fatalError("malloc error in AddToVolumeList", NULL);
p->flow = flow;
p->elementNumber = elementNumber;
@@ -234,11 +232,7 @@
/* ARGSUSED */
static void
-doneCB(aud, handler, ev, d)
-AuServer *aud;
-AuEventHandlerRec *handler;
-AuEvent *ev;
-AuPointer d;
+doneCB(AuServer *aud, AuEventHandlerRec *handler, AuEvent *ev, AuPointer d)
{
DonePrivPtr data = (DonePrivPtr) d;
@@ -247,10 +241,7 @@
/* ARGSUSED */
static void
-stopCB(w, g, data)
-Widget w;
-XtPointer g;
-XtPointer data;
+stopCB(Widget w, XtPointer g, XtPointer data)
{
GlobalDataPtr globals = (GlobalDataPtr) g;
@@ -273,10 +264,7 @@
/* ARGSUSED */
static void
-playCB(w, g, data)
-Widget w;
-XtPointer g;
-XtPointer data;
+playCB(Widget w, XtPointer g, XtPointer data)
{
static DonePrivRec priv;
GlobalDataPtr globals = (GlobalDataPtr) g;
@@ -297,8 +285,7 @@
}
static Bool
-showInfo(globals)
-GlobalDataPtr globals;
+showInfo(GlobalDataPtr globals)
{
Sound s;
@@ -314,7 +301,7 @@
}
if (!(p = buf = (char *) malloc(2000 + strlen(SoundComment(s)))))
- fatalError("Can't malloc text in showInfo");
+ fatalError("Can't malloc text in showInfo", NULL);
PRINT(p, " Filename: %s\n", globals->filename);
PRINT(p, "File Format: %s\n", SoundFileFormatString(s));
@@ -340,17 +327,13 @@
/* ARGSUSED */
static void
-quitCB(w, data, call_data)
-Widget w;
-XtPointer data;
-XtPointer call_data;
+quitCB(Widget w, XtPointer data, XtPointer call_data)
{
exit(0);
}
static void
-adjustVolume(globals)
-GlobalDataPtr globals;
+adjustVolume(GlobalDataPtr globals)
{
AuElementParameters *parms;
VolumeListPtr p = VolumeList;
@@ -361,7 +344,7 @@
if (!(parms = (AuElementParameters *)
malloc(sizeof(AuElementParameters) * VolumeListCount)))
- fatalError("malloc error in adjustVolume");
+ fatalError("malloc error in adjustVolume", NULL);
while (p)
{
@@ -380,10 +363,7 @@
/* ARGSUSED */
static void
-scrollProcCB(w, data, cd)
-Widget w;
-XtPointer data;
-XtPointer cd;
+scrollProcCB(Widget w, XtPointer data, XtPointer cd)
{
GlobalDataPtr globals = (GlobalDataPtr) data;
int position = (int) cd;
@@ -411,10 +391,7 @@
/* ARGSUSED */
static void
-jumpProcCB(w, data, cd)
-Widget w;
-XtPointer data;
-XtPointer cd;
+jumpProcCB(Widget w, XtPointer data, XtPointer cd)
{
int newVolume;
char buf[50];
@@ -436,8 +413,7 @@
}
static Dimension
-getFontCharWidth(w)
-Widget w;
+getFontCharWidth(Widget w)
{
XFontStruct *font;
@@ -446,8 +422,7 @@
}
static Dimension
-getFontCharHeight(w)
-Widget w;
+getFontCharHeight(Widget w)
{
XFontStruct *font;
@@ -458,7 +433,7 @@
static char *progname;
static void
-usage()
+usage(void)
{
fprintf(stderr,
"Usage: %s [-audio servername] [-volume percentage] [-toolkitoption ...] file\n", APP_INSTANCE);
@@ -466,9 +441,7 @@
}
int
-main(argc, argv)
-int argc;
-char **argv;
+main(int argc, char **argv)
{
int i;
Dimension infoWidth,
@@ -531,12 +504,12 @@
globals->filename = *argv;
}
if (!globals->filename)
- fatalError("No sound file to play");
+ fatalError("No sound file to play", NULL);
if (!(globals->aud = AuOpenServer(audioServerString, 0, NULL, 0, NULL,
NULL)))
- fatalError("Can't connect to audio server");
+ fatalError("Can't connect to audio server %s", audioServerString);
for (i = 0; i < AuServerNumDevices(globals->aud); i++)
if ((AuDeviceKind(AuServerDevice(globals->aud, i)) ==
@@ -635,9 +608,7 @@
}
static void
-fatalError(message, arg)
-char *message,
- *arg;
+fatalError(char *message, char *arg)
{
fprintf(stderr, message, arg);
fprintf(stderr, ".\n");
-------------- next part --------------
Index: clients/audio/auwave/auwave.c
===================================================================
--- clients/audio/auwave/auwave.c (revision 168)
+++ clients/audio/auwave/auwave.c (working copy)
@@ -154,9 +154,7 @@
};
static void
-fatalError(message, arg)
-char *message,
- *arg;
+fatalError(char *message, char *arg)
{
fprintf(stderr, message, arg);
fprintf(stderr, "\n");
@@ -164,19 +162,13 @@
}
static void
-quitCB(w, gp, call_data)
-Widget w;
-XtPointer gp,
- call_data;
+quitCB(Widget w, XtPointer gp, XtPointer call_data)
{
exit(0);
}
static void
-startCB(w, gp, call_data)
-Widget w;
-XtPointer gp,
- call_data;
+startCB(Widget w, XtPointer gp, XtPointer call_data)
{
GlobalDataPtr g = (GlobalDataPtr) gp;
AuElement elements[3];
@@ -217,10 +209,7 @@
}
static void
-menuCB(w, gp, call_data)
-Widget w;
-XtPointer gp,
- call_data;
+menuCB(Widget w, XtPointer gp, XtPointer call_data)
{
GlobalDataPtr g = (GlobalDataPtr) gp;
String string;
@@ -230,10 +219,7 @@
}
static void
-setVol(w, gp, valuep)
-Widget w;
-XtPointer gp,
- valuep;
+setVol(Widget w, XtPointer gp, XtPointer valuep)
{
GlobalDataPtr g = (GlobalDataPtr) gp;
int value = (int) valuep;
@@ -252,10 +238,7 @@
}
static void
-setFreq(w, gp, valuep)
-Widget w;
-XtPointer gp,
- valuep;
+setFreq(Widget w, XtPointer gp, XtPointer valuep)
{
GlobalDataPtr g = (GlobalDataPtr) gp;
int value = (int) valuep;
@@ -277,10 +260,7 @@
}
static void
-setGain(w, gp, valuep)
-Widget w;
-XtPointer gp,
- valuep;
+setGain(Widget w, XtPointer gp, XtPointer valuep)
{
GlobalDataPtr g = (GlobalDataPtr) gp;
int value = (int) valuep;
@@ -291,8 +271,7 @@
}
static void
-createWidgets(g)
-GlobalDataPtr g;
+createWidgets(GlobalDataPtr g)
{
int i;
Widget w;
@@ -338,8 +317,7 @@
}
static void
-alignWidgets(g)
-GlobalDataPtr g;
+alignWidgets(GlobalDataPtr g)
{
Dimension w;
Position x,
@@ -369,11 +347,7 @@
/* Actions */
static void
-updateFrequency(w, event, params, num_params)
-Widget w;
-XEvent *event;
-String *params;
-Cardinal *num_params;
+updateFrequency(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
GlobalDataPtr g = globals;
String s;
@@ -382,12 +356,8 @@
XtVaSetValues(g->freqSlider, XtNvalue, atoi(s), NULL);
}
-
static AuBool
-EventHandler(aud, ev, handler)
-AuServer *aud;
-AuEvent *ev;
-AuEventHandlerRec *handler;
+EventHandler(AuServer *aud, AuEvent *ev, AuEventHandlerRec *handler)
{
AuElementNotifyEvent *event = (AuElementNotifyEvent *) ev;
@@ -403,11 +373,7 @@
}
static void
-quit(w, event, params, num_params)
-Widget w;
-XEvent *event;
-String *params;
-Cardinal *num_params;
+quit(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
GlobalDataPtr g = globals;
@@ -419,9 +385,7 @@
}
int
-main(argc, argv)
-int argc;
-char **argv;
+main(int argc, char **argv)
{
GlobalDataRec globalData;
GlobalDataPtr g = &globalData;
@@ -443,12 +407,12 @@
if (!strncmp(argv[1], "-a", 2))
audioServer = argv[2];
else
- fatalError(USAGE);
+ fatalError(USAGE, NULL);
else if (argc != 1)
- fatalError(USAGE);
+ fatalError(USAGE, NULL);
if (!(g->aud = AuOpenServer(audioServer, 0, NULL, 0, NULL, NULL)))
- fatalError("Can't connect to audio server");
+ fatalError("Can't connect to audio server %s", audioServer);
g->dpy = XtDisplay(g->top);
g->flow = 0;
@@ -475,7 +439,7 @@
NULL);
if (!AuRegisterEventHandler(g->aud, 0, 0, 0, EventHandler, (AuPointer) g))
- fatalError("Can't register event handler");
+ fatalError("Can't register event handler", NULL);
/* handle delete window message */
g->wm_delete_window = XInternAtom(g->dpy, "WM_DELETE_WINDOW", FALSE);
-------------- next part --------------
Index: clients/audio/examples/playRaw.c
===================================================================
--- clients/audio/examples/playRaw.c (revision 168)
+++ clients/audio/examples/playRaw.c (working copy)
@@ -28,9 +28,7 @@
} InfoRec, *InfoPtr;
static void
-fatalError(message, arg)
-char *message,
- *arg;
+fatalError(char *message, char *arg)
{
fprintf(stderr, message, arg);
fprintf(stderr, "\n");
@@ -38,10 +36,7 @@
}
static void
-sendFile(aud, i, numBytes)
-AuServer *aud;
-InfoPtr i;
-AuUint32 numBytes;
+sendFile(AuServer *aud, InfoPtr i, AuUint32 numBytes)
{
int n;
@@ -54,10 +49,7 @@
}
static AuBool
-eventHandler(aud, ev, handler)
-AuServer *aud;
-AuEvent *ev;
-AuEventHandlerRec *handler;
+eventHandler(AuServer *aud, AuEvent *ev, AuEventHandlerRec *handler)
{
InfoPtr i = (InfoPtr) handler->data;
@@ -88,9 +80,7 @@
}
int
-main(argc, argv)
-int argc;
-char **argv;
+main(int argc, char **argv)
{
AuDeviceID device = AuNone;
AuElement elements[3];
@@ -118,10 +108,10 @@
}
if (device == AuNone)
- fatalError("Couldn't find an output device");
+ fatalError("Couldn't find an output device", NULL);
if (!(info.flow = AuCreateFlow(info.aud, NULL)))
- fatalError("Couldn't create flow");
+ fatalError("Couldn't create flow", NULL);
AuMakeElementImportClient(&elements[0], SAMPLE_RATE, DATA_FORMAT,
NUM_TRACKS,
Index: clients/audio/examples/playSimul.c
===================================================================
--- clients/audio/examples/playSimul.c (revision 168)
+++ clients/audio/examples/playSimul.c (working copy)
@@ -14,11 +14,7 @@
#include <audio/soundlib.h>
static void
-doneCB(aud, handler, ev, data)
-AuServer *aud;
-AuEvent *ev;
-AuEventHandlerRec *handler;
-AuPointer data;
+doneCB(AuServer *aud, AuEventHandlerRec *handler, AuEvent *ev, AuPointer data)
{
int *count = (int *) data;
@@ -26,9 +22,7 @@
}
int
-main(argc, argv)
-int argc;
-char **argv;
+main(int argc, char **argv)
{
AuServer *aud;
AuEvent ev;
Index: clients/audio/examples/playFile.c
===================================================================
--- clients/audio/examples/playFile.c (revision 168)
+++ clients/audio/examples/playFile.c (working copy)
@@ -13,9 +13,7 @@
#include <audio/audiolib.h>
#include <audio/soundlib.h>
-main(argc, argv)
-int argc;
-char **argv;
+main(int argc, char **argv)
{
char *file = argv[1];
int volume = 100;
Index: clients/audio/examples/plyBcktAsync.c
===================================================================
--- clients/audio/examples/plyBcktAsync.c (revision 168)
+++ clients/audio/examples/plyBcktAsync.c (working copy)
@@ -12,9 +12,7 @@
#include <audio/soundlib.h>
static void
-fatalError(message, arg)
-char *message,
- *arg;
+fatalError(char *message, char *arg)
{
fprintf(stderr, message, arg);
fprintf(stderr, "\n");
@@ -22,11 +20,7 @@
}
static void
-doneCB(aud, handler, ev, data)
-AuServer *aud;
-AuEvent *ev;
-AuEventHandlerRec *handler;
-AuPointer data;
+doneCB(AuServer *aud, AuEventHandlerRec *handler, AuEvent *ev, AuPointer data)
{
AuBool *done = (int *) data;
@@ -35,15 +29,13 @@
/* this function must return periodically to service audio events */
static void
-doSomeWork()
+doSomeWork(void)
{
printf("doing some work\n");
}
int
-main(argc, argv)
-int argc;
-char **argv;
+main(int argc, char **argv)
{
AuServer *aud;
AuBucketID bucket;
@@ -52,14 +44,14 @@
char *file = argv[1];
if (argc < 2)
- fatalError("usage: plyBcktAsync file");
+ fatalError("usage: plyBcktAsync file", NULL);
if (!(aud = AuOpenServer(NULL, 0, NULL, 0, NULL, NULL)))
- fatalError("Can't open audio server");
+ fatalError("Can't open audio server", NULL);
if (!(bucket = AuSoundCreateBucketFromFile(aud, file, AuAccessAllMasks,
NULL, NULL)))
- fatalError("Can't create bucket");
+ fatalError("Can't create bucket", NULL);
AuSoundPlayFromBucket(aud, bucket, AuNone, AuFixedPointFromSum(1, 0),
doneCB, (AuPointer) &done, 1, NULL, NULL, NULL, NULL);
Index: clients/audio/examples/loopBucket.c
===================================================================
--- clients/audio/examples/loopBucket.c (revision 168)
+++ clients/audio/examples/loopBucket.c (working copy)
@@ -15,9 +15,7 @@
#include <audio/soundlib.h>
static void
-fatalError(message, arg)
-char *message,
- *arg;
+fatalError(char *message, char *arg)
{
fprintf(stderr, message, arg);
fprintf(stderr, "\n");
@@ -25,10 +23,7 @@
}
static AuBool
-EventHandler(aud, ev, handler)
-AuServer *aud;
-AuEvent *ev;
-AuEventHandlerRec *handler;
+EventHandler(AuServer *aud, AuEvent *ev, AuEventHandlerRec *handler)
{
AuBool *done = (AuBool *) handler->data;
AuElementNotifyEvent *event = (AuElementNotifyEvent *) ev;
@@ -42,9 +37,7 @@
}
int
-main(argc, argv)
-int argc;
-char **argv;
+main(int argc, char **argv)
{
AuServer *aud;
AuBucketID bucket;
@@ -59,7 +52,7 @@
int i;
if (argc < 2)
- fatalError("usage: loopBucket filename");
+ fatalError("usage: loopBucket filename", NULL);
if (!(aud = AuOpenServer(NULL, 0, NULL, 0, NULL, NULL)))
exit(1);
@@ -79,10 +72,10 @@
}
if (device == AuNone)
- fatalError("Couldn't find an output device");
+ fatalError("Couldn't find an output device", NULL);
if (!(flow = AuCreateFlow(aud, NULL)))
- fatalError("Couldn't create flow");
+ fatalError("Couldn't create flow", NULL);
AuMakeChangeStateAction(&actions[0], AuStateStop, AuStateStart,
AuReasonEOF, flow, AuElementAll, AuStateStart);
@@ -99,7 +92,7 @@
if (!(handler = AuRegisterEventHandler(aud, AuEventHandlerIDMask,
0, flow, EventHandler,
(AuPointer) &done)))
- fatalError("Couldn't register event handler");
+ fatalError("Couldn't register event handler", NULL);
AuStartFlow(aud, flow, NULL);
Index: clients/audio/examples/bundle.c
===================================================================
--- clients/audio/examples/bundle.c (revision 168)
+++ clients/audio/examples/bundle.c (working copy)
@@ -22,9 +22,7 @@
#include <audio/soundlib.h>
static void
-fatalError(message, arg)
-char *message,
- *arg;
+fatalError(char *message, char *arg)
{
fprintf(stderr, message, arg);
fprintf(stderr, "\n");
@@ -32,10 +30,7 @@
}
static AuBool
-EventHandler(aud, ev, handler)
-AuServer *aud;
-AuEvent *ev;
-AuEventHandlerRec *handler;
+EventHandler(AuServer *aud, AuEvent *ev, AuEventHandlerRec *handler)
{
AuBool *done = (AuBool *) handler->data;
AuElementNotifyEvent *event = (AuElementNotifyEvent *) ev;
@@ -49,9 +44,7 @@
}
int
-main(argc, argv)
-int argc;
-char **argv;
+main(int argc, char **argv)
{
char *file = argv[1];
AuServer *aud;
@@ -69,10 +62,10 @@
AuBool done = AuFalse;
if (argc < 2)
- fatalError("usage: bundle filename");
+ fatalError("usage: bundle filename", NULL);
if (!(s = SoundOpenFileForReading(file)))
- fatalError("Can't open %s");
+ fatalError("Can't open %s", file);
toTracks = SoundNumTracks(s) == 1 ? 2 : 1;
SoundCloseFile(s);
@@ -91,13 +84,13 @@
}
if (device == AuNone)
- fatalError("Couldn't find an output device");
+ fatalError("Couldn't find an output device", NULL);
bucket = AuSoundCreateBucketFromFile(aud, file, AuAccessAllMasks, &ba,
NULL);
if (!(flow = AuCreateFlow(aud, NULL)))
- fatalError("Couldn't create flow");
+ fatalError("Couldn't create flow", NULL);
AuMakeElementImportBucket(&elements[0], AuBucketSampleRate(ba), bucket,
AuUnlimitedSamples, 0, 0, NULL);
@@ -141,7 +134,7 @@
if (!(handler = AuRegisterEventHandler(aud, AuEventHandlerIDMask,
0, flow, EventHandler,
(AuPointer) &done)))
- fatalError("Couldn't register event handler");
+ fatalError("Couldn't register event handler", NULL);
AuStartFlow(aud, flow, NULL);
Index: clients/audio/examples/recordBucket.c
===================================================================
--- clients/audio/examples/recordBucket.c (revision 168)
+++ clients/audio/examples/recordBucket.c (working copy)
@@ -16,9 +16,7 @@
#include <audio/soundlib.h>
static void
-fatalError(message, arg)
-char *message,
- *arg;
+fatalError(char *message, char *arg)
{
fprintf(stderr, message, arg);
fprintf(stderr, "\n");
@@ -26,11 +24,7 @@
}
static void
-doneCB(aud, handler, ev, data)
-AuServer *aud;
-AuEvent *ev;
-AuEventHandlerRec *handler;
-AuPointer data;
+doneCB(AuServer *aud, AuEventHandlerRec *handler, AuEvent *ev, AuPointer data)
{
AuBool *done = (AuBool *) data;
@@ -38,9 +32,7 @@
}
int
-main(argc, argv)
-int argc;
-char **argv;
+main(int argc, char **argv)
{
AuServer *aud;
AuBool done;
@@ -50,11 +42,11 @@
int i;
if (!(aud = AuOpenServer(NULL, 0, NULL, 0, NULL, NULL)))
- fatalError("Can't open audio server");
+ fatalError("Can't open audio server", NULL);
if (!(bucket = AuCreateBucket(aud, AuFormatULAW8, 1, AuAccessAllMasks,
8000, 80000, NULL, NULL)))
- fatalError("Error creating bucket");
+ fatalError("Error creating bucket", NULL);
/* look for a one track input device */
for (i = 0; i < AuServerNumDevices(aud); i++)
@@ -67,7 +59,7 @@
}
if (!da)
- fatalError("Couldn't find appropriate input device");
+ fatalError("Couldn't find appropriate input device", NULL);
printf("Press return to begin recording\n");
getchar();
Index: clients/audio/examples/playFromBckt.c
===================================================================
--- clients/audio/examples/playFromBckt.c (revision 168)
+++ clients/audio/examples/playFromBckt.c (working copy)
@@ -14,9 +14,7 @@
#include <audio/soundlib.h>
static void
-fatalError(message, arg)
-char *message,
- *arg;
+fatalError(char *message, char *arg)
{
fprintf(stderr, message, arg);
fprintf(stderr, "\n");
@@ -24,10 +22,7 @@
}
static AuBool
-EventHandler(aud, ev, handler)
-AuServer *aud;
-AuEvent *ev;
-AuEventHandlerRec *handler;
+EventHandler(AuServer *aud, AuEvent *ev, AuEventHandlerRec *handler)
{
AuBool *done = (AuBool *) handler->data;
AuElementNotifyEvent *event = (AuElementNotifyEvent *) ev;
@@ -41,9 +36,7 @@
}
int
-main(argc, argv)
-int argc;
-char **argv;
+main(int argc, char **argv)
{
AuServer *aud;
AuBucketID bucket;
@@ -59,7 +52,7 @@
int i;
if (argc < 2)
- fatalError("usage: playFromBckt filename [bucket offset] [number of samples]");
+ fatalError("usage: playFromBckt filename [bucket offset] [number of samples]", NULL);
argc -= 2;
@@ -93,10 +86,10 @@
}
if (device == AuNone)
- fatalError("Couldn't find an output device");
+ fatalError("Couldn't find an output device", NULL);
if (!(flow = AuCreateFlow(aud, NULL)))
- fatalError("Couldn't create flow");
+ fatalError("Couldn't create flow", NULL);
AuMakeElementImportBucket(&elements[0], AuBucketSampleRate(ba), bucket,
samples, offset, 0, NULL);
@@ -110,7 +103,7 @@
if (!(handler = AuRegisterEventHandler(aud, AuEventHandlerIDMask,
0, flow, EventHandler,
(AuPointer) &done)))
- fatalError("Couldn't register event handler");
+ fatalError("Couldn't register event handler", NULL);
AuStartFlow(aud, flow, NULL);
-------------- next part --------------
Index: clients/audio/util/playbucket.c
===================================================================
--- clients/audio/util/playbucket.c (revision 168)
+++ clients/audio/util/playbucket.c (working copy)
@@ -31,9 +31,7 @@
#define USAGE "usage: playbucket [-a audioServer] [-v volume] file"
static void
-fatalError(message, arg)
-char *message,
- *arg;
+fatalError(char *message, char *arg)
{
fprintf(stderr, message, arg);
fprintf(stderr, "\n");
@@ -78,17 +76,17 @@
argc -= 2;
break;
default:
- fatalError(USAGE);
+ fatalError(USAGE, NULL);
}
if (argc != 2)
- fatalError(USAGE);
+ fatalError(USAGE, NULL);
if (!(s = SoundOpenFileForReading(*arg)))
fatalError("Can't open file %s", *arg);
if (!(aud = AuOpenServer(audioServer, 0, NULL, 0, NULL, NULL)))
- fatalError("Can't connect to audio server");
+ fatalError("Can't connect to audio server", NULL);
AuSetString(AuBucketDescription(&b),
AuStringLatin1, strlen(SoundComment(s)), SoundComment(s));
Index: clients/audio/util/soundtoh.c
===================================================================
--- clients/audio/util/soundtoh.c (revision 168)
+++ clients/audio/util/soundtoh.c (working copy)
@@ -44,9 +44,7 @@
#include <audio/sound.h>
static void
-fatalError(message, arg)
-char *message,
- *arg;
+fatalError(char *message, char *arg)
{
fprintf(stderr, message, arg);
fprintf(stderr, "\n");
@@ -85,7 +83,7 @@
int i;
if (argc != 2)
- fatalError("usage: soundtoh filename");
+ fatalError("usage: soundtoh filename", NULL);
if (!(s = SoundOpenFileForReading(name)))
fatalError("Can't open file \"%s\"", name);
-------------- next part --------------
Index: clients/audio/widgets/Slider.c
===================================================================
--- clients/audio/widgets/Slider.c (revision 168)
+++ clients/audio/widgets/Slider.c (working copy)
@@ -57,8 +57,10 @@
},
};
-static void Initialize();
-static Boolean SetValues();
+static void Initialize(Widget request, Widget new, ArgList args,
+ Cardinal *num_args);
+static Boolean SetValues(Widget current, Widget request, Widget new,
+ ArgList in_args, Cardinal *in_num_args);
SliderClassRec sliderClassRec =
{
@@ -210,7 +212,8 @@
}
static Boolean
-SetValues(Widget current, Widget request, Widget new, ArgList in_args, Cardinal *in_num_args)
+SetValues(Widget current, Widget request, Widget new, ArgList in_args,
+ Cardinal *in_num_args)
{
SliderWidget w = (SliderWidget) new,
old = (SliderWidget) current;
More information about the Nas
mailing list