[FFmpeg-devel] [PATCH] vhook/{fish, ppm}.c: Fix compilation warnings

Diego Biurrun diego
Sat Feb 21 22:11:16 CET 2009


On Mon, Feb 16, 2009 at 10:32:59AM +0100, Patrik Kullman wrote:
> 
> Moving the last part of the function to within the same if-statement to
> prevent uninitialization of the out_* ints.
> 
> --- vhook/ppm.c	(revision 17319)
> +++ vhook/ppm.c	(working copy)
> @@ -318,33 +323,38 @@
>                  ptr += picture2.linesize[ 0 ];
>              }
>          }
> -    }
>  
> -    /* Convert the returned PPM back to the input format */
> -    if ( !err )
> -    {
> -        /* The out_width/out_height returned from the PPM
> -         * filter won't necessarily be the same as width and height
> -         * but it will be scaled anyway to width/height.
> -         */
> -        av_log(NULL, AV_LOG_DEBUG,
> +        /* Convert the returned PPM back to the input format */
> +
> +        if ( !err )
> +        {
> +            /* The out_width/out_height returned from the PPM
> +             * filter won't necessarily be the same as width and height
> +             * but it will be scaled anyway to width/height.
> +             */
> +            av_log(NULL, AV_LOG_DEBUG,
>                    "PPM vhook: Input dimensions: %d x %d Output dimensions: %d x %d\n",
>                    width, height, out_width, out_height);
> -        ci->fromRGB_convert_ctx = sws_getCachedContext(ci->fromRGB_convert_ctx,
> +            ci->fromRGB_convert_ctx = sws_getCachedContext(ci->fromRGB_convert_ctx,
>                                          out_width, out_height, PIX_FMT_RGB24,
>                                          width,     height,     pix_fmt,
>                                          sws_flags, NULL, NULL, NULL);
> -        if (ci->fromRGB_convert_ctx == NULL) {
> -            av_log(NULL, AV_LOG_ERROR,
> +            if (ci->fromRGB_convert_ctx == NULL) {
> +                av_log(NULL, AV_LOG_ERROR,
>                     "Cannot initialize the fromRGB conversion context\n");
> -            return;
> -        }
> +                return;
> +            }
>  
>  // img_convert parameters are          2 first destination, then 4 source
>  // sws_scale   parameters are context, 4 first source,      then 2 destination
> -        sws_scale(ci->fromRGB_convert_ctx,
> +            sws_scale(ci->fromRGB_convert_ctx,
>                   picture2.data, picture2.linesize, 0, out_height,
>                   picture->data, picture->linesize);
> +        }
> +    } else {
> +        av_log(NULL, AV_LOG_ERROR,
> +               "Read PPM header failed\n");
> +        return;

This is at least 90% cosmetics.

Some parts of this patch are now applied, resend whatever is missing and
you want to see applied.

Diego




More information about the ffmpeg-devel mailing list