[2/3] vorbisdec: use av_assert0() over assert()

Message ID 1368624059-8468-2-git-send-email-jb@videolan.org
State New
Headers show

Commit Message

Jean-Baptiste Kempf May 15, 2013, 1:20 p.m.
---
 libavcodec/vorbisdec.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Luca Barbato May 15, 2013, 2:45 p.m. | #1
On 05/15/2013 03:20 PM, Jean-Baptiste Kempf wrote:
> ---
>  libavcodec/vorbisdec.c |    6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c
> index be2e38d..18041d1 100644
> --- a/libavcodec/vorbisdec.c
> +++ b/libavcodec/vorbisdec.c
> @@ -26,6 +26,7 @@
>  #include <math.h>
>  
>  #define BITSTREAM_READER_LE
> +#include "libavutil/avassert.h"
>  #include "libavutil/float_dsp.h"
>  #include "avcodec.h"
>  #include "get_bits.h"
> @@ -42,9 +43,6 @@
>  #define V_MAX_VLCS (1 << 16)
>  #define V_MAX_PARTITIONS (1 << 20)
>  
> -#undef NDEBUG
> -#include <assert.h>
> -
>  typedef struct {
>      uint8_t      dimensions;
>      uint8_t      lookup_type;
> @@ -1353,7 +1351,7 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
>  
>                          av_dlog(NULL, "Classword: %u\n", temp);
>  
> -                        assert(vr->classifications > 1 && temp <= 65536); //needed for inverse[]
> +                        av_assert0(vr->classifications > 1 && temp <= 65536); //needed for inverse[]
>                          for (i = 0; i < c_p_c; ++i) {
>                              unsigned temp2;
>  
> 

That reminds me we aren't checking that the vqclass is < 64 probably we
could drop that assert and put a proper check where we use that value.

lu

Patch

diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c
index be2e38d..18041d1 100644
--- a/libavcodec/vorbisdec.c
+++ b/libavcodec/vorbisdec.c
@@ -26,6 +26,7 @@ 
 #include <math.h>
 
 #define BITSTREAM_READER_LE
+#include "libavutil/avassert.h"
 #include "libavutil/float_dsp.h"
 #include "avcodec.h"
 #include "get_bits.h"
@@ -42,9 +43,6 @@ 
 #define V_MAX_VLCS (1 << 16)
 #define V_MAX_PARTITIONS (1 << 20)
 
-#undef NDEBUG
-#include <assert.h>
-
 typedef struct {
     uint8_t      dimensions;
     uint8_t      lookup_type;
@@ -1353,7 +1351,7 @@  static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
 
                         av_dlog(NULL, "Classword: %u\n", temp);
 
-                        assert(vr->classifications > 1 && temp <= 65536); //needed for inverse[]
+                        av_assert0(vr->classifications > 1 && temp <= 65536); //needed for inverse[]
                         for (i = 0; i < c_p_c; ++i) {
                             unsigned temp2;