[FFmpeg-devel] [PATCH 3/8] Optimize / simplify av_get_pix_fmt_name().

Jean-Daniel Dupas devlists
Fri Nov 5 12:10:51 CET 2010


Le 5 nov. 2010 ? 12:00, Stefano Sabatini a ?crit :

> ---
> libavutil/pixdesc.c |    6 ++----
> 1 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
> index c099d03..01e2917 100644
> --- a/libavutil/pixdesc.c
> +++ b/libavutil/pixdesc.c
> @@ -816,10 +816,8 @@ static enum PixelFormat get_pix_fmt_internal(const char *name)
> 
> const char *av_get_pix_fmt_name(enum PixelFormat pix_fmt)
> {
> -    if (pix_fmt < 0 || pix_fmt >= PIX_FMT_NB)
> -        return NULL;
> -    else
> -        return av_pix_fmt_descriptors[pix_fmt].name;
> +    return ((unsigned)pix_fmt >= PIX_FMT_NB) ?
> +        av_pix_fmt_descriptors[pix_fmt].name : NULL;
> }
> 

shouldn't it be "<= PIX_FMT_NB" ? 


-- Jean-Daniel







More information about the ffmpeg-devel mailing list