[FFmpeg-cvslog] get_bits: get_bits_long() support n=0 as the docs allow it

Michael Niedermayer git at videolan.org
Sat Oct 6 23:04:52 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat Oct  6 22:25:04 2012 +0200| [094a82c7de30b6a086c785aa14cc7e2e2eb3418e] | committer: Michael Niedermayer

get_bits: get_bits_long() support n=0 as the docs allow it

also the 0 case is indeed used in some code pathes

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=094a82c7de30b6a086c785aa14cc7e2e2eb3418e
---

 libavcodec/get_bits.h |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h
index 05ac8f7..a1a48ab 100644
--- a/libavcodec/get_bits.h
+++ b/libavcodec/get_bits.h
@@ -302,7 +302,9 @@ static inline void skip_bits1(GetBitContext *s)
  */
 static inline unsigned int get_bits_long(GetBitContext *s, int n)
 {
-    if (n <= MIN_CACHE_BITS)
+    if (!n) {
+        return 0;
+    } else if (n <= MIN_CACHE_BITS)
         return get_bits(s, n);
     else {
 #ifdef BITSTREAM_READER_LE



More information about the ffmpeg-cvslog mailing list