Browse Source

avcodec/bitstream: Rewrite code to avoid triggering compiler warning

Clang infers from the existence of a default case that said case can be
taken. In case of libavcodec/bitstream.c said default case consisted of
an av_assert1 that evaluates to nothing in case of the ordinary assert
level. In this case (that doesn't happen) a variable wouldn't be
initialized, so Clang emitted Wsometimes-uninitialized warnings.
Solve this by making sure that the default path also initializes
the aforementioned variable.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
tags/n4.4
Andreas Rheinhardt 5 years ago
parent
commit
3bf07b1a2d
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      libavcodec/bitstream.c

+ 2
- 2
libavcodec/bitstream.c View File

@@ -104,10 +104,10 @@ void ff_copy_bits(PutBitContext *pb, const uint8_t *src, int length)
v = *(const uint16_t *)ptr; \
break; \
case 4: \
default: \
av_assert1(size == 4); \
v = *(const uint32_t *)ptr; \
break; \
default: \
av_assert1(0); \
} \
}



Loading…
Cancel
Save