code there is badly broken, it tries to modify const fields, and gcc < 3.3.5

didn't enforce that correctly.
This commit is contained in:
espie 2004-12-13 11:59:48 +00:00
parent 3cb7e2fc09
commit df5d15dff0

View File

@ -0,0 +1,37 @@
$OpenBSD: patch-tools_find_sts_main_c,v 1.1 2004/12/13 11:59:48 espie Exp $
--- tools/find_sts_main.c.orig Mon Dec 13 12:55:55 2004
+++ tools/find_sts_main.c Mon Dec 13 12:58:01 2004
@@ -75,6 +75,11 @@ cst_sts *find_sts(cst_wave *sig, cst_tra
double *resd;
int size,start,end;
short *sigplus;
+ struct dummy {
+ unsigned short *frame;
+ int size;
+ unsigned char *residual;
+ } *stsw;
sts = cst_alloc(cst_sts,lpc->num_frames);
start = 0;
@@ -93,14 +98,16 @@ cst_sts *find_sts(cst_wave *sig, cst_tra
lpc->frames[i],lpc->num_channels,
resd,
size);
- sts[i].size = size;
- sts[i].frame = cst_alloc(unsigned short,lpc->num_channels-1);
+
+ stsw = (struct dummy *)(sts+i);
+ stsw->size = size;
+ stsw->frame = cst_alloc(unsigned short,lpc->num_channels-1);
for (j=1; j < lpc->num_channels; j++)
- sts[i].frame[j-1] = (unsigned short)
+ stsw->frame[j-1] = (unsigned short)
(((lpc->frames[i][j]-lpc_min)/lpc_range)*65535);
- sts[i].residual = cst_alloc(unsigned char,size);
+ stsw->residual = cst_alloc(unsigned char,size);
for (j=0; j < size; j++)
- sts[i].residual[j] = cst_short_to_ulaw((short)resd[j]);
+ stsw->residual[j] = cst_short_to_ulaw((short)resd[j]);
start = end;
}