Reformat all C files.

I'll push a formatting guide at some point. There may still be
outstanding changes, but please feel free to resolve those as you arrive
a them.

To the best of my knowledge, there is no changes to the actual code
content, but the formatter does have the occasional bug. If you run into
an issue, please fix it!
This commit is contained in:
Sean Hunt
2015-05-09 13:43:16 -04:00
parent 167800afdf
commit 97d6fade74
270 changed files with 182649 additions and 173878 deletions
+36 -35
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 cvtsnd.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.6 cvtsnd.c $NHDT-Date: 1431192783 2015/05/09 17:33:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.6 $ */
/* NetHack 3.6 cvtsnd.c $Date: 2009/05/06 10:48:31 $ $Revision: 1.3 $ */
/* SCCS Id: @(#)cvtsnd.c 3.5 1995/09/10 */
/* Copyright (c) 1995, Andrew Church, Olney, Maryland */
@@ -11,7 +11,7 @@
typedef struct {
short namelen;
char name[62];
char misc[64]; /* rest of MacBinary header */
char misc[64]; /* rest of MacBinary header */
long FORM;
long flen;
long AIFF;
@@ -26,19 +26,18 @@ typedef struct {
char VHDR[4];
long vhlen;
long oneshot, repeat;
long samples; /* 'samplesPerHiCycle' in the docs - usually 32, so
* we'll use that */
long samples; /* 'samplesPerHiCycle' in the docs - usually 32, so
* we'll use that */
short freq;
char octaves, compress;
long volume;
char NAME[4];
long nlen; /* should be 64; see name[] comment */
char name[64]; /* for simplicity, i.e. just fwrite() entiree header */
long nlen; /* should be 64; see name[] comment */
char name[64]; /* for simplicity, i.e. just fwrite() entiree header */
char BODY[4];
long blen;
} IFF;
main(int ac, char **av)
{
FILE *in, *out;
@@ -48,51 +47,53 @@ main(int ac, char **av)
long n, len;
if (ac != 3) {
fprintf(stderr, "Usage: %s input-file output-file\n", av[0]);
exit(20);
fprintf(stderr, "Usage: %s input-file output-file\n", av[0]);
exit(20);
}
if (!(in = fopen(av[1], "r"))) {
fprintf(stderr, "Can't open input file\n");
exit(20);
fprintf(stderr, "Can't open input file\n");
exit(20);
}
if (!(out = fopen(av[2], "w"))) {
fprintf(stderr, "Can't open output file\n");
exit(20);
fprintf(stderr, "Can't open output file\n");
exit(20);
}
fread(&aiff, sizeof(aiff), 1, in);
memcpy(iff.FORM, "FORM", 4);
iff.flen = sizeof(iff) + aiff.sndlen - 8;
iff.flen = sizeof(iff) + aiff.sndlen - 8;
memcpy(iff._8SVX, "8SVX", 4);
memcpy(iff.VHDR, "VHDR", 4);
iff.vhlen = 20;
iff.oneshot = aiff.sndlen;
iff.repeat = 0;
iff.samples = 32;
iff.freq = 22000;
iff.octaves = 1;
iff.compress= 0;
iff.volume = 0x10000;
iff.vhlen = 20;
iff.oneshot = aiff.sndlen;
iff.repeat = 0;
iff.samples = 32;
iff.freq = 22000;
iff.octaves = 1;
iff.compress = 0;
iff.volume = 0x10000;
memcpy(iff.NAME, "NAME", 4);
iff.nlen = 64;
strncpy(iff.name, aiff.name, 62); iff.name[aiff.namelen] = 0;
iff.nlen = 64;
strncpy(iff.name, aiff.name, 62);
iff.name[aiff.namelen] = 0;
memcpy(iff.BODY, "BODY", 4);
iff.blen = aiff.sndlen;
iff.blen = aiff.sndlen;
fwrite(&iff, sizeof(iff), 1, out);
len = aiff.sndlen;
do {
if (len >= sizeof(buf))
n = fread(buf, 1, sizeof(buf), in);
else
n = fread(buf, 1, len, in);
if (n) {
fwrite(buf, 1, n, out);
len -= n;
}
if (len >= sizeof(buf))
n = fread(buf, 1, sizeof(buf), in);
else
n = fread(buf, 1, len, in);
if (n) {
fwrite(buf, 1, n, out);
len -= n;
}
} while (len && n);
if (len)
fprintf(stderr, "Warning: %ld bytes of sample missing\n", len);
fclose(in); fclose(out);
fprintf(stderr, "Warning: %ld bytes of sample missing\n", len);
fclose(in);
fclose(out);
exit(0);
}