On Thu, Sep 18, 2014 at 12:41 AM, Luca Barbato <[email protected]> wrote:
> On 18/09/14 06:35, Reinhard Tartler wrote:
>> From: Timothy Gu <[email protected]>
>>
>> Also add a note about SNDCTL_DSP_GETFMTS which may fail even if OSS is
>> available.
>>
>> Fixes: CID 1238992
>> Signed-off-by: Timothy Gu <[email protected]>
>> Signed-off-by: Michael Niedermayer <[email protected]>
>> Signed-off-by: Reinhard Tartler <[email protected]>
>> ---
>>  libavdevice/oss_audio.c | 27 ++++++++++++++-------------
>>  1 file changed, 14 insertions(+), 13 deletions(-)
>>
>> diff --git a/libavdevice/oss_audio.c b/libavdevice/oss_audio.c
>> index ad52d78..aa491ce 100644
>> --- a/libavdevice/oss_audio.c
>> +++ b/libavdevice/oss_audio.c
>> @@ -68,7 +68,16 @@ int ff_oss_audio_open(AVFormatContext *s1, int is_output,
>>
>>      s->frame_size = OSS_AUDIO_BLOCK_SIZE;
>>
>> -    /* select format : favour native format */
>> +#define CHECK_IOCTL_ERROR(event)                                            
>>   \
>> +    if (err < 0) {                                                          
>>   \
>> +        av_log(s1, AV_LOG_ERROR, #event ": %s\n", strerror(errno));         
>> \
>
> strerror should not be used.

Why is that, and what would you prefer instead?

>
>> +        goto fail;                                                          
>>   \
>> +    }
>> +
>> +    /* select format : favour native format
>> +     * We don't CHECK_IOCTL_ERROR here because even if failed OSS still may 
>> be
>> +     * usable. If OSS is not usable the SNDCTL_DSP_SETFMTS later is going to
>> +     * fail anyway. `err =` kept to eliminate compiler warning. */
>>      err = ioctl(audio_fd, SNDCTL_DSP_GETFMTS, &tmp);
>
> (void) cast should do the same.

Probably, is that a general libav coding guideline? I think I would
prefer Timothy's suggestion over casting return values, but I don't
have a very strong opinion on this.

> The factorization isn't a bad idea though.
>
> lu
> _______________________________________________
> libav-devel mailing list
> [email protected]
> https://lists.libav.org/mailman/listinfo/libav-devel



-- 
regards,
    Reinhard
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to