On Thu, Jul 17, 2014 at 05:59:43PM -0700, Timothy Gu wrote: > Also uses a macro to simplify. > > Signed-off-by: Timothy Gu <timothyg...@gmail.com> > --- > > Found with clang's static analyzer. > > --- > libavdevice/oss_audio.c | 23 +++++++++++------------ > 1 file changed, 11 insertions(+), 12 deletions(-) > > diff --git a/libavdevice/oss_audio.c b/libavdevice/oss_audio.c > index 734e565..3c5065c 100644 > --- a/libavdevice/oss_audio.c > +++ b/libavdevice/oss_audio.c > @@ -87,8 +87,15 @@ static int audio_open(AVFormatContext *s1, int is_output, > const char *audio_devi > > s->frame_size = AUDIO_BLOCK_SIZE; > > +#define CHECK_IOCTL_ERROR(event) > \ > + if (err < 0) { > \ > + av_log(s1, AV_LOG_ERROR, #event ": %s\n", strerror(errno)); \ > + goto fail; > \ > + } > +
> /* select format : favour native format */ > err = ioctl(audio_fd, SNDCTL_DSP_GETFMTS, &tmp); > + CHECK_IOCTL_ERROR(SNDCTL_DSP_GETFMTS) > > #if HAVE_BIGENDIAN i think failure of SNDCTL_DSP_GETFMTS, does not need to lead to failure of audio_open() simply trying SNDCTL_DSP_SETFMT with some format in case of SNDCTL_DSP_GETFMTS fails is better [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I have often repented speaking, but never of holding my tongue. -- Xenocrates
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel