openbsd-ports/audio/sox/patches/patch-src_sphere_c
naddy ffbb62be15 * make sox work on platforms where char defaults to unsigned
* sprintf -> snprintf, and opportunistically get rid of some strcpy()s

From: Matthias Kilian <kili@outback.escape.de>
2005-07-02 16:27:56 +00:00

40 lines
1.4 KiB
Plaintext

$OpenBSD: patch-src_sphere_c,v 1.1 2005/07/02 16:27:56 naddy Exp $
--- src/sphere.c.orig Tue Sep 28 04:33:09 2004
+++ src/sphere.c Fri Jun 24 11:50:27 2005
@@ -276,27 +276,29 @@ int st_spherestopwrite(ft_t ft)
st_writes(ft, " 1024\n");
samples = sphere->numSamples/ft->info.channels;
- sprintf(buf, "sample_count -i %ld\n", samples);
+ snprintf(buf, sizeof(buf), "sample_count -i %ld\n", samples);
st_writes(ft, buf);
- sprintf(buf, "sample_n_bytes -i %d\n", ft->info.size);
+ snprintf(buf, sizeof(buf), "sample_n_bytes -i %d\n", ft->info.size);
st_writes(ft, buf);
- sprintf(buf, "channel_count -i %d\n", ft->info.channels);
+ snprintf(buf, sizeof(buf), "channel_count -i %d\n", ft->info.channels);
st_writes(ft, buf);
if (ft->swap)
{
- sprintf(buf, "sample_byte_format -s2 %s\n", ST_IS_BIGENDIAN ? "01" : "10");
+ snprintf(buf, sizeof(buf), "sample_byte_format -s2 %s\n",
+ ST_IS_BIGENDIAN ? "01" : "10");
}
else
{
- sprintf(buf, "sample_byte_format -s2 %s\n", ST_IS_BIGENDIAN ? "10" : "01");
+ snprintf(buf, sizeof(buf), "sample_byte_format -s2 %s\n",
+ ST_IS_BIGENDIAN ? "10" : "01");
}
st_writes(ft, buf);
rate = ft->info.rate;
- sprintf(buf, "sample_rate -i %ld\n", rate);
+ snprintf(buf, sizeof(buf), "sample_rate -i %ld\n", rate);
st_writes(ft, buf);
if (ft->info.encoding == ST_ENCODING_ULAW)