36 lines
1.3 KiB
Plaintext
36 lines
1.3 KiB
Plaintext
$OpenBSD: patch-src_dat_c,v 1.2 2006/10/18 15:41:06 naddy Exp $
|
|
--- src/dat.c.orig Wed Oct 18 15:57:26 2006
|
|
+++ src/dat.c Wed Oct 18 15:58:46 2006
|
|
@@ -90,9 +90,9 @@ int st_datstartwrite(ft_t ft)
|
|
dat->timevalue = 0.0;
|
|
dat->deltat = 1.0 / (double)ft->info.rate;
|
|
/* Write format comments to start of file */
|
|
- sprintf(s,"; Sample Rate %ld\015\n", (long)ft->info.rate);
|
|
+ snprintf(s, sizeof(s), "; Sample Rate %ld\015\n", (long)ft->info.rate);
|
|
st_writes(ft, s);
|
|
- sprintf(s,"; Channels %d\015\n", (int)ft->info.channels);
|
|
+ snprintf(s, sizeof(s), "; Channels %d\015\n", (int)ft->info.channels);
|
|
st_writes(ft, s);
|
|
|
|
return (ST_SUCCESS);
|
|
@@ -159,16 +159,16 @@ st_ssize_t st_datwrite(ft_t ft, st_sampl
|
|
|
|
/* Write time, then sample values, then CRLF newline */
|
|
while(done < nsamp) {
|
|
- sprintf(s," %15.8g ",dat->timevalue);
|
|
+ snprintf(s, sizeof(s), " %15.8g ",dat->timevalue);
|
|
st_writes(ft, s);
|
|
for (i=0; i<ft->info.channels; i++) {
|
|
sampval = *buf++ ;
|
|
sampval = sampval * LONGTOFLOAT;
|
|
- sprintf(s," %15.8g", sampval);
|
|
+ snprintf(s, sizeof(s), " %15.8g", sampval);
|
|
st_writes(ft, s);
|
|
done++;
|
|
}
|
|
- sprintf(s," \015\n");
|
|
+ snprintf(s, sizeof(s), " \015\n");
|
|
st_writes(ft, s);
|
|
dat->timevalue += dat->deltat;
|
|
}
|