example fix
authorAnas Nashif <anas.nashif@intel.com>
Wed, 7 Nov 2012 23:51:10 +0000 (15:51 -0800)
committerAnas Nashif <anas.nashif@intel.com>
Wed, 7 Nov 2012 23:51:10 +0000 (15:51 -0800)
examples/generate.c
examples/sfprocess.c
examples/sndfile-to-text.c

index 8a92332..fc71336 100644 (file)
@@ -98,6 +98,7 @@ encode_file (const char *infilename, const char *outfilename, int filetype)
        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)) ;
index 5c7db28..abe0bca 100644 (file)
@@ -31,6 +31,7 @@
 */
 
 #include       <stdio.h>
+#include       <string.h>
 
 /* Include this header file to use functions from libsndfile. */
 #include       <sndfile.h>
@@ -83,6 +84,7 @@ main (void)
        **              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) ;
index 7a7a219..1920802 100644 (file)
@@ -101,6 +101,7 @@ main (int argc, char * argv [])
                return 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)) ;