[FFmpeg-cvslog] get_bits: Add OPEN_READER macro variant w/o size_plus8

Diego Biurrun git at videolan.org
Fri Sep 5 19:15:38 CEST 2014


ffmpeg | branch: master | Diego Biurrun <diego at biurrun.de> | Fri Aug 22 14:37:39 2014 +0200| [b574e1e97ea7067a5fcd3876e30a67df0e4e6611] | committer: Diego Biurrun

get_bits: Add OPEN_READER macro variant w/o size_plus8

This avoids a trillion warnings from MSVC.

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

 libavcodec/dvdec.c    |    2 +-
 libavcodec/get_bits.h |   13 +++++++------
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c
index 476f8c9..876a4a2 100644
--- a/libavcodec/dvdec.c
+++ b/libavcodec/dvdec.c
@@ -88,7 +88,7 @@ static void dv_decode_ac(GetBitContext *gb, BlockInfo *mb, int16_t *block)
     int partial_bit_count = mb->partial_bit_count;
     int level, run, vlc_len, index;
 
-    OPEN_READER(re, gb);
+    OPEN_READER_NOSIZE(re, gb);
     UPDATE_CACHE(re, gb);
 
     /* if we must parse a partial VLC, we do it here */
diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h
index f1962f2..b7c68e1 100644
--- a/libavcodec/get_bits.h
+++ b/libavcodec/get_bits.h
@@ -123,17 +123,18 @@ typedef struct RL_VLC_ELEM {
 #   define MIN_CACHE_BITS 25
 #endif
 
-#if UNCHECKED_BITSTREAM_READER
-#define OPEN_READER(name, gb)                   \
+#define OPEN_READER_NOSIZE(name, gb)            \
     unsigned int name ## _index = (gb)->index;  \
     unsigned int av_unused name ## _cache = 0
 
+#if UNCHECKED_BITSTREAM_READER
+#define OPEN_READER(name, gb) OPEN_READER_NOSIZE(name, gb)
+
 #define BITS_AVAILABLE(name, gb) 1
 #else
 #define OPEN_READER(name, gb)                   \
-    unsigned int name ## _index = (gb)->index;  \
-    unsigned int av_unused name ## _cache = 0;  \
-    unsigned int av_unused name ## _size_plus8 = (gb)->size_in_bits_plus8
+    OPEN_READER_NOSIZE(name, gb);               \
+    unsigned int name ## _size_plus8 = (gb)->size_in_bits_plus8
 
 #define BITS_AVAILABLE(name, gb) name ## _index < name ## _size_plus8
 #endif
@@ -254,7 +255,7 @@ static inline unsigned int get_bits(GetBitContext *s, int n)
 static inline unsigned int show_bits(GetBitContext *s, int n)
 {
     register int tmp;
-    OPEN_READER(re, s);
+    OPEN_READER_NOSIZE(re, s);
     UPDATE_CACHE(re, s);
     tmp = SHOW_UBITS(re, s, n);
     return tmp;



More information about the ffmpeg-cvslog mailing list