[FFmpeg-devel] [PATCH 2/2] lavf/file: cosmetic: Use "not" instead of "equals zero"

Michael Niedermayer michaelni at gmx.at
Sun Jul 1 03:02:03 CEST 2012


On Sun, Jul 01, 2012 at 02:50:06AM +0200, Alexander Strasser wrote:
>   This is more similar to the "overall" FFmpeg coding style.
> ---
> 
>    Assuming the context member is_streamed is initialized
> properly to zero 
> 
>     if (!fstat(fd, &st))
>       h->is_streamed = S_ISFIFO(st.st_mode);
> 
> would be another possibility. I personally find use of !
> in places like this a bit odd, but OTOH we use it every
> where else like this (including !strcmp(a, b)).
> 
>  libavformat/file.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/file.c b/libavformat/file.c
> index b49f84f..c54ec28 100644
> --- a/libavformat/file.c
> +++ b/libavformat/file.c
> @@ -91,7 +91,7 @@ static int file_open(URLContext *h, const char *filename, int flags)
>          return AVERROR(errno);
>      h->priv_data = (void *) (intptr_t) fd;
>  
> -    h->is_streamed = 0==fstat(fd, &st) && S_ISFIFO(st.st_mode);
> +    h->is_streamed = !fstat(fd, &st) && S_ISFIFO(st.st_mode);

whatever people prefer ...

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Avoid a single point of failure, be that a person or equipment.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120701/2c10944b/attachment.asc>


More information about the ffmpeg-devel mailing list