shithub: sox

Download patch

ref: cd6f068af3d62ce561a146571439bfdd844ed922
parent: 9f72db1f539ef08438ef679424a2c05d08c473d6
author: cbagwell <cbagwell>
date: Mon Dec 6 23:11:21 EST 1999

u_char isn't defined on all platforms.  Also added back libst.h
to raw.c since it needs ulaw prototypes.

--- a/src/adpcm.c
+++ b/src/adpcm.c
@@ -113,12 +113,12 @@
 	int chans,          /* total channels             */
 	int nCoef,
 	const short *iCoef,
-	const u_char *ibuff,/* input buffer[blockAlign]   */
+	const unsigned char *ibuff,/* input buffer[blockAlign]   */
 	SAMPL *obuff,       /* output samples, n*chans    */
 	int n               /* samples to decode PER channel */
 )
 {
-	const u_char *ip;
+	const unsigned char *ip;
 	int ch;
 	const char *errmsg = NULL;
 	MsState_t state[4];						/* One decompressor state for each channel */
@@ -126,7 +126,7 @@
 	/* Read the four-byte header for each channel */
 	ip = ibuff;
 	for (ch = 0; ch < chans; ch++) {
-		u_char bpred = *ip++;
+		unsigned char bpred = *ip++;
 		if (bpred >= nCoef) {
 			errmsg = "MSADPCM bpred >= nCoef, arbitrarily using 0\n";
 			bpred = 0;
@@ -149,7 +149,7 @@
 
 	{
 		int ch;
-		u_char b;
+		unsigned char b;
 		short *op, *top;
 
 		/* already have 1st 2 samples from block-header */
@@ -178,12 +178,12 @@
 	const SAMPL *ibuff,  /* ibuff[] is interleaved input samples */
 	int n,               /* samples to encode PER channel */
 	int *iostep,         /* input/output step, REQUIRE 16 <= *st <= 0x7fff */
-	u_char *obuff,       /* output buffer[blockAlign], or NULL for no output  */
+	unsigned char *obuff,       /* output buffer[blockAlign], or NULL for no output  */
 	int sho              /* nonzero for debug printout */
 )
 {
 	const SAMPL *ip, *itop;
-	u_char *op;
+	unsigned char *op;
 	int ox = 0;      /*  */
 	int i, d, v0, v1, step;
 	double d2;       /* long long is okay also, speed abt the same */
@@ -317,7 +317,7 @@
 	const SAMPL *ip,    /* ip[] is interleaved input samples */
 	int n,              /* samples to encode PER channel, REQUIRE */
 	int *st,            /* input/output steps, 16<=st[i] */
-	u_char *obuff,      /* output buffer[blockAlign] */
+	unsigned char *obuff,      /* output buffer[blockAlign] */
 	int opt             /* non-zero allows some cpu-intensive code to improve output */
 )
 {
@@ -377,13 +377,13 @@
 	const SAMPL *ip,    /* ip[n*chans] is interleaved input samples */
 	int n,              /* samples to encode PER channel */
 	int *st,            /* input/output steps, 16<=st[i] */
-	u_char *obuff,      /* output buffer[blockAlign]     */
+	unsigned char *obuff,      /* output buffer[blockAlign]     */
 	int blockAlign,     /* >= 7*chans + chans*(n-2)/2.0    */
 	int opt             /* non-zero allows some cpu-intensive code to improve output */
 )
 {
 	int ch;
-	u_char *p;
+	unsigned char *p;
 
 	/*fprintf(stderr,"AdpcmMashI(chans %d, ip %p, n %d, st %p, obuff %p, bA %d)\n",
 								 chans, ip, n, st, obuff, blockAlign);*/
--- a/src/adpcm.h
+++ b/src/adpcm.h
@@ -23,7 +23,7 @@
 	int chans,          /* total channels             */
 	int nCoef,
 	const short *iCoef,
-	const u_char *ibuff,/* input buffer[blockAlign]   */
+	const unsigned char *ibuff,/* input buffer[blockAlign]   */
 	SAMPL *obuff,       /* output samples, n*chans    */
 	int n               /* samples to decode PER channel, REQUIRE n % 8 == 1  */
 );
@@ -33,7 +33,7 @@
 	const SAMPL *ip,    /* ip[n*chans] is interleaved input samples */
 	int n,              /* samples to encode PER channel, REQUIRE */
 	int *st,            /* input/output steps, 16<=st[i] */
-	u_char *obuff,      /* output buffer[blockAlign] */
+	unsigned char *obuff,      /* output buffer[blockAlign] */
 	int blockAlign,     /* >= 7*chans + n/2          */
 	int opt             /* non-zero allows some cpu-intensive code to improve output */
 );
--- a/src/ima_rw.c
+++ b/src/ima_rw.c
@@ -48,7 +48,7 @@
 /* -0 - -3, decrease step size */
 /* -4 - -7, increase step size */
 
-static u_char imaStateAdjustTable[ISSTMAX+1][8];
+static unsigned char imaStateAdjustTable[ISSTMAX+1][8];
 
 void initImaTable(void)
 {
@@ -66,13 +66,13 @@
 static void ImaExpandS(
 	int ch,             /* channel number to decode, REQUIRE 0 <= ch < chans  */
 	int chans,          /* total channels             */
-	const u_char *ibuff,/* input buffer[blockAlign]   */
+	const unsigned char *ibuff,/* input buffer[blockAlign]   */
 	SAMPL *obuff,       /* obuff[n] will be output samples */
 	int n,              /* samples to decode PER channel, REQUIRE n % 8 == 1  */
 	int o_inc           /* index difference between successive output samples */
 )
 {
-	const u_char *ip;
+	const unsigned char *ip;
 	int i_inc;
 	SAMPL *op;
 	int i, val, state;
@@ -141,7 +141,7 @@
 /* ImaBlockExpandI() outputs interleaved samples into one output buffer */
 void ImaBlockExpandI(
 	int chans,          /* total channels             */
-	const u_char *ibuff,/* input buffer[blockAlign]   */
+	const unsigned char *ibuff,/* input buffer[blockAlign]   */
 	SAMPL *obuff,       /* output samples, n*chans    */
 	int n               /* samples to decode PER channel, REQUIRE n % 8 == 1  */
 )
@@ -154,7 +154,7 @@
 /* ImaBlockExpandM() outputs non-interleaved samples into chan separate output buffers */
 void ImaBlockExpandM(
 	int chans,          /* total channels             */
-	const u_char *ibuff,/* input buffer[blockAlign]   */
+	const unsigned char *ibuff,/* input buffer[blockAlign]   */
 	SAMPL **obuffs,     /* chan output sample buffers, each takes n samples */
 	int n               /* samples to decode PER channel, REQUIRE n % 8 == 1  */
 )
@@ -171,12 +171,12 @@
 	const SAMPL *ibuff, /* ibuff[] is interleaved input samples */
 	int n,              /* samples to encode PER channel, REQUIRE n % 8 == 1 */
 	int *st,            /* input/output state, REQUIRE 0 <= *st <= ISSTMAX */
-	u_char *obuff,      /* output buffer[blockAlign], or NULL for no output  */
+	unsigned char *obuff, /* output buffer[blockAlign], or NULL for no output  */
 	int sho             /* nonzero for debug printout */
 )
 {
 	const SAMPL *ip, *itop;
-	u_char *op;
+	unsigned char *op;
 	int o_inc = 0;      /* set 0 only to shut up gcc's 'might be uninitialized' */
 	int i, val;
 	int state;
@@ -268,7 +268,7 @@
 	const SAMPL *ip,    /* ip[] is interleaved input samples */
 	int n,              /* samples to encode PER channel, REQUIRE n % 8 == 1 */
 	int *st,            /* input/output state, REQUIRE 0 <= *st <= ISSTMAX */
-	u_char *obuff,      /* output buffer[blockAlign] */
+	unsigned char *obuff, /* output buffer[blockAlign] */
 	int opt             /* non-zero allows some cpu-intensive code to improve output */
 )
 {
@@ -324,7 +324,7 @@
 	const SAMPL *ip,    /* ip[] is interleaved input samples */
 	int n,              /* samples to encode PER channel, REQUIRE n % 8 == 1 */
 	int *st,            /* input/output state, REQUIRE 0 <= *st <= ISSTMAX */
-	u_char *obuff,      /* output buffer[blockAlign] */
+	unsigned char *obuff, /* output buffer[blockAlign] */
 	int opt             /* non-zero allows some cpu-intensive code to improve output */
 )
 {
--- a/src/ima_rw.h
+++ b/src/ima_rw.h
@@ -48,7 +48,7 @@
 /* ImaBlockExpandI() outputs interleaved samples into one output buffer */
 extern void ImaBlockExpandI(
 	int chans,          /* total channels             */
-	const u_char *ibuff,/* input buffer[blockAlign]   */
+	const unsigned char *ibuff,/* input buffer[blockAlign]   */
 	SAMPL *obuff,       /* output samples, n*chans    */
 	int n               /* samples to decode PER channel, REQUIRE n % 8 == 1  */
 );
@@ -56,7 +56,7 @@
 /* ImaBlockExpandM() outputs non-interleaved samples into chan separate output buffers */
 extern void ImaBlockExpandM(
 	int chans,          /* total channels             */
-	const u_char *ibuff,/* input buffer[blockAlign]   */
+	const unsigned char *ibuff,/* input buffer[blockAlign]   */
 	SAMPL **obuffs,     /* chan output sample buffers, each takes n samples */
 	int n               /* samples to decode PER channel, REQUIRE n % 8 == 1  */
 );
@@ -67,7 +67,7 @@
 	const SAMPL *ip,    /* ip[] is interleaved input samples */
 	int n,              /* samples to encode PER channel, REQUIRE n % 8 == 1 */
 	int *st,            /* input/output state[chans], REQUIRE 0 <= st[ch] <= ISSTMAX */
-	u_char *obuff,      /* output buffer[blockAlign] */
+	unsigned char *obuff, /* output buffer[blockAlign] */
 	int opt             /* non-zero allows some cpu-intensive code to improve output */
 );
 
--- a/src/raw.c
+++ b/src/raw.c
@@ -20,6 +20,7 @@
  */
 
 #include "st.h"
+#include "libst.h"
 
 #include <string.h>
 #include <stdlib.h>