From e83c8957b6f162f52ee162576253d539531b1fe5 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Wed, 17 May 2006 09:12:44 +0000 Subject: [PATCH] strange workaround to fix segfaults on some wav files strange workaround to fix segfaults on some wav files --- ext/sndfileio.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ext/sndfileio.c b/ext/sndfileio.c index 95147b02..9ff3b804 100644 --- a/ext/sndfileio.c +++ b/ext/sndfileio.c @@ -42,8 +42,11 @@ aubio_sndfile_t * new_aubio_sndfile_ro(const char* outputname) { aubio_sndfile_t * f = AUBIO_NEW(aubio_sndfile_t); SF_INFO sfinfo; AUBIO_MEMSET(&sfinfo, 0, sizeof (sfinfo)); + sfinfo.format = 0; - if (! (f->handle = sf_open (outputname, SFM_READ, &sfinfo))) { + f->handle = sf_open (outputname, SFM_READ, &sfinfo); + + if (f->handle == NULL) { AUBIO_ERR("Unable to open input file %s.\n", outputname); AUBIO_ERR("%s\n",sf_strerror (NULL)); /* libsndfile err msg */ return NULL; @@ -66,7 +69,7 @@ aubio_sndfile_t * new_aubio_sndfile_ro(const char* outputname) { int aubio_sndfile_open_wo(aubio_sndfile_t * f, const char* inputname) { SF_INFO sfinfo; - memset (&sfinfo, 0, sizeof (sfinfo)); + AUBIO_MEMSET(&sfinfo, 0, sizeof (sfinfo)); /* define file output spec */ sfinfo.samplerate = f->samplerate; -- 2.26.2