libsndfile/libsndfile-example-fix.diff

52 lines
1.5 KiB
Diff

--- examples/cooledit-fixer.c
+++ examples/cooledit-fixer.c
@@ -48,7 +48,9 @@
usage_exit (argv [0]) ;
for (k = 1 ; k < argc ; k++)
- { if ((sndfile = sf_open (argv [k], SFM_READ, &sfinfo)) == NULL)
+ {
+ memset(&sfinfo, 0, sizeof(sfinfo));
+ if ((sndfile = sf_open (argv [k], SFM_READ, &sfinfo)) == NULL)
{ /*-printf ("Failed to open : %s\n", argv [k]) ;-*/
continue ;
} ;
--- examples/generate.c
+++ examples/generate.c
@@ -84,6 +84,7 @@
k = 16 - strlen (outfilename) ;
PUT_DOTS (k) ;
+ memset(&sfinfo, 0, sizeof(sfinfo));
if (! (infile = sf_open (infilename, SFM_READ, &sfinfo)))
{ printf ("Error : could not open file : %s\n", infilename) ;
puts (sf_strerror (NULL)) ;
--- examples/sfprocess.c
+++ examples/sfprocess.c
@@ -17,6 +17,7 @@
*/
#include <stdio.h>
+#include <string.h>
/* Include this header file to use functions from libsndfile. */
#include <sndfile.h>
@@ -69,6 +70,7 @@
** sfinfo.format = SF_FORMAT_RAW | SF_FORMAT_PCM_16 ;
** sfinfo.channels = 2 ;
*/
+ memset(&sfinfo, 0, sizeof(sfinfo));
if (! (infile = sf_open (infilename, SFM_READ, &sfinfo)))
{ /* Open failed so print an error message. */
printf ("Not able to open input file %s.\n", infilename) ;
--- examples/sndfile-convert.c
+++ examples/sndfile-convert.c
@@ -242,6 +242,7 @@
exit (1) ;
} ;
+ memset(&sfinfo, 0, sizeof(sfinfo));
if ((infile = sf_open (infilename, SFM_READ, &sfinfo)) == NULL)
{ printf ("Not able to open input file %s.\n", infilename) ;
puts (sf_strerror (NULL)) ;