It's better to show a message what the error is, instead of just asserting that no errors happen in an external library call. --- src/pulsecore/sndfile-util.c | 22 ++++++++++++++++------ 1 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/pulsecore/sndfile-util.c b/src/pulsecore/sndfile-util.c index ab6485d..d65b346 100644 --- a/src/pulsecore/sndfile-util.c +++ b/src/pulsecore/sndfile-util.c @@ -34,12 +34,16 @@ int pa_sndfile_read_sample_spec(SNDFILE *sf, pa_sample_spec *ss) { SF_INFO sfi; + int sf_errno; pa_assert(sf); pa_assert(ss); pa_zero(sfi); - pa_assert_se(sf_command(sf, SFC_GET_CURRENT_SF_INFO, &sfi, sizeof(sfi)) == 0); + if ((sf_errno = sf_command(sf, SFC_GET_CURRENT_SF_INFO, &sfi, sizeof(sfi)))) { + pa_log_error("sndfile: %s", sf_error_number(sf_errno)); + return -1; + } switch (sfi.format & SF_FORMAT_SUBMASK) { @@ -175,6 +179,7 @@ int pa_sndfile_read_channel_map(SNDFILE *sf, pa_channel_map *cm) { }; SF_INFO sfi; + int sf_errno; int *channels; unsigned c; @@ -182,12 +187,13 @@ int pa_sndfile_read_channel_map(SNDFILE *sf, pa_channel_map *cm) { pa_assert(cm); pa_zero(sfi); - pa_assert_se(sf_command(sf, SFC_GET_CURRENT_SF_INFO, &sfi, sizeof(sfi)) == 0); + if ((sf_errno = sf_command(sf, SFC_GET_CURRENT_SF_INFO, &sfi, sizeof(sfi)))) { + pa_log_error("sndfile: %s", sf_error_number(sf_errno)); + return -1; + } channels = pa_xnew(int, sfi.channels); - if (!sf_command(sf, SFC_GET_CHANNEL_MAP_INFO, - channels, sizeof(channels[0]) * sfi.channels)) { - + if (!sf_command(sf, SFC_GET_CHANNEL_MAP_INFO, channels, sizeof(channels[0]) * sfi.channels)) { pa_xfree(channels); return -1; } @@ -325,6 +331,7 @@ void pa_sndfile_init_proplist(SNDFILE *sf, pa_proplist *p) { SF_INFO sfi; SF_FORMAT_INFO fi; + int sf_errno; unsigned c; pa_assert(sf); @@ -346,7 +353,10 @@ void pa_sndfile_init_proplist(SNDFILE *sf, pa_proplist *p) { } pa_zero(sfi); - pa_assert_se(sf_command(sf, SFC_GET_CURRENT_SF_INFO, &sfi, sizeof(sfi)) == 0); + if ((sf_errno = sf_command(sf, SFC_GET_CURRENT_SF_INFO, &sfi, sizeof(sfi)))) { + pa_log_error("sndfile: %s", sf_error_number(sf_errno)); + return; + } pa_zero(fi); fi.format = sfi.format; -- 1.7.4.1