mirror of
https://github.com/claunia/flac.git
synced 2025-12-16 18:54:26 +00:00
Use new function flac_snprintf() where ever appropriate.
This replaces un-safe usage of sprintf() and Micorsoft's _snprintf() with something sane.
This commit is contained in:
@@ -24,4 +24,4 @@ noinst_PROGRAMS = test_streams
|
||||
test_streams_SOURCES = \
|
||||
main.c
|
||||
|
||||
test_streams_LDADD = -lm
|
||||
test_streams_LDADD = $(top_builddir)/src/share/grabbag/libgrabbag.la -lm
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#endif
|
||||
#include "FLAC/assert.h"
|
||||
#include "FLAC/ordinals.h"
|
||||
#include "share/compat.h"
|
||||
|
||||
#ifndef M_PI
|
||||
/* math.h in VC++ doesn't seem to have this (how Microsoft is that?) */
|
||||
@@ -1136,24 +1137,24 @@ int main(int argc, char *argv[])
|
||||
for(samples = 0; samples < sizeof(nsamples)/sizeof(nsamples[0]); samples++) {
|
||||
char fn[64];
|
||||
|
||||
sprintf(fn, "rt-%u-%u-%u.aiff", channels, bits_per_sample, nsamples[samples]);
|
||||
flac_snprintf(fn, sizeof (fn), "rt-%u-%u-%u.aiff", channels, bits_per_sample, nsamples[samples]);
|
||||
if(!generate_aiff(fn, 44100, channels, bits_per_sample, nsamples[samples]))
|
||||
return 1;
|
||||
|
||||
sprintf(fn, "rt-%u-%u-%u.wav", channels, bits_per_sample, nsamples[samples]);
|
||||
flac_snprintf(fn, sizeof (fn), "rt-%u-%u-%u.wav", channels, bits_per_sample, nsamples[samples]);
|
||||
if(!generate_wav(fn, 44100, channels, bits_per_sample, nsamples[samples], /*strict=*/true, /*flavor=*/0))
|
||||
return 1;
|
||||
|
||||
sprintf(fn, "rt-%u-%u-%u.rf64", channels, bits_per_sample, nsamples[samples]);
|
||||
flac_snprintf(fn, sizeof (fn), "rt-%u-%u-%u.rf64", channels, bits_per_sample, nsamples[samples]);
|
||||
if(!generate_wav(fn, 44100, channels, bits_per_sample, nsamples[samples], /*strict=*/true, /*flavor=*/1))
|
||||
return 1;
|
||||
|
||||
sprintf(fn, "rt-%u-%u-%u.w64", channels, bits_per_sample, nsamples[samples]);
|
||||
flac_snprintf(fn, sizeof (fn), "rt-%u-%u-%u.w64", channels, bits_per_sample, nsamples[samples]);
|
||||
if(!generate_wav(fn, 44100, channels, bits_per_sample, nsamples[samples], /*strict=*/true, /*flavor=*/2))
|
||||
return 1;
|
||||
|
||||
if(bits_per_sample % 8 == 0) {
|
||||
sprintf(fn, "rt-%u-%u-%u.raw", channels, bits_per_sample, nsamples[samples]);
|
||||
flac_snprintf(fn, sizeof (fn), "rt-%u-%u-%u.raw", channels, bits_per_sample, nsamples[samples]);
|
||||
if(!generate_raw(fn, channels, bits_per_sample/8, nsamples[samples]))
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user