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

Alexander Strasser eclipse7 at gmx.net
Sun Jul 1 02:50:06 CEST 2012


  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);
 
     return 0;
 }
-- 
1.7.10.2.552.gaa3bb87


More information about the ffmpeg-devel mailing list