diff mbox series

[FFmpeg-devel,4/7] avcodec/golomb: Document return value of get_ue_golomb_30 on error

Message ID 20200714153454.9354-3-andreas.rheinhardt@gmail.com
State Superseded
Headers show
Series [FFmpeg-devel] avcodec/golomb: Prevent shift by negative number | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Andreas Rheinhardt July 14, 2020, 3:34 p.m. UTC
If the return value is undefined if the value of the encountered
exp golomb code was outside the 0..30 range, said function can't
be used anywhere where one wants to check for correctness. So document
that in this case the return value is outside the range 0..30 (it
currently always returns 32 in this case).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
Btw: get_ue_golomb_30() could be used to skip exp golomb codes with
length <= 17 bits.

 libavcodec/golomb.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavcodec/golomb.h b/libavcodec/golomb.h
index 172d9934e0..8b69196d44 100644
--- a/libavcodec/golomb.h
+++ b/libavcodec/golomb.h
@@ -135,7 +135,8 @@  static inline unsigned get_ue_golomb_long(GetBitContext *gb)
 
 /**
  * Read unsigned exp golomb code, constraint to a max of 30.
- * the return value is undefined if the stored value exceeds 30.
+ * The return value is outside the range of 0..30 if no exp golomb code
+ * in that range was encountered.
  */
 static inline int get_ue_golomb_30(GetBitContext *gb)
 {